85 return ptd.get_errno().value_or(0);
88 const int locale_mb_cur_max =
locale->locinfo->_public._locale_mb_cur_max;
89 _ASSERTE(locale_mb_cur_max == 1 || locale_mb_cur_max == 2);
98 if (pmbst->_Wchar != 0)
101 ((
char *) pmbst)[1] = *
s;
102 if (locale_mb_cur_max <= 1 ||
103 (__acrt_MultiByteToWideChar(
104 locale->locinfo->_public._locale_lc_codepage,
109 (
dst !=
nullptr ? 1 : 0)) == 0))
124 if (
n < (
size_t) locale_mb_cur_max)
127 ((
char *) pmbst)[0] = *
s;
131 else if (locale_mb_cur_max <= 1 ||
132 (__acrt_MultiByteToWideChar(
locale->locinfo->_public._locale_lc_codepage,
137 (
dst !=
nullptr ? 1 : 0)) == 0))
153 if (__acrt_MultiByteToWideChar(
154 locale->locinfo->_public._locale_lc_codepage,
159 (
dst !=
nullptr ? 1 : 0)) == 0)
201 __crt_cached_ptd_host
ptd;
202 _mbrtowc_internal(&retValue, &wc, &ch, 1, &mbst,
ptd);
203 return (retValue < 0 ?
WEOF : wc);
230 __crt_cached_ptd_host
ptd;
231 _mbrtowc_internal(&retValue,
nullptr,
s,
n, (pst !=
nullptr ? pst : &mbst),
ptd);
259 __crt_cached_ptd_host
ptd;
263 _mbrtowc_internal(&retValue,
dst,
s,
n, (pst !=
nullptr ? pst : &mbst),
ptd);
267 _mbrtowc_internal(&retValue,
nullptr,
"", 1, (pst !=
nullptr ? pst : &mbst),
ptd);
290static
size_t __cdecl _mbsrtowcs_helper(
321 for (;; ++nwc,
s +=
i)
337 for (; 0 <
n; ++nwc,
s +=
i, ++
wcs, --
n)
389 __crt_cached_ptd_host
ptd;
390 return _mbsrtowcs_helper(
wcs, ps,
n, pst,
ptd);
427 __crt_cached_ptd_host&
ptd
443 retsize = _mbsrtowcs_helper(
dst, ps, (
n > sizeInWords ? sizeInWords :
n), pmbst,
ptd);
445 if (retsize == (
size_t) - 1)
451 return ptd.get_errno().value_or(0);
460 if (retsize > sizeInWords)
468 dst[retsize - 1] =
'\0';
486 __crt_cached_ptd_host
ptd;
487 return mbsrtowcs_s_internal(pRetValue,
dst, sizeInWords, ps,
n, pmbst,
ptd);
492 static_assert(
sizeof(
wchar_t) == 2,
"wchar_t is assumed to be 16 bits");
511 const char* current_src = *
src;
513 auto compute_available = [](
const char*
s) ->
size_t
520 else if (
s[1] ==
'\0')
524 else if (
s[2] ==
'\0')
533 wchar_t* current_dest =
dst;
536 const size_t avail = compute_available(current_src);
548 current_src =
nullptr;
549 *current_dest =
L'\0';
552 else if (c32 > 0xffff)
559 const char16_t high_surrogate =
static_cast<char16_t>((c32 >> 10) | 0xd800);
560 const char16_t low_surrogate =
static_cast<char16_t>((c32 & 0x03ff) | 0xdc00);
561 *current_dest++ = high_surrogate;
562 *current_dest++ = low_surrogate;
571 *current_dest++ =
static_cast<wchar_t>(c32);
576 return current_dest -
dst;
580 size_t total_count = 0;
581 for (;; ++total_count)
583 const size_t avail = compute_available(current_src);
ACPI_SIZE strlen(const char *String)
_Check_return_ __forceinline unsigned short __cdecl _isleadbyte_fast_internal(_In_ unsigned char const c, _In_ _locale_t const locale)
#define _UCRT_VALIDATE_RETURN(ptd, expr, errorcode, retexpr)
#define _UCRT_VALIDATE_RETURN_ERRCODE(ptd, expr, errorcode)
#define _ASSIGN_IF_NOT_NULL(_Pointer, _Value)
#define _RESET_STRING(_String, _Size)
result_buffer_count char *const _In_ int const _In_ bool const _In_ unsigned const _In_ STRFLT const _In_ bool const _Inout_ __crt_cached_ptd_host &ptd throw()
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
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
#define MB_ERR_INVALID_CHARS
wint_t __cdecl btowc(int)
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)
size_t __cdecl mbrlen(_In_reads_bytes_opt_(_SizeInBytes) _Pre_opt_z_ const char *_Ch, _In_ size_t _SizeInBytes, _Out_opt_ mbstate_t *_State)
#define _Deref_pre_opt_z_
size_t __cdecl __mbrtowc_utf8(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps, __crt_cached_ptd_host &ptd)
size_t __cdecl __mbrtoc32_utf8(char32_t *pc32, const char *s, size_t n, mbstate_t *ps, __crt_cached_ptd_host &ptd)
size_t __cdecl __mbsrtowcs_utf8(wchar_t *dst, const char **src, size_t len, mbstate_t *ps, __crt_cached_ptd_host &ptd)
constexpr size_t INCOMPLETE
#define _Out_range_(l, h)
#define _Out_writes_opt_z_(s)
#define _Post_satisfies_(e)