Differences From Artifact [fc310b0712]:
- File
src/OFString_UTF8.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 30406) [annotate] [blame] [check-ins using]
To Artifact [b63159ccbd]:
- File src/OFString_UTF8.m — part of check-in [37d2a81754] at 2017-05-07 21:25:56 on branch trunk — Use char{16,32}_t instead of of_char{16,32}_t (user: js, size: 30355) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
33 34 35 36 37 38 39 | #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "of_asprintf.h" #import "unicode.h" | | | | | | | | | | | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "of_asprintf.h" #import "unicode.h" extern const char16_t of_iso_8859_2_table[]; extern const size_t of_iso_8859_2_table_offset; extern const char16_t of_iso_8859_3_table[]; extern const size_t of_iso_8859_3_table_offset; extern const char16_t of_iso_8859_15_table[]; extern const size_t of_iso_8859_15_table_offset; extern const char16_t of_windows_1251_table[]; extern const size_t of_windows_1251_table_offset; extern const char16_t of_windows_1252_table[]; extern const size_t of_windows_1252_table_offset; extern const char16_t of_codepage_437_table[]; extern const size_t of_codepage_437_table_offset; extern const char16_t of_codepage_850_table[]; extern const size_t of_codepage_850_table_offset; extern const char16_t of_codepage_858_table[]; extern const size_t of_codepage_858_table_offset; extern const char16_t of_mac_roman_table[]; extern const size_t of_mac_roman_table_offset; extern const char16_t of_koi8_r_table[]; extern const size_t of_koi8_r_table_offset; extern const char16_t of_koi8_u_table[]; extern const size_t of_koi8_u_table_offset; static inline int memcasecmp(const char *first, const char *second, size_t length) { for (size_t i = 0; i < length; i++) { unsigned char f = first[i]; |
︙ | ︙ | |||
227 228 229 230 231 232 233 | - initWithCString: (const char *)cString encoding: (of_string_encoding_t)encoding length: (size_t)cStringLength { self = [super init]; @try { | | | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | - initWithCString: (const char *)cString encoding: (of_string_encoding_t)encoding length: (size_t)cStringLength { self = [super init]; @try { const char16_t *table; size_t tableOffset, j; if (encoding == OF_STRING_ENCODING_UTF_8 && cStringLength >= 3 && memcmp(cString, "\xEF\xBB\xBF", 3) == 0) { cString += 3; cStringLength -= 3; |
︙ | ︙ | |||
493 494 495 496 497 498 499 | [self release]; @throw e; } return self; } | | | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | [self release]; @throw e; } return self; } - initWithUTF16String: (const char16_t *)string length: (size_t)length byteOrder: (of_byte_order_t)byteOrder { self = [super init]; @try { size_t j; |
︙ | ︙ | |||
529 530 531 532 533 534 535 | size_t len; /* Missing high surrogate */ if ((character & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException exception]; if ((character & 0xFC00) == 0xD800) { | | | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | size_t len; /* Missing high surrogate */ if ((character & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException exception]; if ((character & 0xFC00) == 0xD800) { char16_t nextCharacter; if (length <= i + 1) @throw [OFInvalidEncodingException exception]; nextCharacter = (swap ? OF_BSWAP16(string[i + 1]) |
︙ | ︙ | |||
578 579 580 581 582 583 584 | [self release]; @throw e; } return self; } | | | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | [self release]; @throw e; } return self; } - initWithUTF32String: (const char32_t *)characters length: (size_t)length byteOrder: (of_byte_order_t)byteOrder { self = [super init]; @try { size_t j; |
︙ | ︙ | |||
1275 1276 1277 1278 1279 1280 1281 | ret[j++] = c; i += cLen; } return ret; } | | | | 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 | ret[j++] = c; i += cLen; } return ret; } - (const char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder { OFObject *object = [[[OFObject alloc] init] autorelease]; char32_t *ret; size_t i, j; ret = [object allocMemoryWithSize: sizeof(of_unichar_t) count: _s->length + 1]; i = j = 0; |
︙ | ︙ |