if (IS_HIGH_SURROGATE(w))
{ if (s_check_rem(s, 2))
{
char16_t low;
in_uint16_le_unchecked(s, low); if (IS_LOW_SURROGATE(low))
{ /* Valid surrogate pair */
char32_t v = C32_FROM_SURROGATE_PAIR(low, w);
/* Ignore some values which can be successfully encoded
* in this way */ if (!IS_PLANE_END_NON_CHARACTER(c32))
{
c32 = v;
}
} else
{ /* Invalid low surrogate - pop character back */
s->p -= 2;
}
}
} elseif (!IS_LOW_SURROGATE(w) &&
!IS_PLANE_END_NON_CHARACTER(w) &&
!IS_ARABIC_NON_CHARACTER(w))
{ /* Character from the Basic Multilingual Plane */
c32 = (char32_t)w;
}
// Expansion of S_CHECK_REM(s, n*2) using passed-in file and line #ifdef USE_DEVEL_STREAMCHECK
parser_stream_overflow_check(s, n * 2, 0, file, line); #endif // Temporarily set the stream end pointer to allow us to use // s_check_rem() when reading in UTF-16 words if (s->end - s->p > (int)(n * 2))
{
s->end = s->p + (int)(n * 2);
}
while (s_check_rem(s, 2))
{
c32 = get_c32_from_stream(s);
u8len = utf_char32_to_utf8(c32, u8str); if (u8len + 1 <= vn)
{ /* Room for this character and a terminator. Add the character */ unsignedint i; for (i = 0 ; i < u8len ; ++i)
{
v[i] = u8str[i];
}
vn -= u8len;
v += u8len;
} elseif (vn > 1)
{ /* We've skipped a character, but there's more than one byte *remainingintheoutputbuffer.Marktheoutputbufferas *fullsowedon'tgetasmallercharacterbeingsqueezedinto
* the remaining space */
vn = 1;
}
rv += u8len;
}
// Restore stream to full length
s->end = saved_s_end;
u8len = utf_char32_to_utf8(c32, u8str); if (u8len + 1 <= vn)
{ /* Room for this character and a terminator. Add the character */ unsignedint i; for (i = 0 ; i < u8len ; ++i)
{
v[i] = u8str[i];
}
vn -= u8len;
v += u8len;
} elseif (vn > 1)
{ /* We've skipped a character, but there's more than one byte *remainingintheoutputbuffer.Marktheoutputbufferas *fullsowedon'tgetasmallercharacterbeingsqueezedinto
* the remaining space */
vn = 1;
}
rv += u8len;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.