#include <corecrt_internal_mbstring.h>
#include <corecrt_internal_ptd_propagation.h>
#include <corecrt_internal_securecrt.h>
#include <limits.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
Go to the source code of this file.
|
| _Success_ (return==0) static errno_t __cdecl _wcrtomb_internal(int *const return_value |
|
| __out_bcount_z_opt (destination_count) char *const destination |
|
| _ASSERTE (locale->locinfo->_public._locale_mb_cur_max==1||locale->locinfo->_public._locale_mb_cur_max==2||locale->locinfo->_public._locale_lc_codepage==CP_UTF8) |
|
| if (state) |
|
| if (locale->locinfo->_public._locale_lc_codepage==CP_UTF8) |
|
| if (!locale->locinfo->locale_name[LC_CTYPE]) |
|
| if (size==0||default_used) |
|
| if (return_value) |
|
static errno_t __cdecl | wcrtomb_s_internal (size_t *const return_value, char *const destination, size_t const destination_count, wchar_t const wchar, mbstate_t *const state, __crt_cached_ptd_host &ptd) |
|
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) |
|
size_t __cdecl | wcrtomb (char *const destination, wchar_t const wchar, mbstate_t *const state) |
|
static size_t __cdecl | _wcsrtombs_internal (_Pre_maybenull_ _Post_z_ char *destination, _Inout_ _Deref_prepost_z_ wchar_t const **const source, _In_ size_t n, _Out_opt_ mbstate_t *const state, _Inout_ __crt_cached_ptd_host &ptd) throw () |
|
size_t __cdecl | wcsrtombs (char *const destination, wchar_t const **const source, size_t const n, mbstate_t *const state) |
|
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) |
|
int __cdecl | wctob (wint_t const wchar) |
|
◆ __out_bcount_z_opt()
◆ _ASSERTE()
◆ _Success_()
_Success_ |
( |
return |
= = 0 | ) |
const |
◆ _wcsrtombs_internal()
Definition at line 227 of file wcrtomb.cpp.
234{
235
237
239
241 {
243 }
244
247 size_t nc = 0;
249
250 if (!destination)
251 {
252 for (; ; nc +=
i, ++
wcs)
253 {
254
257 {
258 return static_cast<size_t>(-1);
259 }
260 else if (
buf[
i - 1] ==
'\0')
261 {
263 }
264 }
265 }
266
267 for (; 0 <
n; nc +=
i, ++
wcs, destination +=
i,
n -=
i)
268 {
269
271
272 if (
n < (
size_t)
locale->locinfo->_public._locale_mb_cur_max)
273 {
275 }
276 else
277 {
279 }
280
283 {
284
286 break;
287 }
288
289 if (destination ==
t)
290 {
291
292 }
293 else if (
n <
static_cast<size_t>(
i))
294 {
295 break;
296 }
297 else
298 {
300 }
301
302 if (destination[
i - 1] ==
'\0')
303 {
304
307 }
308 }
309
311 return nc;
312}
#define _UCRT_VALIDATE_RETURN(ptd, expr, errorcode, retexpr)
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
size_t __cdecl __wcsrtombs_utf8(char *dst, const wchar_t **src, size_t len, mbstate_t *ps, __crt_cached_ptd_host &ptd)
int CDECL memcpy_s(void *dest, size_t numberOfElements, const void *src, size_t count)
size_t const wchar_t const mbstate_t *const _Inout_ __crt_cached_ptd_host & ptd
size_t const wchar_t const mbstate_t *const state
Referenced by wcsrtombs(), and wcsrtombs_s().
◆ if() [1/5]
Definition at line 93 of file wcrtomb.cpp.
94 {
96 {
97 if (return_value)
98 *return_value = -1;
99
101 }
102
103 *destination =
static_cast<char>(
wchar);
104 if (return_value)
105 {
106 *return_value = 1;
107 }
108
109 return 0;
110 }
size_t const wchar_t const wchar
◆ if() [2/5]
Definition at line 72 of file wcrtomb.cpp.
73 {
74
75
76
79 if (return_value != nullptr)
80 {
82 }
84 {
85 return 0;
86 }
87 else
88 {
89 return ptd.get_errno().value_or(0);
90 }
91 }
size_t __cdecl __c32rtomb_utf8(char *s, char32_t c32, mbstate_t *ps, __crt_cached_ptd_host &ptd)
◆ if() [3/5]
◆ if() [4/5]
Definition at line 123 of file wcrtomb.cpp.
124 {
125 if (return_value)
126 {
127 *return_value = -1;
128 }
129
131 }
◆ if() [5/5]
◆ wcrtomb()
Definition at line 200 of file wcrtomb.cpp.
205{
206 size_t return_value = static_cast<size_t>(-1);
208 return return_value;
209}
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)
◆ wcrtomb_s()
Definition at line 188 of file wcrtomb.cpp.
195{
196 __crt_cached_ptd_host
ptd;
198}
size_t const destination_count
static errno_t __cdecl wcrtomb_s_internal(size_t *const return_value, char *const destination, size_t const destination_count, wchar_t const wchar, mbstate_t *const state, __crt_cached_ptd_host &ptd)
Referenced by wcrtomb().
◆ wcrtomb_s_internal()
Definition at line 154 of file wcrtomb.cpp.
162{
163
164
165
167
169 int int_return_value = -1;
170 if (destination == nullptr)
171 {
174 }
175 else
176 {
178 }
179
180 if (return_value != nullptr)
181 {
182 *return_value = static_cast<size_t>(int_return_value);
183 }
184
186}
#define _UCRT_VALIDATE_RETURN_ERRCODE(ptd, expr, errorcode)
Referenced by wcrtomb_s().
◆ wcsrtombs()
Definition at line 314 of file wcrtomb.cpp.
320{
321 __crt_cached_ptd_host
ptd;
323}
static size_t __cdecl _wcsrtombs_internal(_Pre_maybenull_ _Post_z_ char *destination, _Inout_ _Deref_prepost_z_ wchar_t const **const source, _In_ size_t n, _Out_opt_ mbstate_t *const state, _Inout_ __crt_cached_ptd_host &ptd)
◆ wcsrtombs_s()
Definition at line 351 of file wcrtomb.cpp.
359{
360 __crt_cached_ptd_host
ptd;
361
362 if (return_value != nullptr)
363 {
364 *return_value = static_cast<size_t>(-1);
365 }
366
372
373 if (destination != nullptr)
374 {
376 }
377
379
381 if (retsize == static_cast<size_t>(-1))
382 {
383 if (destination != nullptr)
384 {
386 }
387
388 return ptd.get_errno().value_or(0);
389 }
390
391 ++retsize;
392
393 if (destination != nullptr)
394 {
395
397 {
400 }
401
402
403 destination[retsize - 1] = '\0';
404 }
405
406 if (return_value != nullptr)
407 {
408 *return_value = retsize;
409 }
410
411 return 0;
412}
#define _RESET_STRING(_String, _Size)
◆ wctob()
Definition at line 417 of file wcrtomb.cpp.
418{
419 __crt_cached_ptd_host
ptd;
420
422 {
424 }
425
426 int return_value = -1;
428
431 if (
e == 0 && return_value == 1)
432 {
433 return local_buffer[0];
434 }
435
437}
◆ default_used
◆ destination_count
◆ locale
◆ ptd
◆ return
◆ size
Initial value:
locale->locinfo->_public._locale_lc_codepage,
0,
1,
destination,
nullptr,
return __acrt_WideCharToMultiByte(code_page, 0, buffer.get(), -1, result_size !=0 ? result :nullptr, result_size, nullptr, nullptr)
Definition at line 113 of file wcrtomb.cpp.
Referenced by if().
◆ state
◆ wchar
Definition at line 53 of file wcrtomb.cpp.
Referenced by __pragma(), _putch_nolock_internal(), _wctomb_internal(), _wctomb_l(), _wctomb_s_l(), if(), KmtWcToMb(), mbtowc(), wcrtomb(), wcrtomb_s(), wcrtomb_s_internal(), wctob(), wctomb(), and wctomb_s().