32 for (i = 0; (u = string16[i]); i++) {
47 if ((u = string16[i]) == 0) {
50 if (u >= 0xDC00 && u < 0xE000) {
80 for (; (u = *string8); string8++) {
82 if ((u & 0x01 << 7) == 0) {
87 if ((u & 0x07 << 5) == 0xC0) {
92 if ((u & 0x0F << 4) == 0xE0) {
97 if ((u & 0x1F << 3) == 0xF0) {
105 if ((u & 0xC0) == 0x80) {
106 u32 = (u32 << 6) | (u & 0x3F);
116 if ((0 < u32 && u32 < 0xD800) || (0xE000 <= u32 && u32 < 0x10000))
118 else if (0x10000 <= u32 && u32 < 0x110000)
129 char *out8end = out8 + size8;
132 if (!size8 || !in16 || !out8)
136 for (; out8 < out8end && (u = *in16); in16++, out8++) {
140 else if (u < 0x0800) {
141 if (out8 + 1 >= out8end)
143 *out8++ = (0x3 << 6) | (0x1F & (u >> 6));
144 *out8 = (0x1 << 7) | (0x3F & (u));
146 else if (u < 0xD800 || u >= 0xE000) {
147 if (out8 + 2 >= out8end)
149 *out8++ = (0x7 << 5) | (0xF & (u >> 12));
150 *out8++ = (0x1 << 7) | (0x3F & (u >> 6));
151 *out8 = (0x1 << 7) | (0x3F & (u));
153 else if (u < 0xDC00) {
154 wchar_t u2 = *++in16;
158 if (
u2 >= 0xDC00 &&
u2 < 0xE000) {
159 if (out8 + 3 >= out8end)
162 unsigned int uc = 0x10000 + (
u2 - 0xDC00) + ((u - 0xD800) << 10);
164 *out8++ = (0xF << 4) | (0x7 & (uc >> 18));
165 *out8++ = (0x1 << 7) | (0x3F & (uc >> 12));
166 *out8++ = (0x1 << 7) | (0x3F & (uc >> 6));
167 *out8 = (0x1 << 7) | (0x3F & (uc));
175 else if (u < 0xE000) {
181 *out8 = *out8end = 0;
193 unsigned int u32 = 0;
194 wchar_t *out16end = out16 + size16;
196 if (!size16 || !in8 || !out16)
200 for (; out16 < out16end && (u = *in8); in8++) {
202 if ((u & 0x01 << 7) == 0) {
208 if ((u & 0x07 << 5) == 0xC0) {
213 if ((u & 0x0F << 4) == 0xE0) {
218 if ((u & 0x1F << 3) == 0xF0) {
227 if ((u & 0xC0) == 0x80) {
228 u32 = (u32 << 6) | (u & 0x3F);
238 if ((0 < u32 && u32 < 0xD800) || (0xE000 <= u32 && u32 < 0x10000)) {
242 else if (0x10000 <= u32 && u32 < 0x110000) {
243 if (out16 + 1 >= out16end)
246 *out16 = 0xD800 + (u32 >> 10);
248 *out16 = 0xDC00 + (u32 & 0x3FF);
255 *out16 = *out16end = 0;
265 static int is_ascii(
const char *in8)
274 static void utf_8_cut_end(
char *inout8,
size_t maxcutpoint)
276 char *cur = inout8 + maxcutpoint;
291 out8 = (
char *)malloc(
sizeof(
char) * (bsize +
add));
299 wchar_t *out16 =
NULL;
302 out16 = (
wchar_t *)malloc(
sizeof(
wchar_t) * (bsize +
add));
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble u2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
static void add(GHash *messages, MemArena *memarena, const Message *msg)
size_t count_utf_8_from_16(const wchar_t *string16)
wchar_t * alloc_utf16_from_8(const char *in8, size_t add)
int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16)
char * alloc_utf_8_from_16(const wchar_t *in16, size_t add)
int conv_utf_16_to_8(const wchar_t *in16, char *out8, size_t size8)
size_t count_utf_16_from_8(const char *string8)
#define UTF_ERROR_ILLCHAR
#define UTF_ERROR_NULL_IN