106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
madvise((void*)str, len, MADV_NORMAL);
return utf8;
}
size_t
of_string_unicode_to_utf8(uint32_t c, char *buf)
{
size_t i = 0;
if (c < 0x80) {
buf[i] = c;
return 1;
}
|
|
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
madvise((void*)str, len, MADV_NORMAL);
return utf8;
}
size_t
of_string_unicode_to_utf8(of_unichar_t c, char *buf)
{
size_t i = 0;
if (c < 0x80) {
buf[i] = c;
return 1;
}
|
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
case OF_STRING_ENCODING_ISO_8859_15:
case OF_STRING_ENCODING_WINDOWS_1252:
for (i = j = 0; i < len; i++) {
if ((uint8_t)str[i] < 0x80)
string[j++] = str[i];
else {
char buf[4];
uint32_t chr;
size_t chr_bytes;
switch (encoding) {
case OF_STRING_ENCODING_ISO_8859_1:
chr = (uint8_t)str[i];
break;
case OF_STRING_ENCODING_ISO_8859_15:
|
|
|
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
case OF_STRING_ENCODING_ISO_8859_15:
case OF_STRING_ENCODING_WINDOWS_1252:
for (i = j = 0; i < len; i++) {
if ((uint8_t)str[i] < 0x80)
string[j++] = str[i];
else {
char buf[4];
of_unichar_t chr;
size_t chr_bytes;
switch (encoding) {
case OF_STRING_ENCODING_ISO_8859_1:
chr = (uint8_t)str[i];
break;
case OF_STRING_ENCODING_ISO_8859_15:
|