| 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | #ifndef _INC_STDIO |
| 7 | #define _INC_STDIO |
| 8 | |
| 9 | #include <corecrt_stdio_config.h> |
| 10 | |
| 11 | #pragma pack(push,_CRT_PACKING) |
| 12 | |
| 13 | #pragma push_macro("snprintf") |
| 14 | #undef snprintf |
| 15 | #pragma push_macro("vsnprintf") |
| 16 | #undef vsnprintf |
| 17 | #pragma push_macro("snwprintf") |
| 18 | #undef snwprintf |
| 19 | #pragma push_macro("vsnwprintf") |
| 20 | #undef vsnwprintf |
| 21 | |
| 22 | #ifdef __cplusplus |
| 23 | extern "C" { |
| 24 | #endif |
| 25 | |
| 26 | #define BUFSIZ 512 |
| 27 | #define _NFILE _NSTREAM_ |
| 28 | #define _NSTREAM_ 512 |
| 29 | #define _IOB_ENTRIES 20 |
| 30 | #define EOF (-1) |
| 31 | |
| 32 | #ifndef _FILE_DEFINED |
| 33 | struct _iobuf { |
| 34 | #ifdef _UCRT |
| 35 | void *_Placeholder; |
| 36 | #else |
| 37 | char *_ptr; |
| 38 | int _cnt; |
| 39 | char *_base; |
| 40 | int _flag; |
| 41 | int _file; |
| 42 | int _charbuf; |
| 43 | int _bufsiz; |
| 44 | char *_tmpfname; |
| 45 | #endif |
| 46 | }; |
| 47 | typedef struct _iobuf FILE; |
| 48 | #define _FILE_DEFINED |
| 49 | #endif |
| 50 | |
| 51 | #ifdef _POSIX_ |
| 52 | #define _P_tmpdir "/" |
| 53 | #define _wP_tmpdir L"/" |
| 54 | #else |
| 55 | #define _P_tmpdir "\\" |
| 56 | #define _wP_tmpdir L"\\" |
| 57 | #endif |
| 58 | |
| 59 | #ifdef _UCRT |
| 60 | #define L_tmpnam 260 |
| 61 | #else |
| 62 | #define L_tmpnam (sizeof(_P_tmpdir) + 12) |
| 63 | #endif |
| 64 | |
| 65 | #ifdef _POSIX_ |
| 66 | #define L_ctermid 9 |
| 67 | #define L_cuserid 32 |
| 68 | #endif |
| 69 | |
| 70 | #define SEEK_CUR 1 |
| 71 | #define SEEK_END 2 |
| 72 | #define SEEK_SET 0 |
| 73 | |
| 74 | #define	STDIN_FILENO	0 |
| 75 | #define	STDOUT_FILENO	1 |
| 76 | #define	STDERR_FILENO	2 |
| 77 | |
| 78 | #define FILENAME_MAX 260 |
| 79 | #define FOPEN_MAX 20 |
| 80 | #define _SYS_OPEN 20 |
| 81 | #ifdef _UCRT |
| 82 | #define TMP_MAX 2147483647 |
| 83 | #else |
| 84 | #define TMP_MAX 32767 |
| 85 | #endif |
| 86 | |
| 87 | #ifndef NULL |
| 88 | #ifdef __cplusplus |
| 89 | #ifndef _WIN64 |
| 90 | #define NULL 0 |
| 91 | #else |
| 92 | #define NULL 0LL |
| 93 | #endif /* W64 */ |
| 94 | #else |
| 95 | #define NULL ((void *)0) |
| 96 | #endif |
| 97 | #endif |
| 98 | |
| 99 | #include <_mingw_off_t.h> |
| 100 | |
| 101 | _CRTIMP FILE *__cdecl __acrt_iob_func(unsigned index); |
| 102 | #ifndef _STDIO_DEFINED |
| 103 | _CRTIMP FILE *__cdecl __iob_func(void); |
| 104 | #define _iob __iob_func() |
| 105 | #endif |
| 106 | |
| 107 | #ifndef _FPOS_T_DEFINED |
| 108 | #define _FPOS_T_DEFINED |
| 109 | #undef _FPOSOFF |
| 110 | |
| 111 | #if (!defined(NO_OLDNAMES) || defined(__GNUC__)) |
| 112 | __MINGW_EXTENSION typedef __int64 fpos_t; |
| 113 | #define _FPOSOFF(fp) ((long)(fp)) |
| 114 | #else |
| 115 | __MINGW_EXTENSION typedef long long fpos_t; |
| 116 | #define _FPOSOFF(fp) ((long)(fp)) |
| 117 | #endif |
| 118 | |
| 119 | #endif |
| 120 | |
| 121 | #ifndef _STDSTREAM_DEFINED |
| 122 | #define _STDSTREAM_DEFINED |
| 123 | |
| 124 | #define stdin (__acrt_iob_func(0)) |
| 125 | #define stdout (__acrt_iob_func(1)) |
| 126 | #define stderr (__acrt_iob_func(2)) |
| 127 | #endif |
| 128 | |
| 129 | #define _IOFBF 0x0000 |
| 130 | #define _IOLBF 0x0040 |
| 131 | #define _IONBF 0x0004 |
| 132 | |
| 133 | #ifndef _UCRT |
| 134 | #define _IOREAD 0x0001 |
| 135 | #define _IOWRT 0x0002 |
| 136 | #define _IOMYBUF 0x0008 |
| 137 | #define _IOEOF 0x0010 |
| 138 | #define _IOERR 0x0020 |
| 139 | #define _IOSTRG 0x0040 |
| 140 | #define _IORW 0x0080 |
| 141 | #ifdef _POSIX_ |
| 142 | #define _IOAPPEND 0x0200 |
| 143 | #endif |
| 144 | #endif |
| 145 | |
| 146 | /* used with _set_output_format which is not present in ucrt */ |
| 147 | #ifndef _UCRT |
| 148 | #define _TWO_DIGIT_EXPONENT 0x1 |
| 149 | #endif |
| 150 | |
| 151 | #if __MINGW_FORTIFY_LEVEL > 0 |
| 152 | __mingw_bos_declare; |
| 153 | #endif |
| 154 | |
| 155 | #ifndef _STDIO_DEFINED |
| 156 | extern |
| 157 | __MINGW_GNU_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 158 | int __cdecl __mingw_sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...); |
| 159 | extern |
| 160 | __MINGW_GNU_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 161 | int __cdecl __mingw_vsscanf (const char * __restrict__ _Str,const char * __restrict__ Format,va_list argp); |
| 162 | extern |
| 163 | __MINGW_GNU_SCANF(1, 2) __MINGW_ATTRIB_NONNULL(1) |
| 164 | int __cdecl __mingw_scanf(const char * __restrict__ _Format,...); |
| 165 | extern |
| 166 | __MINGW_GNU_SCANF(1, 0) __MINGW_ATTRIB_NONNULL(1) |
| 167 | int __cdecl __mingw_vscanf(const char * __restrict__ Format, va_list argp); |
| 168 | extern |
| 169 | __MINGW_GNU_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 170 | int __cdecl __mingw_fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...); |
| 171 | extern |
| 172 | __MINGW_GNU_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 173 | int __cdecl __mingw_vfscanf (FILE * __restrict__ fp, const char * __restrict__ Format,va_list argp); |
| 174 | |
| 175 | extern |
| 176 | __MINGW_GNU_PRINTF(3, 0) __MINGW_ATTRIB_NONNULL(3) |
| 177 | int __cdecl __mingw_vsnprintf(char * __restrict__ _DstBuf,size_t _MaxCount,const char * __restrict__ _Format, |
| 178 | va_list _ArgList); |
| 179 | extern |
| 180 | __MINGW_GNU_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) |
| 181 | int __cdecl __mingw_snprintf(char * __restrict__ s, size_t n, const char * __restrict__ format, ...); |
| 182 | extern |
| 183 | __MINGW_GNU_PRINTF(1, 2) __MINGW_ATTRIB_NONNULL(1) |
| 184 | int __cdecl __mingw_printf(const char * __restrict__ , ... ) __MINGW_NOTHROW; |
| 185 | extern |
| 186 | __MINGW_GNU_PRINTF(1, 0) __MINGW_ATTRIB_NONNULL(1) |
| 187 | int __cdecl __mingw_vprintf (const char * __restrict__ , va_list) __MINGW_NOTHROW; |
| 188 | extern |
| 189 | __MINGW_GNU_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 190 | int __cdecl __mingw_fprintf (FILE * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW; |
| 191 | extern |
| 192 | __MINGW_GNU_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 193 | int __cdecl __mingw_vfprintf (FILE * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW; |
| 194 | extern |
| 195 | __MINGW_GNU_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 196 | int __cdecl __mingw_sprintf (char * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW; |
| 197 | extern |
| 198 | __MINGW_GNU_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 199 | int __cdecl __mingw_vsprintf (char * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW; |
| 200 | extern |
| 201 | __MINGW_GNU_PRINTF(2, 3) __attribute__((nonnull (1,2))) |
| 202 | int __cdecl __mingw_asprintf(char ** __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW; |
| 203 | extern |
| 204 | __MINGW_GNU_PRINTF(2, 0) __attribute__((nonnull (1,2))) |
| 205 | int __cdecl __mingw_vasprintf(char ** __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW; |
| 206 | |
| 207 | extern |
| 208 | __MINGW_MS_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 209 | int __cdecl __ms_sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...) |
| 210 | __MINGW_UCRT_ASM_CALL(sscanf); |
| 211 | extern |
| 212 | __MINGW_MS_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 213 | int __cdecl __ms_vsscanf(const char * __restrict__ _Str,const char * __restrict__ _Format,va_list argp) |
| 214 | __MINGW_ASM_CALL(vsscanf); |
| 215 | extern |
| 216 | __MINGW_MS_SCANF(1, 2) __MINGW_ATTRIB_NONNULL(1) |
| 217 | int __cdecl __ms_scanf(const char * __restrict__ _Format,...) |
| 218 | __MINGW_UCRT_ASM_CALL(scanf); |
| 219 | extern |
| 220 | __MINGW_MS_SCANF(1, 0) __MINGW_ATTRIB_NONNULL(1) |
| 221 | int __cdecl __ms_vscanf(const char * __restrict__ _Format,va_list argp) |
| 222 | __MINGW_ASM_CALL(vscanf); |
| 223 | extern |
| 224 | __MINGW_MS_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 225 | int __cdecl __ms_fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...) |
| 226 | __MINGW_UCRT_ASM_CALL(fscanf); |
| 227 | extern |
| 228 | __MINGW_MS_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 229 | int __cdecl __ms_vfscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list argp) |
| 230 | __MINGW_ASM_CALL(vfscanf); |
| 231 | |
| 232 | extern |
| 233 | __MINGW_MS_PRINTF(1, 2) __MINGW_ATTRIB_NONNULL(1) |
| 234 | int __cdecl __ms_printf(const char * __restrict__ , ... ) |
| 235 | __MINGW_UCRT_ASM_CALL(printf) __MINGW_NOTHROW; |
| 236 | extern |
| 237 | __MINGW_MS_PRINTF(1, 0) __MINGW_ATTRIB_NONNULL(1) |
| 238 | int __cdecl __ms_vprintf (const char * __restrict__ , va_list) |
| 239 | __MINGW_UCRT_ASM_CALL(vprintf) __MINGW_NOTHROW; |
| 240 | extern |
| 241 | __MINGW_MS_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 242 | int __cdecl __ms_fprintf (FILE * __restrict__ , const char * __restrict__ , ...) |
| 243 | __MINGW_UCRT_ASM_CALL(fprintf) __MINGW_NOTHROW; |
| 244 | extern |
| 245 | __MINGW_MS_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 246 | int __cdecl __ms_vfprintf (FILE * __restrict__ , const char * __restrict__ , va_list) |
| 247 | __MINGW_UCRT_ASM_CALL(vfprintf) __MINGW_NOTHROW |
| 248 | ; |
| 249 | extern |
| 250 | __MINGW_MS_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 251 | int __cdecl __ms_sprintf (char * __restrict__ , const char * __restrict__ , ...) |
| 252 | __MINGW_UCRT_ASM_CALL(sprintf) __MINGW_NOTHROW; |
| 253 | extern |
| 254 | __MINGW_MS_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 255 | int __cdecl __ms_vsprintf (char * __restrict__ , const char * __restrict__ , va_list) |
| 256 | __MINGW_UCRT_ASM_CALL(vsprintf) __MINGW_NOTHROW; |
| 257 | extern |
| 258 | __MINGW_MS_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) |
| 259 | int __cdecl __ms_snprintf (char * __restrict__ , size_t , const char * __restrict__ , ...) |
| 260 | __MINGW_UCRT_ASM_CALL(snprintf) __MINGW_NOTHROW; |
| 261 | extern |
| 262 | __MINGW_MS_PRINTF(3, 0) __MINGW_ATTRIB_NONNULL(3) |
| 263 | int __cdecl __ms_vsnprintf (char * __restrict__ , size_t , const char * __restrict__ , va_list) |
| 264 | __MINGW_UCRT_ASM_CALL(vsnprintf) __MINGW_NOTHROW; |
| 265 | |
| 266 | #ifdef _UCRT |
| 267 | int __cdecl __stdio_common_vsprintf(unsigned __int64 options, char *str, size_t len, const char *format, _locale_t locale, va_list valist); |
| 268 | int __cdecl __stdio_common_vfprintf(unsigned __int64 options, FILE *file, const char *format, _locale_t locale, va_list valist); |
| 269 | int __cdecl __stdio_common_vsscanf(unsigned __int64 options, const char *input, size_t length, const char *format, _locale_t locale, va_list valist); |
| 270 | int __cdecl __stdio_common_vfscanf(unsigned __int64 options, FILE *file, const char *format, _locale_t locale, va_list valist); |
| 271 | #endif |
| 272 | |
| 273 | #undef __MINGW_PRINTF_FORMAT |
| 274 | #undef __MINGW_SCANF_FORMAT |
| 275 | |
| 276 | #if defined(__clang__) |
| 277 | #define __MINGW_PRINTF_FORMAT __printf__ |
| 278 | #define __MINGW_SCANF_FORMAT __scanf__ |
| 279 | #elif defined(_UCRT) || __USE_MINGW_ANSI_STDIO |
| 280 | #define __MINGW_PRINTF_FORMAT __gnu_printf__ |
| 281 | #define __MINGW_SCANF_FORMAT __gnu_scanf__ |
| 282 | #else |
| 283 | #define __MINGW_PRINTF_FORMAT __ms_printf__ |
| 284 | #define __MINGW_SCANF_FORMAT __ms_scanf__ |
| 285 | #endif |
| 286 | |
| 287 | #if __USE_MINGW_ANSI_STDIO && !defined(_CRTBLD) |
| 288 | /* |
| 289 | * User has expressed a preference for C99 conformance... |
| 290 | */ |
| 291 | |
| 292 | #ifdef _GNU_SOURCE |
| 293 | __MINGW_GNU_PRINTF(2, 3) __attribute__((nonnull (1,2))) |
| 294 | int asprintf(char **__ret, const char *__format, ...) |
| 295 | __MINGW_ASM_CALL(__mingw_asprintf); |
| 296 | |
| 297 | __MINGW_GNU_PRINTF(2, 0) __attribute__((nonnull (1,2))) |
| 298 | int vasprintf(char **__ret, const char *__format, __builtin_va_list __local_argv) |
| 299 | __MINGW_ASM_CALL(__mingw_vasprintf); |
| 300 | #endif /* _GNU_SOURCE */ |
| 301 | |
| 302 | /* There seems to be a bug about builtins and static overrides of them |
| 303 | in g++. So we need to do here some trickery. */ |
| 304 | #ifdef __cplusplus |
| 305 | extern "C++" { |
| 306 | #endif |
| 307 | |
| 308 | __MINGW_GNU_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 309 | int sscanf(const char *__source, const char *__format, ...) |
| 310 | __MINGW_ASM_CALL(__mingw_sscanf); |
| 311 | |
| 312 | __MINGW_GNU_SCANF(1, 2) __MINGW_ATTRIB_NONNULL(1) |
| 313 | int scanf(const char *__format, ...) |
| 314 | __MINGW_ASM_CALL(__mingw_scanf); |
| 315 | |
| 316 | __MINGW_GNU_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 317 | int fscanf(FILE *__stream, const char *__format, ...) |
| 318 | __MINGW_ASM_CALL(__mingw_fscanf); |
| 319 | |
| 320 | #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ |
| 321 | #ifdef __GNUC__ |
| 322 | #pragma GCC diagnostic push |
| 323 | #pragma GCC diagnostic ignored "-Wshadow" |
| 324 | #endif |
| 325 | |
| 326 | __MINGW_GNU_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 327 | int vsscanf (const char *__source, const char *__format, __builtin_va_list __local_argv) |
| 328 | __MINGW_ASM_CALL(__mingw_vsscanf); |
| 329 | |
| 330 | __MINGW_GNU_SCANF(1, 0) __MINGW_ATTRIB_NONNULL(1) |
| 331 | int vscanf(const char *__format, __builtin_va_list __local_argv) |
| 332 | __MINGW_ASM_CALL(__mingw_vscanf); |
| 333 | |
| 334 | __MINGW_GNU_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 335 | int vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_argv) |
| 336 | __MINGW_ASM_CALL(__mingw_vfscanf); |
| 337 | |
| 338 | #ifdef __GNUC__ |
| 339 | #pragma GCC diagnostic pop |
| 340 | #endif |
| 341 | #endif /* __NO_ISOCEXT */ |
| 342 | |
| 343 | |
| 344 | |
| 345 | __MINGW_GNU_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 346 | int fprintf (FILE *__stream, const char *__format, ...) |
| 347 | __MINGW_ASM_CALL(__mingw_fprintf); |
| 348 | |
| 349 | __MINGW_GNU_PRINTF(1, 2) __MINGW_ATTRIB_NONNULL(1) |
| 350 | int printf (const char *__format, ...) |
| 351 | __MINGW_ASM_CALL(__mingw_printf); |
| 352 | |
| 353 | __MINGW_GNU_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 354 | int sprintf (char *__stream, const char *__format, ...) |
| 355 | __MINGW_ASM_CALL(__mingw_sprintf); |
| 356 | |
| 357 | #if __MINGW_FORTIFY_VA_ARG |
| 358 | |
| 359 | __mingw_bos_extern_ovr |
| 360 | __MINGW_GNU_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 361 | int sprintf (char *__stream, const char *__format, ...) |
| 362 | { |
| 363 | if (__mingw_bos_known(__stream)) { |
| 364 | int __retval = __mingw_snprintf( __stream, __mingw_bos(__stream, 1), __format, __builtin_va_arg_pack() ); |
| 365 | if (__retval >= 0) |
| 366 | __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); |
| 367 | return __retval; |
| 368 | } |
| 369 | return __mingw_sprintf( __stream, __format, __builtin_va_arg_pack() ); |
| 370 | } |
| 371 | |
| 372 | #endif /* __MINGW_FORTIFY_VA_ARG */ |
| 373 | |
| 374 | __MINGW_GNU_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 375 | int vfprintf (FILE *__stream, const char *__format, __builtin_va_list __local_argv) |
| 376 | __MINGW_ASM_CALL(__mingw_vfprintf); |
| 377 | |
| 378 | __MINGW_GNU_PRINTF(1, 0) __MINGW_ATTRIB_NONNULL(1) |
| 379 | int vprintf (const char *__format, __builtin_va_list __local_argv) |
| 380 | __MINGW_ASM_CALL(__mingw_vprintf); |
| 381 | |
| 382 | __mingw_bos_ovr |
| 383 | __MINGW_GNU_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 384 | int vsprintf (char *__stream, const char *__format, __builtin_va_list __local_argv) |
| 385 | { |
| 386 | #if __MINGW_FORTIFY_LEVEL > 0 |
| 387 | if (__mingw_bos_known(__stream)) { |
| 388 | int __retval = __mingw_vsnprintf( __stream, __mingw_bos(__stream, 1), __format, __local_argv ); |
| 389 | if (__retval >= 0) |
| 390 | __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); |
| 391 | return __retval; |
| 392 | } |
| 393 | #endif |
| 394 | return __mingw_vsprintf( __stream, __format, __local_argv ); |
| 395 | } |
| 396 | /* #ifndef __NO_ISOCEXT */ /* externs in libmingwex.a */ |
| 397 | |
| 398 | __MINGW_GNU_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) |
| 399 | int snprintf (char *__stream, size_t __n, const char *__format, ...) |
| 400 | __MINGW_ASM_CALL(__mingw_snprintf); |
| 401 | |
| 402 | #if __MINGW_FORTIFY_VA_ARG |
| 403 | |
| 404 | __mingw_bos_extern_ovr |
| 405 | __MINGW_GNU_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) |
| 406 | int snprintf (char *__stream, size_t __n, const char *__format, ...) |
| 407 | { |
| 408 | __mingw_bos_ptr_chk_warn(__stream, __n, 1); |
| 409 | return __mingw_snprintf( __stream, __n, __format, __builtin_va_arg_pack() ); |
| 410 | } |
| 411 | |
| 412 | #endif /* __MINGW_FORTIFY_VA_ARG */ |
| 413 | |
| 414 | __mingw_bos_ovr |
| 415 | __MINGW_GNU_PRINTF(3, 0) __MINGW_ATTRIB_NONNULL(3) |
| 416 | int vsnprintf (char *__stream, size_t __n, const char *__format, __builtin_va_list __local_argv) |
| 417 | { |
| 418 | #if __MINGW_FORTIFY_LEVEL > 0 |
| 419 | __mingw_bos_ptr_chk_warn(__stream, __n, 1); |
| 420 | #endif |
| 421 | return __mingw_vsnprintf( __stream, __n, __format, __local_argv ); |
| 422 | } |
| 423 | |
| 424 | /* Override __builtin_printf-routines ... Kludge for libstdc++ ...*/ |
| 425 | #define __builtin_vsnprintf __mingw_vsnprintf |
| 426 | #define __builtin_vsprintf __mingw_vsprintf |
| 427 | |
| 428 | /* #endif */ /* __NO_ISOCEXT */ |
| 429 | |
| 430 | #ifdef __cplusplus |
| 431 | } |
| 432 | #endif |
| 433 | |
| 434 | #else /* !__USE_MINGW_ANSI_STDIO */ |
| 435 | |
| 436 | #undef __builtin_vsnprintf |
| 437 | #undef __builtin_vsprintf |
| 438 | |
| 439 | /* |
| 440 | * Default configuration: simply direct all calls to MSVCRT... |
| 441 | */ |
| 442 | #ifdef _UCRT |
| 443 | #ifdef __GNUC__ |
| 444 | #pragma GCC diagnostic push |
| 445 | #pragma GCC diagnostic ignored "-Wshadow" |
| 446 | #endif |
| 447 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2) |
| 448 | int __cdecl fprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,...); |
| 449 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 1, 2))) __MINGW_ATTRIB_NONNULL(1) |
| 450 | int __cdecl printf(const char * __restrict__ _Format,...); |
| 451 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2) |
| 452 | int __cdecl sprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 453 | |
| 454 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(2) |
| 455 | int __cdecl vfprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list _ArgList); |
| 456 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 1, 0))) __MINGW_ATTRIB_NONNULL(1) |
| 457 | int __cdecl vprintf(const char * __restrict__ _Format,va_list _ArgList); |
| 458 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(2) |
| 459 | int __cdecl vsprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 460 | |
| 461 | __MINGW_ATTRIB_DEPRECATED_SEC_WARN |
| 462 | __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2) |
| 463 | int __cdecl fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...); |
| 464 | __MINGW_ATTRIB_DEPRECATED_SEC_WARN |
| 465 | __attribute__((__format__ (__MINGW_SCANF_FORMAT, 1, 2))) __MINGW_ATTRIB_NONNULL(1) |
| 466 | int __cdecl scanf(const char * __restrict__ _Format,...); |
| 467 | __MINGW_ATTRIB_DEPRECATED_SEC_WARN |
| 468 | __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2) |
| 469 | int __cdecl sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...); |
| 470 | #ifdef _GNU_SOURCE |
| 471 | __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, 2, 0))) |
| 472 | int __cdecl vasprintf(char ** __restrict__ _Ret,const char * __restrict__ _Format,va_list _Args); |
| 473 | __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, 2, 3))) |
| 474 | int __cdecl asprintf(char ** __restrict__ _Ret,const char * __restrict__ _Format,...); |
| 475 | #endif /*_GNU_SOURCE*/ |
| 476 | |
| 477 | __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(2) |
| 478 | int vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_argv); |
| 479 | |
| 480 | __attribute__((__format__ (__MINGW_SCANF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(2) |
| 481 | int vsscanf (const char * __restrict__ __source, const char * __restrict__ __format, __builtin_va_list __local_argv); |
| 482 | __attribute__((__format__ (__MINGW_SCANF_FORMAT, 1, 0))) __MINGW_ATTRIB_NONNULL(1) |
| 483 | int vscanf(const char *__format, __builtin_va_list __local_argv); |
| 484 | |
| 485 | #ifdef __GNUC__ |
| 486 | #pragma GCC diagnostic pop |
| 487 | #endif |
| 488 | |
| 489 | #else |
| 490 | __MINGW_MS_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 491 | int __cdecl fprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,...); |
| 492 | __MINGW_MS_PRINTF(1, 2) __MINGW_ATTRIB_NONNULL(1) |
| 493 | int __cdecl printf(const char * __restrict__ _Format,...); |
| 494 | __MINGW_MS_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 495 | int __cdecl sprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 496 | |
| 497 | __MINGW_MS_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 498 | int __cdecl vfprintf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list _ArgList); |
| 499 | __MINGW_MS_PRINTF(1, 0) __MINGW_ATTRIB_NONNULL(1) |
| 500 | int __cdecl vprintf(const char * __restrict__ _Format,va_list _ArgList); |
| 501 | __MINGW_MS_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 502 | int __cdecl vsprintf(char * __restrict__ _Dest,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 503 | |
| 504 | __MINGW_MS_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 505 | int __cdecl fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 506 | __MINGW_MS_SCANF(1, 2) __MINGW_ATTRIB_NONNULL(1) |
| 507 | int __cdecl scanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 508 | __MINGW_MS_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 509 | int __cdecl sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 510 | #ifdef _GNU_SOURCE |
| 511 | int __cdecl vasprintf(char ** __restrict__ __ret,const char * __restrict__ __format,va_list __ap) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 0))); |
| 512 | int __cdecl asprintf(char ** __restrict__ __ret,const char * __restrict__ __format,...) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 3))); |
| 513 | #endif /*_GNU_SOURCE*/ |
| 514 | #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ |
| 515 | #ifdef __GNUC__ |
| 516 | #pragma GCC diagnostic push |
| 517 | #pragma GCC diagnostic ignored "-Wshadow" |
| 518 | #endif |
| 519 | |
| 520 | __MINGW_MS_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 521 | int vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_argv); |
| 522 | __MINGW_MS_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 523 | int vsscanf (const char * __restrict__ __source, const char * __restrict__ __format, __builtin_va_list __local_argv); |
| 524 | __MINGW_MS_SCANF(1, 0) __MINGW_ATTRIB_NONNULL(1) |
| 525 | int vscanf(const char *__format, __builtin_va_list __local_argv); |
| 526 | |
| 527 | #ifdef __GNUC__ |
| 528 | #pragma GCC diagnostic pop |
| 529 | #endif |
| 530 | |
| 531 | #endif /* __NO_ISOCEXT */ |
| 532 | #endif /* _UCRT */ |
| 533 | #endif /* __USE_MINGW_ANSI_STDIO */ |
| 534 | |
| 535 | _CRTIMP int __cdecl _filbuf(FILE *_File); |
| 536 | _CRTIMP int __cdecl _flsbuf(int _Ch,FILE *_File); |
| 537 | #ifdef _POSIX_ |
| 538 | _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode); |
| 539 | #else |
| 540 | _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode,int _ShFlag); |
| 541 | #endif |
| 542 | void __cdecl clearerr(FILE *_File); |
| 543 | int __cdecl fclose(FILE *_File); |
| 544 | _CRTIMP int __cdecl _fcloseall(void); |
| 545 | #ifdef _POSIX_ |
| 546 | FILE *__cdecl fdopen(int _FileHandle,const char *_Mode) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 547 | #else |
| 548 | _CRTIMP FILE *__cdecl _fdopen(int _FileHandle,const char *_Mode); |
| 549 | #endif |
| 550 | int __cdecl feof(FILE *_File); |
| 551 | int __cdecl ferror(FILE *_File); |
| 552 | int __cdecl fflush(FILE *_File); |
| 553 | int __cdecl fgetc(FILE *_File); |
| 554 | _CRTIMP int __cdecl _fgetchar(void); |
| 555 | int __cdecl fgetpos(FILE * __restrict__ _File ,fpos_t * __restrict__ _Pos); /* 64bit only, no 32bit version */ |
| 556 | int __cdecl fgetpos64(FILE * __restrict__ _File ,fpos_t * __restrict__ _Pos); /* fgetpos already 64bit */ |
| 557 | char *__cdecl fgets(char * __restrict__ _Buf,int _MaxCount,FILE * __restrict__ _File); |
| 558 | _CRTIMP int __cdecl _fileno(FILE *_File); |
| 559 | #ifdef _POSIX_ |
| 560 | int __cdecl fileno(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 561 | #endif |
| 562 | #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) |
| 563 | #pragma push_macro("_tempnam") |
| 564 | #undef _tempnam |
| 565 | #endif |
| 566 | _CRTIMP char *__cdecl _tempnam(const char *_DirName,const char *_FilePrefix); |
| 567 | #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) |
| 568 | #pragma pop_macro("_tempnam") |
| 569 | #endif |
| 570 | _CRTIMP int __cdecl _flushall(void); |
| 571 | FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 572 | FILE *__cdecl fopen64(const char * __restrict__ filename,const char * __restrict__ mode); |
| 573 | int __cdecl fputc(int _Ch,FILE *_File); |
| 574 | _CRTIMP int __cdecl _fputchar(int _Ch); |
| 575 | int __cdecl fputs(const char * __restrict__ _Str,FILE * __restrict__ _File); |
| 576 | size_t __cdecl fread(void * __restrict__ _DstBuf,size_t _ElementSize,size_t _Count,FILE * __restrict__ _File); |
| 577 | FILE *__cdecl freopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode,FILE * __restrict__ _File) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 578 | FILE *__cdecl freopen64(const char * __restrict__ _Filename,const char * __restrict__ _Mode,FILE * __restrict__ _File); |
| 579 | int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos); |
| 580 | int __cdecl fsetpos64(FILE *_File,const fpos_t *_Pos); /* fsetpos already 64bit */ |
| 581 | int __cdecl fseek(FILE *_File,long _Offset,int _Origin); |
| 582 | long __cdecl ftell(FILE *_File); |
| 583 | |
| 584 | _CRTIMP int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin); |
| 585 | _CRTIMP __int64 __cdecl _ftelli64(FILE *_File); |
| 586 | #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) |
| 587 | int __cdecl fseeko(FILE *_File, _off64_t _Offset, int _Origin) __MINGW_ASM_CALL(fseeko64); |
| 588 | #else |
| 589 | int __cdecl fseeko(FILE *_File, _off_t _Offset, int _Origin); |
| 590 | #endif |
| 591 | _CRTIMP int __cdecl fseeko64(FILE *_File, _off64_t _Offset, int _Origin); |
| 592 | #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) |
| 593 | _off64_t __cdecl ftello(FILE *_File) __MINGW_ASM_CALL(ftello64); |
| 594 | #else |
| 595 | _off_t __cdecl ftello(FILE *_File); |
| 596 | #endif |
| 597 | _CRTIMP _off64_t __cdecl ftello64(FILE *_File); |
| 598 | |
| 599 | size_t __cdecl fwrite(const void * __restrict__ _Str,size_t _Size,size_t _Count,FILE * __restrict__ _File); |
| 600 | int __cdecl getc(FILE *_File); |
| 601 | int __cdecl getchar(void); |
| 602 | _CRTIMP int __cdecl _getmaxstdio(void); |
| 603 | char *__cdecl gets(char *_Buffer) |
| 604 | #ifndef _CRTBLD |
| 605 | __attribute__((__warning__("Using gets() is always unsafe - use fgets() instead"))) |
| 606 | #endif |
| 607 | ; |
| 608 | int __cdecl _getw(FILE *_File); |
| 609 | #ifndef _CRT_PERROR_DEFINED |
| 610 | #define _CRT_PERROR_DEFINED |
| 611 | void __cdecl perror(const char *_ErrMsg); |
| 612 | #endif |
| 613 | #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP |
| 614 | _CRTIMP int __cdecl _pclose(FILE *_File); |
| 615 | _CRTIMP FILE *__cdecl _popen(const char *_Command,const char *_Mode); |
| 616 | #if !defined(NO_OLDNAMES) && !defined(popen) |
| 617 | #define popen	_popen |
| 618 | #define pclose	_pclose |
| 619 | #endif |
| 620 | #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ |
| 621 | int __cdecl putc(int _Ch,FILE *_File); |
| 622 | int __cdecl putchar(int _Ch); |
| 623 | int __cdecl puts(const char *_Str); |
| 624 | _CRTIMP int __cdecl _putw(int _Word,FILE *_File); |
| 625 | #ifndef _CRT_DIRECTORY_DEFINED |
| 626 | #define _CRT_DIRECTORY_DEFINED |
| 627 | int __cdecl remove(const char *_Filename); |
| 628 | int __cdecl rename(const char *_OldFilename,const char *_NewFilename); |
| 629 | _CRTIMP int __cdecl _unlink(const char *_Filename); |
| 630 | #ifndef	NO_OLDNAMES |
| 631 | int __cdecl unlink(const char *_Filename) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 632 | #endif |
| 633 | #endif |
| 634 | void __cdecl rewind(FILE *_File); |
| 635 | _CRTIMP int __cdecl _rmtmp(void); |
| 636 | void __cdecl setbuf(FILE * __restrict__ _File,char * __restrict__ _Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 637 | _CRTIMP int __cdecl _setmaxstdio(int _Max); |
| 638 | _CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format); |
| 639 | _CRTIMP unsigned int __cdecl _get_output_format(void); |
| 640 | int __cdecl setvbuf(FILE * __restrict__ _File,char * __restrict__ _Buf,int _Mode,size_t _Size); |
| 641 | #ifdef _UCRT |
| 642 | __MINGW_ATTRIB_PURE |
| 643 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 1, 2))) __MINGW_ATTRIB_NONNULL(1) |
| 644 | int __cdecl _scprintf(const char * __restrict__ _Format,...); |
| 645 | __attribute__((__format__ (__MINGW_SCANF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3) |
| 646 | int __cdecl _snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 647 | #else |
| 648 | __MINGW_ATTRIB_PURE |
| 649 | __MINGW_MS_PRINTF(1, 2) __MINGW_ATTRIB_NONNULL(1) |
| 650 | _CRTIMP int __cdecl _scprintf(const char * __restrict__ _Format,...); |
| 651 | __MINGW_MS_SCANF(3, 4) __MINGW_ATTRIB_NONNULL(3) |
| 652 | _CRTIMP int __cdecl _snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 653 | #endif |
| 654 | __MINGW_ATTRIB_PURE |
| 655 | __MINGW_MS_PRINTF(1, 0) __MINGW_ATTRIB_NONNULL(1) |
| 656 | _CRTIMP int __cdecl _vscprintf(const char * __restrict__ _Format,va_list _ArgList); |
| 657 | FILE *__cdecl tmpfile(void) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 658 | FILE *__cdecl tmpfile64(void); |
| 659 | char *__cdecl tmpnam(char *_Buffer); |
| 660 | int __cdecl ungetc(int _Ch,FILE *_File); |
| 661 | |
| 662 | #ifdef _UCRT |
| 663 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 0))) __MINGW_ATTRIB_NONNULL(3) |
| 664 | int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 665 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3) |
| 666 | int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 667 | #else |
| 668 | __MINGW_MS_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) |
| 669 | _CRTIMP int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 670 | __MINGW_MS_PRINTF(3, 0) __MINGW_ATTRIB_NONNULL(3) |
| 671 | _CRTIMP int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 672 | #endif |
| 673 | |
| 674 | #if __MINGW_FORTIFY_LEVEL > 0 |
| 675 | |
| 676 | char * __cdecl __gets_chk(char *, size_t); |
| 677 | char * __cdecl __mingw_call_gets_warn(char *) __MINGW_ASM_CALL(gets) |
| 678 | __attribute__((__warning__("Using gets() is always unsafe - use fgets() instead"))); |
| 679 | char * __cdecl __mingw_call_fgets(char * __restrict__, int, FILE * __restrict__) __MINGW_ASM_CALL(fgets); |
| 680 | size_t __cdecl __mingw_call_fread(void * __restrict__, size_t, size_t, FILE * __restrict__) __MINGW_ASM_CALL(fread); |
| 681 | char * __cdecl __mingw_call_tmpnam(char *) __MINGW_ASM_CALL(tmpnam); |
| 682 | |
| 683 | __mingw_bos_extern_ovr |
| 684 | char * gets(char * __dst) |
| 685 | { |
| 686 | if (__mingw_bos_known(__dst)) |
| 687 | return __gets_chk(__dst, __mingw_bos(__dst, 1)); |
| 688 | return __mingw_call_gets_warn(__dst); |
| 689 | } |
| 690 | |
| 691 | __mingw_bos_extern_ovr |
| 692 | char * fgets(char * __restrict__ __dst, int __n, FILE * __restrict__ __f) |
| 693 | { |
| 694 | __mingw_bos_ptr_chk_warn(__dst, __n, 1); |
| 695 | return __mingw_call_fgets(__dst, __n, __f); |
| 696 | } |
| 697 | |
| 698 | __mingw_bos_extern_ovr |
| 699 | size_t fread(void * __restrict__ __dst, size_t __sz, size_t __n, FILE * __restrict__ __f) |
| 700 | { |
| 701 | __mingw_bos_ptr_chk_warn(__dst, __sz * __n, 0); |
| 702 | return __mingw_call_fread(__dst, __sz, __n, __f); |
| 703 | } |
| 704 | |
| 705 | __mingw_bos_extern_ovr |
| 706 | char * tmpnam(char * __dst) |
| 707 | { |
| 708 | __mingw_bos_ptr_chk_warn(__dst, L_tmpnam, 1); |
| 709 | return __mingw_call_tmpnam(__dst); |
| 710 | } |
| 711 | |
| 712 | #endif /* __MINGW_FORTIFY_LEVEL > 0 */ |
| 713 | |
| 714 | #if __USE_MINGW_ANSI_STDIO == 0 |
| 715 | |
| 716 | #ifdef _UCRT |
| 717 | #ifdef __GNUC__ |
| 718 | #pragma GCC diagnostic push |
| 719 | #pragma GCC diagnostic ignored "-Wshadow" |
| 720 | #endif |
| 721 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 0))) __MINGW_ATTRIB_NONNULL(3) |
| 722 | int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv); |
| 723 | |
| 724 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3) |
| 725 | int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...); |
| 726 | |
| 727 | #if __MINGW_FORTIFY_LEVEL > 0 |
| 728 | |
| 729 | int __cdecl __mingw_call_vsprintf (char * __restrict__ __stream, const char * __restrict__ __format, va_list __local_argv) __MINGW_ASM_CALL(vsprintf); |
| 730 | int __cdecl __mingw_call_vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv) __MINGW_ASM_CALL(vsnprintf); |
| 731 | |
| 732 | __mingw_bos_extern_ovr |
| 733 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(3) |
| 734 | int vsprintf (char * __restrict__ __stream, const char * __restrict__ __format, va_list __local_argv) |
| 735 | { |
| 736 | if (__mingw_bos_known(__stream)) { |
| 737 | int __retval = __mingw_call_vsnprintf (__stream, __mingw_bos(__stream, 1), __format, __local_argv); |
| 738 | if (__retval >= 0) |
| 739 | __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); |
| 740 | return __retval; |
| 741 | } |
| 742 | return __mingw_call_vsprintf(__stream, __format, __local_argv); |
| 743 | } |
| 744 | |
| 745 | __mingw_bos_extern_ovr |
| 746 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 0))) __MINGW_ATTRIB_NONNULL(3) |
| 747 | int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv) |
| 748 | { |
| 749 | __mingw_bos_ptr_chk_warn(__stream, __n, 1); |
| 750 | return __mingw_call_vsnprintf (__stream, __n, __format, __local_argv); |
| 751 | } |
| 752 | |
| 753 | #endif /* __MINGW_FORTIFY_LEVEL > 0 */ |
| 754 | |
| 755 | #if __MINGW_FORTIFY_VA_ARG |
| 756 | |
| 757 | int __cdecl __mingw_call_sprintf (char * __restrict__ __stream, const char * __restrict__ __Format, ...) __MINGW_ASM_CALL(sprintf); |
| 758 | int __cdecl __mingw_call_snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) __MINGW_ASM_CALL(snprintf); |
| 759 | |
| 760 | __mingw_bos_extern_ovr |
| 761 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2) |
| 762 | int sprintf (char * __restrict__ __stream, const char * __restrict__ __format, ...) |
| 763 | { |
| 764 | if (__mingw_bos_known(__stream)) { |
| 765 | int __retval = __mingw_call_snprintf (__stream, __mingw_bos(__stream, 1), __format, __builtin_va_arg_pack()); |
| 766 | if (__retval >= 0) |
| 767 | __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); |
| 768 | return __retval; |
| 769 | } |
| 770 | return __mingw_call_sprintf (__stream, __format, __builtin_va_arg_pack()); |
| 771 | } |
| 772 | |
| 773 | __mingw_bos_extern_ovr |
| 774 | __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3) |
| 775 | int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) |
| 776 | { |
| 777 | __mingw_bos_ptr_chk_warn(__stream, __n, 1); |
| 778 | return __mingw_call_snprintf (__stream, __n, __format, __builtin_va_arg_pack()); |
| 779 | } |
| 780 | |
| 781 | #endif /* __MINGW_FORTIFY_VA_ARG */ |
| 782 | |
| 783 | #ifdef __GNUC__ |
| 784 | #pragma GCC diagnostic pop |
| 785 | #endif |
| 786 | #else /* !_UCRT */ |
| 787 | |
| 788 | /* this is here to deal with software defining |
| 789 | * vsnprintf as _vsnprintf, eg. libxml2. */ |
| 790 | |
| 791 | #ifdef __GNUC__ |
| 792 | #pragma GCC diagnostic push |
| 793 | #pragma GCC diagnostic ignored "-Wshadow" |
| 794 | #endif |
| 795 | |
| 796 | __mingw_bos_ovr |
| 797 | __MINGW_MS_PRINTF(3, 0) __MINGW_ATTRIB_NONNULL(3) |
| 798 | int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv) |
| 799 | { |
| 800 | #if __MINGW_FORTIFY_LEVEL > 0 |
| 801 | __mingw_bos_ptr_chk_warn(__stream, __n, 1); |
| 802 | #endif |
| 803 | if (__builtin_constant_p(__n) && __n == 0) |
| 804 | return _vscprintf(__format, __local_argv); |
| 805 | return __ms_vsnprintf (__stream, __n, __format, __local_argv); |
| 806 | } |
| 807 | |
| 808 | #ifndef __NO_ISOCEXT |
| 809 | #if __MINGW_FORTIFY_VA_ARG |
| 810 | |
| 811 | int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) __MINGW_ASM_CALL(__ms_snprintf); |
| 812 | |
| 813 | __mingw_bos_extern_ovr |
| 814 | __MINGW_MS_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) |
| 815 | int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) |
| 816 | { |
| 817 | __mingw_bos_ptr_chk_warn(__stream, __n, 1); |
| 818 | if (__builtin_constant_p(__n) && __n == 0) |
| 819 | return _scprintf(__format, __builtin_va_arg_pack()); |
| 820 | return __ms_snprintf(__stream, __n, __format, __builtin_va_arg_pack()); |
| 821 | } |
| 822 | |
| 823 | #else /* !__MINGW_FORTIFY_VA_ARG */ |
| 824 | |
| 825 | __mingw_ovr |
| 826 | __MINGW_MS_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) |
| 827 | int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) |
| 828 | { |
| 829 | int __retval; |
| 830 | __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format ); |
| 831 | if (__builtin_constant_p(__n) && __n == 0) |
| 832 | __retval = _vscprintf(__format, __local_argv); |
| 833 | else |
| 834 | __retval = __ms_vsnprintf (__stream, __n, __format, __local_argv); |
| 835 | __builtin_va_end( __local_argv ); |
| 836 | return __retval; |
| 837 | } |
| 838 | |
| 839 | #endif /* !__MINGW_FORTIFY_VA_ARG */ |
| 840 | #endif /* !__NO_ISOCEXT */ |
| 841 | |
| 842 | #if __MINGW_FORTIFY_VA_ARG |
| 843 | |
| 844 | int __cdecl __mingw_call_ms_sprintf(char * __restrict__, const char * __restrict__, ...) __MINGW_ASM_CALL(sprintf); |
| 845 | |
| 846 | __mingw_bos_extern_ovr |
| 847 | __MINGW_MS_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) |
| 848 | int sprintf (char * __restrict__ __stream, const char * __restrict__ __format, ...) |
| 849 | { |
| 850 | if (__mingw_bos_known(__stream)) { |
| 851 | int __retval = __ms_snprintf( __stream, __mingw_bos(__stream, 1), __format, __builtin_va_arg_pack() ); |
| 852 | if (__retval >= 0) |
| 853 | __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); |
| 854 | return __retval; |
| 855 | } |
| 856 | return __mingw_call_ms_sprintf( __stream, __format, __builtin_va_arg_pack() ); |
| 857 | } |
| 858 | |
| 859 | #endif /* __MINGW_FORTIFY_VA_ARG */ |
| 860 | |
| 861 | #if __MINGW_FORTIFY_LEVEL > 0 |
| 862 | |
| 863 | int __cdecl __mingw_call_ms_vsprintf(char * __restrict__, const char * __restrict__, va_list) __MINGW_ASM_CALL(vsprintf); |
| 864 | |
| 865 | __mingw_bos_extern_ovr |
| 866 | __MINGW_MS_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) |
| 867 | int vsprintf (char * __restrict__ __stream, const char * __restrict__ __format, va_list __local_argv) |
| 868 | { |
| 869 | if (__mingw_bos_known(__stream)) { |
| 870 | int __retval = __ms_vsnprintf( __stream, __mingw_bos(__stream, 1), __format, __local_argv ); |
| 871 | if (__retval >= 0) |
| 872 | __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); |
| 873 | return __retval; |
| 874 | } |
| 875 | return __mingw_call_ms_vsprintf( __stream, __format, __local_argv ); |
| 876 | } |
| 877 | |
| 878 | #endif /* __MINGW_FORTIFY_LEVEL > 0 */ |
| 879 | |
| 880 | #ifdef __GNUC__ |
| 881 | #pragma GCC diagnostic pop |
| 882 | #endif |
| 883 | #endif /* _UCRT */ |
| 884 | #endif /* __USE_MINGW_ANSI_STDIO */ |
| 885 | |
| 886 | _CRTIMP int __cdecl _set_printf_count_output(int _Value); |
| 887 | _CRTIMP int __cdecl _get_printf_count_output(void); |
| 888 | |
| 889 | #ifndef _WSTDIO_DEFINED |
| 890 | #define _WSTDIO_DEFINED |
| 891 | |
| 892 | /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) |
| 893 | int __cdecl __mingw_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...); |
| 894 | /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) |
| 895 | int __cdecl __mingw_vswscanf (const wchar_t * __restrict__ _Str,const wchar_t * __restrict__ Format,va_list argp); |
| 896 | /* __attribute__((__format__ (gnu_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) |
| 897 | int __cdecl __mingw_wscanf(const wchar_t * __restrict__ _Format,...); |
| 898 | /* __attribute__((__format__ (gnu_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) |
| 899 | int __cdecl __mingw_vwscanf(const wchar_t * __restrict__ Format, va_list argp); |
| 900 | /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) |
| 901 | int __cdecl __mingw_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); |
| 902 | /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) |
| 903 | int __cdecl __mingw_vfwscanf (FILE * __restrict__ fp, const wchar_t * __restrict__ Format,va_list argp); |
| 904 | |
| 905 | /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) |
| 906 | int __cdecl __mingw_fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); |
| 907 | /* __attribute__((__format__ (gnu_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) |
| 908 | int __cdecl __mingw_wprintf(const wchar_t * __restrict__ _Format,...); |
| 909 | /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */__MINGW_ATTRIB_NONNULL(2) |
| 910 | int __cdecl __mingw_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList); |
| 911 | /*__attribute__((__format__ (gnu_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) |
| 912 | int __cdecl __mingw_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); |
| 913 | /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) |
| 914 | int __cdecl __mingw_snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...); |
| 915 | /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) |
| 916 | int __cdecl __mingw_vsnwprintf (wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list); |
| 917 | /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) |
| 918 | int __cdecl __mingw_swprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...); |
| 919 | /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) |
| 920 | int __cdecl __mingw_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list); |
| 921 | |
| 922 | /* __attribute__((__format__ (ms_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) |
| 923 | int __cdecl __ms_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) |
| 924 | __MINGW_UCRT_ASM_CALL(swscanf); |
| 925 | /* __attribute__((__format__ (ms_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) |
| 926 | int __cdecl __ms_vswscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,va_list) |
| 927 | __MINGW_ASM_CALL(vswscanf); |
| 928 | /* __attribute__((__format__ (ms_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) |
| 929 | int __cdecl __ms_wscanf(const wchar_t * __restrict__ _Format,...) |
| 930 | __MINGW_UCRT_ASM_CALL(wscanf); |
| 931 | /* __attribute__((__format__ (ms_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) |
| 932 | int __cdecl __ms_vwscanf(const wchar_t * __restrict__ _Format, va_list) |
| 933 | __MINGW_ASM_CALL(vwscanf); |
| 934 | /* __attribute__((__format__ (ms_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) |
| 935 | int __cdecl __ms_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) |
| 936 | __MINGW_UCRT_ASM_CALL(fwscanf); |
| 937 | /* __attribute__((__format__ (ms_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) |
| 938 | int __cdecl __ms_vfwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list) |
| 939 | __MINGW_ASM_CALL(vfwscanf); |
| 940 | |
| 941 | /* __attribute__((__format__ (ms_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) |
| 942 | int __cdecl __ms_fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); |
| 943 | /* No __MINGW_UCRT_ASM_CALL for __ms_fwprintf; this is provided as an |
| 944 | * actual function in the ucrt import libraries. */ |
| 945 | /* __attribute__((__format__ (ms_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) |
| 946 | int __cdecl __ms_wprintf(const wchar_t * __restrict__ _Format,...) |
| 947 | __MINGW_UCRT_ASM_CALL(wprintf); |
| 948 | /* __attribute__((__format__ (ms_wprintf, 2, 0))) */__MINGW_ATTRIB_NONNULL(2) |
| 949 | int __cdecl __ms_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList) |
| 950 | __MINGW_UCRT_ASM_CALL(vfwprintf); |
| 951 | /*__attribute__((__format__ (ms_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) |
| 952 | int __cdecl __ms_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList) |
| 953 | __MINGW_UCRT_ASM_CALL(vwprintf); |
| 954 | /* __attribute__((__format__ (ms_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) |
| 955 | int __cdecl __ms_swprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...) |
| 956 | __MINGW_UCRT_ASM_CALL(swprintf); |
| 957 | /* __attribute__((__format__ (ms_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) |
| 958 | int __cdecl __ms_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list) |
| 959 | __MINGW_UCRT_ASM_CALL(vswprintf); |
| 960 | /* __attribute__((__format__ (ms_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) |
| 961 | int __cdecl __ms_snwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...) |
| 962 | __MINGW_UCRT_ASM_CALL(snwprintf); |
| 963 | /* __attribute__((__format__ (ms_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) |
| 964 | int __cdecl __ms_vsnwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list) |
| 965 | __MINGW_UCRT_ASM_CALL(vsnwprintf); |
| 966 | |
| 967 | #ifdef _UCRT |
| 968 | int __cdecl __stdio_common_vswprintf(unsigned __int64 options, wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist); |
| 969 | int __cdecl __stdio_common_vfwprintf(unsigned __int64 options, FILE *file, const wchar_t *format, _locale_t locale, va_list valist); |
| 970 | int __cdecl __stdio_common_vswscanf(unsigned __int64 options, const wchar_t *input, size_t length, const wchar_t *format, _locale_t locale, va_list valist); |
| 971 | int __cdecl __stdio_common_vfwscanf(unsigned __int64 options, FILE *file, const wchar_t *format, _locale_t locale, va_list valist); |
| 972 | #endif |
| 973 | |
| 974 | #if __USE_MINGW_ANSI_STDIO && !defined(_CRTBLD) |
| 975 | /* |
| 976 | * User has expressed a preference for C99 conformance... |
| 977 | */ |
| 978 | |
| 979 | /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) |
| 980 | int swscanf(const wchar_t *__source, const wchar_t *__format, ...) |
| 981 | __MINGW_ASM_CALL(__mingw_swscanf); |
| 982 | |
| 983 | /* __attribute__((__format__ (gnu_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) |
| 984 | int wscanf(const wchar_t *__format, ...) |
| 985 | __MINGW_ASM_CALL(__mingw_wscanf); |
| 986 | |
| 987 | /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) |
| 988 | int fwscanf(FILE *__stream, const wchar_t *__format, ...) |
| 989 | __MINGW_ASM_CALL(__mingw_fwscanf); |
| 990 | |
| 991 | #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ |
| 992 | /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) |
| 993 | int vswscanf (const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, __builtin_va_list __local_argv) |
| 994 | __MINGW_ASM_CALL(__mingw_vswscanf); |
| 995 | |
| 996 | /* __attribute__((__format__ (gnu_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) |
| 997 | int vwscanf(const wchar_t *__format, __builtin_va_list __local_argv) |
| 998 | __MINGW_ASM_CALL(__mingw_vwscanf); |
| 999 | |
| 1000 | /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) |
| 1001 | int vfwscanf (FILE *__stream, const wchar_t *__format, __builtin_va_list __local_argv) |
| 1002 | __MINGW_ASM_CALL(__mingw_vfwscanf); |
| 1003 | #endif /* __NO_ISOCEXT */ |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) |
| 1008 | int fwprintf (FILE *__stream, const wchar_t *__format, ...) |
| 1009 | __MINGW_ASM_CALL(__mingw_fwprintf); |
| 1010 | |
| 1011 | /* __attribute__((__format__ (gnu_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) |
| 1012 | int wprintf (const wchar_t *__format, ...) |
| 1013 | __MINGW_ASM_CALL(__mingw_wprintf); |
| 1014 | |
| 1015 | /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) |
| 1016 | int vfwprintf (FILE *__stream, const wchar_t *__format, __builtin_va_list __local_argv) |
| 1017 | __MINGW_ASM_CALL(__mingw_vfwprintf); |
| 1018 | |
| 1019 | /* __attribute__((__format__ (gnu_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) |
| 1020 | int vwprintf (const wchar_t *__format, __builtin_va_list __local_argv) |
| 1021 | __MINGW_ASM_CALL(__mingw_vwprintf); |
| 1022 | |
| 1023 | /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) |
| 1024 | int swprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...) |
| 1025 | __MINGW_ASM_CALL(__mingw_swprintf); |
| 1026 | |
| 1027 | #if __MINGW_FORTIFY_VA_ARG |
| 1028 | |
| 1029 | __mingw_bos_extern_ovr |
| 1030 | /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) |
| 1031 | int swprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...) |
| 1032 | { |
| 1033 | __mingw_bos_ptr_chk_warn(__stream, __n * sizeof(wchar_t), 1); |
| 1034 | return __mingw_swprintf( __stream, __n, __format, __builtin_va_arg_pack() ); |
| 1035 | } |
| 1036 | |
| 1037 | #endif /* __MINGW_FORTIFY_VA_ARG */ |
| 1038 | |
| 1039 | __mingw_bos_ovr |
| 1040 | /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) |
| 1041 | int vswprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builtin_va_list __local_argv) |
| 1042 | { |
| 1043 | #if __MINGW_FORTIFY_LEVEL > 0 |
| 1044 | __mingw_bos_ptr_chk_warn(__stream, __n * sizeof(wchar_t), 1); |
| 1045 | #endif |
| 1046 | return __mingw_vswprintf( __stream, __n, __format, __local_argv ); |
| 1047 | } |
| 1048 | |
| 1049 | #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ |
| 1050 | |
| 1051 | /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) |
| 1052 | int snwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...) |
| 1053 | __MINGW_ASM_CALL(__mingw_snwprintf); |
| 1054 | |
| 1055 | #if __MINGW_FORTIFY_VA_ARG |
| 1056 | |
| 1057 | __mingw_bos_extern_ovr |
| 1058 | /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) |
| 1059 | int snwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...) |
| 1060 | { |
| 1061 | __mingw_bos_ptr_chk_warn(__stream, __n * sizeof(wchar_t), 1); |
| 1062 | return __mingw_snwprintf( __stream, __n, __format, __builtin_va_arg_pack() ); |
| 1063 | } |
| 1064 | |
| 1065 | #endif /* __MINGW_FORTIFY_VA_ARG */ |
| 1066 | |
| 1067 | __mingw_bos_ovr |
| 1068 | /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) |
| 1069 | int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builtin_va_list __local_argv) |
| 1070 | { |
| 1071 | #if __MINGW_FORTIFY_LEVEL > 0 |
| 1072 | __mingw_bos_ptr_chk_warn(__stream, __n * sizeof(wchar_t), 1); |
| 1073 | #endif |
| 1074 | return __mingw_vsnwprintf( __stream, __n, __format, __local_argv ); |
| 1075 | } |
| 1076 | |
| 1077 | #endif /* __NO_ISOCEXT */ |
| 1078 | |
| 1079 | #else /* !__USE_MINGW_ANSI_STDIO */ |
| 1080 | __MINGW_ATTRIB_DEPRECATED_SEC_WARN |
| 1081 | int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); |
| 1082 | |
| 1083 | __MINGW_ATTRIB_DEPRECATED_SEC_WARN |
| 1084 | int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...); |
| 1085 | |
| 1086 | __MINGW_ATTRIB_DEPRECATED_SEC_WARN |
| 1087 | int __cdecl wscanf(const wchar_t * __restrict__ _Format,...); |
| 1088 | |
| 1089 | __MINGW_ATTRIB_NONNULL(2) |
| 1090 | int __cdecl vfwscanf(FILE *__stream, const wchar_t *__format, va_list __local_argv); |
| 1091 | |
| 1092 | __MINGW_ATTRIB_NONNULL(2) |
| 1093 | int __cdecl vswscanf(const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, va_list __local_argv); |
| 1094 | |
| 1095 | __MINGW_ATTRIB_NONNULL(1) |
| 1096 | int __cdecl vwscanf(const wchar_t *__format, va_list __local_argv); |
| 1097 | |
| 1098 | int __cdecl fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); |
| 1099 | int __cdecl wprintf(const wchar_t * __restrict__ _Format,...); |
| 1100 | int __cdecl vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList); |
| 1101 | int __cdecl vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); |
| 1102 | |
| 1103 | int __cdecl swprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...); |
| 1104 | int __cdecl vswprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args); |
| 1105 | int __cdecl snwprintf(wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...); |
| 1106 | int __cdecl vsnwprintf(wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg); |
| 1107 | #endif /* __USE_MINGW_ANSI_STDIO */ |
| 1108 | |
| 1109 | #ifndef WEOF |
| 1110 | #define WEOF (wint_t)(0xFFFF) |
| 1111 | #endif |
| 1112 | |
| 1113 | #ifdef _POSIX_ |
| 1114 | _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); |
| 1115 | #else |
| 1116 | _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); |
| 1117 | #endif |
| 1118 | |
| 1119 | wint_t __cdecl fgetwc(FILE *_File); |
| 1120 | _CRTIMP wint_t __cdecl _fgetwchar(void); |
| 1121 | wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); |
| 1122 | _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); |
| 1123 | wint_t __cdecl getwc(FILE *_File); |
| 1124 | wint_t __cdecl getwchar(void); |
| 1125 | wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); |
| 1126 | wint_t __cdecl putwchar(wchar_t _Ch); |
| 1127 | wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); |
| 1128 | wchar_t *__cdecl fgetws(wchar_t * __restrict__ _Dst,int _SizeInWords,FILE * __restrict__ _File); |
| 1129 | int __cdecl fputws(const wchar_t * __restrict__ _Str,FILE * __restrict__ _File); |
| 1130 | _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 1131 | _CRTIMP int __cdecl _putws(const wchar_t *_Str); |
| 1132 | |
| 1133 | _CRTIMP int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...); |
| 1134 | #ifndef _UCRT |
| 1135 | _CRTIMP int __cdecl _swprintf_c(wchar_t * __restrict__ _DstBuf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,...); |
| 1136 | _CRTIMP int __cdecl _vswprintf_c(wchar_t * __restrict__ _DstBuf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,va_list _ArgList); |
| 1137 | #endif /* _UCRT */ |
| 1138 | _CRTIMP int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 1139 | _CRTIMP int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 1140 | _CRTIMP int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); |
| 1141 | _CRTIMP int __cdecl _swprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,...); |
| 1142 | _CRTIMP int __cdecl _vswprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,va_list _Args); |
| 1143 | |
| 1144 | #ifndef RC_INVOKED |
| 1145 | #include <swprintf.inl> |
| 1146 | #endif |
| 1147 | |
| 1148 | #ifdef _CRT_NON_CONFORMING_SWPRINTFS |
| 1149 | #ifndef __cplusplus |
| 1150 | #define _swprintf_l __swprintf_l |
| 1151 | #define _vswprintf_l __vswprintf_l |
| 1152 | #endif |
| 1153 | #endif |
| 1154 | |
| 1155 | #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) |
| 1156 | #pragma push_macro("_wtempnam") |
| 1157 | #undef _wtempnam |
| 1158 | #endif |
| 1159 | _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); |
| 1160 | #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) |
| 1161 | #pragma pop_macro("_wtempnam") |
| 1162 | #endif |
| 1163 | _CRTIMP int __cdecl _snwscanf(const wchar_t * __restrict__ _Src,size_t _MaxCount,const wchar_t * __restrict__ _Format,...); |
| 1164 | _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); |
| 1165 | _CRTIMP FILE *__cdecl _wfopen(const wchar_t * __restrict__ _Filename,const wchar_t *__restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 1166 | _CRTIMP FILE *__cdecl _wfreopen(const wchar_t * __restrict__ _Filename,const wchar_t * __restrict__ _Mode,FILE * __restrict__ _OldFile) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 1167 | |
| 1168 | #ifndef _CRT_WPERROR_DEFINED |
| 1169 | #define _CRT_WPERROR_DEFINED |
| 1170 | _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); |
| 1171 | #endif |
| 1172 | _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); |
| 1173 | #if !defined(NO_OLDNAMES) && !defined(wpopen) |
| 1174 | #define wpopen	_wpopen |
| 1175 | #endif |
| 1176 | |
| 1177 | _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); |
| 1178 | _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); |
| 1179 | #if __MSVCRT_VERSION__ >= 0x800 |
| 1180 | _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); |
| 1181 | _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); |
| 1182 | _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); |
| 1183 | #endif |
| 1184 | |
| 1185 | #undef _CRT_GETPUTWCHAR_NOINLINE |
| 1186 | |
| 1187 | #if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) || defined (__CRT__NO_INLINE) |
| 1188 | #define getwchar() fgetwc(stdin) |
| 1189 | #define putwchar(_c) fputwc((_c),stdout) |
| 1190 | #else |
| 1191 | __CRT_INLINE wint_t __cdecl getwchar() {return (fgetwc(stdin)); } |
| 1192 | __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) {return (fputwc(_C,stdout)); } |
| 1193 | #endif |
| 1194 | |
| 1195 | #define getwc(_stm) fgetwc(_stm) |
| 1196 | #define putwc(_c,_stm) fputwc(_c,_stm) |
| 1197 | #if __MSVCRT_VERSION__ >= 0x800 |
| 1198 | #define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) |
| 1199 | #define _getwc_nolock(_c) _fgetwc_nolock(_c) |
| 1200 | #endif |
| 1201 | #endif |
| 1202 | |
| 1203 | #define _STDIO_DEFINED |
| 1204 | #endif |
| 1205 | |
| 1206 | _CRTIMP int __cdecl _fgetc_nolock(FILE *_File); |
| 1207 | _CRTIMP int __cdecl _fputc_nolock(int _Char, FILE *_File); |
| 1208 | _CRTIMP int __cdecl _getc_nolock(FILE *_File); |
| 1209 | _CRTIMP int __cdecl _putc_nolock(int _Char, FILE *_File); |
| 1210 | #define _getchar_nolock() _getc_nolock(stdin) |
| 1211 | #define _putchar_nolock(_c) _putc_nolock((_c),stdout) |
| 1212 | #define _getwchar_nolock() _getwc_nolock(stdin) |
| 1213 | #define _putwchar_nolock(_c) _putwc_nolock((_c),stdout) |
| 1214 | |
| 1215 | _CRTIMP void __cdecl _lock_file(FILE *_File); |
| 1216 | _CRTIMP void __cdecl _unlock_file(FILE *_File); |
| 1217 | #if __MSVCRT_VERSION__ >= 0x800 |
| 1218 | _CRTIMP int __cdecl _fclose_nolock(FILE *_File); |
| 1219 | _CRTIMP int __cdecl _fflush_nolock(FILE *_File); |
| 1220 | _CRTIMP size_t __cdecl _fread_nolock(void * __restrict__ _DstBuf,size_t _ElementSize,size_t _Count,FILE * __restrict__ _File); |
| 1221 | _CRTIMP int __cdecl _fseek_nolock(FILE *_File,long _Offset,int _Origin); |
| 1222 | _CRTIMP long __cdecl _ftell_nolock(FILE *_File); |
| 1223 | __MINGW_EXTENSION _CRTIMP int __cdecl _fseeki64_nolock(FILE *_File,__int64 _Offset,int _Origin); |
| 1224 | __MINGW_EXTENSION _CRTIMP __int64 __cdecl _ftelli64_nolock(FILE *_File); |
| 1225 | _CRTIMP size_t __cdecl _fwrite_nolock(const void * __restrict__ _DstBuf,size_t _Size,size_t _Count,FILE * __restrict__ _File); |
| 1226 | _CRTIMP int __cdecl _ungetc_nolock(int _Ch,FILE *_File); |
| 1227 | #endif |
| 1228 | |
| 1229 | #if !defined(NO_OLDNAMES) || !defined(_POSIX) |
| 1230 | #define P_tmpdir _P_tmpdir |
| 1231 | #define SYS_OPEN _SYS_OPEN |
| 1232 | |
| 1233 | #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) |
| 1234 | #pragma push_macro("tempnam") |
| 1235 | #undef tempnam |
| 1236 | #endif |
| 1237 | char *__cdecl tempnam(const char *_Directory,const char *_FilePrefix) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1238 | #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) |
| 1239 | #pragma pop_macro("tempnam") |
| 1240 | #endif |
| 1241 | int __cdecl fcloseall(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1242 | FILE *__cdecl fdopen(int _FileHandle,const char *_Format) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1243 | int __cdecl fgetchar(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1244 | int __cdecl fileno(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1245 | int __cdecl flushall(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1246 | int __cdecl fputchar(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1247 | int __cdecl getw(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1248 | int __cdecl putw(int _Ch,FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1249 | int __cdecl rmtmp(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 1250 | #endif |
| 1251 | |
| 1252 | #ifndef __MINGW_MBWC_CONVERT_DEFINED |
| 1253 | #define __MINGW_MBWC_CONVERT_DEFINED |
| 1254 | |
| 1255 | /** |
| 1256 | * __mingw_str_wide_utf8 |
| 1257 | * Converts a null terminated UCS-2 string to a multibyte (UTF-8) equivalent. |
| 1258 | * Caller is supposed to free allocated buffer with __mingw_str_free(). |
| 1259 | * @param[in] wptr Pointer to wide string. |
| 1260 | * @param[out] mbptr Pointer to multibyte string. |
| 1261 | * @param[out] buflen Optional parameter for length of allocated buffer. |
| 1262 | * @return Number of characters converted, 0 for failure. |
| 1263 | * |
| 1264 | * WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx |
| 1265 | */ |
| 1266 | int __cdecl __mingw_str_wide_utf8 (const wchar_t * const wptr, char **mbptr, size_t * buflen); |
| 1267 | |
| 1268 | /** |
| 1269 | * __mingw_str_utf8_wide |
| 1270 | * Converts a null terminated UTF-8 string to a UCS-2 equivalent. |
| 1271 | * Caller is supposed to free allocated buffer with __mingw_str_free(). |
| 1272 | * @param[out] mbptr Pointer to multibyte string. |
| 1273 | * @param[in] wptr Pointer to wide string. |
| 1274 | * @param[out] buflen Optional parameter for length of allocated buffer. |
| 1275 | * @return Number of characters converted, 0 for failure. |
| 1276 | * |
| 1277 | * MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx |
| 1278 | */ |
| 1279 | |
| 1280 | int __cdecl __mingw_str_utf8_wide (const char *const mbptr, wchar_t ** wptr, size_t * buflen); |
| 1281 | |
| 1282 | /** |
| 1283 | * __mingw_str_free |
| 1284 | * Frees buffer create by __mingw_str_wide_utf8 and __mingw_str_utf8_wide. |
| 1285 | * @param[in] ptr memory block to free. |
| 1286 | * |
| 1287 | */ |
| 1288 | |
| 1289 | void __cdecl __mingw_str_free(void *ptr); |
| 1290 | |
| 1291 | #endif /* __MINGW_MBWC_CONVERT_DEFINED */ |
| 1292 | |
| 1293 | #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP |
| 1294 | #ifndef _WSPAWN_DEFINED |
| 1295 | #define _WSPAWN_DEFINED |
| 1296 | _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); |
| 1297 | _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); |
| 1298 | _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); |
| 1299 | _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); |
| 1300 | _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); |
| 1301 | _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); |
| 1302 | _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); |
| 1303 | _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); |
| 1304 | #endif |
| 1305 | |
| 1306 | #ifndef _P_WAIT |
| 1307 | #define _P_WAIT 0 |
| 1308 | #define _P_NOWAIT 1 |
| 1309 | #define _OLD_P_OVERLAY 2 |
| 1310 | #define _P_NOWAITO 3 |
| 1311 | #define _P_DETACH 4 |
| 1312 | #define _P_OVERLAY 2 |
| 1313 | |
| 1314 | #define _WAIT_CHILD 0 |
| 1315 | #define _WAIT_GRANDCHILD 1 |
| 1316 | #endif |
| 1317 | |
| 1318 | #ifndef _SPAWNV_DEFINED |
| 1319 | #define _SPAWNV_DEFINED |
| 1320 | _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList); |
| 1321 | _CRTIMP intptr_t __cdecl _spawnve(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); |
| 1322 | _CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const char *const *_ArgList); |
| 1323 | _CRTIMP intptr_t __cdecl _spawnvpe(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); |
| 1324 | #endif |
| 1325 | #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ |
| 1326 | |
| 1327 | #ifdef __cplusplus |
| 1328 | } |
| 1329 | #endif |
| 1330 | |
| 1331 | #pragma pop_macro("snprintf") |
| 1332 | #pragma pop_macro("vsnprintf") |
| 1333 | #pragma pop_macro("snwprintf") |
| 1334 | #pragma pop_macro("vsnwprintf") |
| 1335 | |
| 1336 | #pragma pack(pop) |
| 1337 | |
| 1338 | #include <sec_api/stdio_s.h> |
| 1339 | |
| 1340 | #endif |