135{
140 ULONG utf8_trail_bytes;
143
144 if (!utf8_src)
146 if (!uni_bytes_written)
148
149 written = 0;
151
152 for (
i = 0;
i < utf8_bytes;
i++)
153 {
154
156 utf8_trail_bytes = 0;
158 {
161 }
163 {
165 utf8_trail_bytes = 3;
166 }
168 {
170 utf8_trail_bytes = 2;
171 }
173 {
175 utf8_trail_bytes = 1;
176 }
178 {
179
182 }
183
184
185 if (
i + utf8_trail_bytes < utf8_bytes)
186 {
187 for (
j = 0;
j < utf8_trail_bytes;
j++)
188 {
189 if ((utf8_src[
i + 1] & 0xc0) == 0x80)
190 {
192 ch |= utf8_src[
i + 1] & 0x3f;
194 }
195 else
196 {
198 utf8_trail_bytes = 0;
200 break;
201 }
202 }
203 }
204 else
205 {
207 utf8_trail_bytes = 0;
210 }
211
212
213 if ((
ch > 0x10ffff) ||
214 (
ch >= 0xd800 &&
ch <= 0xdfff) ||
215 (utf8_trail_bytes == 2 &&
ch < 0x00800) ||
216 (utf8_trail_bytes == 3 &&
ch < 0x10000))
217 {
218
219 utf16_ch[0] = 0xfffd;
220 utf16_ch[1] = 0xfffd;
221 utf16_ch[2] = 0xfffd;
222 utf16_ch_len = utf8_trail_bytes;
224 }
225 else if (
ch >= 0x10000)
226 {
227
229 utf16_ch[0] = 0xd800 + (
ch >> 10 & 0x3ff);
230 utf16_ch[1] = 0xdc00 + (
ch >> 0 & 0x3ff);
231 utf16_ch_len = 2;
232 }
233 else
234 {
235
237 utf16_ch_len = 1;
238 }
239
240 if (!uni_dest)
241 {
242 written += utf16_ch_len;
243 continue;
244 }
245
246 for (
j = 0;
j < utf16_ch_len;
j++)
247 {
248 if (uni_bytes_max >=
sizeof(
WCHAR))
249 {
250 *uni_dest++ = utf16_ch[
j];
251 uni_bytes_max -=
sizeof(
WCHAR);
252 written++;
253 }
254 else
255 {
256 uni_bytes_max = 0;
258 }
259 }
260 }
261
262 *uni_bytes_written = written *
sizeof(
WCHAR);
264}
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