This repository has been archived by the owner on Dec 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 206
/
stdlib.h
1362 lines (1082 loc) · 85.4 KB
/
stdlib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// stdlib.h
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The C Standard Library <stdlib.h> header.
//
#pragma once
#define _INC_STDLIB
#include <corecrt.h>
#include <corecrt_malloc.h>
#include <corecrt_search.h>
#include <corecrt_wstdlib.h>
#include <limits.h>
_CRT_BEGIN_C_HEADER
#ifndef _countof
#define _countof __crt_countof
#endif
// Minimum and maximum macros
#define __max(a,b) (((a) > (b)) ? (a) : (b))
#define __min(a,b) (((a) < (b)) ? (a) : (b))
_ACRTIMP void __cdecl _swab(
_Inout_updates_(_SizeInBytes) _Post_readable_size_(_SizeInBytes) char* _Buf1,
_Inout_updates_(_SizeInBytes) _Post_readable_size_(_SizeInBytes) char* _Buf2,
_In_ int _SizeInBytes
);
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Exit and Abort
//
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// Argument values for exit()
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
_ACRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code);
_ACRTIMP __declspec(noreturn) void __cdecl _exit(_In_ int _Code);
_ACRTIMP __declspec(noreturn) void __cdecl _Exit(_In_ int _Code);
_ACRTIMP __declspec(noreturn) void __cdecl quick_exit(_In_ int _Code);
_ACRTIMP __declspec(noreturn) void __cdecl abort(void);
// Argument values for _set_abort_behavior().
#define _WRITE_ABORT_MSG 0x1 // debug only, has no effect in release
#define _CALL_REPORTFAULT 0x2
_CRT_DEPRECATE_TEXT("温馨提示:VC-LTL中该函数功能并不生效,仅作编译通过处理。任何abort调用都将静默退出程序。")
_ACRTIMP unsigned int __cdecl _set_abort_behavior(
_In_ unsigned int _Flags,
_In_ unsigned int _Mask
);
#ifndef _M_CEE_PURE
typedef int (__cdecl* _onexit_t)(void);
#else
typedef int (__clrcall* _onexit_t)(void);
typedef _onexit_t _onexit_m_t;
#endif
#ifdef _M_CEE_MIXED
typedef int (__clrcall* _onexit_m_t)(void);
#endif
#if !__STDC__
// Non-ANSI name for compatibility
#define onexit_t _onexit_t
#endif
#ifdef _M_CEE
#pragma warning (push)
#pragma warning (disable: 4985)
_Check_return_ int __clrcall _atexit_m_appdomain(_In_opt_ void (__clrcall* _Function)(void));
_onexit_m_t __clrcall _onexit_m_appdomain(_onexit_m_t _Function);
#ifdef _M_CEE_MIXED
#ifdef __cplusplus
[System::Security::SecurityCritical]
#endif
_Check_return_ int __clrcall _atexit_m(_In_opt_ void (__clrcall* _Function)(void));
_onexit_m_t __clrcall _onexit_m(_onexit_m_t _Function);
#else
#ifdef __cplusplus
[System::Security::SecurityCritical]
#endif
_Check_return_ inline int __clrcall _atexit_m(_In_opt_ void (__clrcall* _Function)(void))
{
return _atexit_m_appdomain(_Function);
}
inline _onexit_m_t __clrcall _onexit_m(_onexit_t _Function)
{
return _onexit_m_appdomain(_Function);
}
#endif
#pragma warning (pop)
#endif
#ifdef _M_CEE_PURE
// In pure mode, atexit is the same as atexit_m_appdomain
extern "C++"
{
#ifdef __cplusplus
[System::Security::SecurityCritical]
#endif
inline int __clrcall atexit(void (__clrcall* _Function)(void))
{
return _atexit_m_appdomain(_Function);
}
inline _onexit_t __clrcall _onexit(_onexit_t _Function)
{
return _onexit_m_appdomain(_Function);
}
} // extern "C++"
#else
int __cdecl atexit(void (__cdecl*)(void));
_onexit_t __cdecl _onexit(_In_opt_ _onexit_t _Func);
#endif
int __cdecl at_quick_exit(void (__cdecl*)(void));
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Global State (errno, global handlers, etc.)
//
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#ifndef _M_CEE_PURE
// a purecall handler procedure. Never returns normally
typedef void (__cdecl* _purecall_handler)(void);
// Invalid parameter handler function pointer type
typedef void (__cdecl* _invalid_parameter_handler)(
wchar_t const*,
wchar_t const*,
wchar_t const*,
unsigned int,
uintptr_t
);
// Establishes a purecall handler
_VCRTIMP _purecall_handler __cdecl _set_purecall_handler(
_In_opt_ _purecall_handler _Handler
);
_VCRTIMP _purecall_handler __cdecl _get_purecall_handler(void);
// Establishes an invalid parameter handler
_ACRTIMP _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(
_In_opt_ _invalid_parameter_handler _Handler
);
_ACRTIMP _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void);
_ACRTIMP _invalid_parameter_handler __cdecl _set_thread_local_invalid_parameter_handler(
_In_opt_ _invalid_parameter_handler _Handler
);
_ACRTIMP _invalid_parameter_handler __cdecl _get_thread_local_invalid_parameter_handler(void);
#endif
#if defined __cplusplus && defined _M_CEE_PURE
extern "C++"
{
typedef void (__clrcall* _purecall_handler)(void);
typedef _purecall_handler _purecall_handler_m;
_MRTIMP _purecall_handler __cdecl _set_purecall_handler(
_In_opt_ _purecall_handler _Handler
);
} // extern "C++"
#endif
// Argument values for _set_error_mode().
#define _OUT_TO_DEFAULT 0
#define _OUT_TO_STDERR 1
#define _OUT_TO_MSGBOX 2
#define _REPORT_ERRMODE 3
_Check_return_opt_ _ACRTIMP int __cdecl _set_error_mode(_In_ int _Mode);
_ACRTIMP int* __cdecl _errno(void);
#define errno (*_errno())
_ACRTIMP errno_t __cdecl _set_errno(_In_ int _Value);
_ACRTIMP errno_t __cdecl _get_errno(_Out_ int* _Value);
_ACRTIMP unsigned long* __cdecl __doserrno(void);
#define _doserrno (*__doserrno())
_ACRTIMP errno_t __cdecl _set_doserrno(_In_ unsigned long _Value);
_ACRTIMP errno_t __cdecl _get_doserrno(_Out_ unsigned long * _Value);
// This is non-const for backwards compatibility; do not modify it.
_ACRTIMP _CRT_INSECURE_DEPRECATE(strerror) char** __cdecl __sys_errlist(void);
#define _sys_errlist (__sys_errlist())
_ACRTIMP _CRT_INSECURE_DEPRECATE(strerror) int * __cdecl __sys_nerr(void);
#define _sys_nerr (*__sys_nerr())
_ACRTIMP void __cdecl perror(_In_opt_z_ char const* _ErrMsg);
// These point to the executable module name.
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_pgmptr ) _ACRTIMP char** __cdecl __p__pgmptr (void);
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_wpgmptr) _ACRTIMP wchar_t** __cdecl __p__wpgmptr(void);
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_fmode ) _ACRTIMP int* __cdecl __p__fmode (void);
#ifdef _CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_pgmptr ) _ACRTIMP extern char* _pgmptr;
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_wpgmptr) _ACRTIMP extern wchar_t* _wpgmptr;
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_fmode ) _ACRTIMP extern int _fmode;
#else
#define _pgmptr (*__p__pgmptr ())
#define _wpgmptr (*__p__wpgmptr())
#define _fmode (*__p__fmode ())
#endif
_Success_(return == 0)
_ACRTIMP errno_t __cdecl _get_pgmptr (_Outptr_result_z_ char** _Value);
_Success_(return == 0)
_ACRTIMP errno_t __cdecl _get_wpgmptr(_Outptr_result_z_ wchar_t** _Value);
_ACRTIMP errno_t __cdecl _set_fmode (_In_ int _Mode );
_ACRTIMP errno_t __cdecl _get_fmode (_Out_ int* _PMode);
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Math
//
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
typedef struct _div_t
{
int quot;
int rem;
} div_t;
typedef struct _ldiv_t
{
long quot;
long rem;
} ldiv_t;
typedef struct _lldiv_t
{
long long quot;
long long rem;
} lldiv_t;
_Check_return_ int __cdecl abs (_In_ int _Number);
_Check_return_ long __cdecl labs (_In_ long _Number);
_Check_return_ long long __cdecl llabs (_In_ long long _Number);
_Check_return_ __int64 __cdecl _abs64(_In_ __int64 _Number);
_Check_return_ unsigned short __cdecl _byteswap_ushort(_In_ unsigned short _Number);
_Check_return_ unsigned long __cdecl _byteswap_ulong (_In_ unsigned long _Number);
_Check_return_ unsigned __int64 __cdecl _byteswap_uint64(_In_ unsigned __int64 _Number);
_Check_return_ _ACRTIMP div_t __cdecl div (_In_ int _Numerator, _In_ int _Denominator);
_Check_return_ _ACRTIMP ldiv_t __cdecl ldiv (_In_ long _Numerator, _In_ long _Denominator);
_Check_return_ _ACRTIMP lldiv_t __cdecl lldiv(_In_ long long _Numerator, _In_ long long _Denominator);
// These functions have declspecs in their declarations in the Windows headers,
// which cause PREfast to fire 6540.
#pragma warning (push)
#pragma warning (disable:6540)
unsigned int __cdecl _rotl(
_In_ unsigned int _Value,
_In_ int _Shift
);
_Check_return_
unsigned long __cdecl _lrotl(
_In_ unsigned long _Value,
_In_ int _Shift
);
unsigned __int64 __cdecl _rotl64(
_In_ unsigned __int64 _Value,
_In_ int _Shift
);
unsigned int __cdecl _rotr(
_In_ unsigned int _Value,
_In_ int _Shift
);
_Check_return_
unsigned long __cdecl _lrotr(
_In_ unsigned long _Value,
_In_ int _Shift
);
unsigned __int64 __cdecl _rotr64(
_In_ unsigned __int64 _Value,
_In_ int _Shift
);
#pragma warning (pop)
// Maximum value that can be returned by the rand function:
#define RAND_MAX 0x7fff
_ACRTIMP void __cdecl srand(_In_ unsigned int _Seed);
_Check_return_ _ACRTIMP int __cdecl rand(void);
#if defined _CRT_RAND_S || defined _CRTBLD
_ACRTIMP errno_t __cdecl rand_s(_Out_ unsigned int* _RandomValue);
#endif
#ifdef __cplusplus
extern "C++"
{
inline long abs(long const _X) throw()
{
return labs(_X);
}
inline long long abs(long long const _X) throw()
{
return llabs(_X);
}
inline ldiv_t div(long const _A1, long const _A2) throw()
{
return ldiv(_A1, _A2);
}
inline lldiv_t div(long long const _A1, long long const _A2) throw()
{
return lldiv(_A1, _A2);
}
}
#endif // __cplusplus
// Structs used to fool the compiler into not generating floating point
// instructions when copying and pushing [long] double values
#define _CRT_DOUBLE_DEC
#ifndef _LDSUPPORT
#pragma pack(push, 4)
typedef struct
{
unsigned char ld[10];
} _LDOUBLE;
#pragma pack(pop)
#define _PTR_LD(x) ((unsigned char*)(&(x)->ld))
#else // _LDSUPPORT
// push and pop long, which is #defined as __int64 by a spec2k test
#pragma push_macro("long")
#undef long
typedef long double _LDOUBLE;
#pragma pop_macro("long")
#define _PTR_LD(x) ((unsigned char *)(x))
#endif // _LDSUPPORT
typedef struct
{
double x;
} _CRT_DOUBLE;
typedef struct
{
float f;
} _CRT_FLOAT;
// push and pop long, which is #defined as __int64 by a spec2k test
#pragma push_macro("long")
#undef long
typedef struct
{
long double x;
} _LONGDOUBLE;
#pragma pop_macro("long")
#pragma pack(push, 4)
typedef struct
{
unsigned char ld12[12];
} _LDBL12;
#pragma pack(pop)
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Narrow String to Number Conversions
//
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
_Check_return_ _ACRTIMP double __cdecl atof (_In_z_ char const* _String);
_Check_return_ _CRT_JIT_INTRINSIC _ACRTIMP int __cdecl atoi (_In_z_ char const* _String);
_Check_return_ _ACRTIMP long __cdecl atol (_In_z_ char const* _String);
_Check_return_ _ACRTIMP long long __cdecl atoll (_In_z_ char const* _String);
_Check_return_ _ACRTIMP __int64 __cdecl _atoi64(_In_z_ char const* _String);
_Check_return_ _ACRTIMP double __cdecl _atof_l (_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
_Check_return_ _ACRTIMP int __cdecl _atoi_l (_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
_Check_return_ _ACRTIMP long __cdecl _atol_l (_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
_Check_return_ _ACRTIMP long long __cdecl _atoll_l (_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
_Check_return_ _ACRTIMP __int64 __cdecl _atoi64_l(_In_z_ char const* _String, _In_opt_ _locale_t _Locale);
_Check_return_ _ACRTIMP int __cdecl _atoflt (_Out_ _CRT_FLOAT* _Result, _In_z_ char const* _String);
_Check_return_ _ACRTIMP int __cdecl _atodbl (_Out_ _CRT_DOUBLE* _Result, _In_z_ char* _String);
_Check_return_ _ACRTIMP int __cdecl _atoldbl(_Out_ _LDOUBLE* _Result, _In_z_ char* _String);
_Check_return_
_ACRTIMP int __cdecl _atoflt_l(
_Out_ _CRT_FLOAT* _Result,
_In_z_ char const* _String,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP int __cdecl _atodbl_l(
_Out_ _CRT_DOUBLE* _Result,
_In_z_ char* _String,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP int __cdecl _atoldbl_l(
_Out_ _LDOUBLE* _Result,
_In_z_ char* _String,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP float __cdecl strtof(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr
);
_Check_return_
_ACRTIMP float __cdecl _strtof_l(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP double __cdecl strtod(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr
);
_Check_return_
_ACRTIMP double __cdecl _strtod_l(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP long double __cdecl strtold(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr
);
_Check_return_
_ACRTIMP long double __cdecl _strtold_l(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP long __cdecl strtol(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix
);
_Check_return_
_ACRTIMP long __cdecl _strtol_l(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP long long __cdecl strtoll(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix
);
_Check_return_
_ACRTIMP long long __cdecl _strtoll_l(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP unsigned long __cdecl strtoul(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix
);
_Check_return_
_ACRTIMP unsigned long __cdecl _strtoul_l(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP unsigned long long __cdecl strtoull(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix
);
_Check_return_
_ACRTIMP unsigned long long __cdecl _strtoull_l(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP __int64 __cdecl _strtoi64(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix
);
_Check_return_
_ACRTIMP __int64 __cdecl _strtoi64_l(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix,
_In_opt_ _locale_t _Locale
);
_Check_return_
_ACRTIMP unsigned __int64 __cdecl _strtoui64(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix
);
_Check_return_
_ACRTIMP unsigned __int64 __cdecl _strtoui64_l(
_In_z_ char const* _String,
_Out_opt_ _Deref_post_z_ char** _EndPtr,
_In_ int _Radix,
_In_opt_ _locale_t _Locale
);
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Number to Narrow String Conversions
//
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
_Success_(return == 0)
_Check_return_opt_
_ACRTIMP errno_t __cdecl _itoa_s(
_In_ int _Value,
_Out_writes_z_(_BufferCount) char* _Buffer,
_In_ size_t _BufferCount,
_In_ int _Radix
);
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(
_Success_(return == 0)
errno_t, _itoa_s,
_In_ int, _Value,
char, _Buffer,
_In_ int, _Radix
)
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(
char*, __RETURN_POLICY_DST, _ACRTIMP, _itoa,
_In_ int, _Value,
_Pre_notnull_ _Post_z_, char, _Buffer,
_In_ int, _Radix
)
_Success_(return == 0)
_Check_return_opt_
_ACRTIMP errno_t __cdecl _ltoa_s(
_In_ long _Value,
_Out_writes_z_(_BufferCount) char* _Buffer,
_In_ size_t _BufferCount,
_In_ int _Radix
);
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(
errno_t, _ltoa_s,
_In_ long, _Value,
char, _Buffer,
_In_ int, _Radix
)
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(
char*, __RETURN_POLICY_DST, _ACRTIMP, _ltoa,
_In_ long, _Value,
_Pre_notnull_ _Post_z_, char, _Buffer,
_In_ int, _Radix
)
_Success_(return == 0)
_Check_return_opt_
_ACRTIMP errno_t __cdecl _ultoa_s(
_In_ unsigned long _Value,
_Out_writes_z_(_BufferCount) char* _Buffer,
_In_ size_t _BufferCount,
_In_ int _Radix
);
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(
errno_t, _ultoa_s,
_In_ unsigned long, _Value,
char, _Buffer,
_In_ int, _Radix
)
__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(
char*, __RETURN_POLICY_DST, _ACRTIMP, _ultoa,
_In_ unsigned long, _Value,
_Pre_notnull_ _Post_z_, char, _Buffer,
_In_ int, _Radix
)
_Success_(return == 0)
_Check_return_opt_
_ACRTIMP errno_t __cdecl _i64toa_s(
_In_ __int64 _Value,
_Out_writes_z_(_BufferCount) char* _Buffer,
_In_ size_t _BufferCount,
_In_ int _Radix
);
_Success_(return == 0)
_CRT_INSECURE_DEPRECATE(_i64toa_s)
_ACRTIMP char* __cdecl _i64toa(
_In_ __int64 _Value,
_Pre_notnull_ _Post_z_ char* _Buffer,
_In_ int _Radix
);
_Success_(return == 0)
_Check_return_opt_
_ACRTIMP errno_t __cdecl _ui64toa_s(
_In_ unsigned __int64 _Value,
_Out_writes_z_(_BufferCount) char* _Buffer,
_In_ size_t _BufferCount,
_In_ int _Radix
);
_CRT_INSECURE_DEPRECATE(_ui64toa_s)
_ACRTIMP char* __cdecl _ui64toa(
_In_ unsigned __int64 _Value,
_Pre_notnull_ _Post_z_ char* _Buffer,
_In_ int _Radix
);
// _CVTBUFSIZE is the maximum size for the per-thread conversion buffer. It
// should be at least as long as the number of digits in the largest double
// precision value (?.?e308 in IEEE arithmetic). We will use the same size
// buffer as is used in the printf support routines.
//
// (This value actually allows 40 additional decimal places; even though there
// are only 16 digits of accuracy in a double precision IEEE number, the user may
// ask for more to effect zero padding.)
#define _CVTBUFSIZE (309 + 40) // # of digits in max. dp value + slop
_Success_(return == 0)
_Check_return_wat_
_ACRTIMP errno_t __cdecl _ecvt_s(
_Out_writes_z_(_BufferCount) char* _Buffer,
_In_ size_t _BufferCount,
_In_ double _Value,
_In_ int _DigitCount,
_Out_ int* _PtDec,
_Out_ int* _PtSign
);
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_4(
errno_t, _ecvt_s,
char, _Buffer,
_In_ double, _Value,
_In_ int, _DigitCount,
_Out_ int*, _PtDec,
_Out_ int*, _PtSign
)
_Check_return_ _CRT_INSECURE_DEPRECATE(_ecvt_s)
_ACRTIMP char* __cdecl _ecvt(
_In_ double _Value,
_In_ int _DigitCount,
_Out_ int* _PtDec,
_Out_ int* _PtSign
);
_Success_(return == 0)
_Check_return_wat_
_ACRTIMP errno_t __cdecl _fcvt_s(
_Out_writes_z_(_BufferCount) char* _Buffer,
_In_ size_t _BufferCount,
_In_ double _Value,
_In_ int _FractionalDigitCount,
_Out_ int* _PtDec,
_Out_ int* _PtSign
);
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_4(
_Success_(return == 0)
errno_t, _fcvt_s,
char, _Buffer,
_In_ double, _Value,
_In_ int, _FractionalDigitCount,
_Out_ int*, _PtDec,
_Out_ int*, _PtSign
)
_Success_(return == 0)
_Check_return_ _CRT_INSECURE_DEPRECATE(_fcvt_s)
_ACRTIMP char* __cdecl _fcvt(
_In_ double _Value,
_In_ int _FractionalDigitCount,
_Out_ int* _PtDec,
_Out_ int* _PtSign
);
_Success_(return == 0)
_ACRTIMP errno_t __cdecl _gcvt_s(
_Out_writes_z_(_BufferCount) char* _Buffer,
_In_ size_t _BufferCount,
_In_ double _Value,
_In_ int _DigitCount
);
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(
_Success_(return == 0)
errno_t, _gcvt_s,
char, _Buffer,
_In_ double, _Value,
_In_ int, _DigitCount
)
_CRT_INSECURE_DEPRECATE(_gcvt_s)
_ACRTIMP char* __cdecl _gcvt(
_In_ double _Value,
_In_ int _DigitCount,
_Pre_notnull_ _Post_z_ char* _Buffer
);
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Multibyte String Operations and Conversions
//
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// Maximum number of bytes in multi-byte character in the current locale
// (also defined in ctype.h).
#ifndef MB_CUR_MAX
#if defined _CRT_DISABLE_PERFCRIT_LOCKS && !defined _DLL
#define MB_CUR_MAX __mb_cur_max
#else
#define MB_CUR_MAX ___mb_cur_max_func()
#endif
#ifdef _CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
_ACRTIMP extern int __mb_cur_max;
#else
#define __mb_cur_max (___mb_cur_max_func())
#endif
_Post_satisfies_(return > 0 && return < MB_LEN_MAX)
_ACRTIMP int __cdecl ___mb_cur_max_func(void);
_Post_satisfies_(return > 0 && return < MB_LEN_MAX)
_ACRTIMP int __cdecl ___mb_cur_max_l_func(_locale_t);
#endif
_Check_return_
_ACRTIMP int __cdecl mblen(
_In_reads_bytes_opt_(_MaxCount) _Pre_opt_z_ char const* _Ch,
_In_ size_t _MaxCount
);
_Check_return_
_ACRTIMP int __cdecl _mblen_l(
_In_reads_bytes_opt_(_MaxCount) _Pre_opt_z_ char const* _Ch,
_In_ size_t _MaxCount,
_In_opt_ _locale_t _Locale
);
_Check_return_
_Post_satisfies_(return <= _String_length_(_String))
_ACRTIMP size_t __cdecl _mbstrlen(
_In_z_ char const* _String
);
_Check_return_
_Post_satisfies_(return <= _String_length_(_String) || return == (size_t)-1)
_ACRTIMP size_t __cdecl _mbstrlen_l(
_In_z_ char const* _String,
_In_opt_ _locale_t _Locale
);
_Check_return_
_Post_satisfies_((return <= _String_length_(_String) && return <= _MaxCount) || return == (size_t)-1)
_ACRTIMP size_t __cdecl _mbstrnlen(
_In_z_ char const* _String,
_In_ size_t _MaxCount
);
_Post_satisfies_((return <= _String_length_(_String) && return <= _MaxCount) || return == (size_t)-1)
_Check_return_
_ACRTIMP size_t __cdecl _mbstrnlen_l(
_In_z_ char const* _String,
_In_ size_t _MaxCount,
_In_opt_ _locale_t _Locale
);
_Success_(return != -1)
_ACRTIMP int __cdecl mbtowc(
_Pre_notnull_ _Post_z_ wchar_t* _DstCh,
_In_reads_or_z_opt_(_SrcSizeInBytes) char const* _SrcCh,
_In_ size_t _SrcSizeInBytes
);
_Success_(return != -1)
_ACRTIMP int __cdecl _mbtowc_l(
_Pre_notnull_ _Post_z_ wchar_t* _DstCh,
_In_reads_or_z_opt_(_SrcSizeInBytes) char const* _SrcCh,
_In_ size_t _SrcSizeInBytes,
_In_opt_ _locale_t _Locale
);
_Check_return_opt_
_ACRTIMP errno_t __cdecl mbstowcs_s(
_Out_opt_ size_t* _PtNumOfCharConverted,
_Out_writes_to_opt_(_SizeInWords, *_PtNumOfCharConverted) wchar_t* _DstBuf,
_In_ size_t _SizeInWords,
_In_reads_or_z_(_MaxCount) char const* _SrcBuf,
_In_ size_t _MaxCount
);
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_2(
errno_t, mbstowcs_s,
_Out_opt_ size_t*, _PtNumOfCharConverted,
_Post_z_ wchar_t, _Dest,
_In_z_ char const*, _Source,
_In_ size_t, _MaxCount
)
__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE(
_ACRTIMP, mbstowcs,
_Out_writes_opt_z_(_MaxCount), wchar_t, _Dest,
_In_z_ char const*, _Source,
_In_ size_t, _MaxCount
)
_Check_return_opt_
_ACRTIMP errno_t __cdecl _mbstowcs_s_l(
_Out_opt_ size_t* _PtNumOfCharConverted,
_Out_writes_to_opt_(_SizeInWords, *_PtNumOfCharConverted) wchar_t* _DstBuf,
_In_ size_t _SizeInWords,
_In_reads_or_z_(_MaxCount) char const* _SrcBuf,
_In_ size_t _MaxCount,
_In_opt_ _locale_t _Locale
);
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_3(
errno_t, _mbstowcs_s_l,
_Out_opt_ size_t*, _PtNumOfCharConverted,
_Post_z_ wchar_t, _Dest,
_In_z_ char const*, _Source,
_In_ size_t, _MaxCount,
_In_opt_ _locale_t, _Locale
)
__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_SIZE_EX(
_ACRTIMP, _mbstowcs_l, _mbstowcs_s_l,
_Out_writes_opt_z_(_Size) wchar_t,
_Out_writes_z_(_MaxCount), wchar_t, _Dest,
_In_z_ char const*, _Source,
_In_ size_t, _MaxCount,
_In_opt_ _locale_t, _Locale
)
_CRT_INSECURE_DEPRECATE(wctomb_s)
_ACRTIMP int __cdecl wctomb(
_Out_writes_opt_z_(MB_LEN_MAX) char* _MbCh,
_In_ wchar_t _WCh
);
_CRT_INSECURE_DEPRECATE(_wctomb_s_l)
_ACRTIMP int __cdecl _wctomb_l(
_Pre_maybenull_ _Post_z_ char* _MbCh,
_In_ wchar_t _WCh,
_In_opt_ _locale_t _Locale
);
#if __STDC_WANT_SECURE_LIB__
_Check_return_wat_
_ACRTIMP errno_t __cdecl wctomb_s(
_Out_opt_ int* _SizeConverted,
_Out_writes_bytes_to_opt_(_SizeInBytes, *_SizeConverted) char* _MbCh,
_In_ rsize_t _SizeInBytes,
_In_ wchar_t _WCh
);
#endif // __STDC_WANT_SECURE_LIB__
_Check_return_wat_
_ACRTIMP errno_t __cdecl _wctomb_s_l(
_Out_opt_ int* _SizeConverted,
_Out_writes_opt_z_(_SizeInBytes) char* _MbCh,
_In_ size_t _SizeInBytes,
_In_ wchar_t _WCh,
_In_opt_ _locale_t _Locale);
_Check_return_wat_
_ACRTIMP errno_t __cdecl wcstombs_s(
_Out_opt_ size_t* _PtNumOfCharConverted,
_Out_writes_bytes_to_opt_(_DstSizeInBytes, *_PtNumOfCharConverted) char* _Dst,
_In_ size_t _DstSizeInBytes,
_In_z_ wchar_t const* _Src,
_In_ size_t _MaxCountInBytes
);
__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_2(
errno_t, wcstombs_s,
_Out_opt_ size_t*, _PtNumOfCharConverted,
_Out_writes_bytes_opt_(_Size) char, _Dest,
_In_z_ wchar_t const*, _Source,