18 __crt_cached_ptd_host
ptd;
47 const bool init_state = (ps->_State == 0);
53 if ((first_byte & 0x80) == 0)
59 return first_byte !=
'\0' ? 1 : 0;
62 if ((first_byte & 0xe0) == 0xc0)
66 else if ((first_byte & 0xf0) == 0xe0)
70 else if ((first_byte & 0xf8) == 0xf0)
80 c32 = first_byte & ((1 << (7 -
length)) - 1);
86 bytes_needed =
static_cast<uint8_t>(ps->_State);
91 if (length < 2 || length > 4 || bytes_needed < 1 || bytes_needed >=
length)
105 while (
static_cast<size_t>(
s -
begin) <
n)
108 if ((current_byte & 0xc0) != 0x80)
113 c32 = (c32 << 6) | (current_byte & 0x3f);
116 if (
n < bytes_needed)
119 auto bytes_remaining =
static_cast<uint8_t>(bytes_needed -
n);
120 static_assert(
sizeof(mbstate_t::_Wchar) >=
sizeof(
char32_t),
"mbstate_t has broken mbrtoc32");
123 ps->_State = bytes_remaining;
127 if ((0xd800 <= c32 && c32 <= 0xdfff) || (0x10ffff < c32))
133 constexpr char32_t min_legal[3]{ 0x80, 0x800, 0x10000 };
134 if (c32 < min_legal[
length - 2])
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
GLuint GLsizei GLsizei * length
size_t __cdecl mbrtoc32(char32_t *pc32, const char *s, size_t n, mbstate_t *ps)
size_t __cdecl __mbrtoc32_utf8(char32_t *pc32, const char *s, size_t n, mbstate_t *ps, __crt_cached_ptd_host &ptd)
size_t return_illegal_sequence(mbstate_t *ps, __crt_cached_ptd_host &ptd)
size_t reset_and_return(size_t retval, mbstate_t *ps)
constexpr size_t INCOMPLETE