Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -156,11 +156,11 @@ ivars->cStringLength = cStringLength; switch (of_string_utf8_check(ivars->cString, ivars->cStringLength, &ivars->length)) { case 1: - ivars->UTF8 = YES; + ivars->isUTF8 = YES; break; case -1: free(ivars); @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; Index: src/OFMutableString_UTF8.m ================================================================== --- src/OFMutableString_UTF8.m +++ src/OFMutableString_UTF8.m @@ -59,11 +59,11 @@ size_t unicodeLen, newCStringLength; size_t i, j; char *newCString; BOOL isStart = YES; - if (!s->UTF8) { + if (!s->isUTF8) { uint8_t t; const of_unichar_t *const *table; assert(startTableSize >= 1 && middleTableSize >= 1); @@ -203,11 +203,11 @@ { char buffer[4]; of_unichar_t c; size_t lenNew, lenOld; - if (s->UTF8) + if (s->isUTF8) index = of_string_utf8_get_position(s->cString, index, s->cStringLength); if (index > s->cStringLength) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; @@ -245,11 +245,11 @@ s->cStringLength -= lenOld; s->cStringLength += lenNew; s->cString[s->cStringLength] = '\0'; if (character & 0x80) - s->UTF8 = YES; + s->isUTF8 = YES; } else if (lenNew < lenOld) { memmove(s->cString + index + lenNew, s->cString + index + lenOld, s->cStringLength - index - lenOld); memcpy(s->cString + index, buffer, lenNew); @@ -278,11 +278,11 @@ UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { case 1: - s->UTF8 = YES; + s->isUTF8 = YES; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -307,11 +307,11 @@ UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { case 1: - s->UTF8 = YES; + s->isUTF8 = YES; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -376,14 +376,14 @@ s->cString[s->cStringLength] = 0; if ([string isKindOfClass: [OFString_UTF8 class]] || [string isKindOfClass: [OFMutableString_UTF8 class]]) { - if (((OFString_UTF8*)string)->s->UTF8) - s->UTF8 = YES; + if (((OFString_UTF8*)string)->s->isUTF8) + s->isUTF8 = YES; } else - s->UTF8 = YES; + s->isUTF8 = YES; } - (void)appendFormat: (OFConstantString*)format withArguments: (va_list)arguments { @@ -420,11 +420,11 @@ s->cString[i] ^= s->cString[j]; s->cString[j] ^= s->cString[i]; s->cString[i] ^= s->cString[j]; } - if (!s->UTF8) + if (!s->isUTF8) return; for (i = 0; i < s->cStringLength; i++) { /* ASCII */ if OF_LIKELY (!(s->cString[i] & 0x80)) @@ -500,11 +500,11 @@ if (index > s->length) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; - if (s->UTF8) + if (s->isUTF8) index = of_string_utf8_get_position(s->cString, index, s->cStringLength); newCStringLength = s->cStringLength + [string UTF8StringLength]; s->hashed = NO; @@ -520,14 +520,14 @@ s->cStringLength = newCStringLength; s->length += [string length]; if ([string isKindOfClass: [OFString_UTF8 class]] || [string isKindOfClass: [OFMutableString_UTF8 class]]) { - if (((OFString_UTF8*)string)->s->UTF8) - s->UTF8 = YES; + if (((OFString_UTF8*)string)->s->isUTF8) + s->isUTF8 = YES; } else - s->UTF8 = YES; + s->isUTF8 = YES; } - (void)deleteCharactersInRange: (of_range_t)range { size_t start = range.start; @@ -537,11 +537,11 @@ @throw [OFOutOfRangeException exceptionWithClass: [self class]]; s->hashed = NO; s->length -= end - start; - if (s->UTF8) { + if (s->isUTF8) { start = of_string_utf8_get_position(s->cString, start, s->cStringLength); end = of_string_utf8_get_position(s->cString, end, s->cStringLength); } @@ -568,11 +568,11 @@ if (end > s->length) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; newLength = s->length - (end - start) + [replacement length]; - if (s->UTF8) { + if (s->isUTF8) { start = of_string_utf8_get_position(s->cString, start, s->cStringLength); end = of_string_utf8_get_position(s->cString, end, s->cStringLength); } @@ -602,11 +602,11 @@ size_t searchLength = [string UTF8StringLength]; size_t replacementLength = [replacement UTF8StringLength]; size_t i, last, newCStringLength, newLength; char *newCString; - if (s->UTF8) { + if (s->isUTF8) { range.start = of_string_utf8_get_position(s->cString, range.start, s->cStringLength); range.length = of_string_utf8_get_position(s->cString, range.start + range.length, s->cStringLength) - range.start; } Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -625,11 +625,11 @@ /** * \brief Returns the range of the string. * * \param string The string to search - * \param options Options modifying search behaviour. + * \param options Options modifying search behaviour * \return The range of the first occurrence of the string or a range with * OF_INVALID_INDEX as start position if it was not found */ - (of_range_t)rangeOfString: (OFString*)string options: (of_string_search_options_t)options; Index: src/OFString_UTF8.h ================================================================== --- src/OFString_UTF8.h +++ src/OFString_UTF8.h @@ -27,11 +27,11 @@ * &s_store. */ struct of_string_utf8_ivars { char *cString; size_t cStringLength; - BOOL UTF8; + BOOL isUTF8; size_t length; BOOL hashed; uint32_t hash; char *freeWhenDone; } *restrict s; Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -254,11 +254,11 @@ s->cStringLength = UTF8StringLength; switch (of_string_utf8_check(UTF8String, UTF8StringLength, &s->length)) { case 1: - s->UTF8 = YES; + s->isUTF8 = YES; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -301,11 +301,11 @@ case 1: if (encoding == OF_STRING_ENCODING_ASCII) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; - s->UTF8 = YES; + s->isUTF8 = YES; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -327,11 +327,11 @@ if (!(cString[i] & 0x80)) { s->cString[j++] = cString[i]; continue; } - s->UTF8 = YES; + s->isUTF8 = YES; bytes = of_string_utf8_encode( (uint8_t)cString[i], buffer); if (bytes == 0) @throw [OFInvalidEncodingException @@ -377,11 +377,11 @@ if (character == 0xFFFD) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; - s->UTF8 = YES; + s->isUTF8 = YES; characterBytes = of_string_utf8_encode(character, buffer); if (characterBytes == 0) @throw [OFInvalidEncodingException @@ -427,11 +427,11 @@ s->cStringLength = UTF8StringLength; switch (of_string_utf8_check(UTF8String, UTF8StringLength, &s->length)) { case 1: - s->UTF8 = YES; + s->isUTF8 = YES; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -452,13 +452,13 @@ s->cStringLength = [string UTF8StringLength]; if ([string isKindOfClass: [OFString_UTF8 class]] || [string isKindOfClass: [OFMutableString_UTF8 class]]) - s->UTF8 = ((OFString_UTF8*)string)->s->UTF8; + s->isUTF8 = ((OFString_UTF8*)string)->s->isUTF8; else - s->UTF8 = YES; + s->isUTF8 = YES; s->length = [string length]; s->cString = [self allocMemoryWithSize: s->cStringLength + 1]; memcpy(s->cString, [string UTF8String], s->cStringLength + 1); @@ -505,27 +505,27 @@ switch (characterLen) { case 1: s->cString[j++] = buffer[0]; break; case 2: - s->UTF8 = YES; + s->isUTF8 = YES; s->cStringLength++; memcpy(s->cString + j, buffer, 2); j += 2; break; case 3: - s->UTF8 = YES; + s->isUTF8 = YES; s->cStringLength += 2; memcpy(s->cString + j, buffer, 3); j += 3; break; case 4: - s->UTF8 = YES; + s->isUTF8 = YES; s->cStringLength += 3; memcpy(s->cString + j, buffer, 4); j += 4; @@ -612,27 +612,27 @@ switch (characterLen) { case 1: s->cString[j++] = buffer[0]; break; case 2: - s->UTF8 = YES; + s->isUTF8 = YES; s->cStringLength++; memcpy(s->cString + j, buffer, 2); j += 2; break; case 3: - s->UTF8 = YES; + s->isUTF8 = YES; s->cStringLength += 2; memcpy(s->cString + j, buffer, 3); j += 3; break; case 4: - s->UTF8 = YES; + s->isUTF8 = YES; s->cStringLength += 3; memcpy(s->cString + j, buffer, 4); j += 4; @@ -684,11 +684,11 @@ @try { switch (of_string_utf8_check(tmp, cStringLength, &s->length)) { case 1: - s->UTF8 = YES; + s->isUTF8 = YES; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -722,13 +722,13 @@ s->cStringLength = [firstComponent UTF8StringLength]; if ([firstComponent isKindOfClass: [OFString_UTF8 class]] || [firstComponent isKindOfClass: [OFMutableString_UTF8 class]]) - s->UTF8 = ((OFString_UTF8*)firstComponent)->s->UTF8; + s->isUTF8 = ((OFString_UTF8*)firstComponent)->s->isUTF8; else - s->UTF8 = YES; + s->isUTF8 = YES; s->length = [firstComponent length]; /* Calculate length and see if we need UTF-8 */ va_copy(argumentsCopy, arguments); @@ -737,13 +737,14 @@ s->length += 1 + [component length]; if ([component isKindOfClass: [OFString_UTF8 class]] || [component isKindOfClass: [OFMutableString_UTF8 class]]) - s->UTF8 = ((OFString_UTF8*)component)->s->UTF8; + s->isUTF8 = + ((OFString_UTF8*)component)->s->isUTF8; else - s->UTF8 = YES; + s->isUTF8 = YES; } s->cString = [self allocMemoryWithSize: s->cStringLength + 1]; cStringLength = [firstComponent UTF8StringLength]; @@ -786,11 +787,11 @@ { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cString; case OF_STRING_ENCODING_ASCII: - if (s->UTF8) + if (s->isUTF8) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; return s->cString; default: @@ -814,11 +815,11 @@ { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cStringLength; case OF_STRING_ENCODING_ASCII: - if (s->UTF8) + if (s->isUTF8) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; return s->cStringLength; default: @@ -899,11 +900,11 @@ selector: _cmd]; otherCString = [otherString UTF8String]; otherCStringLength = [otherString UTF8StringLength]; - if (!s->UTF8) { + if (!s->isUTF8) { minimumCStringLength = (s->cStringLength > otherCStringLength ? otherCStringLength : s->cStringLength); if ((compare = memcasecmp(s->cString, otherCString, minimumCStringLength)) == 0) { @@ -1007,11 +1008,11 @@ of_unichar_t character; if (index >= s->length) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; - if (!s->UTF8) + if (!s->isUTF8) return s->cString[index]; index = of_string_utf8_get_position(s->cString, index, s->cStringLength); @@ -1094,11 +1095,11 @@ size_t end = range.start + range.length; if (end > s->length) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; - if (s->UTF8) { + if (s->isUTF8) { start = of_string_utf8_get_position(s->cString, start, s->cStringLength); end = of_string_utf8_get_position(s->cString, end, s->cStringLength); }