@@ -67,12 +67,12 @@ { for (size_t i = 0; i < length; i++) { unsigned char f = first[i]; unsigned char s = second[i]; - f = of_ascii_toupper(f); - s = of_ascii_toupper(s); + f = OFASCIIToUpper(f); + s = OFASCIIToUpper(s); if (f > s) return OFOrderedDescending; if (f < s) return OFOrderedAscending; @@ -532,11 +532,11 @@ _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { OFUnichar character = - (swap ? OF_BSWAP16(string[i]) : string[i]); + (swap ? OFByteSwap16(string[i]) : string[i]); size_t len; /* Missing high surrogate */ if ((character & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException exception]; @@ -547,11 +547,11 @@ if (length <= i + 1) @throw [OFInvalidEncodingException exception]; nextCharacter = (swap - ? OF_BSWAP16(string[i + 1]) + ? OFByteSwap16(string[i + 1]) : string[i + 1]); if ((nextCharacter & 0xFC00) != 0xDC00) @throw [OFInvalidEncodingException exception]; @@ -617,12 +617,13 @@ _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { char buffer[4]; - size_t len = of_string_utf8_encode( - (swap ? OF_BSWAP32(characters[i]) : characters[i]), + size_t len = of_string_utf8_encode((swap + ? OFByteSwap32(characters[i]) + : characters[i]), buffer); switch (len) { case 1: _s->cString[j++] = buffer[0]; @@ -914,33 +915,33 @@ return OFOrderedSame; } - (unsigned long)hash { - uint32_t hash; + unsigned long hash; if (_s->hashed) return _s->hash; - OF_HASH_INIT(hash); + OFHashInit(&hash); for (size_t i = 0; i < _s->cStringLength; i++) { OFUnichar c; ssize_t length; if ((length = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c)) <= 0) @throw [OFInvalidEncodingException exception]; - OF_HASH_ADD(hash, (c & 0xFF0000) >> 16); - OF_HASH_ADD(hash, (c & 0x00FF00) >> 8); - OF_HASH_ADD(hash, c & 0x0000FF); + OFHashAdd(&hash, (c & 0xFF0000) >> 16); + OFHashAdd(&hash, (c & 0x00FF00) >> 8); + OFHashAdd(&hash, c & 0x0000FF); i += length - 1; } - OF_HASH_FINALIZE(hash); + OFHashFinalize(&hash); _s->hash = hash; _s->hashed = true; return hash; @@ -1195,11 +1196,11 @@ OFFreeMemory(buffer); @throw [OFInvalidEncodingException exception]; } if (byteOrder != OFByteOrderNative) - buffer[j++] = OF_BSWAP32(c); + buffer[j++] = OFByteSwap32(c); else buffer[j++] = c; i += cLen; }