@@ -168,25 +168,25 @@ OFString *parentDirectory, OFString *joinString) { void *pool = objc_autoreleasePoolPush(); OFMutableArray *array; OFString *ret; - BOOL done = NO; + bool done = false; array = [[components mutableCopy] autorelease]; while (!done) { size_t i, length = [array count]; - done = YES; + done = true; for (i = 0; i < length; i++) { id object = [array objectAtIndex: i]; if ([object isEqual: currentDirectory]) { [array removeObjectAtIndex: i]; - done = NO; + done = false; break; } if ([object isEqual: parentDirectory]) { @@ -193,11 +193,11 @@ [array removeObjectAtIndex: i]; if (i > 0) [array removeObjectAtIndex: i - 1]; - done = NO; + done = false; break; } } } @@ -250,11 +250,11 @@ length: UTF8StringLength storage: storage]; } - initWithUTF8StringNoCopy: (char*)UTF8String - freeWhenDone: (BOOL)freeWhenDone + freeWhenDone: (bool)freeWhenDone { return (id)[[OFString_UTF8 alloc] initWithUTF8StringNoCopy: UTF8String freeWhenDone: freeWhenDone]; } @@ -494,11 +494,11 @@ initWithUTF8String: UTF8String length: UTF8StringLength] autorelease]; } + (instancetype)stringWithUTF8StringNoCopy: (char*)UTF8String - freeWhenDone: (BOOL)freeWhenDone + freeWhenDone: (bool)freeWhenDone { return [[[self alloc] initWithUTF8StringNoCopy: UTF8String freeWhenDone: freeWhenDone] autorelease]; } @@ -667,11 +667,11 @@ encoding: OF_STRING_ENCODING_UTF_8 length: UTF8StringLength]; } - initWithUTF8StringNoCopy: (char*)UTF8String - freeWhenDone: (BOOL)freeWhenDone + freeWhenDone: (bool)freeWhenDone { return [self initWithUTF8String: UTF8String]; } - initWithCString: (const char*)cString @@ -1364,43 +1364,43 @@ for (i = 0; i < range.length; i++) buffer[i] = [self characterAtIndex: range.location + i]; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { void *pool; OFString *otherString; const of_unichar_t *characters, *otherCharacters; size_t length; if (object == self) - return YES; + return true; if (![object isKindOfClass: [OFString class]]) - return NO; + return false; otherString = object; length = [self length]; if ([otherString length] != length) - return NO; + return false; pool = objc_autoreleasePoolPush(); characters = [self characters]; otherCharacters = [otherString characters]; if (memcmp(characters, otherCharacters, length * sizeof(of_unichar_t))) { objc_autoreleasePoolPop(pool); - return NO; + return false; } objc_autoreleasePoolPop(pool); - return YES; + return true; } - copy { return [self retain]; @@ -1718,21 +1718,21 @@ objc_autoreleasePoolPop(pool); return of_range(OF_NOT_FOUND, 0); } -- (BOOL)containsString: (OFString*)string +- (bool)containsString: (OFString*)string { void *pool; const of_unichar_t *characters, *searchCharacters; size_t i, length, searchLength; if ((searchLength = [string length]) == 0) - return YES; + return true; if (searchLength > (length = [self length])) - return NO; + return false; pool = objc_autoreleasePoolPush(); characters = [self characters]; searchCharacters = [string characters]; @@ -1739,17 +1739,17 @@ for (i = 0; i <= length - searchLength; i++) { if (!memcmp(characters + i, searchCharacters, searchLength * sizeof(of_unichar_t))) { objc_autoreleasePoolPop(pool); - return YES; + return true; } } objc_autoreleasePoolPop(pool); - return NO; + return false; } - (OFString*)substringWithRange: (of_range_t)range { void *pool; @@ -1918,19 +1918,19 @@ [new makeImmutable]; return new; } -- (BOOL)hasPrefix: (OFString*)prefix +- (bool)hasPrefix: (OFString*)prefix { of_unichar_t *tmp; const of_unichar_t *prefixCharacters; size_t prefixLength; int compare; if ((prefixLength = [prefix length]) > [self length]) - return NO; + return false; tmp = [self allocMemoryWithSize: sizeof(of_unichar_t) count: prefixLength]; @try { void *pool = objc_autoreleasePoolPush(); @@ -1948,19 +1948,19 @@ } return !compare; } -- (BOOL)hasSuffix: (OFString*)suffix +- (bool)hasSuffix: (OFString*)suffix { of_unichar_t *tmp; const of_unichar_t *suffixCharacters; size_t length, suffixLength; int compare; if ((suffixLength = [suffix length]) > [self length]) - return NO; + return false; length = [self length]; tmp = [self allocMemoryWithSize: sizeof(of_unichar_t) count: suffixLength]; @@ -1993,11 +1993,11 @@ options: (int)options { void *pool; OFMutableArray *array = [OFMutableArray array]; const of_unichar_t *characters, *delimiterCharacters; - BOOL skipEmpty = (options & OF_STRING_SKIP_EMPTY); + bool skipEmpty = (options & OF_STRING_SKIP_EMPTY); size_t length = [self length]; size_t delimiterLength = [delimiter length]; size_t i, last; OFString *component; @@ -2195,11 +2195,11 @@ void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = [self characters]; size_t length = [self length]; int i = 0; intmax_t value = 0; - BOOL expectWhitespace = NO; + bool expectWhitespace = false; while (length > 0 && (*characters == ' ' || *characters == '\t' || *characters == '\n' || *characters == '\r' || *characters == '\f')) { characters++; @@ -2232,11 +2232,11 @@ value = (value * 10) + (characters[i] - '0'); } else if (characters[i] == ' ' || characters[i] == '\t' || characters[i] == '\n' || characters[i] == '\r' || characters[i] == '\f') - expectWhitespace = YES; + expectWhitespace = true; else @throw [OFInvalidFormatException exceptionWithClass: [self class]]; } @@ -2253,11 +2253,11 @@ void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = [self characters]; size_t length = [self length]; int i = 0; uintmax_t value = 0; - BOOL expectWhitespace = NO, foundValue = NO; + bool expectWhitespace = false, foundValue = false; while (length > 0 && (*characters == ' ' || *characters == '\t' || *characters == '\n' || *characters == '\r' || *characters == '\f')) { characters++; @@ -2286,21 +2286,21 @@ continue; } if (characters[i] >= '0' && characters[i] <= '9') { newValue = (value << 4) | (characters[i] - '0'); - foundValue = YES; + foundValue = true; } else if (characters[i] >= 'A' && characters[i] <= 'F') { newValue = (value << 4) | (characters[i] - 'A' + 10); - foundValue = YES; + foundValue = true; } else if (characters[i] >= 'a' && characters[i] <= 'f') { newValue = (value << 4) | (characters[i] - 'a' + 10); - foundValue = YES; + foundValue = true; } else if (characters[i] == 'h' || characters[i] == ' ' || characters[i] == '\t' || characters[i] == '\n' || characters[i] == '\r' || characters[i] == '\f') { - expectWhitespace = YES; + expectWhitespace = true; continue; } else @throw [OFInvalidFormatException exceptionWithClass: [self class]]; @@ -2399,11 +2399,11 @@ void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = [self characters]; size_t length = [self length]; of_char16_t *ret; size_t i, j; - BOOL swap = (byteOrder != OF_BYTE_ORDER_NATIVE); + bool swap = (byteOrder != OF_BYTE_ORDER_NATIVE); /* Allocate memory for the worst case */ ret = [object allocMemoryWithSize: sizeof(of_char16_t) count: (length + 1) * 2]; @@ -2512,15 +2512,15 @@ - (void)enumerateLinesUsingBlock: (of_string_line_enumeration_block_t)block { void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = [self characters]; size_t i, last = 0, length = [self length]; - BOOL stop = NO, lastCarriageReturn = NO; + bool stop = false, lastCarriageReturn = false; for (i = 0; i < length && !stop; i++) { if (lastCarriageReturn && characters[i] == '\n') { - lastCarriageReturn = NO; + lastCarriageReturn = false; last++; continue; }