ReactOS 0.4.16-dev-1063-gd722e70
wchar.h
Go to the documentation of this file.
1//
2// wchar.h
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// All of the types, macros, and function declarations for all wide-character
7// related functionality. Most of the functionality is in the #included
8// <corecrt_wxxxx.h> headers, which are also #included by other public headers.
9//
10#pragma once
11#ifndef _INC_WCHAR // include guard for 3rd party interop
12#define _INC_WCHAR
13
14#include <corecrt.h>
15#include <corecrt_memcpy_s.h>
16#include <corecrt_wconio.h>
17#include <corecrt_wctype.h>
18#include <corecrt_wdirect.h>
19#include <corecrt_wio.h>
20#include <corecrt_wprocess.h>
21#include <corecrt_wstdio.h>
22#include <corecrt_wstdlib.h>
23#include <corecrt_wstring.h>
24#include <corecrt_wtime.h>
25#include <sys/stat.h>
26#include <sys/types.h>
27#include <vcruntime_string.h>
28
29#pragma warning(push)
30#pragma warning(disable: _UCRT_DISABLED_WARNINGS)
32
34
35
36
37#define WCHAR_MIN 0x0000
38#define WCHAR_MAX 0xffff
39
40
41
42typedef wchar_t _Wint_t;
43
44
45
46#if _CRT_FUNCTIONS_REQUIRED
47
50 _In_ int _Category,
51 _In_opt_z_ wchar_t const* _Locale
52 );
53
56 _In_ int _Category,
57 _In_z_ wchar_t const* _Locale
58 );
59
60
61
63 _In_ int _Ch
64 );
65
66 _ACRTIMP size_t __cdecl mbrlen(
68 _In_ size_t _SizeInBytes,
69 _Inout_ mbstate_t* _State
70 );
71
73 _Pre_maybenull_ _Post_z_ wchar_t* _DstCh,
75 _In_ size_t _SizeInBytes,
76 _Inout_ mbstate_t* _State
77 );
78
79 _Success_(return == 0)
80 _ACRTIMP errno_t __cdecl mbsrtowcs_s(
81 _Out_opt_ size_t* _Retval,
82 _Out_writes_opt_z_(_Size) wchar_t* _Dst,
83 _In_ size_t _Size,
84 _Deref_pre_opt_z_ char const** _PSrc,
85 _In_ size_t _N,
86 _Inout_ mbstate_t* _State
87 );
88
90 _Success_(return == 0)
91 errno_t, mbsrtowcs_s,
92 _Out_opt_ size_t*, _Retval,
93 _Post_z_ wchar_t, _Dest,
95 _In_ size_t, _Count,
96 _Inout_ mbstate_t*, _State
97 )
98
102 _Deref_pre_opt_z_ char const**, _PSrc,
103 _In_ size_t, _Count,
104 _Inout_ mbstate_t*, _State
105 )
106
107 _Success_(return == 0)
109 _Out_opt_ size_t* _Retval,
111 _In_ size_t _SizeInBytes,
112 _In_ wchar_t _Ch,
113 _Inout_opt_ mbstate_t* _State
114 );
115
117 _Success_(return == 0)
119 _Out_opt_ size_t*, _Retval,
121 _In_ wchar_t, _Source,
122 _Inout_opt_ mbstate_t*, _State
123 )
124
128 _In_ wchar_t, _Source,
129 _Inout_opt_ mbstate_t*, _State
130 )
131
132 _Success_(return == 0)
134 _Out_opt_ size_t* _Retval,
135 _Out_writes_bytes_to_opt_(_SizeInBytes, *_Retval) char* _Dst,
136 _In_ size_t _SizeInBytes,
137 _Inout_ _Deref_prepost_z_ wchar_t const** _Src,
138 _In_ size_t _Size,
139 _Inout_opt_ mbstate_t* _State
140 );
141
143 _Success_(return == 0)
145 _Out_opt_ size_t*, _Retval,
147 _Inout_ _Deref_prepost_z_ wchar_t const**, _PSrc,
148 _In_ size_t, _Count,
149 _Inout_opt_ mbstate_t*, _State
150 )
151
155 _Inout_ _Deref_prepost_z_ wchar_t const**, _PSource,
156 _In_ size_t, _Count,
157 _Inout_opt_ mbstate_t*, _State
158 )
159
161 _In_ wint_t _WCh
162 );
163
164 #if __STDC_WANT_SECURE_LIB__
165
166 _Success_(return == 0)
168 _Out_writes_to_opt_(_N1, _N) wchar_t* _S1,
169 _In_ rsize_t _N1,
170 _In_reads_opt_(_N) wchar_t const* _S2,
172 );
173
174 _Success_(return == 0)
176 _Out_writes_to_opt_(_N1, _N) wchar_t* _S1,
177 _In_ rsize_t _N1,
178 _In_reads_opt_(_N) wchar_t const* _S2,
180 );
181
182 #endif // __STDC_WANT_SECURE_LIB__
183
185 _In_opt_ FILE* _F,
186 _In_ int _M
187 )
188 {
189 _CRT_UNUSED(_F);
190 return (_M);
191 }
192
194 _In_opt_ mbstate_t const* _P
195 )
196 {
197 return _P == NULL || _P->_Wchar == 0;
198 }
199
201 _In_reads_(_N) wchar_t const* _S,
202 _In_ wchar_t _C,
203 _In_ size_t _N
204 )
205 {
206 for (; 0 < _N; ++_S, --_N)
207 if (*_S == _C)
208 return (wchar_t _CONST_RETURN*)_S;
209
210 return 0;
211 }
212
214 _In_reads_(_N) wchar_t const* _S1,
215 _In_reads_(_N) wchar_t const* _S2,
216 _In_ size_t _N
217 )
218 {
219 for (; 0 < _N; ++_S1, ++_S2, --_N)
220 if (*_S1 != *_S2)
221 return *_S1 < *_S2 ? -1 : 1;
222
223 return 0;
224 }
225
226 _Post_equal_to_(_S1)
227 _At_buffer_(_S1, _Iter_, _N, _Post_satisfies_(_S1[_Iter_] == _S2[_Iter_]))
229 wchar_t* __CRTDECL wmemcpy(
230 _Out_writes_all_(_N) wchar_t* _S1,
231 _In_reads_(_N) wchar_t const* _S2,
232 _In_ size_t _N
233 )
234 {
235 #pragma warning(suppress: 6386) // Buffer overrun
236 return (wchar_t*)memcpy(_S1, _S2, _N*sizeof(wchar_t));
237 }
238
240 wchar_t* __CRTDECL wmemmove(
241 _Out_writes_all_opt_(_N) wchar_t* _S1,
242 _In_reads_opt_(_N) wchar_t const* _S2,
243 _In_ size_t _N
244 )
245 {
246 #pragma warning(suppress: 6386) // Buffer overrun
247 return (wchar_t*)memmove(_S1, _S2, _N*sizeof(wchar_t));
248 }
249
252 __inline wchar_t* __CRTDECL wmemset(
253 _Out_writes_all_(_N) wchar_t* _S,
254 _In_ wchar_t _C,
255 _In_ size_t _N
256 )
257 {
258 wchar_t *_Su = _S;
259 for (; 0 < _N; ++_Su, --_N)
260 {
261 *_Su = _C;
262 }
263 return _S;
264 }
265
266 #ifdef __cplusplus
267
268 extern "C++" inline wchar_t* __CRTDECL wmemchr(
269 _In_reads_(_N) wchar_t* _S,
270 _In_ wchar_t _C,
271 _In_ size_t _N
272 )
273 {
274 wchar_t const* const _SC = _S;
275 return const_cast<wchar_t*>(wmemchr(_SC, _C, _N));
276 }
277
278 #endif // __cplusplus
279
280#endif // _CRT_FUNCTIONS_REQUIRED
281
282
285#pragma warning(pop) // _UCRT_DISABLED_WARNINGS
286#endif // _INC_WCHAR
int wint_t
Definition: _apple.h:38
#define __inline
Definition: _wctype.cpp:15
#define __cdecl
Definition: accygwin.h:79
return
Definition: dirsup.c:529
_Source
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_2(_ReturnType, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2)
Definition: corecrt.h:182
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_3(_ReturnType, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3)
Definition: corecrt.h:183
_Check_return_ _Ret_maybenull_ _In_ size_t _In_ size_t _Size
Definition: malloc.h:109
_Check_return_ _Ret_maybenull_ _In_ size_t _Count
Definition: malloc.h:108
#define NULL
Definition: types.h:112
size_t rsize_t
Definition: stubs.c:780
size_t __cdecl wcsrtombs(_Pre_maybenull_ _Post_z_ char *_Dest, _Inout_ _Deref_prepost_z_ const wchar_t **_PSource, _In_ size_t _Count, _Out_opt_ mbstate_t *_State)
int __cdecl wctob(_In_ wint_t _WCh)
_CONST_RETURN wchar_t *__cdecl wmemchr(_In_reads_(_N) const wchar_t *_S, _In_ wchar_t _C, _In_ size_t _N)
Definition: wchar.h:2606
wint_t __cdecl btowc(int)
wchar_t _Wint_t
Definition: wchar.h:2443
size_t __cdecl mbsrtowcs(_Pre_notnull_ _Post_z_ wchar_t *_Dest, _Inout_ _Deref_prepost_opt_valid_ const char **_PSrc, _In_ size_t _Count, _Inout_opt_ mbstate_t *_State)
wchar_t *__cdecl wmemmove(_Out_writes_all_opt_(_N) wchar_t *_S1, _In_reads_opt_(_N) const wchar_t *_S2, _In_ size_t _N)
Definition: wchar.h:2652
__CRT_INLINE int __cdecl fwide(_In_opt_ FILE *_F, int _M)
Definition: wchar.h:2585
wchar_t *__cdecl wmemset(_Out_writes_all_(_N) wchar_t *_S, _In_ wchar_t _C, _In_ size_t _N)
Definition: wchar.h:2663
_Iter_
Definition: wchar.h:2530
_In_ size_t _In_z_ _Printf_format_string_ const wchar_t _In_ const struct tm _In_opt_ _locale_t _Locale
Definition: wchar.h:2369
int __cdecl wmemcmp(_In_reads_(_N) const wchar_t *_S1, _In_reads_(_N) const wchar_t *_S2, _In_ size_t _N)
Definition: wchar.h:2621
_N
Definition: wchar.h:2530
size_t __cdecl mbrlen(_In_reads_bytes_opt_(_SizeInBytes) _Pre_opt_z_ const char *_Ch, _In_ size_t _SizeInBytes, _Out_opt_ mbstate_t *_State)
_Check_return_opt_ _CRTIMP wchar_t *__cdecl _wsetlocale(_In_ int _Category, _In_opt_z_ const wchar_t *_Locale)
_Dest
Definition: stdlib.h:926
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define _Deref_pre_opt_z_
Definition: ms_sal.h:1030
#define _Deref_prepost_opt_valid_
Definition: ms_sal.h:1462
#define _Deref_prepost_z_
Definition: ms_sal.h:1423
#define _Pre_opt_z_
Definition: ms_sal.h:1274
#define _Out_writes_to_opt_(s, c)
Definition: no_sal2.h:238
#define _In_reads_(s)
Definition: no_sal2.h:168
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Success_(c)
Definition: no_sal2.h:84
#define _In_z_
Definition: no_sal2.h:164
#define _Pre_maybenull_
Definition: no_sal2.h:514
#define _In_opt_z_
Definition: no_sal2.h:218
#define _Post_z_
Definition: no_sal2.h:508
#define _At_buffer_(t, i, c, a)
Definition: no_sal2.h:42
#define _Out_writes_opt_z_(s)
Definition: no_sal2.h:230
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Post_satisfies_(e)
Definition: no_sal2.h:66
#define _In_reads_opt_(s)
Definition: no_sal2.h:222
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define _Out_writes_bytes_to_opt_(s, c)
Definition: no_sal2.h:240
#define _Post_equal_to_(e)
Definition: no_sal2.h:384
#define _Out_writes_all_(s)
Definition: no_sal2.h:192
#define _Out_writes_all_opt_(s)
Definition: no_sal2.h:242
#define _Ret_z_
Definition: no_sal2.h:306
#define _In_reads_bytes_opt_(s)
Definition: no_sal2.h:224
#define _CONST_RETURN
Definition: memory.h:16
_Check_return_ wchar_t _Ch
Definition: string.h:697
_In_ size_t _SizeInBytes
Definition: time.h:146
#define mbrtowc(wp, cp, len, sp)
Definition: wchar.h:158
#define mbsinit(sp)
Definition: wchar.h:166
#define wcrtomb(cp, wc, sp)
Definition: wchar.h:163
int errno_t
Definition: corecrt.h:615
#define _Check_return_opt_
Definition: corecrt.h:224
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_SIZE(_DeclSpec, _FuncName, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2)
Definition: corecrt.h:869
#define _CRT_UNUSED(x)
Definition: corecrt.h:340
#define _ACRTIMP
Definition: corecrt.h:138
#define _UCRT_DISABLE_CLANG_WARNINGS
Definition: corecrt.h:109
#define _UCRT_RESTORE_CLANG_WARNINGS
Definition: corecrt.h:117
#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_SIZE(_DeclSpec, _FuncName, _SalAttributeDst, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3)
Definition: corecrt.h:904
#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
Definition: vcruntime.h:105
#define _CRT_END_C_HEADER
Definition: vcruntime.h:42
#define _CRT_BEGIN_C_HEADER
Definition: vcruntime.h:40
errno_t __cdecl wcsrtombs_s(size_t *const return_value, char *const destination, size_t const destination_count, wchar_t const **const source, size_t const n, mbstate_t *const state)
Definition: wcrtomb.cpp:351
errno_t __cdecl wcrtomb_s(size_t *const return_value, char *const destination, size_t const destination_count, wchar_t const wchar, mbstate_t *const state)
Definition: wcrtomb.cpp:188
errno_t __cdecl wmemcpy_s(wchar_t *const destination, size_t const size_in_elements, wchar_t const *const source, size_t const count)
Definition: wmemcpy_s.cpp:18
errno_t __cdecl wmemmove_s(wchar_t *const destination, size_t const size_in_elements, wchar_t const *const source, size_t const count)
Definition: wmemmove_s.cpp:17
_locale_t __cdecl _wcreate_locale(int _category, const wchar_t *locale)
Definition: wsetlocale.cpp:340
#define __CRTDECL
Definition: yvals.h:17
#define const
Definition: zconf.h:233