Changeset 1248
- Timestamp:
- 10/27/06 22:22:48 (7 years ago)
- File:
-
- 1 edited
-
libcaca/trunk/cucul/import.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cucul/import.c
r1245 r1248 407 407 { 408 408 unsigned int bytes; 409 /* Probably a wrong thing */ 410 if(((char const *)(buffer + i))[0] == 0) 409 410 if(i + 6 < size) 411 ch = cucul_utf8_to_utf32((char const *)(buffer + i), &bytes); 412 else 411 413 { 412 goto end; 414 /* Add a trailing zero to what we're going to read */ 415 char tmp[7]; 416 memcpy(tmp, buffer + i, size - i); 417 tmp[size - i] = '\0'; 418 ch = cucul_utf8_to_utf32(tmp, &bytes); 413 419 } 414 ch = cucul_utf8_to_utf32((char const *)(buffer + i), &bytes); 420 421 if(!bytes) 422 { 423 /* If the Unicode is invalid, assume it was latin1. */ 424 ch = buffer[i]; 425 bytes = 1; 426 } 415 427 wch = cucul_utf32_is_fullwidth(ch) ? 2 : 1; 416 428 skip += bytes - 1; … … 445 457 cucul_set_canvas_size(cv, width, height = y); 446 458 } 447 end: 459 448 460 return cv; 449 461 }
Note: See TracChangeset
for help on using the changeset viewer.
