stdio.h (59961B) - Raw
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 *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 int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos); 579 int __cdecl fsetpos64(FILE *_File,const fpos_t *_Pos); /* fsetpos already 64bit */ 580 int __cdecl fseek(FILE *_File,long _Offset,int _Origin); 581 long __cdecl ftell(FILE *_File); 582 583 /* Shouldn't be any fseeko32 in glibc, 32bit to 64bit casting should be fine */ 584 /* int fseeko32(FILE* stream, _off_t offset, int whence);*/ /* fseeko32 redirects to fseeko64 */ 585 _CRTIMP int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin); 586 _CRTIMP __int64 __cdecl _ftelli64(FILE *_File); 587 #ifdef _UCRT 588 __mingw_ovr int fseeko(FILE *_File, _off_t _Offset, int _Origin) { 589 return fseek(_File, _Offset, _Origin); 590 } 591 __mingw_ovr int fseeko64(FILE *_File, _off64_t _Offset, int _Origin) { 592 return _fseeki64(_File, _Offset, _Origin); 593 } 594 __mingw_ovr _off_t ftello(FILE *_File) { 595 return ftell(_File); 596 } 597 __mingw_ovr _off64_t ftello64(FILE *_File) { 598 return _ftelli64(_File); 599 } 600 #else 601 int fseeko64(FILE* stream, _off64_t offset, int whence); 602 int fseeko(FILE* stream, _off_t offset, int whence); 603 /* Returns truncated 64bit off_t */ 604 _off_t ftello(FILE * stream); 605 _off64_t ftello64(FILE * stream); 606 #endif 607 608 #ifndef _FILE_OFFSET_BITS_SET_FSEEKO 609 #define _FILE_OFFSET_BITS_SET_FSEEKO 610 #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) 611 #define fseeko fseeko64 612 #endif /* (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ 613 #endif /* _FILE_OFFSET_BITS_SET_FSEEKO */ 614 615 #ifndef _FILE_OFFSET_BITS_SET_FTELLO 616 #define _FILE_OFFSET_BITS_SET_FTELLO 617 #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) 618 #define ftello ftello64 619 #endif /* (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ 620 #endif /* _FILE_OFFSET_BITS_SET_FTELLO */ 621 622 size_t __cdecl fwrite(const void * __restrict__ _Str,size_t _Size,size_t _Count,FILE * __restrict__ _File); 623 int __cdecl getc(FILE *_File); 624 int __cdecl getchar(void); 625 _CRTIMP int __cdecl _getmaxstdio(void); 626 char *__cdecl gets(char *_Buffer) 627 __attribute__((__warning__("Using gets() is always unsafe - use fgets() instead"))); 628 int __cdecl _getw(FILE *_File); 629 #ifndef _CRT_PERROR_DEFINED 630 #define _CRT_PERROR_DEFINED 631 void __cdecl perror(const char *_ErrMsg); 632 #endif 633 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP 634 _CRTIMP int __cdecl _pclose(FILE *_File); 635 _CRTIMP FILE *__cdecl _popen(const char *_Command,const char *_Mode); 636 #if !defined(NO_OLDNAMES) && !defined(popen) 637 #define popen _popen 638 #define pclose _pclose 639 #endif 640 #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ 641 int __cdecl putc(int _Ch,FILE *_File); 642 int __cdecl putchar(int _Ch); 643 int __cdecl puts(const char *_Str); 644 _CRTIMP int __cdecl _putw(int _Word,FILE *_File); 645 #ifndef _CRT_DIRECTORY_DEFINED 646 #define _CRT_DIRECTORY_DEFINED 647 int __cdecl remove(const char *_Filename); 648 int __cdecl rename(const char *_OldFilename,const char *_NewFilename); 649 _CRTIMP int __cdecl _unlink(const char *_Filename); 650 #ifndef NO_OLDNAMES 651 int __cdecl unlink(const char *_Filename) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 652 #endif 653 #endif 654 void __cdecl rewind(FILE *_File); 655 _CRTIMP int __cdecl _rmtmp(void); 656 void __cdecl setbuf(FILE * __restrict__ _File,char * __restrict__ _Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 657 _CRTIMP int __cdecl _setmaxstdio(int _Max); 658 _CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format); 659 _CRTIMP unsigned int __cdecl _get_output_format(void); 660 int __cdecl setvbuf(FILE * __restrict__ _File,char * __restrict__ _Buf,int _Mode,size_t _Size); 661 #ifdef _UCRT 662 __MINGW_ATTRIB_PURE 663 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 1, 2))) __MINGW_ATTRIB_NONNULL(1) 664 int __cdecl _scprintf(const char * __restrict__ _Format,...); 665 __attribute__((__format__ (__MINGW_SCANF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3) 666 int __cdecl _snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 667 #else 668 __MINGW_ATTRIB_PURE 669 __MINGW_MS_PRINTF(1, 2) __MINGW_ATTRIB_NONNULL(1) 670 _CRTIMP int __cdecl _scprintf(const char * __restrict__ _Format,...); 671 __MINGW_MS_SCANF(3, 4) __MINGW_ATTRIB_NONNULL(3) 672 _CRTIMP int __cdecl _snscanf(const char * __restrict__ _Src,size_t _MaxCount,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 673 #endif 674 __MINGW_ATTRIB_PURE 675 __MINGW_MS_PRINTF(1, 0) __MINGW_ATTRIB_NONNULL(1) 676 _CRTIMP int __cdecl _vscprintf(const char * __restrict__ _Format,va_list _ArgList); 677 FILE *__cdecl tmpfile(void) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 678 char *__cdecl tmpnam(char *_Buffer); 679 int __cdecl ungetc(int _Ch,FILE *_File); 680 681 #ifdef _UCRT 682 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 0))) __MINGW_ATTRIB_NONNULL(3) 683 int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 684 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3) 685 int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 686 #else 687 __MINGW_MS_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) 688 _CRTIMP int __cdecl _snprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 689 __MINGW_MS_PRINTF(3, 0) __MINGW_ATTRIB_NONNULL(3) 690 _CRTIMP int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t _Count,const char * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 691 #endif 692 693 #if __MINGW_FORTIFY_LEVEL > 0 694 695 char * __cdecl __gets_chk(char *, size_t); 696 char * __cdecl __mingw_call_gets_warn(char *) __MINGW_ASM_CALL(gets) 697 __attribute__((__warning__("Using gets() is always unsafe - use fgets() instead"))); 698 char * __cdecl __mingw_call_fgets(char * __restrict__, int, FILE * __restrict__) __MINGW_ASM_CALL(fgets); 699 size_t __cdecl __mingw_call_fread(void * __restrict__, size_t, size_t, FILE * __restrict__) __MINGW_ASM_CALL(fread); 700 char * __cdecl __mingw_call_tmpnam(char *) __MINGW_ASM_CALL(tmpnam); 701 702 __mingw_bos_extern_ovr 703 char * gets(char * __dst) 704 { 705 if (__mingw_bos_known(__dst)) 706 return __gets_chk(__dst, __mingw_bos(__dst, 1)); 707 return __mingw_call_gets_warn(__dst); 708 } 709 710 __mingw_bos_extern_ovr 711 char * fgets(char * __restrict__ __dst, int __n, FILE * __restrict__ __f) 712 { 713 __mingw_bos_ptr_chk_warn(__dst, __n, 1); 714 return __mingw_call_fgets(__dst, __n, __f); 715 } 716 717 __mingw_bos_extern_ovr 718 size_t fread(void * __restrict__ __dst, size_t __sz, size_t __n, FILE * __restrict__ __f) 719 { 720 __mingw_bos_ptr_chk_warn(__dst, __sz * __n, 0); 721 return __mingw_call_fread(__dst, __sz, __n, __f); 722 } 723 724 __mingw_bos_extern_ovr 725 char * tmpnam(char * __dst) 726 { 727 __mingw_bos_ptr_chk_warn(__dst, L_tmpnam, 1); 728 return __mingw_call_tmpnam(__dst); 729 } 730 731 #endif /* __MINGW_FORTIFY_LEVEL > 0 */ 732 733 #if __USE_MINGW_ANSI_STDIO == 0 734 735 #ifdef _UCRT 736 #ifdef __GNUC__ 737 #pragma GCC diagnostic push 738 #pragma GCC diagnostic ignored "-Wshadow" 739 #endif 740 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 0))) __MINGW_ATTRIB_NONNULL(3) 741 int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv); 742 743 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3) 744 int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...); 745 746 #if __MINGW_FORTIFY_LEVEL > 0 747 748 int __cdecl __mingw_call_vsprintf (char * __restrict__ __stream, const char * __restrict__ __format, va_list __local_argv) __MINGW_ASM_CALL(vsprintf); 749 int __cdecl __mingw_call_vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv) __MINGW_ASM_CALL(vsnprintf); 750 751 __mingw_bos_extern_ovr 752 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 0))) __MINGW_ATTRIB_NONNULL(3) 753 int vsprintf (char * __restrict__ __stream, const char * __restrict__ __format, va_list __local_argv) 754 { 755 if (__mingw_bos_known(__stream)) { 756 int __retval = __mingw_call_vsnprintf (__stream, __mingw_bos(__stream, 1), __format, __local_argv); 757 if (__retval >= 0) 758 __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); 759 return __retval; 760 } 761 return __mingw_call_vsprintf(__stream, __format, __local_argv); 762 } 763 764 __mingw_bos_extern_ovr 765 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 0))) __MINGW_ATTRIB_NONNULL(3) 766 int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv) 767 { 768 __mingw_bos_ptr_chk_warn(__stream, __n, 1); 769 return __mingw_call_vsnprintf (__stream, __n, __format, __local_argv); 770 } 771 772 #endif /* __MINGW_FORTIFY_LEVEL > 0 */ 773 774 #if __MINGW_FORTIFY_VA_ARG 775 776 int __cdecl __mingw_call_sprintf (char * __restrict__ __stream, const char * __restrict__ __Format, ...) __MINGW_ASM_CALL(sprintf); 777 int __cdecl __mingw_call_snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) __MINGW_ASM_CALL(snprintf); 778 779 __mingw_bos_extern_ovr 780 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 2, 3))) __MINGW_ATTRIB_NONNULL(2) 781 int sprintf (char * __restrict__ __stream, const char * __restrict__ __format, ...) 782 { 783 if (__mingw_bos_known(__stream)) { 784 int __retval = __mingw_call_snprintf (__stream, __mingw_bos(__stream, 1), __format, __builtin_va_arg_pack()); 785 if (__retval >= 0) 786 __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); 787 return __retval; 788 } 789 return __mingw_call_sprintf (__stream, __format, __builtin_va_arg_pack()); 790 } 791 792 __mingw_bos_extern_ovr 793 __attribute__((__format__ (__MINGW_PRINTF_FORMAT, 3, 4))) __MINGW_ATTRIB_NONNULL(3) 794 int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) 795 { 796 __mingw_bos_ptr_chk_warn(__stream, __n, 1); 797 return __mingw_call_snprintf (__stream, __n, __format, __builtin_va_arg_pack()); 798 } 799 800 #endif /* __MINGW_FORTIFY_VA_ARG */ 801 802 #ifdef __GNUC__ 803 #pragma GCC diagnostic pop 804 #endif 805 #else /* !_UCRT */ 806 807 /* this is here to deal with software defining 808 * vsnprintf as _vsnprintf, eg. libxml2. */ 809 810 #ifdef __GNUC__ 811 #pragma GCC diagnostic push 812 #pragma GCC diagnostic ignored "-Wshadow" 813 #endif 814 815 __mingw_bos_ovr 816 __MINGW_MS_PRINTF(3, 0) __MINGW_ATTRIB_NONNULL(3) 817 int vsnprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, va_list __local_argv) 818 { 819 #if __MINGW_FORTIFY_LEVEL > 0 820 __mingw_bos_ptr_chk_warn(__stream, __n, 1); 821 #endif 822 if (__builtin_constant_p(__n) && __n == 0) 823 return _vscprintf(__format, __local_argv); 824 return __ms_vsnprintf (__stream, __n, __format, __local_argv); 825 } 826 827 #ifndef __NO_ISOCEXT 828 #if __MINGW_FORTIFY_VA_ARG 829 830 int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) __MINGW_ASM_CALL(__ms_snprintf); 831 832 __mingw_bos_extern_ovr 833 __MINGW_MS_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) 834 int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) 835 { 836 __mingw_bos_ptr_chk_warn(__stream, __n, 1); 837 if (__builtin_constant_p(__n) && __n == 0) 838 return _scprintf(__format, __builtin_va_arg_pack()); 839 return __ms_snprintf(__stream, __n, __format, __builtin_va_arg_pack()); 840 } 841 842 #else /* !__MINGW_FORTIFY_VA_ARG */ 843 844 __mingw_ovr 845 __MINGW_MS_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) 846 int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...) 847 { 848 int __retval; 849 __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format ); 850 if (__builtin_constant_p(__n) && __n == 0) 851 __retval = _vscprintf(__format, __local_argv); 852 else 853 __retval = __ms_vsnprintf (__stream, __n, __format, __local_argv); 854 __builtin_va_end( __local_argv ); 855 return __retval; 856 } 857 858 #endif /* !__MINGW_FORTIFY_VA_ARG */ 859 #endif /* !__NO_ISOCEXT */ 860 861 #if __MINGW_FORTIFY_VA_ARG 862 863 int __cdecl __mingw_call_ms_sprintf(char * __restrict__, const char * __restrict__, ...) __MINGW_ASM_CALL(sprintf); 864 865 __mingw_bos_extern_ovr 866 __MINGW_MS_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) 867 int sprintf (char * __restrict__ __stream, const char * __restrict__ __format, ...) 868 { 869 if (__mingw_bos_known(__stream)) { 870 int __retval = __ms_snprintf( __stream, __mingw_bos(__stream, 1), __format, __builtin_va_arg_pack() ); 871 if (__retval >= 0) 872 __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); 873 return __retval; 874 } 875 return __mingw_call_ms_sprintf( __stream, __format, __builtin_va_arg_pack() ); 876 } 877 878 #endif /* __MINGW_FORTIFY_VA_ARG */ 879 880 #if __MINGW_FORTIFY_LEVEL > 0 881 882 int __cdecl __mingw_call_ms_vsprintf(char * __restrict__, const char * __restrict__, va_list) __MINGW_ASM_CALL(vsprintf); 883 884 __mingw_bos_extern_ovr 885 __MINGW_MS_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) 886 int vsprintf (char * __restrict__ __stream, const char * __restrict__ __format, va_list __local_argv) 887 { 888 if (__mingw_bos_known(__stream)) { 889 int __retval = __ms_vsnprintf( __stream, __mingw_bos(__stream, 1), __format, __local_argv ); 890 if (__retval >= 0) 891 __mingw_bos_ptr_chk(__stream, (size_t)__retval + 1, 1); 892 return __retval; 893 } 894 return __mingw_call_ms_vsprintf( __stream, __format, __local_argv ); 895 } 896 897 #endif /* __MINGW_FORTIFY_LEVEL > 0 */ 898 899 #ifdef __GNUC__ 900 #pragma GCC diagnostic pop 901 #endif 902 #endif /* _UCRT */ 903 #endif /* __USE_MINGW_ANSI_STDIO */ 904 905 _CRTIMP int __cdecl _set_printf_count_output(int _Value); 906 _CRTIMP int __cdecl _get_printf_count_output(void); 907 908 #ifndef _WSTDIO_DEFINED 909 #define _WSTDIO_DEFINED 910 911 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) 912 int __cdecl __mingw_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...); 913 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) 914 int __cdecl __mingw_vswscanf (const wchar_t * __restrict__ _Str,const wchar_t * __restrict__ Format,va_list argp); 915 /* __attribute__((__format__ (gnu_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) 916 int __cdecl __mingw_wscanf(const wchar_t * __restrict__ _Format,...); 917 /* __attribute__((__format__ (gnu_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) 918 int __cdecl __mingw_vwscanf(const wchar_t * __restrict__ Format, va_list argp); 919 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) 920 int __cdecl __mingw_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); 921 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) 922 int __cdecl __mingw_vfwscanf (FILE * __restrict__ fp, const wchar_t * __restrict__ Format,va_list argp); 923 924 /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) 925 int __cdecl __mingw_fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); 926 /* __attribute__((__format__ (gnu_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) 927 int __cdecl __mingw_wprintf(const wchar_t * __restrict__ _Format,...); 928 /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */__MINGW_ATTRIB_NONNULL(2) 929 int __cdecl __mingw_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList); 930 /*__attribute__((__format__ (gnu_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) 931 int __cdecl __mingw_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); 932 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) 933 int __cdecl __mingw_snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...); 934 /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) 935 int __cdecl __mingw_vsnwprintf (wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list); 936 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) 937 int __cdecl __mingw_swprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...); 938 /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) 939 int __cdecl __mingw_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list); 940 941 /* __attribute__((__format__ (ms_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) 942 int __cdecl __ms_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) 943 __MINGW_UCRT_ASM_CALL(swscanf); 944 /* __attribute__((__format__ (ms_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) 945 int __cdecl __ms_vswscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,va_list) 946 __MINGW_ASM_CALL(vswscanf); 947 /* __attribute__((__format__ (ms_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) 948 int __cdecl __ms_wscanf(const wchar_t * __restrict__ _Format,...) 949 __MINGW_UCRT_ASM_CALL(wscanf); 950 /* __attribute__((__format__ (ms_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) 951 int __cdecl __ms_vwscanf(const wchar_t * __restrict__ _Format, va_list) 952 __MINGW_ASM_CALL(vwscanf); 953 /* __attribute__((__format__ (ms_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) 954 int __cdecl __ms_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) 955 __MINGW_UCRT_ASM_CALL(fwscanf); 956 /* __attribute__((__format__ (ms_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) 957 int __cdecl __ms_vfwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list) 958 __MINGW_ASM_CALL(vfwscanf); 959 960 /* __attribute__((__format__ (ms_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) 961 int __cdecl __ms_fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); 962 /* No __MINGW_UCRT_ASM_CALL for __ms_fwprintf; this is provided as an 963 * actual function in the ucrt import libraries. */ 964 /* __attribute__((__format__ (ms_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) 965 int __cdecl __ms_wprintf(const wchar_t * __restrict__ _Format,...) 966 __MINGW_UCRT_ASM_CALL(wprintf); 967 /* __attribute__((__format__ (ms_wprintf, 2, 0))) */__MINGW_ATTRIB_NONNULL(2) 968 int __cdecl __ms_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList) 969 __MINGW_UCRT_ASM_CALL(vfwprintf); 970 /*__attribute__((__format__ (ms_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) 971 int __cdecl __ms_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList) 972 __MINGW_UCRT_ASM_CALL(vwprintf); 973 /* __attribute__((__format__ (ms_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) 974 int __cdecl __ms_swprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...) 975 __MINGW_UCRT_ASM_CALL(swprintf); 976 /* __attribute__((__format__ (ms_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) 977 int __cdecl __ms_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list) 978 __MINGW_UCRT_ASM_CALL(vswprintf); 979 /* __attribute__((__format__ (ms_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) 980 int __cdecl __ms_snwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...) 981 __MINGW_UCRT_ASM_CALL(snwprintf); 982 /* __attribute__((__format__ (ms_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) 983 int __cdecl __ms_vsnwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list) 984 __MINGW_UCRT_ASM_CALL(vsnwprintf); 985 986 #ifdef _UCRT 987 int __cdecl __stdio_common_vswprintf(unsigned __int64 options, wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist); 988 int __cdecl __stdio_common_vfwprintf(unsigned __int64 options, FILE *file, const wchar_t *format, _locale_t locale, va_list valist); 989 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); 990 int __cdecl __stdio_common_vfwscanf(unsigned __int64 options, FILE *file, const wchar_t *format, _locale_t locale, va_list valist); 991 #endif 992 993 #if __USE_MINGW_ANSI_STDIO && !defined(_CRTBLD) 994 /* 995 * User has expressed a preference for C99 conformance... 996 */ 997 998 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) 999 int swscanf(const wchar_t *__source, const wchar_t *__format, ...) 1000 __MINGW_ASM_CALL(__mingw_swscanf); 1001 1002 /* __attribute__((__format__ (gnu_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) 1003 int wscanf(const wchar_t *__format, ...) 1004 __MINGW_ASM_CALL(__mingw_wscanf); 1005 1006 /* __attribute__((__format__ (gnu_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) 1007 int fwscanf(FILE *__stream, const wchar_t *__format, ...) 1008 __MINGW_ASM_CALL(__mingw_fwscanf); 1009 1010 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ 1011 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) 1012 int vswscanf (const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, __builtin_va_list __local_argv) 1013 __MINGW_ASM_CALL(__mingw_vswscanf); 1014 1015 /* __attribute__((__format__ (gnu_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) 1016 int vwscanf(const wchar_t *__format, __builtin_va_list __local_argv) 1017 __MINGW_ASM_CALL(__mingw_vwscanf); 1018 1019 /* __attribute__((__format__ (gnu_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) 1020 int vfwscanf (FILE *__stream, const wchar_t *__format, __builtin_va_list __local_argv) 1021 __MINGW_ASM_CALL(__mingw_vfwscanf); 1022 #endif /* __NO_ISOCEXT */ 1023 1024 1025 1026 /* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) 1027 int fwprintf (FILE *__stream, const wchar_t *__format, ...) 1028 __MINGW_ASM_CALL(__mingw_fwprintf); 1029 1030 /* __attribute__((__format__ (gnu_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) 1031 int wprintf (const wchar_t *__format, ...) 1032 __MINGW_ASM_CALL(__mingw_wprintf); 1033 1034 /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) 1035 int vfwprintf (FILE *__stream, const wchar_t *__format, __builtin_va_list __local_argv) 1036 __MINGW_ASM_CALL(__mingw_vfwprintf); 1037 1038 /* __attribute__((__format__ (gnu_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) 1039 int vwprintf (const wchar_t *__format, __builtin_va_list __local_argv) 1040 __MINGW_ASM_CALL(__mingw_vwprintf); 1041 1042 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) 1043 int swprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...) 1044 __MINGW_ASM_CALL(__mingw_swprintf); 1045 1046 #if __MINGW_FORTIFY_VA_ARG 1047 1048 __mingw_bos_extern_ovr 1049 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) 1050 int swprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...) 1051 { 1052 __mingw_bos_ptr_chk_warn(__stream, __n * sizeof(wchar_t), 1); 1053 return __mingw_swprintf( __stream, __n, __format, __builtin_va_arg_pack() ); 1054 } 1055 1056 #endif /* __MINGW_FORTIFY_VA_ARG */ 1057 1058 __mingw_bos_ovr 1059 /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) 1060 int vswprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builtin_va_list __local_argv) 1061 { 1062 #if __MINGW_FORTIFY_LEVEL > 0 1063 __mingw_bos_ptr_chk_warn(__stream, __n * sizeof(wchar_t), 1); 1064 #endif 1065 return __mingw_vswprintf( __stream, __n, __format, __local_argv ); 1066 } 1067 1068 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ 1069 1070 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) 1071 int snwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...) 1072 __MINGW_ASM_CALL(__mingw_snwprintf); 1073 1074 #if __MINGW_FORTIFY_VA_ARG 1075 1076 __mingw_bos_extern_ovr 1077 /* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) 1078 int snwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, ...) 1079 { 1080 __mingw_bos_ptr_chk_warn(__stream, __n * sizeof(wchar_t), 1); 1081 return __mingw_snwprintf( __stream, __n, __format, __builtin_va_arg_pack() ); 1082 } 1083 1084 #endif /* __MINGW_FORTIFY_VA_ARG */ 1085 1086 __mingw_bos_ovr 1087 /* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) 1088 int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builtin_va_list __local_argv) 1089 { 1090 #if __MINGW_FORTIFY_LEVEL > 0 1091 __mingw_bos_ptr_chk_warn(__stream, __n * sizeof(wchar_t), 1); 1092 #endif 1093 return __mingw_vsnwprintf( __stream, __n, __format, __local_argv ); 1094 } 1095 1096 #endif /* __NO_ISOCEXT */ 1097 1098 #else /* !__USE_MINGW_ANSI_STDIO */ 1099 1100 #ifdef _UCRT 1101 __MINGW_ATTRIB_DEPRECATED_SEC_WARN 1102 int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); 1103 __MINGW_ATTRIB_DEPRECATED_SEC_WARN 1104 int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...); 1105 __MINGW_ATTRIB_DEPRECATED_SEC_WARN 1106 int __cdecl wscanf(const wchar_t * __restrict__ _Format,...); 1107 __MINGW_ATTRIB_NONNULL(2) 1108 int vfwscanf (FILE *__stream, const wchar_t *__format, va_list __local_argv); 1109 1110 __MINGW_ATTRIB_NONNULL(2) 1111 int vswscanf (const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, va_list __local_argv); 1112 __MINGW_ATTRIB_NONNULL(1) 1113 int vwscanf(const wchar_t *__format, va_list __local_argv); 1114 1115 int __cdecl fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); 1116 int __cdecl wprintf(const wchar_t * __restrict__ _Format,...); 1117 int __cdecl vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList); 1118 int __cdecl vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); 1119 #else 1120 1121 int __cdecl fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1122 int __cdecl swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1123 int __cdecl wscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1124 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ 1125 __MINGW_ATTRIB_NONNULL(2) 1126 int vfwscanf (FILE *__stream, const wchar_t *__format, __builtin_va_list __local_argv); 1127 1128 __MINGW_ATTRIB_NONNULL(2) 1129 int vswscanf (const wchar_t * __restrict__ __source, const wchar_t * __restrict__ __format, __builtin_va_list __local_argv); 1130 1131 __MINGW_ATTRIB_NONNULL(1) 1132 int vwscanf(const wchar_t *__format, __builtin_va_list __local_argv); 1133 1134 #endif /* __NO_ISOCEXT */ 1135 1136 int __cdecl fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); 1137 int __cdecl wprintf(const wchar_t * __restrict__ _Format,...); 1138 int __cdecl vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList); 1139 int __cdecl vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); 1140 #endif /* _UCRT */ 1141 #endif /* __USE_MINGW_ANSI_STDIO */ 1142 1143 #ifndef WEOF 1144 #define WEOF (wint_t)(0xFFFF) 1145 #endif 1146 1147 #ifdef _POSIX_ 1148 _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); 1149 #else 1150 _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); 1151 #endif 1152 1153 wint_t __cdecl fgetwc(FILE *_File); 1154 _CRTIMP wint_t __cdecl _fgetwchar(void); 1155 wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); 1156 _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); 1157 wint_t __cdecl getwc(FILE *_File); 1158 wint_t __cdecl getwchar(void); 1159 wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); 1160 wint_t __cdecl putwchar(wchar_t _Ch); 1161 wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); 1162 wchar_t *__cdecl fgetws(wchar_t * __restrict__ _Dst,int _SizeInWords,FILE * __restrict__ _File); 1163 int __cdecl fputws(const wchar_t * __restrict__ _Str,FILE * __restrict__ _File); 1164 _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1165 _CRTIMP int __cdecl _putws(const wchar_t *_Str); 1166 1167 #ifdef _UCRT 1168 __mingw_ovr 1169 int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...) 1170 { 1171 __builtin_va_list __ap; 1172 int __ret; 1173 __builtin_va_start(__ap, _Format); 1174 __ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, NULL, __ap); 1175 __builtin_va_end(__ap); 1176 return __ret; 1177 } 1178 int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1179 int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1180 1181 #if __USE_MINGW_ANSI_STDIO == 0 1182 int __cdecl swprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...); 1183 int __cdecl vswprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args); 1184 1185 int __cdecl snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...); 1186 int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg); 1187 #endif 1188 1189 __mingw_ovr 1190 int __cdecl _swprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,...) 1191 { 1192 __builtin_va_list __ap; 1193 int __ret; 1194 __builtin_va_start(__ap, _Format); 1195 __ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Dest, (size_t)-1, _Format, NULL, __ap); 1196 __builtin_va_end(__ap); 1197 return __ret; 1198 } 1199 __mingw_ovr 1200 int __cdecl _vswprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,va_list _Args) 1201 { 1202 return __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Dest, (size_t)-1, _Format, NULL, _Args); 1203 } 1204 1205 __mingw_ovr 1206 int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format, va_list _ArgList) 1207 { 1208 int _Result = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, NULL, _ArgList); 1209 return _Result < 0 ? -1 : _Result; 1210 } 1211 #else 1212 _CRTIMP int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...); 1213 _CRTIMP int __cdecl _swprintf_c(wchar_t * __restrict__ _DstBuf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,...); 1214 _CRTIMP int __cdecl _vswprintf_c(wchar_t * __restrict__ _DstBuf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,va_list _ArgList); 1215 _CRTIMP int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1216 _CRTIMP int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1217 _CRTIMP int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); 1218 1219 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ 1220 1221 #if __USE_MINGW_ANSI_STDIO == 0 1222 int __cdecl snwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...) __MINGW_ASM_CALL(__ms_snwprintf); 1223 int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg) __MINGW_ASM_CALL(__ms_vsnwprintf); 1224 #endif 1225 1226 #endif /* ! __NO_ISOCEXT */ 1227 _CRTIMP int __cdecl _swprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,...); 1228 _CRTIMP int __cdecl _vswprintf(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Format,va_list _Args); 1229 1230 int __cdecl swprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...); 1231 int __cdecl vswprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args); 1232 #endif /* _UCRT */ 1233 1234 #ifndef RC_INVOKED 1235 #include <swprintf.inl> 1236 #endif 1237 1238 #ifdef _CRT_NON_CONFORMING_SWPRINTFS 1239 #ifndef __cplusplus 1240 #define _swprintf_l __swprintf_l 1241 #define _vswprintf_l __vswprintf_l 1242 #endif 1243 #endif 1244 1245 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) 1246 #pragma push_macro("_wtempnam") 1247 #undef _wtempnam 1248 #endif 1249 _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); 1250 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) 1251 #pragma pop_macro("_wtempnam") 1252 #endif 1253 _CRTIMP int __cdecl _snwscanf(const wchar_t * __restrict__ _Src,size_t _MaxCount,const wchar_t * __restrict__ _Format,...); 1254 _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); 1255 _CRTIMP FILE *__cdecl _wfopen(const wchar_t * __restrict__ _Filename,const wchar_t *__restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1256 _CRTIMP FILE *__cdecl _wfreopen(const wchar_t * __restrict__ _Filename,const wchar_t * __restrict__ _Mode,FILE * __restrict__ _OldFile) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; 1257 1258 #ifndef _CRT_WPERROR_DEFINED 1259 #define _CRT_WPERROR_DEFINED 1260 _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); 1261 #endif 1262 _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); 1263 #if !defined(NO_OLDNAMES) && !defined(wpopen) 1264 #define wpopen _wpopen 1265 #endif 1266 1267 _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); 1268 _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); 1269 #if __MSVCRT_VERSION__ >= 0x800 1270 _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); 1271 _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); 1272 _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); 1273 #endif 1274 1275 #undef _CRT_GETPUTWCHAR_NOINLINE 1276 1277 #if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) || defined (__CRT__NO_INLINE) 1278 #define getwchar() fgetwc(stdin) 1279 #define putwchar(_c) fputwc((_c),stdout) 1280 #else 1281 __CRT_INLINE wint_t __cdecl getwchar() {return (fgetwc(stdin)); } 1282 __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) {return (fputwc(_C,stdout)); } 1283 #endif 1284 1285 #define getwc(_stm) fgetwc(_stm) 1286 #define putwc(_c,_stm) fputwc(_c,_stm) 1287 #if __MSVCRT_VERSION__ >= 0x800 1288 #define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) 1289 #define _getwc_nolock(_c) _fgetwc_nolock(_c) 1290 #endif 1291 #endif 1292 1293 #define _STDIO_DEFINED 1294 #endif 1295 1296 #ifdef _UCRT 1297 _CRTIMP int __cdecl _fgetc_nolock(FILE *_File); 1298 _CRTIMP int __cdecl _fputc_nolock(int _Char, FILE *_File); 1299 _CRTIMP int __cdecl _getc_nolock(FILE *_File); 1300 _CRTIMP int __cdecl _putc_nolock(int _Char, FILE *_File); 1301 #else 1302 #define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) 1303 #define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream))) 1304 #define _getc_nolock(_stream) _fgetc_nolock(_stream) 1305 #define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream) 1306 #endif 1307 #define _getchar_nolock() _getc_nolock(stdin) 1308 #define _putchar_nolock(_c) _putc_nolock((_c),stdout) 1309 #define _getwchar_nolock() _getwc_nolock(stdin) 1310 #define _putwchar_nolock(_c) _putwc_nolock((_c),stdout) 1311 1312 _CRTIMP void __cdecl _lock_file(FILE *_File); 1313 _CRTIMP void __cdecl _unlock_file(FILE *_File); 1314 #if __MSVCRT_VERSION__ >= 0x800 1315 _CRTIMP int __cdecl _fclose_nolock(FILE *_File); 1316 _CRTIMP int __cdecl _fflush_nolock(FILE *_File); 1317 _CRTIMP size_t __cdecl _fread_nolock(void * __restrict__ _DstBuf,size_t _ElementSize,size_t _Count,FILE * __restrict__ _File); 1318 _CRTIMP int __cdecl _fseek_nolock(FILE *_File,long _Offset,int _Origin); 1319 _CRTIMP long __cdecl _ftell_nolock(FILE *_File); 1320 __MINGW_EXTENSION _CRTIMP int __cdecl _fseeki64_nolock(FILE *_File,__int64 _Offset,int _Origin); 1321 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _ftelli64_nolock(FILE *_File); 1322 _CRTIMP size_t __cdecl _fwrite_nolock(const void * __restrict__ _DstBuf,size_t _Size,size_t _Count,FILE * __restrict__ _File); 1323 _CRTIMP int __cdecl _ungetc_nolock(int _Ch,FILE *_File); 1324 #endif 1325 1326 #if !defined(NO_OLDNAMES) || !defined(_POSIX) 1327 #define P_tmpdir _P_tmpdir 1328 #define SYS_OPEN _SYS_OPEN 1329 1330 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) 1331 #pragma push_macro("tempnam") 1332 #undef tempnam 1333 #endif 1334 char *__cdecl tempnam(const char *_Directory,const char *_FilePrefix) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1335 #if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) 1336 #pragma pop_macro("tempnam") 1337 #endif 1338 int __cdecl fcloseall(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1339 FILE *__cdecl fdopen(int _FileHandle,const char *_Format) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1340 int __cdecl fgetchar(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1341 int __cdecl fileno(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1342 int __cdecl flushall(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1343 int __cdecl fputchar(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1344 int __cdecl getw(FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1345 int __cdecl putw(int _Ch,FILE *_File) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1346 int __cdecl rmtmp(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 1347 #endif 1348 1349 #ifndef __MINGW_MBWC_CONVERT_DEFINED 1350 #define __MINGW_MBWC_CONVERT_DEFINED 1351 1352 /** 1353 * __mingw_str_wide_utf8 1354 * Converts a null terminated UCS-2 string to a multibyte (UTF-8) equivalent. 1355 * Caller is supposed to free allocated buffer with __mingw_str_free(). 1356 * @param[in] wptr Pointer to wide string. 1357 * @param[out] mbptr Pointer to multibyte string. 1358 * @param[out] buflen Optional parameter for length of allocated buffer. 1359 * @return Number of characters converted, 0 for failure. 1360 * 1361 * WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx 1362 */ 1363 int __cdecl __mingw_str_wide_utf8 (const wchar_t * const wptr, char **mbptr, size_t * buflen); 1364 1365 /** 1366 * __mingw_str_utf8_wide 1367 * Converts a null terminated UTF-8 string to a UCS-2 equivalent. 1368 * Caller is supposed to free allocated buffer with __mingw_str_free(). 1369 * @param[out] mbptr Pointer to multibyte string. 1370 * @param[in] wptr Pointer to wide string. 1371 * @param[out] buflen Optional parameter for length of allocated buffer. 1372 * @return Number of characters converted, 0 for failure. 1373 * 1374 * MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx 1375 */ 1376 1377 int __cdecl __mingw_str_utf8_wide (const char *const mbptr, wchar_t ** wptr, size_t * buflen); 1378 1379 /** 1380 * __mingw_str_free 1381 * Frees buffer create by __mingw_str_wide_utf8 and __mingw_str_utf8_wide. 1382 * @param[in] ptr memory block to free. 1383 * 1384 */ 1385 1386 void __cdecl __mingw_str_free(void *ptr); 1387 1388 #endif /* __MINGW_MBWC_CONVERT_DEFINED */ 1389 1390 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP 1391 #ifndef _WSPAWN_DEFINED 1392 #define _WSPAWN_DEFINED 1393 _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); 1394 _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); 1395 _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); 1396 _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); 1397 _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); 1398 _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); 1399 _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); 1400 _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); 1401 #endif 1402 1403 #ifndef _P_WAIT 1404 #define _P_WAIT 0 1405 #define _P_NOWAIT 1 1406 #define _OLD_P_OVERLAY 2 1407 #define _P_NOWAITO 3 1408 #define _P_DETACH 4 1409 #define _P_OVERLAY 2 1410 1411 #define _WAIT_CHILD 0 1412 #define _WAIT_GRANDCHILD 1 1413 #endif 1414 1415 #ifndef _SPAWNV_DEFINED 1416 #define _SPAWNV_DEFINED 1417 _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList); 1418 _CRTIMP intptr_t __cdecl _spawnve(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); 1419 _CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const char *const *_ArgList); 1420 _CRTIMP intptr_t __cdecl _spawnvpe(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); 1421 #endif 1422 #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ 1423 1424 #ifdef __cplusplus 1425 } 1426 #endif 1427 1428 #pragma pop_macro("snprintf") 1429 #pragma pop_macro("vsnprintf") 1430 #pragma pop_macro("snwprintf") 1431 #pragma pop_macro("vsnwprintf") 1432 1433 #pragma pack(pop) 1434 1435 #include <sec_api/stdio_s.h> 1436 1437 #endif