@@ -350,11 +350,11 @@ } j = 0; for (size_t i = 0; i < cStringLength; i++) { unsigned char character = (unsigned char)cString[i]; - of_unichar_t unichar; + OFUnichar unichar; char buffer[4]; size_t byteLength; if (character < tableOffset) { _s->cString[j++] = cString[i]; @@ -459,11 +459,11 @@ } return self; } -- (instancetype)initWithCharacters: (const of_unichar_t *)characters +- (instancetype)initWithCharacters: (const OFUnichar *)characters length: (size_t)length { self = [super init]; @try { @@ -531,11 +531,11 @@ _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { - of_unichar_t character = + OFUnichar character = (swap ? OF_BSWAP16(string[i]) : string[i]); size_t len; /* Missing high surrogate */ if ((character & 0xFC00) == 0xDC00) @@ -867,11 +867,11 @@ } i = j = 0; while (i < _s->cStringLength && j < otherCStringLength) { - of_unichar_t c1, c2; + OFUnichar c1, c2; ssize_t l1, l2; l1 = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c1); l2 = of_string_utf8_decode(otherCString + j, @@ -879,19 +879,19 @@ if (l1 <= 0 || l2 <= 0 || c1 > 0x10FFFF || c2 > 0x10FFFF) @throw [OFInvalidEncodingException exception]; if (c1 >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { - of_unichar_t tc = + OFUnichar tc = of_unicode_casefolding_table[c1 >> 8][c1 & 0xFF]; if (tc) c1 = tc; } if (c2 >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { - of_unichar_t tc = + OFUnichar tc = of_unicode_casefolding_table[c2 >> 8][c2 & 0xFF]; if (tc) c2 = tc; } @@ -922,11 +922,11 @@ return _s->hash; OF_HASH_INIT(hash); for (size_t i = 0; i < _s->cStringLength; i++) { - of_unichar_t c; + OFUnichar c; ssize_t length; if ((length = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c)) <= 0) @throw [OFInvalidEncodingException exception]; @@ -944,13 +944,13 @@ _s->hashed = true; return hash; } -- (of_unichar_t)characterAtIndex: (size_t)idx +- (OFUnichar)characterAtIndex: (size_t)idx { - of_unichar_t character; + OFUnichar character; if (idx >= _s->length) @throw [OFOutOfRangeException exception]; if (!_s->isUTF8) @@ -963,22 +963,22 @@ @throw [OFInvalidEncodingException exception]; return character; } -- (void)getCharacters: (of_unichar_t *)buffer inRange: (OFRange)range +- (void)getCharacters: (OFUnichar *)buffer inRange: (OFRange)range { /* TODO: Could be slightly optimized */ void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; if (range.length > SIZE_MAX - range.location || range.location + range.length > _s->length) @throw [OFOutOfRangeException exception]; memcpy(buffer, characters + range.location, - range.length * sizeof(of_unichar_t)); + range.length * sizeof(OFUnichar)); objc_autoreleasePoolPop(pool); } - (OFRange)rangeOfString: (OFString *)string @@ -1150,17 +1150,17 @@ objc_autoreleasePoolPop(pool); return array; } -- (const of_unichar_t *)characters +- (const OFUnichar *)characters { - of_unichar_t *buffer = of_alloc(_s->length, sizeof(of_unichar_t)); + OFUnichar *buffer = of_alloc(_s->length, sizeof(OFUnichar)); size_t i = 0, j = 0; while (i < _s->cStringLength) { - of_unichar_t c; + OFUnichar c; ssize_t cLen; cLen = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c); @@ -1173,11 +1173,11 @@ i += cLen; } return [[OFData dataWithItemsNoCopy: buffer count: _s->length - itemSize: sizeof(of_unichar_t) + itemSize: sizeof(OFUnichar) freeWhenDone: true] items]; } - (const of_char32_t *)UTF32StringWithByteOrder: (OFByteOrder)byteOrder {