@@ -99,11 +99,11 @@ case 1: s->UTF8 = YES; break; case -1: @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } memcpy(s->cString, UTF8String, UTF8StringLength); s->cString[UTF8StringLength] = 0; } @catch (id e) { @@ -140,17 +140,17 @@ switch (of_string_check_utf8(cString, cStringLength, &s->length)) { case 1: if (encoding == OF_STRING_ENCODING_ASCII) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; s->UTF8 = YES; break; case -1: @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } memcpy(s->cString, cString, cStringLength); s->cString[cStringLength] = 0; @@ -174,11 +174,11 @@ bytes = of_string_unicode_to_utf8( (uint8_t)cString[i], buffer); if (bytes == 0) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; s->cStringLength += bytes - 1; s->cString = [self resizeMemory: s->cString size: s->cStringLength + 1]; @@ -199,11 +199,11 @@ case OF_STRING_ENCODING_WINDOWS_1252: table = of_windows_1252; break; default: @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } for (i = j = 0; i < cStringLength; i++) { char buffer[4]; of_unichar_t character; @@ -216,19 +216,19 @@ character = table[(uint8_t)cString[i]]; if (character == 0xFFFD) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; s->UTF8 = YES; characterBytes = of_string_unicode_to_utf8(character, buffer); if (characterBytes == 0) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; s->cStringLength += characterBytes - 1; s->cString = [self resizeMemory: s->cString size: s->cStringLength + 1]; @@ -332,11 +332,11 @@ j += 4; break; default: @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } } s->cString[j] = '\0'; @@ -387,18 +387,18 @@ size_t characterLen; /* Missing high surrogate */ if ((character & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; if ((character & 0xFC00) == 0xD800) { uint16_t nextCharacter; if (length <= i + 1) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; nextCharacter = (swap ? of_bswap16(string[i + 1]) : string[i + 1]); character = (((character & 0x3FF) << 10) | @@ -440,11 +440,11 @@ j += 4; break; default: @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } } s->cString[j] = '\0'; @@ -471,19 +471,19 @@ char *tmp; int cStringLength; if (format == nil) @throw [OFInvalidArgumentException - exceptionWithClass: isa + exceptionWithClass: [self class] selector: _cmd]; s = &s_store; if ((cStringLength = of_vasprintf(&tmp, [format UTF8String], arguments)) == -1) @throw [OFInvalidFormatException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; s->cStringLength = cStringLength; @try { switch (of_string_check_utf8(tmp, cStringLength, @@ -491,11 +491,11 @@ case 1: s->UTF8 = YES; break; case -1: @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } s->cString = [self allocMemoryWithSize: cStringLength + 1]; memcpy(s->cString, tmp, cStringLength + 1); @@ -583,16 +583,17 @@ case OF_STRING_ENCODING_UTF_8: return s->cString; case OF_STRING_ENCODING_ASCII: if (s->UTF8) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; return s->cString; default: - @throw [OFNotImplementedException exceptionWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException + exceptionWithClass: [self class] + selector: _cmd]; } } - (size_t)length { @@ -610,16 +611,17 @@ case OF_STRING_ENCODING_UTF_8: return s->cStringLength; case OF_STRING_ENCODING_ASCII: if (s->UTF8) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; return s->cStringLength; default: - @throw [OFNotImplementedException exceptionWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException + exceptionWithClass: [self class] + selector: _cmd]; } } - (BOOL)isEqual: (id)object { @@ -651,12 +653,13 @@ if (object == self) return OF_ORDERED_SAME; if (![object isKindOfClass: [OFString class]]) - @throw [OFInvalidArgumentException exceptionWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: [self class] + selector: _cmd]; otherString = object; otherCStringLength = [otherString UTF8StringLength]; minimumCStringLength = (s->cStringLength > otherCStringLength ? otherCStringLength : s->cStringLength); @@ -684,12 +687,13 @@ if (otherString == self) return OF_ORDERED_SAME; if (![otherString isKindOfClass: [OFString class]]) - @throw [OFInvalidArgumentException exceptionWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: [self class] + selector: _cmd]; otherCString = [otherString UTF8String]; otherCStringLength = [otherString UTF8StringLength]; if (!s->UTF8) { @@ -722,11 +726,11 @@ l2 = of_string_utf8_to_unicode(otherCString + j, otherCStringLength - j, &c2); if (l1 == 0 || l2 == 0 || c1 > 0x10FFFF || c2 > 0x10FFFF) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; if (c1 >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { of_unichar_t tc = of_unicode_casefolding_table[c1 >> 8][c1 & 0xFF]; @@ -774,11 +778,11 @@ size_t length; if ((length = of_string_utf8_to_unicode(s->cString + i, s->cStringLength - i, &c)) == 0) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; OF_HASH_ADD(hash, (c & 0xFF0000) >> 16); OF_HASH_ADD(hash, (c & 0x00FF00) >> 8); OF_HASH_ADD(hash, c & 0x0000FF); @@ -796,21 +800,22 @@ - (of_unichar_t)characterAtIndex: (size_t)index { of_unichar_t character; if (index >= s->length) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; if (!s->UTF8) return s->cString[index]; index = of_string_index_to_position(s->cString, index, s->cStringLength); if (!of_string_utf8_to_unicode(s->cString + index, s->cStringLength - index, &character)) - @throw [OFInvalidEncodingException exceptionWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: [self class]]; return character; } - (void)getCharacters: (of_unichar_t*)buffer @@ -888,11 +893,11 @@ { size_t start = range.start; size_t end = range.start + range.length; if (end > s->length) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; if (s->UTF8) { start = of_string_index_to_position(s->cString, start, s->cStringLength); end = of_string_index_to_position(s->cString, end, @@ -1107,11 +1112,11 @@ cLen = of_string_utf8_to_unicode(s->cString + i, s->cStringLength - i, &c); if (cLen == 0 || c > 0x10FFFF) @throw [OFInvalidEncodingException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; ret[j++] = c; i += cLen; }