@@ -186,11 +186,11 @@ _s->cStringLength = UTF8StringLength; switch (of_string_utf8_check(UTF8String, UTF8StringLength, &_s->length)) { case 1: - _s->isUTF8 = YES; + _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -233,11 +233,11 @@ case 1: if (encoding == OF_STRING_ENCODING_ASCII) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; - _s->isUTF8 = YES; + _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -259,11 +259,11 @@ if (!(cString[i] & 0x80)) { _s->cString[j++] = cString[i]; continue; } - _s->isUTF8 = YES; + _s->isUTF8 = true; bytes = of_string_utf8_encode( (uint8_t)cString[i], buffer); if (bytes == 0) @throw [OFInvalidEncodingException @@ -309,11 +309,11 @@ if (character == 0xFFFD) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; - _s->isUTF8 = YES; + _s->isUTF8 = true; characterBytes = of_string_utf8_encode(character, buffer); if (characterBytes == 0) @throw [OFInvalidEncodingException @@ -336,11 +336,11 @@ return self; } - initWithUTF8StringNoCopy: (char*)UTF8String - freeWhenDone: (BOOL)freeWhenDone + freeWhenDone: (bool)freeWhenDone { self = [super init]; @try { size_t UTF8StringLength = strlen(UTF8String); @@ -360,11 +360,11 @@ _s->freeWhenDone = UTF8String; switch (of_string_utf8_check(UTF8String, UTF8StringLength, &_s->length)) { case 1: - _s->isUTF8 = YES; + _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -387,11 +387,11 @@ if ([string isKindOfClass: [OFString_UTF8 class]] || [string isKindOfClass: [OFMutableString_UTF8 class]]) _s->isUTF8 = ((OFString_UTF8*)string)->_s->isUTF8; else - _s->isUTF8 = YES; + _s->isUTF8 = true; _s->length = [string length]; _s->cString = [self allocMemoryWithSize: _s->cStringLength + 1]; memcpy(_s->cString, [string UTF8String], _s->cStringLength + 1); @@ -426,11 +426,11 @@ _s->cString[j++] = buffer[0]; break; case 2: case 3: case 4: - _s->isUTF8 = YES; + _s->isUTF8 = true; memcpy(_s->cString + j, buffer, len); j += len; break; @@ -463,21 +463,21 @@ { self = [super init]; @try { size_t i, j = 0; - BOOL swap = NO; + bool swap = false; if (length > 0 && *string == 0xFEFF) { string++; length--; } else if (length > 0 && *string == 0xFFFE) { - swap = YES; + swap = true; string++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) - swap = YES; + swap = true; _s = &_storage; _s->cString = [self allocMemoryWithSize: (length * 4) + 1]; _s->length = length; @@ -522,11 +522,11 @@ _s->cString[j++] = buffer[0]; break; case 2: case 3: case 4: - _s->isUTF8 = YES; + _s->isUTF8 = true; memcpy(_s->cString + j, buffer, len); j += len; break; @@ -559,21 +559,21 @@ { self = [super init]; @try { size_t i, j = 0; - BOOL swap = NO; + bool swap = false; if (length > 0 && *characters == 0xFEFF) { characters++; length--; } else if (length > 0 && *characters == 0xFFFE0000) { - swap = YES; + swap = true; characters++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) - swap = YES; + swap = true; _s = &_storage; _s->cString = [self allocMemoryWithSize: (length * 4) + 1]; _s->length = length; @@ -589,11 +589,11 @@ _s->cString[j++] = buffer[0]; break; case 2: case 3: case 4: - _s->isUTF8 = YES; + _s->isUTF8 = true; memcpy(_s->cString + j, buffer, len); j += len; break; @@ -645,11 +645,11 @@ @try { switch (of_string_utf8_check(tmp, cStringLength, &_s->length)) { case 1: - _s->isUTF8 = YES; + _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } @@ -686,11 +686,11 @@ [firstComponent isKindOfClass: [OFMutableString_UTF8 class]]) _s->isUTF8 = ((OFString_UTF8*)firstComponent)->_s->isUTF8; else - _s->isUTF8 = YES; + _s->isUTF8 = true; _s->length = [firstComponent length]; /* Calculate length and see if we need UTF-8 */ va_copy(argumentsCopy, arguments); @@ -702,11 +702,11 @@ [component isKindOfClass: [OFMutableString_UTF8 class]]) _s->isUTF8 = ((OFString_UTF8*)component)->_s->isUTF8; else - _s->isUTF8 = YES; + _s->isUTF8 = true; } _s->cString = [self allocMemoryWithSize: _s->cStringLength + 1]; cStringLength = [firstComponent UTF8StringLength]; @@ -804,36 +804,36 @@ - (size_t)UTF8StringLength { return _s->cStringLength; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFString_UTF8 *otherString; if (object == self) - return YES; + return true; if (![object isKindOfClass: [OFString class]]) - return NO; + return false; otherString = object; if ([otherString UTF8StringLength] != _s->cStringLength || [otherString length] != _s->length) - return NO; + return false; if (([otherString isKindOfClass: [OFString_UTF8 class]] || [otherString isKindOfClass: [OFMutableString_UTF8 class]]) && _s->hashed && otherString->_s->hashed && _s->hash != otherString->_s->hash) - return NO; + return false; if (strcmp(_s->cString, [otherString UTF8String])) - return NO; + return false; - return YES; + return true; } - (of_comparison_result_t)compare: (id )object { OFString *otherString; @@ -979,11 +979,11 @@ } OF_HASH_FINALIZE(hash); _s->hash = hash; - _s->hashed = YES; + _s->hashed = true; return hash; } - (of_unichar_t)characterAtIndex: (size_t)index @@ -1082,26 +1082,26 @@ } return of_range(OF_NOT_FOUND, 0); } -- (BOOL)containsString: (OFString*)string +- (bool)containsString: (OFString*)string { const char *cString = [string UTF8String]; size_t i, cStringLength = [string UTF8StringLength]; if (cStringLength == 0) - return YES; + return true; if (cStringLength > _s->cStringLength) - return NO; + return false; for (i = 0; i <= _s->cStringLength - cStringLength; i++) if (!memcmp(_s->cString + i, cString, cStringLength)) - return YES; + return true; - return NO; + return false; } - (OFString*)substringWithRange: (of_range_t)range { size_t start = range.location; @@ -1119,26 +1119,26 @@ return [OFString stringWithUTF8String: _s->cString + start length: end - start]; } -- (BOOL)hasPrefix: (OFString*)prefix +- (bool)hasPrefix: (OFString*)prefix { size_t cStringLength = [prefix UTF8StringLength]; if (cStringLength > _s->cStringLength) - return NO; + return false; return !memcmp(_s->cString, [prefix UTF8String], cStringLength); } -- (BOOL)hasSuffix: (OFString*)suffix +- (bool)hasSuffix: (OFString*)suffix { size_t cStringLength = [suffix UTF8StringLength]; if (cStringLength > _s->cStringLength) - return NO; + return false; return !memcmp(_s->cString + (_s->cStringLength - cStringLength), [suffix UTF8String], cStringLength); } @@ -1147,11 +1147,11 @@ { void *pool; OFMutableArray *array; const char *cString = [delimiter UTF8String]; size_t cStringLength = [delimiter UTF8StringLength]; - BOOL skipEmpty = (options & OF_STRING_SKIP_EMPTY); + bool skipEmpty = (options & OF_STRING_SKIP_EMPTY); size_t i, last; OFString *component; array = [OFMutableArray array]; pool = objc_autoreleasePoolPush(); @@ -1374,15 +1374,15 @@ - (void)enumerateLinesUsingBlock: (of_string_line_enumeration_block_t)block { void *pool; const char *cString = _s->cString; const char *last = cString; - BOOL stop = NO, lastCarriageReturn = NO; + bool stop = false, lastCarriageReturn = false; while (!stop && *cString != 0) { if (lastCarriageReturn && *cString == '\n') { - lastCarriageReturn = NO; + lastCarriageReturn = false; cString++; last++; continue;