@@ -423,90 +423,10 @@ } @finally { free(UTF8String); } } -- (void)reverse -{ - size_t i, j; - - _s->hasHash = false; - - /* We reverse all bytes and restore UTF-8 later, if necessary */ - for (i = 0, j = _s->cStringLength - 1; i < _s->cStringLength / 2; - i++, j--) { - _s->cString[i] ^= _s->cString[j]; - _s->cString[j] ^= _s->cString[i]; - _s->cString[i] ^= _s->cString[j]; - } - - if (!_s->isUTF8) - return; - - for (i = 0; i < _s->cStringLength; i++) { - /* ASCII */ - if OF_LIKELY (!(_s->cString[i] & 0x80)) - continue; - - /* A start byte can't happen first as we reversed everything */ - if OF_UNLIKELY (_s->cString[i] & 0x40) - @throw [OFInvalidEncodingException exception]; - - /* Next byte must not be ASCII */ - if OF_UNLIKELY (_s->cStringLength < i + 1 || - !(_s->cString[i + 1] & 0x80)) - @throw [OFInvalidEncodingException exception]; - - /* Next byte is the start byte */ - if OF_LIKELY (_s->cString[i + 1] & 0x40) { - _s->cString[i] ^= _s->cString[i + 1]; - _s->cString[i + 1] ^= _s->cString[i]; - _s->cString[i] ^= _s->cString[i + 1]; - - i++; - continue; - } - - /* Second next byte must not be ASCII */ - if OF_UNLIKELY (_s->cStringLength < i + 2 || - !(_s->cString[i + 2] & 0x80)) - @throw [OFInvalidEncodingException exception]; - - /* Second next byte is the start byte */ - if OF_LIKELY (_s->cString[i + 2] & 0x40) { - _s->cString[i] ^= _s->cString[i + 2]; - _s->cString[i + 2] ^= _s->cString[i]; - _s->cString[i] ^= _s->cString[i + 2]; - - i += 2; - continue; - } - - /* Third next byte must not be ASCII */ - if OF_UNLIKELY (_s->cStringLength < i + 3 || - !(_s->cString[i + 3] & 0x80)) - @throw [OFInvalidEncodingException exception]; - - /* Third next byte is the start byte */ - if OF_LIKELY (_s->cString[i + 3] & 0x40) { - _s->cString[i] ^= _s->cString[i + 3]; - _s->cString[i + 3] ^= _s->cString[i]; - _s->cString[i] ^= _s->cString[i + 3]; - - _s->cString[i + 1] ^= _s->cString[i + 2]; - _s->cString[i + 2] ^= _s->cString[i + 1]; - _s->cString[i + 1] ^= _s->cString[i + 2]; - - i += 3; - continue; - } - - /* UTF-8 does not allow more than 4 bytes per character */ - @throw [OFInvalidEncodingException exception]; - } -} - - (void)insertString: (OFString *)string atIndex: (size_t)idx { size_t newCStringLength; if (idx > _s->length)