26 else if( c < (
UTF_32)0x800 )
28 else if( c < (
UTF_32)0x10000 )
52 *total_bytes += bytes;
67 else if( c < (
UTF_32)0x800 )
69 else if( c < (
UTF_32)0x10000 )
93 *total_bytes += bytes;
97 static char *
hToUTF8(
const FB_WCHAR *src, ssize_t chars,
char *dst, ssize_t *bytes )
103 dst = malloc( chars * 4 );
111 case sizeof(
UTF_8 ):
131 *dst++ = (
unsigned char)*src++;
139 ssize_t i, dst_size = *bytes;
148 if( *bytes == dst_size )
150 dst_size +=
sizeof(
UTF_16 ) * 8;
151 buffer = realloc( buffer, dst_size );
155 *bytes +=
sizeof(
UTF_16 );
173 *bytes = chars *
sizeof(
UTF_16 );
182 memcpy( dst, src, chars *
sizeof(
UTF_16 ) );
191 dst = malloc( chars *
sizeof(
UTF_16 ) );
215 *dst++ = (
unsigned char)*src++;
232 *bytes -=
sizeof(
UTF_32 );
246 *bytes = chars *
sizeof(
UTF_32 );
255 memcpy( dst, src, chars *
sizeof(
UTF_32 ) );
264 dst = malloc( chars *
sizeof(
UTF_32 ) );
296 return hToUTF8( src, chars, dst, bytes );
299 return hToUTF16( src, chars, dst, bytes );
302 return hToUTF32( src, chars, dst, bytes );