19 for (i = 0; (u = string16[i]); i++) {
34 if ((u = string16[i]) == 0) {
37 if (u >= 0xDC00 && u < 0xE000) {
68 for (; (u = *string8); string8++) {
70 if ((u & 0x01 << 7) == 0) {
75 if ((u & 0x07 << 5) == 0xC0) {
80 if ((u & 0x0F << 4) == 0xE0) {
85 if ((u & 0x1F << 3) == 0xF0) {
92 if ((u & 0xC0) == 0x80) {
93 u32 = (u32 << 6) | (u & 0x3F);
102 if ((0 < u32 && u32 < 0xD800) || (0xE000 <= u32 && u32 < 0x10000)) {
105 else if (0x10000 <= u32 && u32 < 0x110000) {
117 char *out8end = out8 + size8;
120 if (!size8 || !in16 || !out8) {
125 for (; out8 < out8end && (u = *in16); in16++, out8++) {
129 else if (u < 0x0800) {
130 if (out8 + 1 >= out8end) {
133 *out8++ = (0x3 << 6) | (0x1F & (u >> 6));
134 *out8 = (0x1 << 7) | (0x3F & (u));
136 else if (u < 0xD800 || u >= 0xE000) {
137 if (out8 + 2 >= out8end) {
140 *out8++ = (0x7 << 5) | (0xF & (u >> 12));
141 *out8++ = (0x1 << 7) | (0x3F & (u >> 6));
142 *out8 = (0x1 << 7) | (0x3F & (u));
144 else if (u < 0xDC00) {
145 wchar_t u2 = *++in16;
150 if (
u2 >= 0xDC00 &&
u2 < 0xE000) {
151 if (out8 + 3 >= out8end) {
154 unsigned int uc = 0x10000 + (
u2 - 0xDC00) + ((u - 0xD800) << 10);
156 *out8++ = (0xF << 4) | (0x7 & (uc >> 18));
157 *out8++ = (0x1 << 7) | (0x3F & (uc >> 12));
158 *out8++ = (0x1 << 7) | (0x3F & (uc >> 6));
159 *out8 = (0x1 << 7) | (0x3F & (uc));
166 else if (u < 0xE000) {
172 *out8 = *out8end = 0;
185 unsigned int u32 = 0;
186 wchar_t *out16end = out16 + size16;
188 if (!size16 || !in8 || !out16) {
193 for (; out16 < out16end && (u = *in8); in8++) {
195 if ((u & 0x01 << 7) == 0) {
201 if ((u & 0x07 << 5) == 0xC0) {
206 if ((u & 0x0F << 4) == 0xE0) {
211 if ((u & 0x1F << 3) == 0xF0) {
219 if ((u & 0xC0) == 0x80) {
220 u32 = (u32 << 6) | (u & 0x3F);
230 if ((0 < u32 && u32 < 0xD800) || (0xE000 <= u32 && u32 < 0x10000)) {
234 else if (0x10000 <= u32 && u32 < 0x110000) {
235 if (out16 + 1 >= out16end) {
239 *out16 = 0xD800 + (u32 >> 10);
241 *out16 = 0xDC00 + (u32 & 0x3FF);
248 *out16 = *out16end = 0;
259 static int is_ascii(
const char *in8)
268 static void utf_8_cut_end(
char *inout8,
size_t maxcutpoint)
270 char *cur = inout8 + maxcutpoint;
286 out8 = (
char *)malloc(
sizeof(
char) * (bsize +
add));
294 wchar_t *out16 =
NULL;
298 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
bool add(void *owner, const AttributeIDRef &attribute_id, eAttrDomain domain, eCustomDataType data_type, const AttributeInit &initializer)
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