21 ULONG *utf8_bytes_written,
33 if (!utf8_bytes_written)
35 if (utf8_dest && uni_bytes %
sizeof(
WCHAR))
41 for (
i = 0;
i < uni_bytes /
sizeof(
WCHAR);
i++)
45 if (ch >= 0xdc00 && ch <= 0xdfff)
50 else if (ch >= 0xd800 && ch <= 0xdbff)
52 if (
i + 1 < uni_bytes /
sizeof(
WCHAR))
56 if (uni_src[
i + 1] >= 0xdc00 && uni_src[
i + 1] <= 0xdfff)
58 ch |= uni_src[
i + 1] - 0xdc00;
79 utf8_ch[0] = ch & 0x7f;
84 utf8_ch[0] = 0xc0 | (ch >> 6 & 0x1f);
85 utf8_ch[1] = 0x80 | (ch >> 0 & 0x3f);
88 else if (ch < 0x10000)
90 utf8_ch[0] = 0xe0 | (ch >> 12 & 0x0f);
91 utf8_ch[1] = 0x80 | (ch >> 6 & 0x3f);
92 utf8_ch[2] = 0x80 | (ch >> 0 & 0x3f);
95 else if (ch < 0x200000)
97 utf8_ch[0] = 0xf0 | (ch >> 18 & 0x07);
98 utf8_ch[1] = 0x80 | (ch >> 12 & 0x3f);
99 utf8_ch[2] = 0x80 | (ch >> 6 & 0x3f);
100 utf8_ch[3] = 0x80 | (ch >> 0 & 0x3f);
106 written += utf8_ch_len;
110 if (utf8_bytes_max >= utf8_ch_len)
112 memcpy(utf8_dest, utf8_ch, utf8_ch_len);
113 utf8_dest += utf8_ch_len;
114 utf8_bytes_max -= utf8_ch_len;
115 written += utf8_ch_len;
124 *utf8_bytes_written = written;
133 ULONG *uni_bytes_written,
140 ULONG utf8_trail_bytes;
146 if (!uni_bytes_written)
152 for (
i = 0;
i < utf8_bytes;
i++)
155 ch = (
BYTE)utf8_src[
i];
156 utf8_trail_bytes = 0;
165 utf8_trail_bytes = 3;
170 utf8_trail_bytes = 2;
175 utf8_trail_bytes = 1;
185 if (
i + utf8_trail_bytes < utf8_bytes)
187 for (
j = 0;
j < utf8_trail_bytes;
j++)
189 if ((utf8_src[
i + 1] & 0xc0) == 0x80)
192 ch |= utf8_src[
i + 1] & 0x3f;
198 utf8_trail_bytes = 0;
207 utf8_trail_bytes = 0;
213 if ((ch > 0x10ffff) ||
214 (ch >= 0xd800 && ch <= 0xdfff) ||
215 (utf8_trail_bytes == 2 && ch < 0x00800) ||
216 (utf8_trail_bytes == 3 && ch < 0x10000))
219 utf16_ch[0] = 0xfffd;
220 utf16_ch[1] = 0xfffd;
221 utf16_ch[2] = 0xfffd;
222 utf16_ch_len = utf8_trail_bytes;
225 else if (ch >= 0x10000)
229 utf16_ch[0] = 0xd800 + (ch >> 10 & 0x3ff);
230 utf16_ch[1] = 0xdc00 + (ch >> 0 & 0x3ff);
242 written += utf16_ch_len;
246 for (
j = 0;
j < utf16_ch_len;
j++)
248 if (uni_bytes_max >=
sizeof(
WCHAR))
250 *uni_dest++ = utf16_ch[
j];
251 uni_bytes_max -=
sizeof(
WCHAR);
262 *uni_bytes_written = written *
sizeof(
WCHAR);
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
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 GLint GLint j
NTSTATUS NTAPI RtlUnicodeToUTF8N(CHAR *utf8_dest, ULONG utf8_bytes_max, ULONG *utf8_bytes_written, const WCHAR *uni_src, ULONG uni_bytes)
#define memcpy(s1, s2, n)
#define STATUS_INVALID_PARAMETER_4
#define STATUS_SOME_NOT_MAPPED
#define STATUS_INVALID_PARAMETER_5
#define RtlUTF8ToUnicodeN
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_INVALID_PARAMETER