Index: generators/Makefile ================================================================== --- generators/Makefile +++ generators/Makefile @@ -20,11 +20,10 @@ ${LN_S} ../src/libobjfw.dll libobjfw.dll; \ fi if test -f ../src/libobjfw.dylib; then \ ${LN_S} ../src/libobjfw.dylib libobjfw.dylib; \ fi - echo "Generating tables..." LD_LIBRARY_PATH=.$${LD_LIBRARY_PATH+:}$$LD_LIBRARY_PATH \ DYLD_LIBRARY_PATH=.$${DYLD_LIBRARY_PATH+:}$$DYLD_LIBRARY_PATH \ LIBRARY_PATH=.$${LIBRARY_PATH+:}$$LIBRARY_PATH \ ${TEST_LAUNCHER} ./${PROG_NOINST}; EXIT=$$?; \ rm -f libobjfw.so.${OBJFW_LIB_MAJOR}; \ Index: generators/TableGenerator.m ================================================================== --- generators/TableGenerator.m +++ generators/TableGenerator.m @@ -178,15 +178,15 @@ @"#import \"OFString.h\"\n\n" @"static const of_unichar_t nop_page[0x100] = {};\n\n"]; /* Write uppercase_page_%u */ for (i = 0; i < 0x110000; i += 0x100) { - BOOL isEmpty = YES; + bool isEmpty = true; for (j = i; j < i + 0x100; j++) { if (uppercaseTable[j] != 0) { - isEmpty = NO; + isEmpty = false; uppercaseTableSize = i >> 8; uppercaseTableUsed[uppercaseTableSize] = YES; break; } } @@ -216,15 +216,15 @@ } } /* Write lowercase_page_%u */ for (i = 0; i < 0x110000; i += 0x100) { - BOOL isEmpty = YES; + bool isEmpty = true; for (j = i; j < i + 0x100; j++) { if (lowercaseTable[j] != 0) { - isEmpty = NO; + isEmpty = false; lowercaseTableSize = i >> 8; lowercaseTableUsed[lowercaseTableSize] = YES; break; } } @@ -254,17 +254,17 @@ } } /* Write titlecase_page_%u if it does NOT match uppercase_page_%u */ for (i = 0; i < 0x110000; i += 0x100) { - BOOL isEmpty = YES; + bool isEmpty = true; for (j = i; j < i + 0x100; j++) { if (titlecaseTable[j] != 0) { - isEmpty = (memcmp(uppercaseTable + i, + isEmpty = !memcmp(uppercaseTable + i, titlecaseTable + i, - 256 * sizeof(of_unichar_t)) ? NO : YES); + 256 * sizeof(of_unichar_t)); titlecaseTableSize = i >> 8; titlecaseTableUsed[titlecaseTableSize] = (isEmpty ? 2 : 1); break; } @@ -295,17 +295,17 @@ } } /* Write casefolding_page_%u if it does NOT match lowercase_page_%u */ for (i = 0; i < 0x110000; i += 0x100) { - BOOL isEmpty = YES; + bool isEmpty = true; for (j = i; j < i + 0x100; j++) { if (casefoldingTable[j] != 0) { - isEmpty = (memcmp(lowercaseTable + i, + isEmpty = !memcmp(lowercaseTable + i, casefoldingTable + i, - 256 * sizeof(of_unichar_t)) ? NO : YES); + 256 * sizeof(of_unichar_t)); casefoldingTableSize = i >> 8; casefoldingTableUsed[casefoldingTableSize] = (isEmpty ? 2 : 1); break; } Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -240,39 +240,39 @@ pool = objc_autoreleasePoolPush(); if ((env = getenv("HOME")) != NULL) { OFString *home = [[[OFString alloc] initWithUTF8StringNoCopy: env - freeWhenDone: NO] autorelease]; + freeWhenDone: false] autorelease]; [environment setObject: home forKey: @"HOME"]; } if ((env = getenv("PATH")) != NULL) { OFString *path = [[[OFString alloc] initWithUTF8StringNoCopy: env - freeWhenDone: NO] autorelease]; + freeWhenDone: false] autorelease]; [environment setObject: path forKey: @"PATH"]; } if ((env = getenv("SHELL")) != NULL) { OFString *shell = [[[OFString alloc] initWithUTF8StringNoCopy: env - freeWhenDone: NO] autorelease]; + freeWhenDone: false] autorelease]; [environment setObject: shell forKey: @"SHELL"]; } if ((env = getenv("TMPDIR")) != NULL) { OFString *tmpdir = [[[OFString alloc] initWithUTF8StringNoCopy: env - freeWhenDone: NO] autorelease]; + freeWhenDone: false] autorelease]; [environment setObject: tmpdir forKey: @"TMPDIR"]; } if ((env = getenv("USER")) != NULL) { OFString *user = [[[OFString alloc] initWithUTF8StringNoCopy: env - freeWhenDone: NO] autorelease]; + freeWhenDone: false] autorelease]; [environment setObject: user forKey: @"USER"]; } objc_autoreleasePoolPop(pool); @@ -356,21 +356,21 @@ *argv = _argv; } - (OFString*)programName { - OF_GETTER(_programName, NO) + OF_GETTER(_programName, false) } - (OFArray*)arguments { - OF_GETTER(_arguments, NO) + OF_GETTER(_arguments, false) } - (OFDictionary*)environment { - OF_GETTER(_environment, NO) + OF_GETTER(_environment, false) } - (id )delegate { return _delegate; Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -36,12 +36,12 @@ OF_SORT_OPTIONS_DESCENDING = 1 }; #ifdef OF_HAVE_BLOCKS typedef void (^of_array_enumeration_block_t)(id object, size_t index, - BOOL *stop); -typedef BOOL (^of_array_filter_block_t)(id odject, size_t index); + bool *stop); +typedef bool (^of_array_filter_block_t)(id odject, size_t index); typedef id (^of_array_map_block_t)(id object, size_t index); typedef id (^of_array_fold_block_t)(id left, id right); #endif /*! @@ -194,11 +194,11 @@ * * @param object The object which is checked for being in the array * @return A boolean whether the array contains an object with the specified * address. */ -- (BOOL)containsObjectIdenticalTo: (id)object; +- (bool)containsObjectIdenticalTo: (id)object; /*! * @brief Returns the first object of the array or nil. * * @warning The returned object is *not* retained and autoreleased for @@ -329,11 +329,11 @@ */ - (OFArray*)mappedArrayUsingBlock: (of_array_map_block_t)block; /*! * @brief Creates a new array, only containing the objects for which the block - * returns YES. + * returns true. * * @param block A block which determines if the object should be in the new * array * @return A new, autoreleased OFArray */ Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -337,16 +337,16 @@ return i; return OF_NOT_FOUND; } -- (BOOL)containsObject: (id)object +- (bool)containsObject: (id)object { return ([self indexOfObject: object] != OF_NOT_FOUND); } -- (BOOL)containsObjectIdenticalTo: (id)object +- (bool)containsObjectIdenticalTo: (id)object { return ([self indexOfObjectIdenticalTo: object] != OF_NOT_FOUND); } - (id)firstObject @@ -445,32 +445,32 @@ objc_autoreleasePoolPop(pool); return ret; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { /* FIXME: Optimize (for example, buffer of 16 for each) */ OFArray *otherArray; size_t i, count; if (![object isKindOfClass: [OFArray class]]) - return NO; + return false; otherArray = object; count = [self count]; if (count != [otherArray count]) - return NO; + return false; for (i = 0; i < count; i++) if (![[self objectAtIndex: i] isEqual: [otherArray objectAtIndex: i]]) - return NO; + return false; - return YES; + return true; } - (uint32_t)hash { id *objects = [self objects]; @@ -702,11 +702,11 @@ #if defined(OF_HAVE_BLOCKS) && defined(OF_HAVE_FAST_ENUMERATION) - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block { size_t i = 0; - BOOL stop = NO; + bool stop = false; for (id object in self) { block(object, i++, &stop); if (stop) @@ -759,11 +759,11 @@ id *tmp = [self allocMemoryWithSize: sizeof(id) count: count]; @try { [self enumerateObjectsUsingBlock: ^ (id object, size_t index, - BOOL *stop) { + bool *stop) { tmp[index] = block(object, index); }]; ret = [OFArray arrayWithObjects: tmp count: count]; @@ -783,11 +783,11 @@ @try { __block size_t i = 0; [self enumerateObjectsUsingBlock: ^ (id object, size_t index, - BOOL *stop) { + bool *stop) { if (block(object, index)) tmp[i++] = object; }]; ret = [OFArray arrayWithObjects: tmp @@ -808,11 +808,11 @@ return nil; if (count == 1) return [[[self firstObject] retain] autorelease]; [self enumerateObjectsUsingBlock: ^ (id object, size_t index, - BOOL *stop) { + bool *stop) { id new; if (index == 0) { current = [object retain]; return; Index: src/OFArray_adjacent.m ================================================================== --- src/OFArray_adjacent.m +++ src/OFArray_adjacent.m @@ -136,15 +136,15 @@ { self = [self init]; @try { size_t i; - BOOL ok = YES; + bool ok = true; for (i = 0; i < count; i++) { if (objects[i] == nil) - ok = NO; + ok = false; [objects[i] retain]; } if (!ok) @@ -298,11 +298,11 @@ return [OFArray_adjacentSubarray arrayWithArray: self range: range]; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFArray *otherArray; id *objects, *otherObjects; size_t i, count; @@ -314,20 +314,20 @@ otherArray = object; count = [_array count]; if (count != [otherArray count]) - return NO; + return false; objects = [_array items]; otherObjects = [otherArray objects]; for (i = 0; i < count; i++) if (![objects[i] isEqual: otherObjects[i]]) - return NO; + return false; - return YES; + return true; } - (uint32_t)hash { id *objects = [_array items]; @@ -347,11 +347,11 @@ #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block { id *objects = [_array items]; size_t i, count = [_array count]; - BOOL stop = NO; + bool stop = false; for (i = 0; i < count && !stop; i++) block(objects[i], i, &stop); } #endif Index: src/OFArray_adjacentSubarray.m ================================================================== --- src/OFArray_adjacentSubarray.m +++ src/OFArray_adjacentSubarray.m @@ -24,11 +24,11 @@ - (id*)objects { return [_array objects] + _range.location; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFArray *otherArray; id *objects, *otherObjects; size_t i; @@ -38,29 +38,29 @@ return [super isEqual: object]; otherArray = object; if (_range.length != [otherArray count]) - return NO; + return false; objects = [self objects]; otherObjects = [otherArray objects]; for (i = 0; i < _range.length; i++) if (![objects[i] isEqual: otherObjects[i]]) - return NO; + return false; - return YES; + return true; } #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block { id *objects = [self objects]; size_t i; - BOOL stop = NO; + bool stop = false; for (i = 0; i < _range.length && !stop; i++) block(objects[i], i, &stop); } #endif @end Index: src/OFAutoreleasePool.h ================================================================== --- src/OFAutoreleasePool.h +++ src/OFAutoreleasePool.h @@ -25,11 +25,11 @@ * Every thread has its own stack of autorelease pools. */ @interface OFAutoreleasePool: OFObject { void *_pool; - BOOL _ignoreRelease; + bool _ignoreRelease; } /*! * @brief Adds an object to the autorelease pool at the top of the * thread-specific autorelease pool stack. Index: src/OFAutoreleasePool.m ================================================================== --- src/OFAutoreleasePool.m +++ src/OFAutoreleasePool.m @@ -94,18 +94,18 @@ return self; } - (void)releaseObjects { - _ignoreRelease = YES; + _ignoreRelease = true; objc_autoreleasePoolPop(_pool); _pool = objc_autoreleasePoolPush(); _objc_rootAutorelease(self); - _ignoreRelease = NO; + _ignoreRelease = false; } - (void)release { [self dealloc]; @@ -123,11 +123,11 @@ #endif if (_ignoreRelease) return; - _ignoreRelease = YES; + _ignoreRelease = true; objc_autoreleasePoolPop(_pool); if (cache == NULL) { cache = calloc(sizeof(OFAutoreleasePool*), MAX_CACHE_SIZE); @@ -144,11 +144,11 @@ unsigned i; for (i = 0; i < MAX_CACHE_SIZE; i++) { if (cache[i] == NULL) { _pool = NULL; - _ignoreRelease = NO; + _ignoreRelease = false; cache[i] = self; return; } Index: src/OFCollection.h ================================================================== --- src/OFCollection.h +++ src/OFCollection.h @@ -36,7 +36,7 @@ * specified object. * * @param object The object which is checked for being in the collection * @return A boolean whether the collection contains the specified object */ -- (BOOL)containsObject: (id)object; +- (bool)containsObject: (id)object; @end Index: src/OFCondition.h ================================================================== --- src/OFCondition.h +++ src/OFCondition.h @@ -20,11 +20,11 @@ * @brief A class implementing a condition variable for thread synchronization. */ @interface OFCondition: OFMutex { of_condition_t _condition; - BOOL _conditionInitialized; + bool _conditionInitialized; } /*! * @brief Creates a new condition. * Index: src/OFCondition.m ================================================================== --- src/OFCondition.m +++ src/OFCondition.m @@ -38,11 +38,11 @@ Class c = [self class]; [self release]; @throw [OFInitializationFailedException exceptionWithClass: c]; } - _conditionInitialized = YES; + _conditionInitialized = true; return self; } - (void)dealloc Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -157,11 +157,11 @@ ivars->cStringLength = _cStringLength; switch (of_string_utf8_check(ivars->cString, ivars->cStringLength, &ivars->length)) { case 1: - ivars->isUTF8 = YES; + ivars->isUTF8 = true; break; case -1: free(ivars); @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; @@ -267,11 +267,11 @@ return [self compare: object]; } /* From OFObject, but reimplemented in OFString */ -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { [self finishInitialization]; return [self isEqual: object]; } @@ -385,11 +385,11 @@ return [self rangeOfString: string options: options range: range]; } -- (BOOL)containsString: (OFString*)string +- (bool)containsString: (OFString*)string { [self finishInitialization]; return [self containsString: string]; } @@ -493,18 +493,18 @@ [self finishInitialization]; return [self stringByDeletingEnclosingWhitespaces]; } -- (BOOL)hasPrefix: (OFString*)prefix +- (bool)hasPrefix: (OFString*)prefix { [self finishInitialization]; return [self hasPrefix: prefix]; } -- (BOOL)hasSuffix: (OFString*)suffix +- (bool)hasSuffix: (OFString*)suffix { [self finishInitialization]; return [self hasSuffix: suffix]; } Index: src/OFCountedSet.h ================================================================== --- src/OFCountedSet.h +++ src/OFCountedSet.h @@ -16,11 +16,11 @@ #import "OFSet.h" #ifdef OF_HAVE_BLOCKS typedef void (^of_counted_set_enumeration_block_t)(id object, size_t count, - BOOL *stop); + bool *stop); #endif /*! * @brief An abstract class for a mutable unordered set of objects, counting how * often it contains an object. Index: src/OFCountedSet.m ================================================================== --- src/OFCountedSet.m +++ src/OFCountedSet.m @@ -234,11 +234,11 @@ #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsAndCountUsingBlock: (of_counted_set_enumeration_block_t)block { - [self enumerateObjectsUsingBlock: ^ (id object, BOOL *stop) { + [self enumerateObjectsUsingBlock: ^ (id object, bool *stop) { block(object, [self countForObject: object], stop); }]; } #endif Index: src/OFCountedSet_hashtable.m ================================================================== --- src/OFCountedSet_hashtable.m +++ src/OFCountedSet_hashtable.m @@ -192,11 +192,11 @@ - (void)enumerateObjectsAndCountUsingBlock: (of_counted_set_enumeration_block_t)block { @try { [_mapTable enumerateKeysAndValuesUsingBlock: - ^ (void *key, void *value, BOOL *stop) { + ^ (void *key, void *value, bool *stop) { block(key, (size_t)(uintptr_t)value, stop); }]; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException exceptionWithClass: [self class] Index: src/OFDataArray+BinaryPackValue.m ================================================================== --- src/OFDataArray+BinaryPackValue.m +++ src/OFDataArray+BinaryPackValue.m @@ -266,15 +266,15 @@ case 0xC0: *object = [OFNull null]; return 1; /* false */ case 0xC2: - *object = [OFNumber numberWithBool: NO]; + *object = [OFNumber numberWithBool: false]; return 1; /* true */ case 0xC3: - *object = [OFNumber numberWithBool: YES]; + *object = [OFNumber numberWithBool: true]; return 1; /* Data */ case 0xD5: if (length < 2) goto error; Index: src/OFDataArray.m ================================================================== --- src/OFDataArray.m +++ src/OFDataArray.m @@ -472,26 +472,26 @@ count: _count]; return copy; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFDataArray *dataArray; if (![object isKindOfClass: [OFDataArray class]]) - return NO; + return false; dataArray = object; if ([dataArray count] != _count || [dataArray itemSize] != _itemSize) - return NO; + return false; if (memcmp([dataArray items], _items, _count * _itemSize)) - return NO; + return false; - return YES; + return true; } - (of_comparison_result_t)compare: (id )object { OFDataArray *dataArray; Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -345,23 +345,23 @@ } return self; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFDate *otherDate; if (![object isKindOfClass: [OFDate class]]) - return NO; + return false; otherDate = object; if (otherDate->_seconds != _seconds) - return NO; + return false; - return YES; + return true; } - (uint32_t)hash { uint32_t hash; Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -32,12 +32,12 @@ @class OFArray; #ifdef OF_HAVE_BLOCKS typedef void (^of_dictionary_enumeration_block_t)(id key, id object, - BOOL *stop); -typedef BOOL (^of_dictionary_filter_block_t)(id key, id object); + bool *stop); +typedef bool (^of_dictionary_filter_block_t)(id key, id object); typedef id (^of_dictionary_map_block_t)(id key, id object); #endif /*! * @brief An abstract class for storing objects in a dictionary. @@ -186,11 +186,11 @@ * * @param object The object which is checked for being in the dictionary * @return A boolean whether the dictionary contains an object with the * specified address. */ -- (BOOL)containsObjectIdenticalTo: (id)object; +- (bool)containsObjectIdenticalTo: (id)object; /*! * @brief Returns an array of all keys. * * @return An array of all keys @@ -229,11 +229,11 @@ */ - (OFDictionary*)mappedDictionaryUsingBlock: (of_dictionary_map_block_t)block; /*! * @brief Creates a new dictionary, only containing the objects for which the - * block returns YES. + * block returns true. * * @param block A block which determines if the object should be in the new * dictionary * @return A new autoreleased OFDictionary */ Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -326,24 +326,24 @@ - mutableCopy { return [[OFMutableDictionary alloc] initWithDictionary: self]; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFDictionary *otherDictionary; void *pool; OFEnumerator *enumerator; id key; if (![object isKindOfClass: [OFDictionary class]]) - return NO; + return false; otherDictionary = object; if ([otherDictionary count] != [self count]) - return NO; + return false; pool = objc_autoreleasePoolPush(); enumerator = [self keyEnumerator]; while ((key = [enumerator nextObject]) != nil) { @@ -350,65 +350,65 @@ id object = [otherDictionary objectForKey: key]; if (object == nil || ![object isEqual: [self objectForKey: key]]) { objc_autoreleasePoolPop(pool); - return NO; + return false; } } objc_autoreleasePoolPop(pool); - return YES; + return true; } -- (BOOL)containsObject: (id)object +- (bool)containsObject: (id)object { void *pool; OFEnumerator *enumerator; id currentObject; if (object == nil) - return NO; + return false; pool = objc_autoreleasePoolPush(); enumerator = [self objectEnumerator]; while ((currentObject = [enumerator nextObject]) != nil) { if ([currentObject isEqual: object]) { objc_autoreleasePoolPop(pool); - return YES; + return true; } } objc_autoreleasePoolPop(pool); - return NO; + return false; } -- (BOOL)containsObjectIdenticalTo: (id)object +- (bool)containsObjectIdenticalTo: (id)object { void *pool; OFEnumerator *enumerator; id currentObject; if (object == nil) - return NO; + return false; pool = objc_autoreleasePoolPush(); enumerator = [self objectEnumerator]; while ((currentObject = [enumerator nextObject]) != nil) { if (currentObject == object) { objc_autoreleasePoolPop(pool); - return YES; + return true; } } objc_autoreleasePoolPop(pool); - return NO; + return false; } - (OFArray*)allKeys { void *pool = objc_autoreleasePoolPush(); @@ -487,11 +487,11 @@ #if defined(OF_HAVE_BLOCKS) && defined(OF_HAVE_FAST_ENUMERATION) - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { - BOOL stop = NO; + bool stop = false; for (id key in self) { block(key, [self objectForKey: key], &stop); if (stop) @@ -504,11 +504,11 @@ - (OFDictionary*)mappedDictionaryUsingBlock: (of_dictionary_map_block_t)block { OFMutableDictionary *new = [OFMutableDictionary dictionary]; [self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object, - BOOL *stop) { + bool *stop) { [new setObject: block(key, object) forKey: key]; }]; [new makeImmutable]; @@ -520,11 +520,11 @@ (of_dictionary_filter_block_t)block { OFMutableDictionary *new = [OFMutableDictionary dictionary]; [self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object, - BOOL *stop) { + bool *stop) { if (block(key, object)) [new setObject: object forKey: key]; }]; Index: src/OFDictionary_hashtable.m ================================================================== --- src/OFDictionary_hashtable.m +++ src/OFDictionary_hashtable.m @@ -53,11 +53,11 @@ hash(void *value) { return [(id)value hash]; } -static BOOL +static bool equal(void *value1, void *value2) { return [(id)value1 isEqual: (id)value2]; } @@ -319,11 +319,11 @@ - (size_t)count { return [_mapTable count]; } -- (BOOL)isEqual: (id)dictionary +- (bool)isEqual: (id)dictionary { OFDictionary_hashtable *dictionary_; if ([self class] != [OFDictionary_hashtable class] && [self class] != [OFMutableDictionary_hashtable class]) @@ -332,16 +332,16 @@ dictionary_ = (OFDictionary_hashtable*)dictionary; return [dictionary_->_mapTable isEqual: _mapTable]; } -- (BOOL)containsObject: (id)object +- (bool)containsObject: (id)object { return [_mapTable containsValue: object]; } -- (BOOL)containsObjectIdenticalTo: (id)object +- (bool)containsObjectIdenticalTo: (id)object { return [_mapTable containsValueIdenticalTo: object]; } - (OFArray*)allKeys @@ -441,11 +441,11 @@ - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { @try { [_mapTable enumerateKeysAndValuesUsingBlock: - ^ (void *key, void *value, BOOL *stop) { + ^ (void *key, void *value, bool *stop) { block(key, value, stop); }]; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException exceptionWithClass: [self class] Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -40,12 +40,12 @@ * @brief A class which provides functions to read, write and manipulate files. */ @interface OFFile: OFSeekableStream { int _fd; - BOOL _closable; - BOOL _atEndOfStream; + bool _closable; + bool _atEndOfStream; } /*! * @brief Creates a new OFFile with the specified path and mode. * @@ -91,19 +91,19 @@ * @brief Checks whether a file exists at the specified path. * * @param path The path to check * @return A boolean whether there is a file at the specified path */ -+ (BOOL)fileExistsAtPath: (OFString*)path; ++ (bool)fileExistsAtPath: (OFString*)path; /*! * @brief Checks whether a directory exists at the specified path. * * @param path The path to check * @return A boolean whether there is a directory at the specified path */ -+ (BOOL)directoryExistsAtPath: (OFString*)path; ++ (bool)directoryExistsAtPath: (OFString*)path; /*! * @brief Creates a directory at the specified path. * * @param path The path of the directory @@ -115,11 +115,11 @@ * * @param path The path of the directory * @param createParents Whether to create the parents of the directory */ + (void)createDirectoryAtPath: (OFString*)path - createParents: (BOOL)createParents; + createParents: (bool)createParents; /*! * @brief Returns an array with the files in the specified directory. * * @param path The path of the directory Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -208,50 +208,50 @@ } return ret; } -+ (BOOL)fileExistsAtPath: (OFString*)path ++ (bool)fileExistsAtPath: (OFString*)path { #ifndef _WIN32 struct stat s; if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) - return NO; + return false; #else struct _stat s; if (_wstat([path UTF16String], &s) == -1) - return NO; + return false; #endif if (S_ISREG(s.st_mode)) - return YES; + return true; - return NO; + return false; } -+ (BOOL)directoryExistsAtPath: (OFString*)path ++ (bool)directoryExistsAtPath: (OFString*)path { #ifndef _WIN32 struct stat s; if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) - return NO; + return false; #else struct _stat s; if (_wstat([path UTF16String], &s) == -1) - return NO; + return false; #endif if (S_ISDIR(s.st_mode)) - return YES; + return true; - return NO; + return false; } + (void)createDirectoryAtPath: (OFString*)path { #ifndef _WIN32 @@ -264,11 +264,11 @@ exceptionWithClass: self path: path]; } + (void)createDirectoryAtPath: (OFString*)path - createParents: (BOOL)createParents + createParents: (bool)createParents { void *pool; OFArray *pathComponents; OFString *currentPath = nil, *component; OFEnumerator *enumerator; @@ -511,11 +511,11 @@ + (void)copyFileAtPath: (OFString*)source toPath: (OFString*)destination { void *pool = objc_autoreleasePoolPush(); - BOOL override; + bool override; OFFile *sourceFile = nil; OFFile *destinationFile = nil; char *buffer; size_t pageSize; @@ -694,11 +694,11 @@ @throw [OFOpenFileFailedException exceptionWithClass: [self class] path: path mode: mode]; - _closable = YES; + _closable = true; } @catch (id e) { [self release]; @throw e; } @@ -712,14 +712,14 @@ _fd = fd; return self; } -- (BOOL)lowlevelIsAtEndOfStream +- (bool)lowlevelIsAtEndOfStream { if (_fd == -1) - return YES; + return true; return _atEndOfStream; } - (size_t)lowlevelReadIntoBuffer: (void*)buffer @@ -732,11 +732,11 @@ @throw [OFReadFailedException exceptionWithClass: [self class] stream: self requestedLength: length]; if (ret == 0) - _atEndOfStream = YES; + _atEndOfStream = true; return ret; } - (void)lowlevelWriteBuffer: (const void*)buffer Index: src/OFHTTPClient.h ================================================================== --- src/OFHTTPClient.h +++ src/OFHTTPClient.h @@ -77,11 +77,11 @@ * @param client The OFHTTPClient which wants to follow a redirect * @param URL The URL to which it will follow a redirect * @param request The request for which the OFHTTPClient wants to redirect * @return A boolean whether the OFHTTPClient should follow the redirect */ -- (BOOL)client: (OFHTTPClient*)client +- (bool)client: (OFHTTPClient*)client shouldFollowRedirect: (OFURL*)URL request: (OFHTTPRequest*)request; @end /*! @@ -88,16 +88,16 @@ * @brief A class for performing HTTP requests. */ @interface OFHTTPClient: OFObject { id _delegate; - BOOL _insecureRedirectsAllowed; + bool _insecureRedirectsAllowed; } #ifdef OF_HAVE_PROPERTIES @property (assign) id delegate; -@property BOOL insecureRedirectsAllowed; +@property bool insecureRedirectsAllowed; #endif /*! * @brief Creates a new OFHTTPClient. * @@ -122,18 +122,18 @@ /*! * @brief Sets whether redirects from HTTPS to HTTP are allowed. * * @param allowed Whether redirects from HTTPS to HTTP are allowed */ -- (void)setInsecureRedirectsAllowed: (BOOL)allowed; +- (void)setInsecureRedirectsAllowed: (bool)allowed; /*! * @brief Returns whether redirects from HTTPS to HTTP will be allowed * * @return Whether redirects from HTTPS to HTTP will be allowed */ -- (BOOL)insecureRedirectsAllowed; +- (bool)insecureRedirectsAllowed; /*! * @brief Performs the specified HTTP request */ - (OFHTTPRequestReply*)performRequest: (OFHTTPRequest*)request; Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -43,30 +43,30 @@ static OF_INLINE void normalize_key(char *str_) { uint8_t *str = (uint8_t*)str_; - BOOL firstLetter = YES; + bool firstLetter = true; while (*str != '\0') { if (!isalnum(*str)) { - firstLetter = YES; + firstLetter = true; str++; continue; } *str = (firstLetter ? toupper(*str) : tolower(*str)); - firstLetter = NO; + firstLetter = false; str++; } } @interface OFHTTPClientReply: OFHTTPRequestReply { OFTCPSocket *_socket; - BOOL _chunked, _atEndOfStream; + bool _chunked, _atEndOfStream; size_t _toRead; } - initWithSocket: (OFTCPSocket*)socket; @end @@ -143,20 +143,20 @@ exceptionWithClass: [self class]]; } if (_toRead == 0) { [_socket close]; - _atEndOfStream = YES; + _atEndOfStream = true; } objc_autoreleasePoolPop(pool); return 0; } } -- (BOOL)lowlevelIsAtEndOfStream +- (bool)lowlevelIsAtEndOfStream { if (!_chunked) return [_socket isAtEndOfStream]; return _atEndOfStream; @@ -193,16 +193,16 @@ - (id )delegate { return _delegate; } -- (void)setInsecureRedirectsAllowed: (BOOL)allowed +- (void)setInsecureRedirectsAllowed: (bool)allowed { _insecureRedirectsAllowed = allowed; } -- (BOOL)insecureRedirectsAllowed +- (bool)insecureRedirectsAllowed { return _insecureRedirectsAllowed; } - (OFHTTPRequestReply*)performRequest: (OFHTTPRequest*)request @@ -256,11 +256,11 @@ /* * Work around a bug with packet splitting in lighttpd when using * HTTPS. */ - [socket setWriteBufferEnabled: YES]; + [socket setWriteBufferEnabled: true]; if (requestType == OF_HTTP_REQUEST_TYPE_GET) type = "GET"; if (requestType == OF_HTTP_REQUEST_TYPE_HEAD) type = "HEAD"; @@ -310,11 +310,11 @@ [socket writeString: @"\r\n"]; /* Work around a bug in lighttpd, see above */ [socket flushWriteBuffer]; - [socket setWriteBufferEnabled: NO]; + [socket setWriteBufferEnabled: false]; if (requestType == OF_HTTP_REQUEST_TYPE_POST) [socket writeBuffer: [POSTData items] length: [POSTData count] * [POSTData itemSize]]; @@ -373,11 +373,11 @@ keyC[tmp - lineC] = '\0'; normalize_key(keyC); @try { key = [OFString stringWithUTF8StringNoCopy: keyC - freeWhenDone: YES]; + freeWhenDone: true]; } @catch (id e) { free(keyC); @throw e; } @@ -392,11 +392,11 @@ [key isEqual: @"Location"]) && (_insecureRedirectsAllowed || [scheme isEqual: @"http"] || ![value hasPrefix: @"http://"])) { OFURL *newURL; OFHTTPRequest *newRequest; - BOOL follow = YES; + bool follow = true; newURL = [OFURL URLWithString: value relativeToURL: URL]; if ([_delegate respondsToSelector: Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -77,16 +77,16 @@ [super dealloc]; } - (void)setURL: (OFURL*)URL { - OF_SETTER(_URL, URL, YES, 1) + OF_SETTER(_URL, URL, true, 1) } - (OFURL*)URL { - OF_GETTER(_URL, YES) + OF_GETTER(_URL, true) } - (void)setRequestType: (of_http_request_type_t)requestType { _requestType = requestType; @@ -145,46 +145,46 @@ _protocolVersion.minor]; } - (void)setHeaders: (OFDictionary*)headers { - OF_SETTER(_headers, headers, YES, 1) + OF_SETTER(_headers, headers, true, 1) } - (OFDictionary*)headers { - OF_GETTER(_headers, YES) + OF_GETTER(_headers, true) } - (void)setPOSTData: (OFDataArray*)POSTData { - OF_SETTER(_POSTData, POSTData, YES, 0) + OF_SETTER(_POSTData, POSTData, true, 0) } - (OFDataArray*)POSTData { - OF_GETTER(_POSTData, YES) + OF_GETTER(_POSTData, true) } - (void)setMIMEType: (OFString*)MIMEType { - OF_SETTER(_MIMEType, MIMEType, YES, 1) + OF_SETTER(_MIMEType, MIMEType, true, 1) } - (OFString*)MIMEType { - OF_GETTER(_MIMEType, YES) + OF_GETTER(_MIMEType, true) } - (void)setRemoteAddress: (OFString*)remoteAddress { - OF_SETTER(_remoteAddress, remoteAddress, YES, 1) + OF_SETTER(_remoteAddress, remoteAddress, true, 1) } - (OFString*)remoteAddress { - OF_GETTER(_remoteAddress, YES) + OF_GETTER(_remoteAddress, true) } - (OFString*)description { void *pool = objc_autoreleasePoolPush(); Index: src/OFHTTPRequestReply.m ================================================================== --- src/OFHTTPRequestReply.m +++ src/OFHTTPRequestReply.m @@ -104,16 +104,16 @@ _statusCode = statusCode; } - (OFDictionary*)headers { - OF_GETTER(_headers, YES) + OF_GETTER(_headers, true) } - (void)setHeaders: (OFDictionary*)headers { - OF_SETTER(_headers, headers, YES, YES) + OF_SETTER(_headers, headers, true, 1) } - (OFString*)description { void *pool = objc_autoreleasePoolPush(); Index: src/OFHTTPServer.h ================================================================== --- src/OFHTTPServer.h +++ src/OFHTTPServer.h @@ -46,15 +46,15 @@ * encountered an exception. * * @param server The HTTP server which encountered an exception * @param exception The exception that occurred on the HTTP server's listening * socket - * @return Whether to continue listening. If you return NO, existing connections - * will still be handled and you can start accepting new connections - * again by calling @ref OFHTTPServer::start again. + * @return Whether to continue listening. If you return false, existing + * connections will still be handled and you can start accepting new + * connections again by calling @ref OFHTTPServer::start again. */ -- (BOOL)server: (OFHTTPServer*)server +- (bool)server: (OFHTTPServer*)server didReceiveExceptionOnListeningSocket: (OFException*)exception; @end /*! * @brief A class for creating a simple HTTP server inside of applications. @@ -148,12 +148,12 @@ * connections, but still handle existing connections until they are * finished or timed out. */ - (void)stop; -- (BOOL)OF_socket: (OFTCPSocket*)socket +- (bool)OF_socket: (OFTCPSocket*)socket didAcceptSocket: (OFTCPSocket*)clientSocket exception: (OFException*)exception; @end @interface OFObject (OFHTTPServerDelegate) @end Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -139,39 +139,39 @@ static OF_INLINE OFString* normalized_key(OFString *key) { char *cString = strdup([key UTF8String]); uint8_t *tmp = (uint8_t*)cString; - BOOL firstLetter = YES; + bool firstLetter = true; if (cString == NULL) @throw [OFOutOfMemoryException exceptionWithClass: nil requestedSize: strlen([key UTF8String])]; while (*tmp != '\0') { if (!isalnum(*tmp)) { - firstLetter = YES; + firstLetter = true; tmp++; continue; } *tmp = (firstLetter ? toupper(*tmp) : tolower(*tmp)); - firstLetter = NO; + firstLetter = false; tmp++; } return [OFString stringWithUTF8StringNoCopy: cString - freeWhenDone: YES]; + freeWhenDone: true]; } @interface OFHTTPServerReply: OFHTTPRequestReply { OFTCPSocket *_socket; OFHTTPServer *_server; - BOOL _chunked, _headersSent, _closed; + bool _chunked, _headersSent, _closed; } - initWithSocket: (OFTCPSocket*)socket server: (OFHTTPServer*)server; @end @@ -222,11 +222,11 @@ if (![key isEqual: @"Server"] && ![key isEqual: @"Date"]) [_socket writeFormat: @"%@: %@\r\n", key, value]; [_socket writeString: @"\r\n"]; - _headersSent = YES; + _headersSent = true; _chunked = [[_headers objectForKey: @"Transfer-Encoding"] isEqual: @"chunked"]; objc_autoreleasePoolPop(pool); } @@ -264,11 +264,11 @@ [_socket writeBuffer: "0\r\n\r\n" length: 5]; [_socket close]; - _closed = YES; + _closed = true; } - (int)fileDescriptorForWriting { return [_socket fileDescriptorForWriting]; @@ -294,20 +294,20 @@ OFDataArray *_POSTData; } - initWithSocket: (OFTCPSocket*)socket server: (OFHTTPServer*)server; -- (BOOL)socket: (OFTCPSocket*)socket +- (bool)socket: (OFTCPSocket*)socket didReadLine: (OFString*)line exception: (OFException*)exception; -- (BOOL)parseProlog: (OFString*)line; -- (BOOL)parseHeaders: (OFString*)line; -- (BOOL)socket: (OFTCPSocket*)socket +- (bool)parseProlog: (OFString*)line; +- (bool)parseHeaders: (OFString*)line; +- (bool)socket: (OFTCPSocket*)socket didReadIntoBuffer: (const char*)buffer length: (size_t)length exception: (OFException*)exception; -- (BOOL)sendErrorAndClose: (short)statusCode; +- (bool)sendErrorAndClose: (short)statusCode; - (void)createReply; @end @implementation OFHTTPServer_Connection - initWithSocket: (OFTCPSocket*)socket @@ -321,11 +321,11 @@ _timer = [[OFTimer scheduledTimerWithTimeInterval: 10 target: socket selector: @selector( cancelAsyncRequests) - repeats: NO] retain]; + repeats: false] retain]; _state = AWAITING_PROLOG; } @catch (id e) { [self release]; @throw e; } @@ -347,42 +347,42 @@ [_POSTData release]; [super dealloc]; } -- (BOOL)socket: (OFTCPSocket*)socket +- (bool)socket: (OFTCPSocket*)socket didReadLine: (OFString*)line exception: (OFException*)exception { if (line == nil || exception != nil) - return NO; + return false; @try { switch (_state) { case AWAITING_PROLOG: return [self parseProlog: line]; case PARSING_HEADERS: if (![self parseHeaders: line]) - return NO; + return false; if (_state == SEND_REPLY) { [self createReply]; - return NO; + return false; } - return YES; + return true; default: - return NO; + return false; } } @catch (OFWriteFailedException *e) { - return NO; + return false; } abort(); } -- (BOOL)parseProlog: (OFString*)line +- (bool)parseProlog: (OFString*)line { OFString *type; size_t pos; @try { @@ -428,14 +428,14 @@ return [self sendErrorAndClose: 400]; _headers = [[OFMutableDictionary alloc] init]; _state = PARSING_HEADERS; - return YES; + return true; } -- (BOOL)parseHeaders: (OFString*)line +- (bool)parseHeaders: (OFString*)line { OFString *key, *value; size_t pos; if ([line length] == 0) { @@ -468,14 +468,14 @@ didReadIntoBuffer: length:exception:)]; [_timer setFireDate: [OFDate dateWithTimeIntervalSinceNow: 5]]; - return NO; + return false; } - return YES; + return true; } pos = [line rangeOfString: @":"].location; if (pos == OF_NOT_FOUND) return [self sendErrorAndClose: 400]; @@ -518,40 +518,40 @@ _host = [value retain]; _port = 80; } } - return YES; + return true; } -- (BOOL)socket: (OFTCPSocket*)socket +- (bool)socket: (OFTCPSocket*)socket didReadIntoBuffer: (const char*)buffer length: (size_t)length exception: (OFException*)exception { if ([socket isAtEndOfStream] || exception != nil) - return NO; + return false; [_POSTData addItems: buffer count: length]; if ([_POSTData count] >= _contentLength) { @try { [self createReply]; } @catch (OFWriteFailedException *e) { - return NO; + return false; } - return NO; + return false; } [_timer setFireDate: [OFDate dateWithTimeIntervalSinceNow: 5]]; - return YES; + return true; } -- (BOOL)sendErrorAndClose: (short)statusCode +- (bool)sendErrorAndClose: (short)statusCode { OFString *date = [[OFDate date] dateStringWithFormat: @"%a, %d %b %Y %H:%M:%S GMT"]; [_socket writeFormat: @"HTTP/1.1 %d %s\r\n" @@ -560,11 +560,11 @@ @"\r\n", statusCode, status_code_to_string(statusCode), date, [_server name]]; [_socket close]; - return NO; + return false; } - (void)createReply { OFURL *URL; @@ -647,16 +647,16 @@ [super dealloc]; } - (void)setHost: (OFString*)host { - OF_SETTER(_host, host, YES, 1) + OF_SETTER(_host, host, true, 1) } - (OFString*)host { - OF_GETTER(_host, YES) + OF_GETTER(_host, true) } - (void)setPort: (uint16_t)port { _port = port; @@ -677,16 +677,16 @@ return _delegate; } - (void)setName: (OFString*)name { - OF_SETTER(_name, name, YES, 1) + OF_SETTER(_name, name, true, 1) } - (OFString*)name { - OF_GETTER(_name, YES) + OF_GETTER(_name, true) } - (void)start { if (_host == nil || _port == 0) @@ -715,11 +715,11 @@ [_listeningSocket cancelAsyncRequests]; [_listeningSocket release]; _listeningSocket = nil; } -- (BOOL)OF_socket: (OFTCPSocket*)socket +- (bool)OF_socket: (OFTCPSocket*)socket didAcceptSocket: (OFTCPSocket*)clientSocket exception: (OFException*)exception { OFHTTPServer_Connection *connection; @@ -727,11 +727,11 @@ if ([_delegate respondsToSelector: @selector(server:didReceiveExceptionOnListeningSocket:)]) return [_delegate server: self didReceiveExceptionOnListeningSocket: exception]; - return NO; + return false; } connection = [[[OFHTTPServer_Connection alloc] initWithSocket: clientSocket server: self] autorelease]; @@ -738,8 +738,8 @@ [clientSocket asyncReadLineWithTarget: connection selector: @selector(socket:didReadLine: exception:)]; - return YES; + return true; } @end Index: src/OFHash.h ================================================================== --- src/OFHash.h +++ src/OFHash.h @@ -19,11 +19,11 @@ /*! * @brief A protocol for classes providing hash functions. */ @protocol OFHash #ifdef OF_HAVE_PROPERTIES -@property (readonly, getter=isCalculated) BOOL calculated; +@property (readonly, getter=isCalculated) bool calculated; #endif /*! * @brief Creates a new hash. * @@ -67,7 +67,7 @@ /*! * @brief Returns a boolean whether the hash has already been calculated. * * @return A boolean whether the hash has already been calculated */ -- (BOOL)isCalculated; +- (bool)isCalculated; @end Index: src/OFIntrospection.m ================================================================== --- src/OFIntrospection.m +++ src/OFIntrospection.m @@ -79,11 +79,11 @@ return _selector; } - (OFString*)name { - OF_GETTER(_name, YES) + OF_GETTER(_name, true) } - (const char*)typeEncoding { return _typeEncoding; @@ -93,34 +93,34 @@ { return [OFString stringWithFormat: @"", _name, _typeEncoding]; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFMethod *method; if (![object isKindOfClass: [OFMethod class]]) - return NO; + return false; method = object; if (!sel_isEqual(method->_selector, _selector)) - return NO; + return false; if (![method->_name isEqual: _name]) - return NO; + return false; if ((method->_typeEncoding == NULL && _typeEncoding != NULL) || (method->_typeEncoding != NULL && _typeEncoding == NULL)) - return NO; + return false; if (method->_typeEncoding != NULL && _typeEncoding != NULL && strcmp(method->_typeEncoding, _typeEncoding)) - return NO; + return false; - return YES; + return true; } - (uint32_t)hash { uint32_t hash; @@ -186,11 +186,11 @@ [super dealloc]; } - (OFString*)name { - OF_GETTER(_name, YES); + OF_GETTER(_name, true); } - (ptrdiff_t)offset { return _offset; @@ -337,18 +337,18 @@ [super dealloc]; } - (OFArray*)classMethods { - OF_GETTER(_classMethods, YES) + OF_GETTER(_classMethods, true) } - (OFArray*)instanceMethods { - OF_GETTER(_instanceMethods, YES) + OF_GETTER(_instanceMethods, true) } - (OFArray*)instanceVariables { - OF_GETTER(_instanceVariables, YES) + OF_GETTER(_instanceVariables, true) } @end Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -130,11 +130,11 @@ * * @param object The object which is checked for being in the list * @return A boolean whether the list contains an object with the specified * address. */ -- (BOOL)containsObjectIdenticalTo: (id)object; +- (bool)containsObjectIdenticalTo: (id)object; /*! * @brief Returns the first object of the list or nil. * * @warning The returned object is *not* retained and autoreleased for Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -214,61 +214,61 @@ - (size_t)count { return _count; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFList *list; of_list_object_t *iter, *iter2; if (![object isKindOfClass: [OFList class]]) - return NO; + return false; list = object; if ([list count] != _count) - return NO; + return false; for (iter = _firstListObject, iter2 = [list firstListObject]; iter != NULL && iter2 != NULL; iter = iter->next, iter2 = iter2->next) if (![iter->object isEqual: iter2->object]) - return NO; - - /* One is bigger than the other even though we checked the count */ - assert(iter == NULL && iter2 == NULL); - - return YES; -} - -- (BOOL)containsObject: (id)object -{ - of_list_object_t *iter; - - if (_count == 0) - return NO; - - for (iter = _firstListObject; iter != NULL; iter = iter->next) - if ([iter->object isEqual: object]) - return YES; - - return NO; -} - -- (BOOL)containsObjectIdenticalTo: (id)object -{ - of_list_object_t *iter; - - if (_count == 0) - return NO; - - for (iter = _firstListObject; iter != NULL; iter = iter->next) - if (iter->object == object) - return YES; - - return NO; + return false; + + /* One is bigger than the other even though we checked the count */ + assert(iter == NULL && iter2 == NULL); + + return true; +} + +- (bool)containsObject: (id)object +{ + of_list_object_t *iter; + + if (_count == 0) + return false; + + for (iter = _firstListObject; iter != NULL; iter = iter->next) + if ([iter->object isEqual: object]) + return true; + + return false; +} + +- (bool)containsObjectIdenticalTo: (id)object +{ + of_list_object_t *iter; + + if (_count == 0) + return false; + + for (iter = _firstListObject; iter != NULL; iter = iter->next) + if (iter->object == object) + return true; + + return false; } - (void)removeAllObjects { of_list_object_t *iter, *next; Index: src/OFLocking.h ================================================================== --- src/OFLocking.h +++ src/OFLocking.h @@ -32,11 +32,11 @@ /*! * @brief Tries to lock the lock. * * @return A boolean whether the lock could be locked */ -- (BOOL)tryLock; +- (bool)tryLock; /*! * @brief Unlocks the lock. */ - (void)unlock; Index: src/OFMD5Hash.h ================================================================== --- src/OFMD5Hash.h +++ src/OFMD5Hash.h @@ -27,8 +27,8 @@ uint32_t _bits[2]; union { uint8_t u8[64]; uint32_t u32[16]; } _in; - BOOL _calculated; + bool _calculated; } @end Index: src/OFMD5Hash.m ================================================================== --- src/OFMD5Hash.m +++ src/OFMD5Hash.m @@ -257,15 +257,15 @@ _in.u32[15] = _bits[1]; md5_transform(_buffer, _in.u32); BSWAP32_VEC_IF_BE(_buffer, 4); - _calculated = YES; + _calculated = true; return (uint8_t*)_buffer; } -- (BOOL)isCalculated +- (bool)isCalculated { return _calculated; } @end Index: src/OFMapTable.h ================================================================== --- src/OFMapTable.h +++ src/OFMapTable.h @@ -26,18 +26,18 @@ /// The function to release keys / values void (*release)(void *value); /// The function to hash keys uint32_t (*hash)(void *value); /// The function to compare keys / values - BOOL (*equal)(void *value1, void *value2); + bool (*equal)(void *value1, void *value2); } of_map_table_functions_t; #ifdef OF_HAVE_BLOCKS typedef void (^of_map_table_enumeration_block_t)(void *key, void *value, - BOOL *stop); + bool *stop); typedef void* (^of_map_table_replace_block_t)(void *key, void *value, - BOOL *stop); + bool *stop); #endif @class OFMapTableEnumerator; /** @@ -144,21 +144,21 @@ * value. * * @param value The value which is checked for being in the map table * @return A boolean whether the map table contains the specified value */ -- (BOOL)containsValue: (void*)value; +- (bool)containsValue: (void*)value; /*! * @brief Checks whether the map table contains a value with the specified * address. * * @param value The value which is checked for being in the map table * @return A boolean whether the map table contains a value with the specified * address. */ -- (BOOL)containsValueIdenticalTo: (void*)value; +- (bool)containsValueIdenticalTo: (void*)value; /*! * @brief Returns an OFMapTableEnumerator to enumerate through the map table's * keys. * Index: src/OFMapTable.m ================================================================== --- src/OFMapTable.m +++ src/OFMapTable.m @@ -53,11 +53,11 @@ default_hash(void *value) { return (uint32_t)(uintptr_t)value; } -static BOOL +static bool default_equal(void *value1, void *value2) { return (value1 == value2); } @@ -180,35 +180,35 @@ } [super dealloc]; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFMapTable *mapTable; uint32_t i; if (![object isKindOfClass: [OFMapTable class]]) - return NO; + return false; mapTable = object; if (mapTable->_count != _count || mapTable->_keyFunctions.equal != _keyFunctions.equal || mapTable->_valueFunctions.equal != _valueFunctions.equal) - return NO; + return false; for (i = 0; i < _capacity; i++) { if (_buckets[i] != NULL && _buckets[i] != &deleted) { void *value = [mapTable valueForKey: _buckets[i]->key]; if (!_valueFunctions.equal(value, _buckets[i]->value)) - return NO; + return false; } } - return YES; + return true; } - (uint32_t)hash { uint32_t i, hash = 0; @@ -502,38 +502,38 @@ return; } } } -- (BOOL)containsValue: (void*)value +- (bool)containsValue: (void*)value { uint32_t i; if (value == NULL || _count == 0) - return NO; + return false; for (i = 0; i < _capacity; i++) if (_buckets[i] != NULL && _buckets[i] != &deleted) if (_valueFunctions.equal(_buckets[i]->value, value)) - return YES; + return true; - return NO; + return false; } -- (BOOL)containsValueIdenticalTo: (void*)value +- (bool)containsValueIdenticalTo: (void*)value { uint32_t i; if (value == NULL || _count == 0) - return NO; + return false; for (i = 0; i < _capacity; i++) if (_buckets[i] != NULL && _buckets[i] != &deleted) if (_buckets[i]->value == value) - return YES; + return true; - return NO; + return false; } - (OFMapTableEnumerator*)keyEnumerator { return [[[OFMapTableKeyEnumerator alloc] @@ -580,11 +580,11 @@ #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndValuesUsingBlock: (of_map_table_enumeration_block_t)block { size_t i; - BOOL stop = NO; + bool stop = false; unsigned long mutations = _mutations; for (i = 0; i < _capacity && !stop; i++) { if (_mutations != mutations) @throw [OFEnumerationMutationException @@ -597,11 +597,11 @@ } - (void)replaceValuesUsingBlock: (of_map_table_replace_block_t)block { size_t i; - BOOL stop = NO; + bool stop = false; unsigned long mutations = _mutations; for (i = 0; i < _capacity && !stop; i++) { if (_mutations != mutations) @throw [OFEnumerationMutationException Index: src/OFMutableArray.h ================================================================== --- src/OFMutableArray.h +++ src/OFMutableArray.h @@ -15,11 +15,11 @@ */ #import "OFArray.h" #ifdef OF_HAVE_BLOCKS -typedef id (^of_array_replace_block_t)(id obj, size_t idx, BOOL *stop); +typedef id (^of_array_replace_block_t)(id obj, size_t idx, bool *stop); #endif /*! * @brief An abstract class for storing, adding and removing objects in an * array. Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -373,11 +373,11 @@ #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { [self enumerateObjectsUsingBlock: ^ (id object, size_t index, - BOOL *stop) { + bool *stop) { [self replaceObjectAtIndex: index withObject: block(object, index, stop)]; }]; } #endif Index: src/OFMutableArray_adjacent.m ================================================================== --- src/OFMutableArray_adjacent.m +++ src/OFMutableArray_adjacent.m @@ -333,11 +333,11 @@ #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block { id *objects = [_array items]; size_t i, count = [_array count]; - BOOL stop = NO; + bool stop = false; unsigned long mutations = _mutations; for (i = 0; i < count && !stop; i++) { if (_mutations != mutations) @throw [OFEnumerationMutationException @@ -350,11 +350,11 @@ - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { id *objects = [_array items]; size_t i, count = [_array count]; - BOOL stop = NO; + bool stop = false; unsigned long mutations = _mutations; for (i = 0; i < count && !stop; i++) { id newObject; Index: src/OFMutableDictionary.h ================================================================== --- src/OFMutableDictionary.h +++ src/OFMutableDictionary.h @@ -15,11 +15,11 @@ */ #import "OFDictionary.h" #ifdef OF_HAVE_BLOCKS -typedef id (^of_dictionary_replace_block_t)(id key, id object, BOOL *stop); +typedef id (^of_dictionary_replace_block_t)(id key, id object, bool *stop); #endif /*! * @brief An abstract class for storing and changing objects in a dictionary. */ Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -197,11 +197,11 @@ #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block { [self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object, - BOOL *stop) { + bool *stop) { [self setObject: block(key, object, stop) forKey: key]; }]; } #endif Index: src/OFMutableDictionary_hashtable.m ================================================================== --- src/OFMutableDictionary_hashtable.m +++ src/OFMutableDictionary_hashtable.m @@ -62,11 +62,11 @@ #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block { @try { [_mapTable replaceValuesUsingBlock: - ^ void* (void *key, void *value, BOOL *stop) { + ^ void* (void *key, void *value, bool *stop) { return block(key, value, stop); }]; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException exceptionWithClass: [self class] Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -268,11 +268,11 @@ wordMiddleTableSize: (size_t)middleTableSize { void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = [self characters]; size_t i, length = [self length]; - BOOL isStart = YES; + bool isStart = true; for (i = 0; i < length; i++) { const of_unichar_t *const *table; size_t tableSize; of_unichar_t c = characters[i]; @@ -292,14 +292,14 @@ switch (c) { case ' ': case '\t': case '\n': case '\r': - isStart = YES; + isStart = true; break; default: - isStart = NO; + isStart = false; break; } } objc_autoreleasePoolPop(pool); Index: src/OFMutableString_UTF8.m ================================================================== --- src/OFMutableString_UTF8.m +++ src/OFMutableString_UTF8.m @@ -43,11 +43,11 @@ if (self == [OFMutableString_UTF8 class]) [self inheritMethodsFromClass: [OFString_UTF8 class]]; } - initWithUTF8StringNoCopy: (char*)UTF8String - freeWhenDone: (BOOL)freeWhenDone + freeWhenDone: (bool)freeWhenDone { @try { self = [self initWithUTF8String: UTF8String]; } @finally { if (freeWhenDone) @@ -64,19 +64,19 @@ { of_unichar_t *unicodeString; size_t unicodeLen, newCStringLength; size_t i, j; char *newCString; - BOOL isStart = YES; + bool isStart = true; if (!_s->isUTF8) { uint8_t t; const of_unichar_t *const *table; assert(startTableSize >= 1 && middleTableSize >= 1); - _s->hashed = NO; + _s->hashed = false; for (i = 0; i < _s->cStringLength; i++) { if (isStart) table = startTable; else @@ -85,14 +85,14 @@ switch (_s->cString[i]) { case ' ': case '\t': case '\n': case '\r': - isStart = YES; + isStart = true; break; default: - isStart = NO; + isStart = false; break; } if ((t = table[0][(uint8_t)_s->cString[i]]) != 0) _s->cString[i] = t; @@ -134,14 +134,14 @@ switch (c) { case ' ': case '\t': case '\n': case '\r': - isStart = YES; + isStart = true; break; default: - isStart = NO; + isStart = false; break; } if (c >> 8 < tableSize) { of_unichar_t tc = table[c >> 8][c & 0xFF]; @@ -193,11 +193,11 @@ assert(j == newCStringLength); newCString[j] = 0; [self freeMemory: unicodeString]; [self freeMemory: _s->cString]; - _s->hashed = NO; + _s->hashed = false; _s->cString = newCString; _s->cStringLength = newCStringLength; /* * Even though cStringLength can change, length cannot, therefore no @@ -219,11 +219,11 @@ if (index > _s->cStringLength) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; /* Shortcut if old and new character both are ASCII */ if (!(character & 0x80) && !(_s->cString[index] & 0x80)) { - _s->hashed = NO; + _s->hashed = false; _s->cString[index] = character; return; } if ((lenNew = of_string_utf8_encode(character, buffer)) == 0) @@ -233,11 +233,11 @@ if ((lenOld = of_string_utf8_decode(_s->cString + index, _s->cStringLength - index, &c)) == 0) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; - _s->hashed = NO; + _s->hashed = false; if (lenNew == lenOld) memcpy(_s->cString + index, buffer, lenNew); else if (lenNew > lenOld) { _s->cString = [self resizeMemory: _s->cString @@ -252,11 +252,11 @@ _s->cStringLength -= lenOld; _s->cStringLength += lenNew; _s->cString[_s->cStringLength] = '\0'; if (character & 0x80) - _s->isUTF8 = YES; + _s->isUTF8 = true; } else if (lenNew < lenOld) { memmove(_s->cString + index + lenNew, _s->cString + index + lenOld, _s->cStringLength - index - lenOld); memcpy(_s->cString + index, buffer, lenNew); @@ -286,18 +286,18 @@ UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { case 1: - _s->isUTF8 = YES; + _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } - _s->hashed = NO; + _s->hashed = false; _s->cString = [self resizeMemory: _s->cString size: _s->cStringLength + UTF8StringLength + 1]; memcpy(_s->cString + _s->cStringLength, UTF8String, UTF8StringLength + 1); @@ -316,18 +316,18 @@ UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &length)) { case 1: - _s->isUTF8 = YES; + _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; } - _s->hashed = NO; + _s->hashed = false; _s->cString = [self resizeMemory: _s->cString size: _s->cStringLength + UTF8StringLength + 1]; memcpy(_s->cString + _s->cStringLength, UTF8String, UTF8StringLength); @@ -371,11 +371,11 @@ exceptionWithClass: [self class] selector: _cmd]; UTF8StringLength = [string UTF8StringLength]; - _s->hashed = NO; + _s->hashed = false; _s->cString = [self resizeMemory: _s->cString size: _s->cStringLength + UTF8StringLength + 1]; memcpy(_s->cString + _s->cStringLength, [string UTF8String], UTF8StringLength); @@ -386,13 +386,13 @@ _s->cString[_s->cStringLength] = 0; if ([string isKindOfClass: [OFString_UTF8 class]] || [string isKindOfClass: [OFMutableString_UTF8 class]]) { if (((OFString_UTF8*)string)->_s->isUTF8) - _s->isUTF8 = YES; + _s->isUTF8 = true; } else - _s->isUTF8 = YES; + _s->isUTF8 = true; } - (void)appendCharacters: (of_unichar_t*)characters length: (size_t)length { @@ -399,35 +399,35 @@ char *tmp; tmp = [self allocMemoryWithSize: (length * 4) + 1]; @try { size_t i, j = 0; - BOOL isUTF8 = NO; + bool isUTF8 = false; for (i = 0; i < length; i++) { char buffer[4]; switch (of_string_utf8_encode(characters[i], buffer)) { case 1: tmp[j++] = buffer[0]; break; case 2: - isUTF8 = YES; + isUTF8 = true; memcpy(tmp + j, buffer, 2); j += 2; break; case 3: - isUTF8 = YES; + isUTF8 = true; memcpy(tmp + j, buffer, 3); j += 3; break; case 4: - isUTF8 = YES; + isUTF8 = true; memcpy(tmp + j, buffer, 4); j += 4; break; @@ -437,20 +437,20 @@ } } tmp[j] = '\0'; - _s->hashed = NO; + _s->hashed = false; _s->cString = [self resizeMemory: _s->cString size: _s->cStringLength + j + 1]; memcpy(_s->cString + _s->cStringLength, tmp, j + 1); _s->cStringLength += j; _s->length += length; if (isUTF8) - _s->isUTF8 = YES; + _s->isUTF8 = true; } @finally { [self freeMemory: tmp]; } } @@ -480,11 +480,11 @@ - (void)reverse { size_t i, j; - _s->hashed = NO; + _s->hashed = 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]; @@ -575,11 +575,11 @@ if (_s->isUTF8) index = of_string_utf8_get_position(_s->cString, index, _s->cStringLength); newCStringLength = _s->cStringLength + [string UTF8StringLength]; - _s->hashed = NO; + _s->hashed = false; _s->cString = [self resizeMemory: _s->cString size: newCStringLength + 1]; memmove(_s->cString + index + [string UTF8StringLength], _s->cString + index, _s->cStringLength - index); @@ -591,13 +591,13 @@ _s->length += [string length]; if ([string isKindOfClass: [OFString_UTF8 class]] || [string isKindOfClass: [OFMutableString_UTF8 class]]) { if (((OFString_UTF8*)string)->_s->isUTF8) - _s->isUTF8 = YES; + _s->isUTF8 = true; } else - _s->isUTF8 = YES; + _s->isUTF8 = true; } - (void)deleteCharactersInRange: (of_range_t)range { size_t start = range.location; @@ -613,11 +613,11 @@ _s->cStringLength); } memmove(_s->cString + start, _s->cString + end, _s->cStringLength - end); - _s->hashed = NO; + _s->hashed = false; _s->length -= range.length; _s->cStringLength -= end - start; _s->cString[_s->cStringLength] = 0; @try { @@ -647,11 +647,11 @@ _s->cStringLength); } newCStringLength = _s->cStringLength - (end - start) + [replacement UTF8StringLength]; - _s->hashed = NO; + _s->hashed = false; _s->cString = [self resizeMemory: _s->cString size: newCStringLength + 1]; memmove(_s->cString + start + [replacement UTF8StringLength], _s->cString + end, _s->cStringLength - end); @@ -732,11 +732,11 @@ _s->cStringLength - last); newCStringLength += _s->cStringLength - last; newCString[newCStringLength] = 0; [self freeMemory: _s->cString]; - _s->hashed = NO; + _s->hashed = false; _s->cString = newCString; _s->cStringLength = newCStringLength; _s->length = newLength; } @@ -748,11 +748,11 @@ if (_s->cString[i] != ' ' && _s->cString[i] != '\t' && _s->cString[i] != '\n' && _s->cString[i] != '\r' && _s->cString[i] != '\f') break; - _s->hashed = NO; + _s->hashed = false; _s->cStringLength -= i; _s->length -= i; memmove(_s->cString, _s->cString + i, _s->cStringLength); _s->cString[_s->cStringLength] = '\0'; @@ -768,11 +768,11 @@ - (void)deleteTrailingWhitespaces { size_t d; char *p; - _s->hashed = NO; + _s->hashed = false; d = 0; for (p = _s->cString + _s->cStringLength - 1; p >= _s->cString; p--) { if (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\r' && *p != '\f') @@ -796,11 +796,11 @@ - (void)deleteEnclosingWhitespaces { size_t d, i; char *p; - _s->hashed = NO; + _s->hashed = false; d = 0; for (p = _s->cString + _s->cStringLength - 1; p >= _s->cString; p--) { if (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\r' && *p != '\f') Index: src/OFMutex.h ================================================================== --- src/OFMutex.h +++ src/OFMutex.h @@ -23,11 +23,11 @@ * @brief A class for creating mutual exclusions. */ @interface OFMutex: OFObject { of_mutex_t _mutex; - BOOL _initialized; + bool _initialized; OFString *_name; } /*! * @brief Creates a new mutex. Index: src/OFMutex.m ================================================================== --- src/OFMutex.m +++ src/OFMutex.m @@ -40,11 +40,11 @@ Class c = [self class]; [self release]; @throw [OFInitializationFailedException exceptionWithClass: c]; } - _initialized = YES; + _initialized = true; return self; } - (void)lock @@ -52,11 +52,11 @@ if (!of_mutex_lock(&_mutex)) @throw [OFLockFailedException exceptionWithClass: [self class] lock: self]; } -- (BOOL)tryLock +- (bool)tryLock { return of_mutex_trylock(&_mutex); } - (void)unlock @@ -66,16 +66,16 @@ lock: self]; } - (void)setName: (OFString*)name { - OF_SETTER(_name, name, YES, 1) + OF_SETTER(_name, name, true, 1) } - (OFString*)name { - OF_GETTER(_name, YES) + OF_GETTER(_name, true) } - (OFString*)description { if (_name == nil) Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -32,11 +32,11 @@ /*! * @brief The C type of a number stored in an OFNumber. */ typedef enum of_number_type_t { - /*! BOOL */ + /*! bool */ OF_NUMBER_BOOL = 0x01, /*! unsigned char */ OF_NUMBER_UCHAR = 0x02, /*! unsigned short */ OF_NUMBER_USHORT = 0x03, @@ -98,11 +98,11 @@ */ @interface OFNumber: OFObject { union of_number_value { - BOOL bool_; + bool bool_; signed char schar; signed short sshort; signed int sint; signed long slong; signed long long slonglong; @@ -135,16 +135,16 @@ #ifdef OF_HAVE_PROPERTIES @property (readonly) of_number_type_t type; #endif /*! - * @brief Creates a new OFNumber with the specified BOOL. + * @brief Creates a new OFNumber with the specified bool. * - * @param bool_ A BOOL which the OFNumber should contain + * @param bool_ A bool which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithBool: (BOOL)bool_; ++ (instancetype)numberWithBool: (bool)bool_; /*! * @brief Creates a new OFNumber with the specified signed char. * * @param schar A signed char which the OFNumber should contain @@ -359,16 +359,16 @@ * @return A new autoreleased OFNumber */ + (instancetype)numberWithDouble: (double)double_; /*! - * @brief Initializes an already allocated OFNumber with the specified BOOL. + * @brief Initializes an already allocated OFNumber with the specified bool. * - * @param bool_ A BOOL which the OFNumber should contain + * @param bool_ A bool which the OFNumber should contain * @return An initialized OFNumber */ -- initWithBool: (BOOL)bool_; +- initWithBool: (bool)bool_; /*! * @brief Initializes an already allocated OFNumber with the specified signed * char. * @@ -603,15 +603,15 @@ * @return An of_number_type_t indicating the type of the number */ - (of_number_type_t)type; /*! - * @brief Returns the OFNumber as a BOOL. + * @brief Returns the OFNumber as a bool. * - * @return The OFNumber as a BOOL + * @return The OFNumber as a bool */ -- (BOOL)boolValue; +- (bool)boolValue; /*! * @brief Returns the OFNumber as a signed char. * * @return The OFNumber as a signed char Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -341,11 +341,11 @@ @throw [OFInvalidFormatException \ exceptionWithClass: [self class]]; \ } @implementation OFNumber -+ (instancetype)numberWithBool: (BOOL)bool_ ++ (instancetype)numberWithBool: (bool)bool_ { return [[[self alloc] initWithBool: bool_] autorelease]; } + (instancetype)numberWithChar: (signed char)schar @@ -493,15 +493,15 @@ } abort(); } -- initWithBool: (BOOL)bool_ +- initWithBool: (bool)bool_ { self = [super init]; - _value.bool_ = (bool_ ? YES : NO); + _value.bool_ = bool_; _type = OF_NUMBER_BOOL; return self; } @@ -792,14 +792,14 @@ typeString = [[element attributeForName: @"type"] stringValue]; if ([typeString isEqual: @"boolean"]) { _type = OF_NUMBER_BOOL; - if ([[element stringValue] isEqual: @"YES"]) - _value.bool_ = YES; - else if ([[element stringValue] isEqual: @"NO"]) - _value.bool_ = NO; + if ([[element stringValue] isEqual: @"true"]) + _value.bool_ = true; + else if ([[element stringValue] isEqual: @"false"]) + _value.bool_ = false; else @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; } else if ([typeString isEqual: @"unsigned"]) { @@ -849,73 +849,13 @@ - (of_number_type_t)type { return _type; } -- (BOOL)boolValue -{ - switch (_type) { - case OF_NUMBER_BOOL: - return !!_value.bool_; - case OF_NUMBER_CHAR: - return !!_value.schar; - case OF_NUMBER_SHORT: - return !!_value.sshort; - case OF_NUMBER_INT: - return !!_value.sint; - case OF_NUMBER_LONG: - return !!_value.slong; - case OF_NUMBER_LONGLONG: - return !!_value.slonglong; - case OF_NUMBER_UCHAR: - return !!_value.uchar; - case OF_NUMBER_USHORT: - return !!_value.ushort; - case OF_NUMBER_UINT: - return !!_value.uint; - case OF_NUMBER_ULONG: - return !!_value.ulong; - case OF_NUMBER_ULONGLONG: - return !!_value.ulonglong; - case OF_NUMBER_INT8: - return !!_value.int8; - case OF_NUMBER_INT16: - return !!_value.int16; - case OF_NUMBER_INT32: - return !!_value.int32; - case OF_NUMBER_INT64: - return !!_value.int64; - case OF_NUMBER_UINT8: - return !!_value.uint8; - case OF_NUMBER_UINT16: - return !!_value.uint16; - case OF_NUMBER_UINT32: - return !!_value.uint32; - case OF_NUMBER_UINT64: - return !!_value.uint64; - case OF_NUMBER_SIZE: - return !!_value.size; - case OF_NUMBER_SSIZE: - return !!_value.ssize; - case OF_NUMBER_INTMAX: - return !!_value.intmax; - case OF_NUMBER_UINTMAX: - return !!_value.uintmax; - case OF_NUMBER_PTRDIFF: - return !!_value.ptrdiff; - case OF_NUMBER_INTPTR: - return !!_value.intptr; - case OF_NUMBER_UINTPTR: - return !!_value.uintptr; - case OF_NUMBER_FLOAT: - return !!_value.float_; - case OF_NUMBER_DOUBLE: - return !!_value.double_; - default: - @throw [OFInvalidFormatException - exceptionWithClass: [self class]]; - } +- (bool)boolValue +{ + RETURN_AS(bool) } - (signed char)charValue { RETURN_AS(signed char) @@ -1049,16 +989,16 @@ - (double)doubleValue { RETURN_AS(double) } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFNumber *number; if (![object isKindOfClass: [OFNumber class]]) - return NO; + return false; number = object; if (_type & OF_NUMBER_FLOAT || number->_type & OF_NUMBER_FLOAT) return ([number doubleValue] == [self doubleValue]); @@ -1331,11 +1271,11 @@ { OFMutableString *ret; switch (_type) { case OF_NUMBER_BOOL: - return (_value.bool_ ? @"YES" : @"NO"); + return (_value.bool_ ? @"true" : @"false"); case OF_NUMBER_UCHAR: case OF_NUMBER_USHORT: case OF_NUMBER_UINT: case OF_NUMBER_ULONG: case OF_NUMBER_ULONGLONG: Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -194,37 +194,37 @@ * @brief Returns a boolean whether the object of the specified kind. * * @param class_ The class whose kind is checked * @return A boolean whether the object is of the specified kind */ -- (BOOL)isKindOfClass: (Class)class_; +- (bool)isKindOfClass: (Class)class_; /*! * @brief Returns a boolean whether the object is a member of the specified * class. * * @param class_ The class for which the receiver is checked * @return A boolean whether the object is a member of the specified class */ -- (BOOL)isMemberOfClass: (Class)class_; +- (bool)isMemberOfClass: (Class)class_; /*! * @brief Returns a boolean whether the object responds to the specified * selector. * * @param selector The selector which should be checked for respondance * @return A boolean whether the objects responds to the specified selector */ -- (BOOL)respondsToSelector: (SEL)selector; +- (bool)respondsToSelector: (SEL)selector; /*! * @brief Checks whether the object conforms to the specified protocol. * * @param protocol The protocol which should be checked for conformance * @return A boolean whether the object conforms to the specified protocol */ -- (BOOL)conformsToProtocol: (Protocol*)protocol; +- (bool)conformsToProtocol: (Protocol*)protocol; /*! * @brief Returns the implementation for the specified selector. * * @param selector The selector for which the method should be returned @@ -283,11 +283,11 @@ * return the same hash for objects which are equal! * * @param object The object which should be tested for equality * @return A boolean whether the object is equal to the specified object */ -- (BOOL)isEqual: (id)object; +- (bool)isEqual: (id)object; /*! * @brief Calculates a hash for the object. * * Classes containing data (like strings, arrays, lists etc.) should reimplement @@ -342,11 +342,11 @@ /*! * @brief Returns whether the object is a proxy object. * * @return A boolean whether the object is a proxy object */ -- (BOOL)isProxy; +- (bool)isProxy; @end /*! * @brief The root class for all other classes inside ObjFW. */ @@ -412,11 +412,11 @@ * class. * * @param class_ The class which is checked for being a superclass * @return A boolean whether the class is a subclass of the specified class */ -+ (BOOL)isSubclassOfClass: (Class)class_; ++ (bool)isSubclassOfClass: (Class)class_; /*! * @brief Returns the superclass of the class. * * @return The superclass of the class @@ -428,19 +428,19 @@ * * @param selector The selector which should be checked for respondance * @return A boolean whether instances of the class respond to the specified * selector */ -+ (BOOL)instancesRespondToSelector: (SEL)selector; ++ (bool)instancesRespondToSelector: (SEL)selector; /*! * @brief Checks whether the class conforms to a given protocol. * * @param protocol The protocol which should be checked for conformance * @return A boolean whether the class conforms to the specified protocol */ -+ (BOOL)conformsToProtocol: (Protocol*)protocol; ++ (bool)conformsToProtocol: (Protocol*)protocol; /*! * @brief Returns the implementation of the instance method for the specified * selector. * @@ -547,21 +547,21 @@ * This method is called if a class method was not found, so that an * implementation can be provided at runtime. * * @return Whether the method has been added to the class */ -+ (BOOL)resolveClassMethod: (SEL)selector; ++ (bool)resolveClassMethod: (SEL)selector; /*! * @brief Try to resolve the specified instance method. * * This method is called if an instance method was not found, so that an * implementation can be provided at runtime. * * @return Whether the method has been added to the class */ -+ (BOOL)resolveInstanceMethod: (SEL)selector; ++ (bool)resolveInstanceMethod: (SEL)selector; /*! * @brief Initializes an already allocated object. * * Derived classes may override this, but need to do @@ -708,11 +708,11 @@ * @param thread The thread on which to perform the selector * @param waitUntilDone Whether to wait until the perform finished */ - (void)performSelector: (SEL)selector onThread: (OFThread*)thread - waitUntilDone: (BOOL)waitUntilDone; + waitUntilDone: (bool)waitUntilDone; /*! * @brief Performs the specified selector on the specified thread with the * specified object. * @@ -723,11 +723,11 @@ * @param waitUntilDone Whether to wait until the perform finished */ - (void)performSelector: (SEL)selector onThread: (OFThread*)thread withObject: (id)object - waitUntilDone: (BOOL)waitUntilDone; + waitUntilDone: (bool)waitUntilDone; /*! * @brief Performs the specified selector on the specified thread with the * specified objects. * @@ -741,20 +741,20 @@ */ - (void)performSelector: (SEL)selector onThread: (OFThread*)thread withObject: (id)object1 withObject: (id)object2 - waitUntilDone: (BOOL)waitUntilDone; + waitUntilDone: (bool)waitUntilDone; /*! * @brief Performs the specified selector on the main thread. * * @param selector The selector to perform * @param waitUntilDone Whether to wait until the perform finished */ - (void)performSelectorOnMainThread: (SEL)selector - waitUntilDone: (BOOL)waitUntilDone; + waitUntilDone: (bool)waitUntilDone; /*! * @brief Performs the specified selector on the main thread with the specified * object. * @@ -763,11 +763,11 @@ * selector * @param waitUntilDone Whether to wait until the perform finished */ - (void)performSelectorOnMainThread: (SEL)selector withObject: (id)object - waitUntilDone: (BOOL)waitUntilDone; + waitUntilDone: (bool)waitUntilDone; /*! * @brief Performs the specified selector on the main thread with the specified * objects. * @@ -779,11 +779,11 @@ * @param waitUntilDone Whether to wait until the perform finished */ - (void)performSelectorOnMainThread: (SEL)selector withObject: (id)object1 withObject: (id)object2 - waitUntilDone: (BOOL)waitUntilDone; + waitUntilDone: (bool)waitUntilDone; /*! * @brief Performs the specified selector on the specified thread after the * specified delay. * @@ -829,11 +829,11 @@ afterDelay: (double)delay; #endif /*! * @brief This method is called when @ref resolveClassMethod: or - * @ref resolveInstanceMethod: returned NO. It should return a target + * @ref resolveInstanceMethod: returned false. It should return a target * to which the message should be forwarded. * * @note When the message should not be forwarded, you should not return nil, * but instead return the result of the superclass! * Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -133,11 +133,11 @@ if (class_isMetaClass(object_getClass(obj))) { if ([obj respondsToSelector: @selector(resolveClassMethod:)] && [obj resolveClassMethod: sel]) { if (![obj respondsToSelector: sel]) { fprintf(stderr, "Runtime error: [%s " - "resolveClassMethod: %s] returned YES " + "resolveClassMethod: %s] returned true " "without adding the method!\n", class_getName(obj), sel_getName(sel)); abort(); } @@ -148,11 +148,11 @@ if ([c respondsToSelector: @selector(resolveInstanceMethod:)] && [c resolveInstanceMethod: sel]) { if (![obj respondsToSelector: sel]) { fprintf(stderr, "Runtime error: [%s " - "resolveInstanceMethod: %s] returned YES " + "resolveInstanceMethod: %s] returned true " "without adding the method!\n", class_getName(object_getClass(obj)), sel_getName(sel)); abort(); } @@ -292,40 +292,40 @@ { return [OFString stringWithCString: class_getName(self) encoding: OF_STRING_ENCODING_ASCII]; } -+ (BOOL)isSubclassOfClass: (Class)class ++ (bool)isSubclassOfClass: (Class)class { Class iter; for (iter = self; iter != Nil; iter = class_getSuperclass(iter)) if (iter == class) - return YES; + return true; - return NO; + return false; } + (Class)superclass { return class_getSuperclass(self); } -+ (BOOL)instancesRespondToSelector: (SEL)selector ++ (bool)instancesRespondToSelector: (SEL)selector { return class_respondsToSelector(self, selector); } -+ (BOOL)conformsToProtocol: (Protocol*)protocol ++ (bool)conformsToProtocol: (Protocol*)protocol { Class c; for (c = self; c != Nil; c = class_getSuperclass(c)) if (class_conformsToProtocol(c, protocol)) - return YES; + return true; - return NO; + return false; } + (IMP)instanceMethodForSelector: (SEL)selector { return class_getMethodImplementation(self, selector); @@ -489,18 +489,18 @@ #endif [self inheritMethodsFromClass: [class superclass]]; } -+ (BOOL)resolveClassMethod: (SEL)selector ++ (bool)resolveClassMethod: (SEL)selector { - return NO; + return false; } -+ (BOOL)resolveInstanceMethod: (SEL)selector ++ (bool)resolveInstanceMethod: (SEL)selector { - return NO; + return false; } - init { return self; @@ -515,33 +515,33 @@ { return [OFString stringWithCString: object_getClassName(self) encoding: OF_STRING_ENCODING_ASCII]; } -- (BOOL)isKindOfClass: (Class)class +- (bool)isKindOfClass: (Class)class { Class iter; for (iter = object_getClass(self); iter != Nil; iter = class_getSuperclass(iter)) if (iter == class) - return YES; + return true; - return NO; + return false; } -- (BOOL)isMemberOfClass: (Class)class +- (bool)isMemberOfClass: (Class)class { return (object_getClass(self) == class); } -- (BOOL)respondsToSelector: (SEL)selector +- (bool)respondsToSelector: (SEL)selector { return class_respondsToSelector(object_getClass(self), selector); } -- (BOOL)conformsToProtocol: (Protocol*)protocol +- (bool)conformsToProtocol: (Protocol*)protocol { return [object_getClass(self) conformsToProtocol: protocol]; } - (IMP)methodForSelector: (SEL)selector @@ -590,11 +590,11 @@ void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self selector: selector - repeats: NO]; + repeats: false]; objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector @@ -605,11 +605,11 @@ [OFTimer scheduledTimerWithTimeInterval: delay target: self selector: selector object: object - repeats: NO]; + repeats: false]; objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector @@ -622,25 +622,25 @@ [OFTimer scheduledTimerWithTimeInterval: delay target: self selector: selector object: object1 object: object2 - repeats: NO]; + repeats: false]; objc_autoreleasePoolPop(pool); } #ifdef OF_HAVE_THREADS - (void)performSelector: (SEL)selector onThread: (OFThread*)thread - waitUntilDone: (BOOL)waitUntilDone + waitUntilDone: (bool)waitUntilDone { void *pool = objc_autoreleasePoolPush(); OFTimer *timer = [OFTimer timerWithTimeInterval: 0 target: self selector: selector - repeats: NO]; + repeats: false]; [[thread runLoop] addTimer: timer]; if (waitUntilDone) [timer waitUntilDone]; @@ -648,18 +648,18 @@ } - (void)performSelector: (SEL)selector onThread: (OFThread*)thread withObject: (id)object - waitUntilDone: (BOOL)waitUntilDone + waitUntilDone: (bool)waitUntilDone { void *pool = objc_autoreleasePoolPush(); OFTimer *timer = [OFTimer timerWithTimeInterval: 0 target: self selector: selector object: object - repeats: NO]; + repeats: false]; [[thread runLoop] addTimer: timer]; if (waitUntilDone) [timer waitUntilDone]; @@ -668,35 +668,35 @@ - (void)performSelector: (SEL)selector onThread: (OFThread*)thread withObject: (id)object1 withObject: (id)object2 - waitUntilDone: (BOOL)waitUntilDone + waitUntilDone: (bool)waitUntilDone { void *pool = objc_autoreleasePoolPush(); OFTimer *timer = [OFTimer timerWithTimeInterval: 0 target: self selector: selector object: object1 object: object2 - repeats: NO]; + repeats: false]; [[thread runLoop] addTimer: timer]; if (waitUntilDone) [timer waitUntilDone]; objc_autoreleasePoolPop(pool); } - (void)performSelectorOnMainThread: (SEL)selector - waitUntilDone: (BOOL)waitUntilDone + waitUntilDone: (bool)waitUntilDone { void *pool = objc_autoreleasePoolPush(); OFTimer *timer = [OFTimer timerWithTimeInterval: 0 target: self selector: selector - repeats: NO]; + repeats: false]; [[OFRunLoop mainRunLoop] addTimer: timer]; if (waitUntilDone) [timer waitUntilDone]; @@ -703,18 +703,18 @@ objc_autoreleasePoolPop(pool); } - (void)performSelectorOnMainThread: (SEL)selector withObject: (id)object - waitUntilDone: (BOOL)waitUntilDone + waitUntilDone: (bool)waitUntilDone { void *pool = objc_autoreleasePoolPush(); OFTimer *timer = [OFTimer timerWithTimeInterval: 0 target: self selector: selector object: object - repeats: NO]; + repeats: false]; [[OFRunLoop mainRunLoop] addTimer: timer]; if (waitUntilDone) [timer waitUntilDone]; @@ -722,19 +722,19 @@ } - (void)performSelectorOnMainThread: (SEL)selector withObject: (id)object1 withObject: (id)object2 - waitUntilDone: (BOOL)waitUntilDone + waitUntilDone: (bool)waitUntilDone { void *pool = objc_autoreleasePoolPush(); OFTimer *timer = [OFTimer timerWithTimeInterval: 0 target: self selector: selector object: object1 object: object2 - repeats: NO]; + repeats: false]; [[OFRunLoop mainRunLoop] addTimer: timer]; if (waitUntilDone) [timer waitUntilDone]; @@ -748,11 +748,11 @@ void *pool = objc_autoreleasePoolPush(); [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay target: self selector: selector - repeats: NO]]; + repeats: false]]; objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector @@ -764,11 +764,11 @@ [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay target: self selector: selector object: object - repeats: NO]]; + repeats: false]]; objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector @@ -782,11 +782,11 @@ [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay target: self selector: selector object: object1 object: object2 - repeats: NO]]; + repeats: false]]; objc_autoreleasePoolPop(pool); } #endif @@ -803,11 +803,11 @@ return method_getTypeEncoding(m); #endif } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { return (self == object); } - (uint32_t)hash @@ -1014,13 +1014,13 @@ - self { return self; } -- (BOOL)isProxy +- (bool)isProxy { - return NO; + return false; } - (void)dealloc { struct pre_mem *iter; Index: src/OFProcess.h ================================================================== --- src/OFProcess.h +++ src/OFProcess.h @@ -43,11 +43,11 @@ int _readPipe[2], _writePipe[2]; #else HANDLE _process, _readPipe[2], _writePipe[2]; #endif int _status; - BOOL _atEndOfStream; + bool _atEndOfStream; } /*! * @brief Creates a new OFProcess with the specified program and invokes the * program. Index: src/OFProcess.m ================================================================== --- src/OFProcess.m +++ src/OFProcess.m @@ -225,11 +225,11 @@ enumerator = [arguments objectEnumerator]; while ((argument = [enumerator nextObject]) != nil) { OFMutableString *tmp = [[argument mutableCopy] autorelease]; - BOOL containsSpaces = [tmp containsString: @" "]; + bool containsSpaces = [tmp containsString: @" "]; [argumentsString appendString: @" "]; if (containsSpaces) [argumentsString appendString: @"\""]; @@ -357,18 +357,18 @@ return [env items]; } #endif -- (BOOL)lowlevelIsAtEndOfStream +- (bool)lowlevelIsAtEndOfStream { #ifndef _WIN32 if (_readPipe[0] == -1) #else if (_readPipe[0] == NULL) #endif - return YES; + return true; return _atEndOfStream; } - (size_t)lowlevelReadIntoBuffer: (void*)buffer @@ -385,11 +385,11 @@ (ret = read(_readPipe[0], buffer, length)) < 0) { #else if (_readPipe[0] == NULL || _atEndOfStream || !ReadFile(_readPipe[0], buffer, length, &ret, NULL)) { if (GetLastError() == ERROR_BROKEN_PIPE) { - _atEndOfStream = YES; + _atEndOfStream = true; return 0; } #endif @throw [OFReadFailedException exceptionWithClass: [self class] @@ -396,11 +396,11 @@ stream: self requestedLength: length]; } if (ret == 0) - _atEndOfStream = YES; + _atEndOfStream = true; return ret; } - (void)lowlevelWriteBuffer: (const void*)buffer Index: src/OFRecursiveMutex.h ================================================================== --- src/OFRecursiveMutex.h +++ src/OFRecursiveMutex.h @@ -24,11 +24,11 @@ * recursively. */ @interface OFRecursiveMutex: OFObject { of_rmutex_t _rmutex; - BOOL _initialized; + bool _initialized; OFString *_name; } /*! * @brief Creates a new recursive mutex. Index: src/OFRecursiveMutex.m ================================================================== --- src/OFRecursiveMutex.m +++ src/OFRecursiveMutex.m @@ -40,11 +40,11 @@ Class c = [self class]; [self release]; @throw [OFInitializationFailedException exceptionWithClass: c]; } - _initialized = YES; + _initialized = true; return self; } - (void)lock @@ -52,11 +52,11 @@ if (!of_rmutex_lock(&_rmutex)) @throw [OFLockFailedException exceptionWithClass: [self class] lock: self]; } -- (BOOL)tryLock +- (bool)tryLock { return of_rmutex_trylock(&_rmutex); } - (void)unlock @@ -66,16 +66,16 @@ lock: self]; } - (void)setName: (OFString*)name { - OF_SETTER(_name, name, YES, 1) + OF_SETTER(_name, name, true, 1) } - (OFString*)name { - OF_GETTER(_name, YES) + OF_GETTER(_name, true) } - (OFString*)description { if (_name == nil) Index: src/OFRunLoop.h ================================================================== --- src/OFRunLoop.h +++ src/OFRunLoop.h @@ -35,11 +35,11 @@ #ifdef OF_HAVE_THREADS OFMutex *_timersQueueLock; #endif OFStreamObserver *_streamObserver; OFMutableDictionary *_readQueues; - volatile BOOL _running; + volatile bool _running; } /*! * @brief Returns the main run loop. * Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -398,12 +398,12 @@ removeObjectForKey: stream]; } } } else { #endif - BOOL (*func)(id, SEL, OFStream*, void*, size_t, - OFException*) = (BOOL(*)(id, SEL, OFStream*, void*, + bool (*func)(id, SEL, OFStream*, void*, size_t, + OFException*) = (bool(*)(id, SEL, OFStream*, void*, size_t, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (!func(queueItem->_target, queueItem->_selector, @@ -457,12 +457,12 @@ removeObjectForKey: stream]; } } } else { #endif - BOOL (*func)(id, SEL, OFStream*, void*, - size_t, OFException*) = (BOOL(*)(id, SEL, + bool (*func)(id, SEL, OFStream*, void*, + size_t, OFException*) = (bool(*)(id, SEL, OFStream*, void*, size_t, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (func(queueItem->_target, @@ -515,12 +515,12 @@ removeObjectForKey: stream]; } } } else { #endif - BOOL (*func)(id, SEL, OFStream*, OFString*, - OFException*) = (BOOL(*)(id, SEL, OFStream*, + bool (*func)(id, SEL, OFStream*, OFString*, + OFException*) = (bool(*)(id, SEL, OFStream*, OFString*, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (!func(queueItem->_target, @@ -566,13 +566,13 @@ removeObjectForKey: stream]; } } } else { #endif - BOOL (*func)(id, SEL, OFTCPSocket*, OFTCPSocket*, + bool (*func)(id, SEL, OFTCPSocket*, OFTCPSocket*, OFException*) = - (BOOL(*)(id, SEL, OFTCPSocket*, OFTCPSocket*, + (bool(*)(id, SEL, OFTCPSocket*, OFTCPSocket*, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (!func(queueItem->_target, queueItem->_selector, @@ -593,11 +593,11 @@ OF_ENSURE(0); } - (void)run { - _running = YES; + _running = true; while (_running) { void *pool = objc_autoreleasePoolPush(); OFDate *now = [OFDate date]; OFTimer *timer; @@ -660,9 +660,9 @@ } } - (void)stop { - _running = NO; + _running = false; [_streamObserver cancel]; } @end Index: src/OFSHA1Hash.h ================================================================== --- src/OFSHA1Hash.h +++ src/OFSHA1Hash.h @@ -25,8 +25,8 @@ { uint32_t _state[5]; uint64_t _count; char _buffer[64]; uint8_t _digest[OF_SHA1_DIGEST_SIZE]; - BOOL _calculated; + bool _calculated; } @end Index: src/OFSHA1Hash.m ================================================================== --- src/OFSHA1Hash.m +++ src/OFSHA1Hash.m @@ -191,15 +191,15 @@ for (i = 0; i < OF_SHA1_DIGEST_SIZE; i++) _digest[i] = (char)((_state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255); - _calculated = YES; + _calculated = true; return _digest; } -- (BOOL)isCalculated +- (bool)isCalculated { return _calculated; } @end Index: src/OFSet.h ================================================================== --- src/OFSet.h +++ src/OFSet.h @@ -28,12 +28,12 @@ #import "OFSerialization.h" @class OFArray; #ifdef OF_HAVE_BLOCKS -typedef void (^of_set_enumeration_block_t)(id object, BOOL *stop); -typedef BOOL (^of_set_filter_block_t)(id object); +typedef void (^of_set_enumeration_block_t)(id object, bool *stop); +typedef bool (^of_set_filter_block_t)(id object); #endif /*! * @brief An abstract class for an unordered set of unique objects. * @@ -131,20 +131,20 @@ /*! * @brief Returns whether the receiver is a subset of the specified set. * * @return Whether the receiver is a subset of the specified set */ -- (BOOL)isSubsetOfSet: (OFSet*)set; +- (bool)isSubsetOfSet: (OFSet*)set; /*! * @brief Returns whether the receiver and the specified set have at least one * object in common. * * @return Whether the receiver and the specified set have at least one object * in common */ -- (BOOL)intersectsSet: (OFSet*)set; +- (bool)intersectsSet: (OFSet*)set; /*! * @brief Creates a new set which contains the objects which are in the * receiver, but not in the specified set. * @@ -176,15 +176,15 @@ */ - (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block; /*! * @brief Creates a new set, only containing the objects for which the block - * returns YES. + * returns true. * * @param block A block which determines if the object should be in the new set * @return A new, autoreleased OFSet */ - (OFSet*)filteredSetUsingBlock: (of_set_filter_block_t)block; #endif @end #import "OFMutableSet.h" Index: src/OFSet.m ================================================================== --- src/OFSet.m +++ src/OFSet.m @@ -249,11 +249,11 @@ { [self doesNotRecognizeSelector: _cmd]; abort(); } -- (BOOL)containsObject: (id)object +- (bool)containsObject: (id)object { [self doesNotRecognizeSelector: _cmd]; abort(); } @@ -269,21 +269,21 @@ { [self doesNotRecognizeSelector: _cmd]; abort(); } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFSet *otherSet; if (![object isKindOfClass: [OFSet class]]) - return NO; + return false; otherSet = object; if ([otherSet count] != [self count]) - return NO; + return false; return [otherSet isSubsetOfSet: self]; } - (uint32_t)hash @@ -347,46 +347,46 @@ - mutableCopy { return [[OFMutableSet alloc] initWithSet: self]; } -- (BOOL)isSubsetOfSet: (OFSet*)set +- (bool)isSubsetOfSet: (OFSet*)set { void *pool = objc_autoreleasePoolPush(); OFEnumerator *enumerator; id object; enumerator = [self objectEnumerator]; while ((object = [enumerator nextObject]) != nil) { if (![set containsObject: object]) { objc_autoreleasePoolPop(pool); - return NO; + return false; } } objc_autoreleasePoolPop(pool); - return YES; + return true; } -- (BOOL)intersectsSet: (OFSet*)set +- (bool)intersectsSet: (OFSet*)set { void *pool = objc_autoreleasePoolPush(); OFEnumerator *enumerator; id object; enumerator = [self objectEnumerator]; while ((object = [enumerator nextObject]) != nil) { if ([set containsObject: object]) { objc_autoreleasePoolPop(pool); - return YES; + return true; } } objc_autoreleasePoolPop(pool); - return NO; + return false; } - (OFXMLElement*)XMLElementBySerializing { void *pool = objc_autoreleasePoolPush(); @@ -455,11 +455,11 @@ } #if defined(OF_HAVE_BLOCKS) && defined(OF_HAVE_FAST_ENUMERATION) - (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block { - BOOL stop = NO; + bool stop = false; for (id object in self) { block(object, &stop); if (stop) @@ -471,11 +471,11 @@ #ifdef OF_HAVE_BLOCKS - (OFSet*)filteredSetUsingBlock: (of_set_filter_block_t)block { OFMutableSet *ret = [OFMutableSet set]; - [self enumerateObjectsUsingBlock: ^ (id object, BOOL *stop) { + [self enumerateObjectsUsingBlock: ^ (id object, bool *stop) { if (block(object)) [ret addObject: object]; }]; [ret makeImmutable]; Index: src/OFSet_hashtable.m ================================================================== --- src/OFSet_hashtable.m +++ src/OFSet_hashtable.m @@ -45,11 +45,11 @@ hash(void *value) { return [(id)value hash]; } -static BOOL +static bool equal(void *value1, void *value2) { return [(id)value1 isEqual: (id)value2]; } @@ -252,19 +252,19 @@ - (size_t)count { return [_mapTable count]; } -- (BOOL)containsObject: (id)object +- (bool)containsObject: (id)object { if (object == nil) - return NO; + return false; return ([_mapTable valueForKey: object] != nil); } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFSet_hashtable *set; if (![object isKindOfClass: [OFSet_hashtable class]] && ![object isKindOfClass: [OFMutableSet_hashtable class]] && @@ -295,11 +295,11 @@ #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block { @try { [_mapTable enumerateKeysAndValuesUsingBlock: - ^ (void *key, void *value, BOOL *stop) { + ^ (void *key, void *value, bool *stop) { block(key, stop); }]; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException exceptionWithClass: [self class] Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -29,13 +29,13 @@ @class OFStream; @class OFDataArray; @class OFException; #ifdef OF_HAVE_BLOCKS -typedef BOOL (^of_stream_async_read_block_t)(OFStream*, void*, size_t, +typedef bool (^of_stream_async_read_block_t)(OFStream*, void*, size_t, OFException*); -typedef BOOL (^of_stream_async_read_line_block_t)(OFStream*, OFString*, +typedef bool (^of_stream_async_read_line_block_t)(OFStream*, OFString*, OFException*); #endif /*! * @brief A base class for different types of streams. @@ -57,25 +57,25 @@ */ @interface OFStream: OFObject { char *_readBuffer, *_writeBuffer; size_t _readBufferLength, _writeBufferLength; - BOOL _writeBufferEnabled, _blocking, _waitingForDelimiter; + bool _writeBufferEnabled, _blocking, _waitingForDelimiter; } #ifdef OF_HAVE_PROPERTIES -@property (getter=isWriteBufferEnabled) BOOL writeBufferEnabled; -@property (getter=isBlocking) BOOL blocking; -@property (readonly, getter=isAtEndOfStream) BOOL atEndOfStream; +@property (getter=isWriteBufferEnabled) bool writeBufferEnabled; +@property (getter=isBlocking) bool blocking; +@property (readonly, getter=isAtEndOfStream) bool atEndOfStream; #endif /*! * @brief Returns a boolean whether the end of the stream has been reached. * * @return A boolean whether the end of the stream has been reached */ -- (BOOL)isAtEndOfStream; +- (bool)isAtEndOfStream; /*! * @brief Reads *at most* size bytes from the stream into a buffer. * * On network streams, this might read less than the specified number of bytes. @@ -123,17 +123,17 @@ * @param buffer The buffer into which the data is read. * The buffer must not be free'd before the async read completed! * @param length The length of the data that should be read at most. * The buffer *must* be *at least* this big! * @param target The target on which the selector should be called when the - * data has been received. If the method returns YES, it will be + * data has been received. If the method returns true, it will be * called again with the same buffer and maximum length when more * data has been received. If you want the next method in the - * queue to handle the data received next, you need to return NO - * from the method. + * queue to handle the data received next, you need to return + * false from the method. * @param selector The selector to call on the target. The signature must be - * BOOL (OFStream *stream, void *buffer, size_t size, + * bool (OFStream *stream, void *buffer, size_t size, * OFException *exception). */ - (void)asyncReadIntoBuffer: (void*)buffer length: (size_t)length target: (id)target @@ -150,17 +150,17 @@ * * @param buffer The buffer into which the data is read * @param length The length of the data that should be read. * The buffer *must* be *at least* this big! * @param target The target on which the selector should be called when the - * data has been received. If the method returns YES, it will be + * data has been received. If the method returns true, it will be * called again with the same buffer and exact length when more * data has been received. If you want the next method in the - * queue to handle the data received next, you need to return NO - * from the method. + * queue to handle the data received next, you need to return + * false from the method. * @param selector The selector to call on the target. The signature must be - * BOOL (OFStream *stream, void *buffer, size_t size, + * bool (OFStream *stream, void *buffer, size_t size, * OFException *exception). */ - (void)asyncReadIntoBuffer: (void*)buffer exactLength: (size_t)length target: (id)target @@ -180,14 +180,14 @@ * @param buffer The buffer into which the data is read. * The buffer must not be free'd before the async read completed! * @param length The length of the data that should be read at most. * The buffer *must* be *at least* this big! * @param block The block to call when the data has been received. - * If the block returns YES, it will be called again with the same + * If the block returns true, it will be called again with the same * buffer and maximum length when more data has been received. If * you want the next block in the queue to handle the data - * received next, you need to return NO from the block. + * received next, you need to return false from the block. */ - (void)asyncReadIntoBuffer: (void*)buffer length: (size_t)length block: (of_stream_async_read_block_t)block; @@ -202,14 +202,14 @@ * * @param buffer The buffer into which the data is read * @param length The length of the data that should be read. * The buffer *must* be *at least* this big! * @param block The block to call when the data has been received. - * If the block returns YES, it will be called again with the same + * If the block returns true, it will be called again with the same * buffer and exact length when more data has been received. If * you want the next block in the queue to handle the data - * received next, you need to return NO from the block. + * received next, you need to return false from the block. */ - (void)asyncReadIntoBuffer: (void*)buffer exactLength: (size_t)length block: (of_stream_async_read_block_t)block; #endif @@ -563,16 +563,16 @@ /*! * @brief Asyncronously reads until a newline, \\0, end of stream or an * exception occurs. * * @param target The target on which to call the selector when the data has - * been received. If the method returns YES, it will be called + * been received. If the method returns true, it will be called * again when the next line has been received. If you want the * next method in the queue to handle the next line, you need to - * return NO from the method + * return false from the method * @param selector The selector to call on the target. The signature must be - * BOOL (OFStream *stream, OFString *line, + * bool (OFStream *stream, OFString *line, * OFException *exception). */ - (void)asyncReadLineWithTarget: (id)target selector: (SEL)selector; @@ -580,16 +580,16 @@ * @brief Asyncronously reads with the specified encoding until a newline, \\0, * end of stream or an exception occurs. * * @param encoding The encoding used by the stream * @param target The target on which to call the selector when the data has - * been received. If the method returns YES, it will be called + * been received. If the method returns true, it will be called * again when the next line has been received. If you want the * next method in the queue to handle the next line, you need to - * return NO from the method + * return false from the method * @param selector The selector to call on the target. The signature must be - * BOOL (OFStream *stream, OFString *line, + * bool (OFStream *stream, OFString *line, * OFException *exception). */ - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding target: (id)target selector: (SEL)selector; @@ -598,25 +598,27 @@ /*! * @brief Asyncronously reads until a newline, \\0, end of stream or an * exception occurs. * * @param block The block to call when the data has been received. - * If the block returns YES, it will be called again when the next + * If the block returns true, it will be called again when the next * line has been received. If you want the next block in the queue - * to handle the next line, you need to return NO from the block. + * to handle the next line, you need to return false from the + * block. */ - (void)asyncReadLineWithBlock: (of_stream_async_read_line_block_t)block; /*! * @brief Asyncronously reads with the specified encoding until a newline, \\0, * end of stream or an exception occurs. * * @param encoding The encoding used by the stream * @param block The block to call when the data has been received. - * If the block returns YES, it will be called again when the next + * If the block returns true, it will be called again when the next * line has been received. If you want the next block in the queue - * to handle the next line, you need to return NO from the block. + * to handle the next line, you need to return false from the + * block. */ - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block; #endif @@ -689,18 +691,18 @@ /*! * @brief Returns a boolen whether writes are buffered. * * @return A boolean whether writes are buffered */ -- (BOOL)isWriteBufferEnabled; +- (bool)isWriteBufferEnabled; /*! * @brief Enables or disables the write buffer. * * @param enable Whether the write buffer should be enabled or disabled */ -- (void)setWriteBufferEnabled: (BOOL)enable; +- (void)setWriteBufferEnabled: (bool)enable; /*! * @brief Writes everythig in the write buffer to the stream. */ - (void)flushWriteBuffer; @@ -991,21 +993,21 @@ /*! * @brief Returns whether the stream is in blocking mode. * * @return Whether the stream is in blocking mode */ -- (BOOL)isBlocking; +- (bool)isBlocking; /*! * @brief Enables or disables non-blocking I/O. * * By default, a stream is in blocking mode. * On Win32, this currently only works for sockets! * * @param enable Whether the stream should be blocking */ -- (void)setBlocking: (BOOL)enable; +- (void)setBlocking: (bool)enable; /*! * @brief Returns the file descriptor for the read end of the stream. * * @return The file descriptor for the read end of the stream @@ -1064,9 +1066,9 @@ * Override this method with your actual end of stream checking implementation * when subclassing! * * @return Whether the lowlevel is at the end of the stream */ -- (BOOL)lowlevelIsAtEndOfStream; +- (bool)lowlevelIsAtEndOfStream; -- (BOOL)OF_isWaitingForDelimiter; +- (bool)OF_isWaitingForDelimiter; @end Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -66,16 +66,16 @@ } } self = [super init]; - _blocking = YES; + _blocking = true; return self; } -- (BOOL)lowlevelIsAtEndOfStream +- (bool)lowlevelIsAtEndOfStream { [self doesNotRecognizeSelector: _cmd]; abort(); } @@ -96,14 +96,14 @@ - copy { return [self retain]; } -- (BOOL)isAtEndOfStream +- (bool)isAtEndOfStream { if (_readBufferLength > 0) - return NO; + return false; return [self lowlevelIsAtEndOfStream]; } - (size_t)readIntoBuffer: (void*)buffer @@ -593,11 +593,11 @@ [self freeMemory: _readBuffer]; _readBuffer = readBuffer; _readBufferLength -= i + 1; - _waitingForDelimiter = NO; + _waitingForDelimiter = false; return ret; } } } @@ -606,11 +606,11 @@ buffer = [self allocMemoryWithSize: pageSize]; @try { if ([self lowlevelIsAtEndOfStream]) { if (_readBuffer == NULL) { - _waitingForDelimiter = NO; + _waitingForDelimiter = false; return nil; } retLength = _readBufferLength; @@ -623,11 +623,11 @@ [self freeMemory: _readBuffer]; _readBuffer = NULL; _readBufferLength = 0; - _waitingForDelimiter = NO; + _waitingForDelimiter = false; return ret; } bufferLength = [self lowlevelReadIntoBuffer: buffer length: pageSize]; @@ -688,11 +688,11 @@ [self freeMemory: _readBuffer]; _readBuffer = readBuffer; _readBufferLength = bufferLength - i - 1; - _waitingForDelimiter = NO; + _waitingForDelimiter = false; return ret; } } /* There was no newline or \0 */ @@ -711,11 +711,11 @@ _readBufferLength += bufferLength; } @finally { [self freeMemory: buffer]; } - _waitingForDelimiter = YES; + _waitingForDelimiter = true; return nil; } - (OFString*)readLine { @@ -812,11 +812,11 @@ [self freeMemory: _readBuffer]; _readBuffer = readBuffer; _readBufferLength -= i + 1; - _waitingForDelimiter = NO; + _waitingForDelimiter = false; return ret; } } } @@ -825,11 +825,11 @@ buffer = [self allocMemoryWithSize: pageSize]; @try { if ([self lowlevelIsAtEndOfStream]) { if (_readBuffer == NULL) { - _waitingForDelimiter = NO; + _waitingForDelimiter = false; return nil; } ret = [OFString stringWithCString: _readBuffer encoding: encoding @@ -837,11 +837,11 @@ [self freeMemory: _readBuffer]; _readBuffer = NULL; _readBufferLength = 0; - _waitingForDelimiter = NO; + _waitingForDelimiter = false; return ret; } bufferLength = [self lowlevelReadIntoBuffer: buffer length: pageSize]; @@ -891,11 +891,11 @@ [self freeMemory: _readBuffer]; _readBuffer = readBuffer; _readBufferLength = bufferLength - i - 1; - _waitingForDelimiter = NO; + _waitingForDelimiter = false; return ret; } } /* Neither the delimiter nor \0 was found */ @@ -914,11 +914,11 @@ _readBufferLength += bufferLength; } @finally { [self freeMemory: buffer]; } - _waitingForDelimiter = YES; + _waitingForDelimiter = true; return nil; } - (OFString*)readTillDelimiter: (OFString*)delimiter @@ -945,16 +945,16 @@ { return [self tryReadTillDelimiter: delimiter encoding: OF_STRING_ENCODING_UTF_8]; } -- (BOOL)isWriteBufferEnabled +- (bool)isWriteBufferEnabled { return _writeBufferEnabled; } -- (void)setWriteBufferEnabled: (BOOL)enable +- (void)setWriteBufferEnabled: (bool)enable { _writeBufferEnabled = enable; } - (void)flushWriteBuffer @@ -1467,26 +1467,26 @@ - (size_t)numberOfBytesInReadBuffer { return _readBufferLength; } -- (BOOL)isBlocking +- (bool)isBlocking { return _blocking; } -- (void)setBlocking: (BOOL)enable +- (void)setBlocking: (bool)enable { #ifndef _WIN32 - BOOL readImplemented = NO, writeImplemented = NO; + bool readImplemented = false, writeImplemented = false; @try { int readFlags; readFlags = fcntl([self fileDescriptorForReading], F_GETFL); - readImplemented = YES; + readImplemented = true; if (readFlags == -1) @throw [OFSetOptionFailedException exceptionWithClass: [self class] stream: self]; @@ -1507,11 +1507,11 @@ @try { int writeFlags; writeFlags = fcntl([self fileDescriptorForWriting], F_GETFL); - writeImplemented = YES; + writeImplemented = true; if (writeFlags == -1) @throw [OFSetOptionFailedException exceptionWithClass: [self class] stream: self]; @@ -1562,10 +1562,10 @@ { [self doesNotRecognizeSelector: _cmd]; abort(); } -- (BOOL)OF_isWaitingForDelimiter +- (bool)OF_isWaitingForDelimiter { return _waitingForDelimiter; } @end Index: src/OFStreamObserver.h ================================================================== --- src/OFStreamObserver.h +++ src/OFStreamObserver.h @@ -175,11 +175,11 @@ * timeout is reached. * * @param timeout The time to wait for an event, in seconds * @return A boolean whether events occurred during the timeinterval */ -- (BOOL)observeWithTimeout: (double)timeout; +- (bool)observeWithTimeout: (double)timeout; /*! * @brief Cancels the currently blocking observe call. * * This is automatically done when a new stream is added or removed by another @@ -191,10 +191,10 @@ - (void)OF_addFileDescriptorForReading: (int)fd; - (void)OF_addFileDescriptorForWriting: (int)fd; - (void)OF_removeFileDescriptorForReading: (int)fd; - (void)OF_removeFileDescriptorForWriting: (int)fd; - (void)OF_processQueue; -- (BOOL)OF_processCache; +- (bool)OF_processCache; @end @interface OFObject (OFStreamObserverDelegate) @end Index: src/OFStreamObserver.m ================================================================== --- src/OFStreamObserver.m +++ src/OFStreamObserver.m @@ -371,11 +371,11 @@ - (void)observe { [self observeWithTimeout: -1]; } -- (BOOL)observeWithTimeout: (double)timeout +- (bool)observeWithTimeout: (double)timeout { [self doesNotRecognizeSelector: _cmd]; abort(); } @@ -387,15 +387,15 @@ OF_ENSURE(sendto(_cancelFD[1], "", 1, 0, (struct sockaddr*)&_cancelAddr, sizeof(_cancelAddr)) > 0); #endif } -- (BOOL)OF_processCache +- (bool)OF_processCache { OFStream **objects = [_readStreams objects]; size_t i, count = [_readStreams count]; - BOOL foundInCache = NO; + bool foundInCache = false; for (i = 0; i < count; i++) { if ([objects[i] numberOfBytesInReadBuffer] > 0 && ![objects[i] OF_isWaitingForDelimiter]) { void *pool = objc_autoreleasePoolPush(); @@ -402,11 +402,11 @@ if ([_delegate respondsToSelector: @selector(streamIsReadyForReading:)]) [_delegate streamIsReadyForReading: objects[i]]; - foundInCache = YES; + foundInCache = true; objc_autoreleasePoolPop(pool); } } @@ -413,10 +413,10 @@ /* * As long as we have data in the cache for any stream, we don't want * to block. */ if (foundInCache) - return YES; + return true; - return NO; + return false; } @end Index: src/OFStreamObserver_kqueue.m ================================================================== --- src/OFStreamObserver_kqueue.m +++ src/OFStreamObserver_kqueue.m @@ -103,11 +103,11 @@ EV_SET(&event, fd, EVFILT_WRITE, EV_DELETE, 0, 0, 0); [_changeList addItem: &event]; } -- (BOOL)observeWithTimeout: (double)timeout +- (bool)observeWithTimeout: (double)timeout { void *pool = objc_autoreleasePoolPush(); struct timespec timespec; struct kevent eventList[EVENTLIST_SIZE]; int i, events, realEvents = 0; @@ -117,26 +117,26 @@ [self OF_processQueue]; if ([self OF_processCache]) { objc_autoreleasePoolPop(pool); - return YES; + return true; } objc_autoreleasePoolPop(pool); events = kevent(_kernelQueue, [_changeList items], (int)[_changeList count], eventList, EVENTLIST_SIZE, (timeout == -1 ? NULL : ×pec)); if (events < 0) - return NO; + return false; [_changeList removeAllItems]; if (events == 0) - return NO; + return false; for (i = 0; i < events; i++) { if (eventList[i].ident == _cancelFD[0]) { char buffer; @@ -178,10 +178,10 @@ objc_autoreleasePoolPop(pool); } if (realEvents == 0) - return NO; + return false; - return YES; + return true; } @end Index: src/OFStreamObserver_poll.m ================================================================== --- src/OFStreamObserver_poll.m +++ src/OFStreamObserver_poll.m @@ -60,16 +60,16 @@ - (void)OF_addFileDescriptor: (int)fd withEvents: (short)events { struct pollfd *FDs = [_FDs items]; size_t i, count = [_FDs count]; - BOOL found = NO; + bool found = false; for (i = 0; i < count; i++) { if (FDs[i].fd == fd) { FDs[i].events |= events; - found = YES; + found = true; break; } } if (!found) { @@ -118,21 +118,21 @@ { [self OF_removeFileDescriptor: fd withEvents: POLLOUT]; } -- (BOOL)observeWithTimeout: (double)timeout +- (bool)observeWithTimeout: (double)timeout { void *pool = objc_autoreleasePoolPush(); struct pollfd *FDs; size_t i, nFDs, realEvents = 0; [self OF_processQueue]; if ([self OF_processCache]) { objc_autoreleasePoolPop(pool); - return YES; + return true; } objc_autoreleasePoolPop(pool); FDs = [_FDs items]; @@ -143,11 +143,11 @@ @throw [OFOutOfRangeException exceptionWithClass: [self class]]; #endif if (poll(FDs, (nfds_t)nFDs, (int)(timeout != -1 ? timeout * 1000 : -1)) < 1) - return NO; + return false; for (i = 0; i < nFDs; i++) { pool = objc_autoreleasePoolPush(); if (FDs[i].revents & POLLIN) { @@ -191,10 +191,10 @@ objc_autoreleasePoolPop(pool); } if (realEvents == 0) - return NO; + return false; - return YES; + return true; } @end Index: src/OFStreamObserver_select.m ================================================================== --- src/OFStreamObserver_select.m +++ src/OFStreamObserver_select.m @@ -69,11 +69,11 @@ if (!FD_ISSET(fd, &_readFDs)) FD_CLR(fd, &_exceptFDs); } -- (BOOL)observeWithTimeout: (double)timeout +- (bool)observeWithTimeout: (double)timeout { void *pool = objc_autoreleasePoolPush(); OFStream **objects; fd_set readFDs; fd_set writeFDs; @@ -83,11 +83,11 @@ [self OF_processQueue]; if ([self OF_processCache]) { objc_autoreleasePoolPop(pool); - return YES; + return true; } objc_autoreleasePoolPop(pool); #ifdef FD_COPY @@ -109,11 +109,11 @@ time.tv_sec = (time_t)timeout; time.tv_usec = (int)((timeout - time.tv_sec) * 1000); if (select((int)_maxFD + 1, &readFDs, &writeFDs, &exceptFDs, (timeout != -1 ? &time : NULL)) < 1) - return NO; + return false; if (FD_ISSET(_cancelFD[0], &readFDs)) { char buffer; #ifndef _WIN32 OF_ENSURE(read(_cancelFD[0], &buffer, 1) > 0); @@ -184,10 +184,10 @@ objc_autoreleasePoolPop(pool); } if (realEvents == 0) - return NO; + return false; - return YES; + return true; } @end Index: src/OFStreamSocket.h ================================================================== --- src/OFStreamSocket.h +++ src/OFStreamSocket.h @@ -27,15 +27,15 @@ * @brief A class which provides functions to create and use stream sockets. */ @interface OFStreamSocket: OFStream { int _socket; - BOOL _atEndOfStream; + bool _atEndOfStream; } /*! * @brief Returns a new, autoreleased OFTCPSocket. * * @return A new, autoreleased OFTCPSocket */ + (instancetype)socket; @end Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -63,11 +63,11 @@ + (instancetype)socket { return [[[self alloc] init] autorelease]; } -- (BOOL)lowlevelIsAtEndOfStream +- (bool)lowlevelIsAtEndOfStream { return _atEndOfStream; } - (size_t)lowlevelReadIntoBuffer: (void*)buffer @@ -98,11 +98,11 @@ @throw [OFReadFailedException exceptionWithClass: [self class] stream: self requestedLength: length]; if (ret == 0) - _atEndOfStream = YES; + _atEndOfStream = true; return ret; } - (void)lowlevelWriteBuffer: (const void*)buffer @@ -132,11 +132,11 @@ stream: self requestedLength: length]; } #ifdef _WIN32 -- (void)setBlocking: (BOOL)enable +- (void)setBlocking: (bool)enable { u_long v = enable; _blocking = enable; if (ioctlsocket(_socket, FIONBIO, &v) == SOCKET_ERROR) @@ -163,11 +163,11 @@ socket: self]; close(_socket); _socket = INVALID_SOCKET; - _atEndOfStream = NO; + _atEndOfStream = false; } - (void)dealloc { if (_socket != INVALID_SOCKET) Index: src/OFString+JSONValue.m ================================================================== --- src/OFString+JSONValue.m +++ src/OFString+JSONValue.m @@ -62,11 +62,11 @@ return; (*pointer)++; if (**pointer == '*') { - BOOL lastIsAsterisk = NO; + bool lastIsAsterisk = false; (*pointer)++; while (*pointer < stop) { if (lastIsAsterisk && **pointer == '/') { @@ -533,19 +533,19 @@ static inline OFNumber* parseNumber(const char *restrict *pointer, const char *stop, size_t *restrict line) { - BOOL isHex = (*pointer + 1 < stop && (*pointer)[1] == 'x'); - BOOL hasDecimal = NO; + bool isHex = (*pointer + 1 < stop && (*pointer)[1] == 'x'); + bool hasDecimal = false; size_t i; OFString *string; OFNumber *number; for (i = 0; *pointer + i < stop; i++) { if ((*pointer)[i] == '.') - hasDecimal = YES; + hasDecimal = true; if ((*pointer)[i] == ' ' || (*pointer)[i] == '\t' || (*pointer)[i] == '\r' || (*pointer)[i] == '\n' || (*pointer)[i] == ',' || (*pointer)[i] == ']' || (*pointer)[i] == '}') { @@ -605,21 +605,21 @@ if (memcmp(*pointer, "true", 4)) return nil; (*pointer) += 4; - return [OFNumber numberWithBool: YES]; + return [OFNumber numberWithBool: true]; case 'f': if (*pointer + 4 >= stop) return nil; if (memcmp(*pointer, "false", 5)) return nil; (*pointer) += 5; - return [OFNumber numberWithBool: NO]; + return [OFNumber numberWithBool: false]; case 'n': if (*pointer + 3 >= stop) return nil; if (memcmp(*pointer, "null", 4)) Index: src/OFString+XMLUnescaping.m ================================================================== --- src/OFString+XMLUnescaping.m +++ src/OFString+XMLUnescaping.m @@ -84,28 +84,28 @@ - (OFString*)stringByXMLUnescapingWithDelegate: (id )delegate { const char *string; size_t i, last, length; - BOOL inEntity; + bool inEntity; OFMutableString *ret; string = [self UTF8String]; length = [self UTF8StringLength]; ret = [OFMutableString string]; last = 0; - inEntity = NO; + inEntity = false; for (i = 0; i < length; i++) { if (!inEntity && string[i] == '&') { [ret appendUTF8String: string + last length: i - last]; last = i + 1; - inEntity = YES; + inEntity = true; } else if (inEntity && string[i] == ';') { const char *entity = string + last; size_t entityLength = i - last; if (entityLength == 2 && !memcmp(entity, "lt", 2)) @@ -165,11 +165,11 @@ } else @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; last = i + 1; - inEntity = NO; + inEntity = false; } } if (inEntity) @throw [OFInvalidEncodingException @@ -187,28 +187,28 @@ - (OFString*)stringByXMLUnescapingWithBlock: (of_string_xml_unescaping_block_t)block { const char *string; size_t i, last, length; - BOOL inEntity; + bool inEntity; OFMutableString *ret; string = [self UTF8String]; length = [self UTF8StringLength]; ret = [OFMutableString string]; last = 0; - inEntity = NO; + inEntity = false; for (i = 0; i < length; i++) { if (!inEntity && string[i] == '&') { [ret appendUTF8String: string + last length: i - last]; last = i + 1; - inEntity = YES; + inEntity = true; } else if (inEntity && string[i] == ';') { const char *entity = string + last; size_t entityLength = i - last; if (entityLength == 2 && !memcmp(entity, "lt", 2)) @@ -265,11 +265,11 @@ [ret appendString: tmp]; objc_autoreleasePoolPop(pool); } last = i + 1; - inEntity = NO; + inEntity = false; } } if (inEntity) @throw [OFInvalidEncodingException Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -67,11 +67,11 @@ /* FIXME */ #define OF_STRING_ENCODING_NATIVE OF_STRING_ENCODING_UTF_8 #ifdef OF_HAVE_BLOCKS -typedef void (^of_string_line_enumeration_block_t)(OFString *line, BOOL *stop); +typedef void (^of_string_line_enumeration_block_t)(OFString *line, bool *stop); #endif @class OFArray; @class OFURL; @@ -118,11 +118,11 @@ * @param freeWhenDone Whether to free the C string when the OFString gets * deallocated * @return A new autoreleased OFString */ + (instancetype)stringWithUTF8StringNoCopy: (char*)UTF8String - freeWhenDone: (BOOL)freeWhenDone; + freeWhenDone: (bool)freeWhenDone; /*! * @brief Creates a new OFString from a C string with the specified encoding. * * @param cString A C string to initialize the OFString with @@ -346,11 +346,11 @@ * @param freeWhenDone Whether to free the C string when it is not needed * anymore * @return An initialized OFString */ - initWithUTF8StringNoCopy: (char*)UTF8String - freeWhenDone: (BOOL)freeWhenDone; + freeWhenDone: (bool)freeWhenDone; /*! * @brief Initializes an already allocated OFString from a C string with the * specified encoding. * @@ -705,11 +705,11 @@ * @brief Returns whether the string contains the specified string. * * @param string The string to search * @return Whether the string contains the specified string */ -- (BOOL)containsString: (OFString*)string; +- (bool)containsString: (OFString*)string; /*! * @brief Creates a substring with the specified range. * * @param range The range of the substring @@ -838,19 +838,19 @@ * @brief Checks whether the string has the specified prefix. * * @param prefix The prefix to check for * @return A boolean whether the string has the specified prefix */ -- (BOOL)hasPrefix: (OFString*)prefix; +- (bool)hasPrefix: (OFString*)prefix; /*! * @brief Checks whether the string has the specified suffix. * * @param suffix The suffix to check for * @return A boolean whether the string has the specified suffix */ -- (BOOL)hasSuffix: (OFString*)suffix; +- (bool)hasSuffix: (OFString*)suffix; /*! * @brief Separates an OFString into an OFArray of OFStrings. * * @param delimiter The delimiter for separating Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -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; } Index: src/OFString_UTF8.h ================================================================== --- src/OFString_UTF8.h +++ src/OFString_UTF8.h @@ -27,13 +27,13 @@ * to &_storage. */ struct of_string_utf8_ivars { char *cString; size_t cStringLength; - BOOL isUTF8; + bool isUTF8; size_t length; - BOOL hashed; + bool hashed; uint32_t hash; char *freeWhenDone; } *restrict _s; struct of_string_utf8_ivars _storage; } Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -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; Index: src/OFTCPSocket+SOCKS5.m ================================================================== --- src/OFTCPSocket+SOCKS5.m +++ src/OFTCPSocket+SOCKS5.m @@ -27,11 +27,11 @@ - (void)OF_SOCKS5ConnectToHost: (OFString*)host port: (uint16_t)port { const char request[] = { 5, 1, 0, 3 }; char reply[256]; - BOOL wasWriteBufferEnabled; + bool wasWriteBufferEnabled; /* 5 1 0 -> no authentication */ [self writeBuffer: request length: 3]; @@ -46,11 +46,11 @@ host: host port: port]; } wasWriteBufferEnabled = [self isWriteBufferEnabled]; - [self setWriteBufferEnabled: YES]; + [self setWriteBufferEnabled: true]; /* CONNECT request */ [self writeBuffer: request length: 4]; [self writeInt8: [host UTF8StringLength]]; Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -36,11 +36,11 @@ @class OFTCPSocket; @class OFString; #ifdef OF_HAVE_BLOCKS typedef void (^of_tcpsocket_async_connect_block_t)(OFTCPSocket*, OFException*); -typedef BOOL (^of_tcpsocket_async_accept_block_t)(OFTCPSocket*, OFTCPSocket*, +typedef bool (^of_tcpsocket_async_accept_block_t)(OFTCPSocket*, OFTCPSocket*, OFException*); #endif /*! * @brief A class which provides functions to create and use TCP sockets. @@ -48,19 +48,19 @@ * To connect to a server, create a socket and connect it. * To create a server, create a socket, bind it and listen on it. */ @interface OFTCPSocket: OFStreamSocket { - BOOL _listening; + bool _listening; struct sockaddr_storage *_sockAddr; socklen_t _sockAddrLen; OFString *_SOCKS5Host; uint16_t _SOCKS5Port; } #ifdef OF_HAVE_PROPERTIES -@property (readonly, getter=isListening) BOOL listening; +@property (readonly, getter=isListening) bool listening; @property (copy) OFString *SOCKS5Host; @property uint16_t SOCKS5Port; #endif /*! @@ -198,11 +198,11 @@ * @param target The target on which to execute the selector when a new * connection has been accepted. The method returns whether the * next incoming connection should be accepted by the specified * block as well. * @param selector The selector to call on the target. The signature must be - * BOOL (OFTCPSocket *socket, OFTCPSocket *acceptedSocket, + * bool (OFTCPSocket *socket, OFTCPSocket *acceptedSocket, * OFException *exception). */ - (void)asyncAcceptWithTarget: (id)target selector: (SEL)selector; @@ -220,11 +220,11 @@ /*! * @brief Enable or disable keep alives for the connection. * * @param enable Whether to enable or disable keep alives for the connection */ -- (void)setKeepAlivesEnabled: (BOOL)enable; +- (void)setKeepAlivesEnabled: (bool)enable; /*! * @brief Returns the remote address of the socket. * * Only works with accepted sockets! @@ -236,15 +236,15 @@ /*! * @brief Returns whether the socket is a listening socket. * * @return Whether the socket is a listening socket */ -- (BOOL)isListening; +- (bool)isListening; @end #ifdef __cplusplus extern "C" { #endif extern Class of_tls_socket_class; #ifdef __cplusplus } #endif Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -213,11 +213,11 @@ _exception = [[e retain] autorelease]; } [self performSelector: @selector(didConnect) onThread: _sourceThread - waitUntilDone: NO]; + waitUntilDone: false]; objc_autoreleasePoolPop(pool); return nil; } @@ -279,16 +279,16 @@ [super dealloc]; } - (void)setSOCKS5Host: (OFString*)SOCKS5Host { - OF_SETTER(_SOCKS5Host, SOCKS5Host, YES, 1) + OF_SETTER(_SOCKS5Host, SOCKS5Host, true, 1) } - (OFString*)SOCKS5Host { - OF_GETTER(_SOCKS5Host, YES) + OF_GETTER(_SOCKS5Host, true) } - (void)setSOCKS5Port: (uint16_t)SOCKS5Port { _SOCKS5Port = SOCKS5Port; @@ -347,11 +347,11 @@ break; } freeaddrinfo(res0); #else - BOOL connected = NO; + bool connected = false; struct hostent *he; struct sockaddr_in addr; char **ip; # ifdef OF_HAVE_THREADS OFDataArray *addrlist; @@ -411,11 +411,11 @@ if (connect(_socket, (struct sockaddr*)&addr, sizeof(addr)) == -1) continue; - connected = YES; + connected = true; break; } # ifdef OF_HAVE_THREADS [addrlist release]; @@ -633,11 +633,11 @@ if (listen(_socket, backLog) == -1) @throw [OFListenFailedException exceptionWithClass: [self class] socket: self backLog: backLog]; - _listening = YES; + _listening = true; } - (void)listen { [self listenWithBackLog: SOMAXCONN]; @@ -680,11 +680,11 @@ [OFRunLoop OF_addAsyncAcceptForTCPSocket: self block: block]; } #endif -- (void)setKeepAlivesEnabled: (BOOL)enable +- (void)setKeepAlivesEnabled: (bool)enable { int v = enable; if (setsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, sizeof(v))) @throw [OFSetOptionFailedException @@ -738,20 +738,20 @@ /* Get rid of a warning, never reached anyway */ assert(0); } -- (BOOL)isListening +- (bool)isListening { return _listening; } - (void)close { [super close]; - _listening = NO; + _listening = false; [self freeMemory: _sockAddr]; _sockAddr = NULL; _sockAddrLen = 0; } @end Index: src/OFTLSKey.h ================================================================== --- src/OFTLSKey.h +++ src/OFTLSKey.h @@ -32,11 +32,11 @@ @public of_tlskey_t _key; @protected void (*_destructor)(id); of_list_object_t *_listObject; - BOOL _initialized; + bool _initialized; } /*! * @brief Creates a new Thread Local Storage key * Index: src/OFTLSKey.m ================================================================== --- src/OFTLSKey.m +++ src/OFTLSKey.m @@ -61,11 +61,11 @@ @try { if (!of_tlskey_new(&_key)) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; - _initialized = YES; + _initialized = true; @synchronized (TLSKeys) { _listObject = [TLSKeys appendObject: self]; } } @catch (id e) { Index: src/OFTLSSocket.h ================================================================== --- src/OFTLSSocket.h +++ src/OFTLSSocket.h @@ -32,11 +32,11 @@ * keychain * @param keychain An array of objects implementing the OFX509Certificate * protocol * @return Whether the TLS socket should accept the received keychain */ -- (BOOL)socket: (id )socket +- (bool)socket: (id )socket shouldAcceptKeychain: (OFArray*)keychain; @end /*! * @brief A protocol that should be implemented by 3rd-party libraries Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -346,16 +346,16 @@ return [[_runLoop retain] autorelease]; } - (OFString*)name { - OF_GETTER(_name, YES) + OF_GETTER(_name, true) } - (void)setName: (OFString*)name { - OF_SETTER(_name, name, YES, 1) + OF_SETTER(_name, name, true, 1) if (_running == OF_THREAD_RUNNING) set_thread_name(self); } Index: src/OFThreadPool.m ================================================================== --- src/OFThreadPool.m +++ src/OFThreadPool.m @@ -128,11 +128,11 @@ @interface OFThreadPoolThread: OFThread { OFList *_queue; OFCondition *_queueCondition, *_countCondition; @public - volatile BOOL _terminate; + volatile bool _terminate; volatile int *_doneCount; } + (instancetype)threadWithThreadPool: (OFThreadPool*)threadPool; - initWithThreadPool: (OFThreadPool*)threadPool; @@ -305,11 +305,11 @@ @try { OFEnumerator *enumerator = [_threads objectEnumerator]; OFThreadPoolThread *thread; while ((thread = [enumerator nextObject]) != nil) - thread->_terminate = YES; + thread->_terminate = true; } @finally { [_countCondition unlock]; } [_queueCondition broadcast]; Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -35,18 +35,18 @@ OFDate *_fireDate; double _interval; id _target, _object1, _object2; SEL _selector; uint8_t _arguments; - BOOL _repeats; + bool _repeats; #ifdef OF_HAVE_BLOCKS of_timer_block_t _block; #endif - BOOL _valid; + bool _valid; #ifdef OF_HAVE_THREADS OFCondition *_condition; - BOOL _done; + bool _done; #endif OFRunLoop *_inRunLoop; } #ifdef OF_HAVE_PROPERTIES @@ -64,11 +64,11 @@ * @return A new, autoreleased timer */ + (instancetype)scheduledTimerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector - repeats: (BOOL)repeats; + repeats: (bool)repeats; /*! * @brief Creates and schedules a new timer with the specified time interval. * * @param interval The time interval after which the timer should be executed @@ -81,11 +81,11 @@ */ + (instancetype)scheduledTimerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector object: (id)object - repeats: (BOOL)repeats; + repeats: (bool)repeats; /*! * @brief Creates and schedules a new timer with the specified time interval. * * @param interval The time interval after which the timer should be executed @@ -102,11 +102,11 @@ + (instancetype)scheduledTimerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 - repeats: (BOOL)repeats; + repeats: (bool)repeats; #ifdef OF_HAVE_BLOCKS /*! * @brief Creates and schedules a new timer with the specified time interval. * @@ -115,11 +115,11 @@ * @param repeats Whether the timer repeats after it has been executed * @param block The block to invoke when the timer fires * @return A new, autoreleased timer */ + (instancetype)scheduledTimerWithTimeInterval: (double)interval - repeats: (BOOL)repeats + repeats: (bool)repeats block: (of_timer_block_t)block; #endif /*! * @brief Creates a new timer with the specified time interval. @@ -132,11 +132,11 @@ * @return A new, autoreleased timer */ + (instancetype)timerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector - repeats: (BOOL)repeats; + repeats: (bool)repeats; /*! * @brief Creates a new timer with the specified time interval. * * @param interval The time interval after which the timer should be executed @@ -149,11 +149,11 @@ */ + (instancetype)timerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector object: (id)object - repeats: (BOOL)repeats; + repeats: (bool)repeats; /*! * @brief Creates a new timer with the specified time interval. * * @param interval The time interval after which the timer should be executed @@ -170,11 +170,11 @@ + (instancetype)timerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 - repeats: (BOOL)repeats; + repeats: (bool)repeats; #ifdef OF_HAVE_BLOCKS /*! * @brief Creates a new timer with the specified time interval. * @@ -183,11 +183,11 @@ * @param repeats Whether the timer repeats after it has been executed * @param block The block to invoke when the timer fires * @return A new, autoreleased timer */ + (instancetype)timerWithTimeInterval: (double)interval - repeats: (BOOL)repeats + repeats: (bool)repeats block: (of_timer_block_t)block; #endif /*! * @brief Initializes an already allocated timer with the specified time @@ -203,11 +203,11 @@ */ - initWithFireDate: (OFDate*)fireDate interval: (double)interval target: (id)target selector: (SEL)selector - repeats: (BOOL)repeats; + repeats: (bool)repeats; /*! * @brief Initializes an already allocated timer with the specified time * interval. * @@ -223,11 +223,11 @@ - initWithFireDate: (OFDate*)fireDate interval: (double)interval target: (id)target selector: (SEL)selector object: (id)object - repeats: (BOOL)repeats; + repeats: (bool)repeats; /*! * @brief Initializes an already allocated timer with the specified time * interval. * @@ -247,11 +247,11 @@ interval: (double)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 - repeats: (BOOL)repeats; + repeats: (bool)repeats; #ifdef OF_HAVE_BLOCKS /*! * @brief Initializes an already allocated timer with the specified time * interval. @@ -263,11 +263,11 @@ * @param block The block to invoke when the timer fires * @return An initialized timer */ - initWithFireDate: (OFDate*)fireDate interval: (double)interval - repeats: (BOOL)repeats + repeats: (bool)repeats block: (of_timer_block_t)block; #endif /*! * @brief Fires the timer, meaning it will execute the specified selector on the @@ -302,11 +302,11 @@ /*! * @brief Returns whether the timer is valid. * * @return Whether the timer is valid */ -- (BOOL)isValid; +- (bool)isValid; /*! * @brief Returns the time interval in which the timer will repeat, if it is a * repeating timer. * Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -34,11 +34,11 @@ @implementation OFTimer + (instancetype)scheduledTimerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector - repeats: (BOOL)repeats + repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; id timer = [[[self alloc] initWithFireDate: fireDate interval: interval @@ -56,11 +56,11 @@ + (instancetype)scheduledTimerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector object: (id)object - repeats: (BOOL)repeats + repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; id timer = [[[self alloc] initWithFireDate: fireDate interval: interval @@ -80,11 +80,11 @@ + (instancetype)scheduledTimerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 - repeats: (BOOL)repeats + repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; id timer = [[[self alloc] initWithFireDate: fireDate interval: interval @@ -102,11 +102,11 @@ return [timer autorelease]; } #ifdef OF_HAVE_BLOCKS + (instancetype)scheduledTimerWithTimeInterval: (double)interval - repeats: (BOOL)repeats + repeats: (bool)repeats block: (of_timer_block_t)block { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; id timer = [[[self alloc] initWithFireDate: fireDate @@ -124,11 +124,11 @@ #endif + (instancetype)timerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector - repeats: (BOOL)repeats + repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; id timer = [[[self alloc] initWithFireDate: fireDate interval: interval @@ -144,11 +144,11 @@ + (instancetype)timerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector object: (id)object - repeats: (BOOL)repeats + repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; id timer = [[[self alloc] initWithFireDate: fireDate interval: interval @@ -166,11 +166,11 @@ + (instancetype)timerWithTimeInterval: (double)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 - repeats: (BOOL)repeats + repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; id timer = [[[self alloc] initWithFireDate: fireDate interval: interval @@ -186,11 +186,11 @@ return [timer autorelease]; } #ifdef OF_HAVE_BLOCKS + (instancetype)timerWithTimeInterval: (double)interval - repeats: (BOOL)repeats + repeats: (bool)repeats block: (of_timer_block_t)block { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: interval]; id timer = [[[self alloc] initWithFireDate: fireDate @@ -222,11 +222,11 @@ target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 arguments: (uint8_t)arguments - repeats: (BOOL)repeats + repeats: (bool)repeats { self = [super init]; @try { _fireDate = [fireDate retain]; @@ -235,11 +235,11 @@ _selector = selector; _object1 = [object1 retain]; _object2 = [object2 retain]; _arguments = arguments; _repeats = repeats; - _valid = YES; + _valid = true; #ifdef OF_HAVE_THREADS _condition = [[OFCondition alloc] init]; #endif } @catch (id e) { [self release]; @@ -251,11 +251,11 @@ - initWithFireDate: (OFDate*)fireDate interval: (double)interval target: (id)target selector: (SEL)selector - repeats: (BOOL)repeats + repeats: (bool)repeats { return [self OF_initWithFireDate: fireDate interval: interval target: target selector: selector @@ -268,11 +268,11 @@ - initWithFireDate: (OFDate*)fireDate interval: (double)interval target: (id)target selector: (SEL)selector object: (id)object - repeats: (BOOL)repeats + repeats: (bool)repeats { return [self OF_initWithFireDate: fireDate interval: interval target: target selector: selector @@ -286,11 +286,11 @@ interval: (double)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 - repeats: (BOOL)repeats + repeats: (bool)repeats { return [self OF_initWithFireDate: fireDate interval: interval target: target selector: selector @@ -301,21 +301,21 @@ } #ifdef OF_HAVE_BLOCKS - initWithFireDate: (OFDate*)fireDate interval: (double)interval - repeats: (BOOL)repeats + repeats: (bool)repeats block: (of_timer_block_t)block { self = [super init]; @try { _fireDate = [fireDate retain]; _interval = interval; _repeats = repeats; _block = [block copy]; - _valid = YES; + _valid = true; # ifdef OF_HAVE_THREADS _condition = [[OFCondition alloc] init]; # endif } @catch (id e) { [self release]; @@ -390,11 +390,11 @@ #endif #ifdef OF_HAVE_THREADS [_condition lock]; @try { - _done = YES; + _done = true; [_condition signal]; } @finally { [_condition unlock]; } #endif @@ -410,21 +410,21 @@ [self invalidate]; } - (OFDate*)fireDate { - OF_GETTER(_fireDate, YES) + OF_GETTER(_fireDate, true) } - (void)setFireDate: (OFDate*)fireDate { [self retain]; @try { @synchronized (self) { [_inRunLoop OF_removeTimer: self]; - OF_SETTER(_fireDate, fireDate, YES, 0) + OF_SETTER(_fireDate, fireDate, true, 0) [_inRunLoop addTimer: self]; } } @finally { [self release]; @@ -436,17 +436,17 @@ return _interval; } - (void)invalidate { - _valid = NO; + _valid = false; [_target release]; _target = nil; } -- (BOOL)isValid +- (bool)isValid { return _valid; } #ifdef OF_HAVE_THREADS @@ -453,11 +453,11 @@ - (void)waitUntilDone { [_condition lock]; @try { if (_done) { - _done = NO; + _done = false; return; } [_condition wait]; } @finally { @@ -466,8 +466,8 @@ } #endif - (void)OF_setInRunLoop: (OFRunLoop*)inRunLoop { - OF_SETTER(_inRunLoop, inRunLoop, YES, 0) + OF_SETTER(_inRunLoop, inRunLoop, true, 0) } @end Index: src/OFURL.m ================================================================== --- src/OFURL.m +++ src/OFURL.m @@ -287,43 +287,43 @@ [_fragment release]; [super dealloc]; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFURL *URL; if (![object isKindOfClass: [OFURL class]]) - return NO; + return false; URL = object; if (![URL->_scheme isEqual: _scheme]) - return NO; + return false; if (![URL->_host isEqual: _host]) - return NO; + return false; if (URL->_port != _port) - return NO; + return false; if (URL->_user != _user && ![URL->_user isEqual: _user]) - return NO; + return false; if (URL->_password != _password && ![URL->_password isEqual: _password]) - return NO; + return false; if (![URL->_path isEqual: _path]) - return NO; + return false; if (URL->_parameters != _parameters && ![URL->_parameters isEqual: _parameters]) - return NO; + return false; if (URL->_query != _query && ![URL->_query isEqual: _query]) - return NO; + return false; if (URL->_fragment != _fragment && ![URL->_fragment isEqual: _fragment]) - return NO; + return false; - return YES; + return true; } - (uint32_t)hash { uint32_t hash; @@ -368,31 +368,31 @@ return copy; } - (OFString*)scheme { - OF_GETTER(_scheme, YES) + OF_GETTER(_scheme, true) } - (void)setScheme: (OFString*)scheme { if (![scheme isEqual: @"http"] && ![scheme isEqual: @"https"]) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; - OF_SETTER(_scheme, scheme, YES, 1) + OF_SETTER(_scheme, scheme, true, 1) } - (OFString*)host { - OF_GETTER(_host, YES) + OF_GETTER(_host, true) } - (void)setHost: (OFString*)host { - OF_SETTER(_host, host, YES, 1) + OF_SETTER(_host, host, true, 1) } - (uint16_t)port { return _port; @@ -403,31 +403,31 @@ _port = port; } - (OFString*)user { - OF_GETTER(_user, YES) + OF_GETTER(_user, true) } - (void)setUser: (OFString*)user { - OF_SETTER(_user, user, YES, 1) + OF_SETTER(_user, user, true, 1) } - (OFString*)password { - OF_GETTER(_password, YES) + OF_GETTER(_password, true) } - (void)setPassword: (OFString*)password { - OF_SETTER(_password, password, YES, 1) + OF_SETTER(_password, password, true, 1) } - (OFString*)path { - OF_GETTER(_path, YES) + OF_GETTER(_path, true) } - (void)setPath: (OFString*)path { if (([_scheme isEqual: @"http"] || [_scheme isEqual: @"https"]) && @@ -434,41 +434,41 @@ ![path hasPrefix: @"/"]) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; - OF_SETTER(_path, path, YES, 1) + OF_SETTER(_path, path, true, 1) } - (OFString*)parameters { - OF_GETTER(_parameters, YES) + OF_GETTER(_parameters, true) } - (void)setParameters: (OFString*)parameters { - OF_SETTER(_parameters, parameters, YES, 1) + OF_SETTER(_parameters, parameters, true, 1) } - (OFString*)query { - OF_GETTER(_query, YES) + OF_GETTER(_query, true) } - (void)setQuery: (OFString*)query { - OF_SETTER(_query, query, YES, 1) + OF_SETTER(_query, query, true, 1) } - (OFString*)fragment { - OF_GETTER(_fragment, YES) + OF_GETTER(_fragment, true) } - (void)setFragment: (OFString*)fragment { - OF_SETTER(_fragment, fragment, YES, 1) + OF_SETTER(_fragment, fragment, true, 1) } - (OFString*)string { OFMutableString *ret = [OFMutableString stringWithFormat: @"%@://", Index: src/OFXMLAttribute.m ================================================================== --- src/OFXMLAttribute.m +++ src/OFXMLAttribute.m @@ -107,41 +107,41 @@ [super dealloc]; } - (OFString*)name { - OF_GETTER(_name, YES) + OF_GETTER(_name, true) } - (OFString*)namespace { - OF_GETTER(_namespace, YES) + OF_GETTER(_namespace, true) } - (OFString*)stringValue { - OF_GETTER(_stringValue, YES) + OF_GETTER(_stringValue, true) } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFXMLAttribute *attribute; if (![object isKindOfClass: [OFXMLAttribute class]]) - return NO; + return false; attribute = object; if (![attribute->_name isEqual: _name]) - return NO; + return false; if (attribute->_namespace != _namespace && ![attribute->_namespace isEqual: _namespace]) - return NO; + return false; if (![attribute->_stringValue isEqual: _stringValue]) - return NO; + return false; - return YES; + return true; } - (uint32_t)hash { uint32_t hash; Index: src/OFXMLCDATA.m ================================================================== --- src/OFXMLCDATA.m +++ src/OFXMLCDATA.m @@ -66,16 +66,16 @@ } return self; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFXMLCDATA *CDATA; if (![object isKindOfClass: [OFXMLCDATA class]]) - return NO; + return false; CDATA = object; return ([CDATA->_CDATA isEqual: _CDATA]); } Index: src/OFXMLCharacters.m ================================================================== --- src/OFXMLCharacters.m +++ src/OFXMLCharacters.m @@ -66,16 +66,16 @@ } return self; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFXMLCharacters *characters; if (![object isKindOfClass: [OFXMLCharacters class]]) - return NO; + return false; characters = object; return ([characters->_characters isEqual: _characters]); } Index: src/OFXMLComment.m ================================================================== --- src/OFXMLComment.m +++ src/OFXMLComment.m @@ -68,16 +68,16 @@ } return self; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFXMLComment *comment; if (![object isKindOfClass: [OFXMLComment class]]) - return NO; + return false; comment = object; return ([comment->_comment isEqual: _comment]); } Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -403,41 +403,41 @@ if (name == nil) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; - OF_SETTER(_name, name, YES, 1) + OF_SETTER(_name, name, true, 1) } - (OFString*)name { - OF_GETTER(_name, YES) + OF_GETTER(_name, true) } - (void)setNamespace: (OFString*)namespace { - OF_SETTER(_namespace, namespace, YES, 1) + OF_SETTER(_namespace, namespace, true, 1) } - (OFString*)namespace { - OF_GETTER(_namespace, YES) + OF_GETTER(_namespace, true) } - (OFArray*)attributes { - OF_GETTER(_attributes, YES) + OF_GETTER(_attributes, true) } - (void)setChildren: (OFArray*)children { - OF_SETTER(_children, children, YES, 2) + OF_SETTER(_children, children, true, 2) } - (OFArray*)children { - OF_GETTER(_children, YES) + OF_GETTER(_children, true) } - (void)setStringValue: (OFString*)stringValue { void *pool = objc_autoreleasePoolPush(); @@ -624,25 +624,25 @@ /* Childen */ if (_children != nil) { OFXMLElement **childrenObjects = [_children objects]; size_t childrenCount = [_children count]; OFDataArray *tmp = [OFDataArray dataArray]; - BOOL indent; + bool indent; if (indentation > 0) { - indent = YES; + indent = true; for (j = 0; j < childrenCount; j++) { if ([childrenObjects[j] isKindOfClass: charactersClass] || [childrenObjects[j] isKindOfClass: CDATAClass]) { - indent = NO; + indent = false; break; } } } else - indent = NO; + indent = false; for (j = 0; j < childrenCount; j++) { OFString *child; unsigned int ind = (indent ? indentation : 0); @@ -942,16 +942,16 @@ stringValue: namespace]; } - (OFString*)defaultNamespace { - OF_GETTER(_defaultNamespace, YES) + OF_GETTER(_defaultNamespace, true) } - (void)setDefaultNamespace: (OFString*)defaultNamespace { - OF_SETTER(_defaultNamespace, defaultNamespace, YES, 1) + OF_SETTER(_defaultNamespace, defaultNamespace, true, 1) } - (void)addChild: (OFXMLNode*)child { if ([child isKindOfClass: [OFXMLAttribute class]]) @@ -1123,38 +1123,38 @@ [ret makeImmutable]; return ret; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFXMLElement *element; if (![object isKindOfClass: [OFXMLElement class]]) - return NO; + return false; element = object; if (element->_name != _name && ![element->_name isEqual: _name]) - return NO; + return false; if (element->_namespace != _namespace && ![element->_namespace isEqual: _namespace]) - return NO; + return false; if (element->_defaultNamespace != _defaultNamespace && ![element->_defaultNamespace isEqual: _defaultNamespace]) - return NO; + return false; if (element->_attributes != _attributes && ![element->_attributes isEqual: _attributes]) - return NO; + return false; if (element->_namespaces != _namespaces && ![element->_namespaces isEqual: _namespaces]) - return NO; + return false; if (element->_children != _children && ![element->_children isEqual: _children]) - return NO; + return false; - return YES; + return true; } - (uint32_t)hash { uint32_t hash; Index: src/OFXMLParser.h ================================================================== --- src/OFXMLParser.h +++ src/OFXMLParser.h @@ -153,13 +153,13 @@ OFMutableArray *_namespaces, *_attributes; OFString *_attributeName, *_attributePrefix; char _delimiter; OFMutableArray *_previous; size_t _level; - BOOL _acceptProlog; + bool _acceptProlog; size_t _lineNumber; - BOOL _lastCarriageReturn, _finishedParsing; + bool _lastCarriageReturn, _finishedParsing; of_string_encoding_t _encoding; size_t _depthLimit; } #ifdef OF_HAVE_PROPERTIES @@ -246,10 +246,10 @@ /*! * @brief Returns whether the XML parser has finished parsing. * * @return Whether the XML parser has finished parsing */ -- (BOOL)finishedParsing; +- (bool)finishedParsing; @end @interface OFObject (OFXMLParserDelegate) @end Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -58,16 +58,16 @@ objc_autoreleasePoolPop(pool); } } static OFString* -transform_string(OFDataArray *buffer, size_t cut, BOOL unescape, +transform_string(OFDataArray *buffer, size_t cut, bool unescape, id delegate) { char *items; size_t i, length; - BOOL hasEntities = NO; + bool hasEntities = false; OFString *ret; items = [buffer items]; length = [buffer count] - cut; @@ -80,11 +80,11 @@ i--; length--; } else items[i] = '\n'; } else if (items[i] == '&') - hasEntities = YES; + hasEntities = true; } ret = [OFString stringWithUTF8String: items length: length]; @@ -194,11 +194,11 @@ dict = [OFMutableDictionary dictionaryWithKeysAndObjects: @"xml", @"http://www.w3.org/XML/1998/namespace", @"xmlns", @"http://www.w3.org/2000/xmlns/", nil]; [_namespaces addObject: dict]; - _acceptProlog = YES; + _acceptProlog = true; _lineNumber = 1; _encoding = OF_STRING_ENCODING_UTF_8; _depthLimit = 32; objc_autoreleasePoolPop(pool); @@ -331,11 +331,11 @@ if ((length = *i - *last) > 0) buffer_append(_buffer, buffer + *last, _encoding, length); if ([_buffer count] > 0) { void *pool = objc_autoreleasePoolPush(); - OFString *characters = transform_string(_buffer, 0, YES, self); + OFString *characters = transform_string(_buffer, 0, true, self); if ([_delegate respondsToSelector: @selector(parser:foundCharacters:)]) [_delegate parser: self foundCharacters: characters]; @@ -365,44 +365,44 @@ _level = 0; break; case '/': *last = *i + 1; _state = OF_XMLPARSER_IN_CLOSE_TAG_NAME; - _acceptProlog = NO; + _acceptProlog = false; break; case '!': *last = *i + 1; _state = OF_XMLPARSER_IN_EXCLAMATIONMARK; - _acceptProlog = NO; + _acceptProlog = false; break; default: if (_depthLimit > 0 && [_previous count] >= _depthLimit) @throw [OFMalformedXMLException exceptionWithClass: [self class] parser: self]; _state = OF_XMLPARSER_IN_TAG_NAME; - _acceptProlog = NO; + _acceptProlog = false; (*i)--; break; } } /* */ -- (BOOL)OF_parseXMLProcessingInstructions: (OFString*)pi +- (bool)OF_parseXMLProcessingInstructions: (OFString*)pi { const char *cString; size_t i, last, length; int PIState = 0; OFString *attribute = nil; OFMutableString *value = nil; char piDelimiter = 0; if (!_acceptProlog) - return NO; + return false; - _acceptProlog = NO; + _acceptProlog = false; pi = [pi substringWithRange: of_range(3, [pi length] - 3)]; pi = [pi stringByDeletingEnclosingWhitespaces]; cString = [pi UTF8String]; @@ -431,11 +431,11 @@ PIState = 2; break; case 2: if (cString[i] != '\'' && cString[i] != '"') - return NO; + return false; piDelimiter = cString[i]; last = i + 1; PIState = 3; @@ -448,11 +448,11 @@ stringWithUTF8String: cString + last length: i - last]; if ([attribute isEqual: @"version"]) if (![value hasPrefix: @"1."]) - return NO; + return false; if ([attribute isEqual: @"encoding"]) { [value lowercase]; if ([value isEqual: @"utf-8"]) @@ -465,11 +465,11 @@ OF_STRING_ENCODING_ISO_8859_15; else if ([value isEqual: @"windows-1252"]) _encoding = OF_STRING_ENCODING_WINDOWS_1252; else - return NO; + return false; } last = i + 1; PIState = 0; @@ -476,13 +476,13 @@ break; } } if (PIState != 0) - return NO; + return false; - return YES; + return true; } /* Inside processing instructions */ - (void)OF_parseInProcessingInstructionsWithBuffer: (const char*)buffer i: (size_t*)i @@ -493,11 +493,11 @@ else if (_level == 1 && buffer[*i] == '>') { void *pool = objc_autoreleasePoolPush(); OFString *PI; buffer_append(_buffer, buffer + *last, _encoding, *i - *last); - PI = transform_string(_buffer, 1, NO, nil); + PI = transform_string(_buffer, 1, false, nil); if ([PI isEqual: @"xml"] || [PI hasPrefix: @"xml "] || [PI hasPrefix: @"xml\t"] || [PI hasPrefix: @"xml\r"] || [PI hasPrefix: @"xml\n"]) if (![self OF_parseXMLProcessingInstructions: PI]) @@ -582,11 +582,11 @@ didEndElement: _name prefix: _prefix namespace: namespace]; if ([_previous count] == 0) - _finishedParsing = YES; + _finishedParsing = true; } else [_previous addObject: bufferString]; [_name release]; [_prefix release]; @@ -676,11 +676,11 @@ _state = (buffer[*i] == '>' ? OF_XMLPARSER_OUTSIDE_TAG : OF_XMLPARSER_EXPECT_SPACE_OR_CLOSE); if ([_previous count] == 0) - _finishedParsing = YES; + _finishedParsing = true; } /* Inside a tag, name found */ - (void)OF_parseInTagWithBuffer: (const char*)buffer i: (size_t*)i @@ -733,11 +733,11 @@ didEndElement: _name prefix: _prefix namespace: namespace]; if ([_previous count] == 0) - _finishedParsing = YES; + _finishedParsing = true; [_namespaces removeLastObject]; } else if (_prefix != nil) { OFString *str = [OFString stringWithFormat: @"%@:%@", _prefix, _name]; @@ -839,11 +839,11 @@ if ((length = *i - *last) > 0) buffer_append(_buffer, buffer + *last, _encoding, length); pool = objc_autoreleasePoolPush(); - attributeValue = transform_string(_buffer, 0, YES, self); + attributeValue = transform_string(_buffer, 0, true, self); if (_attributePrefix == nil && [_attributeName isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: @""]; if ([_attributePrefix isEqual: @"xmlns"]) @@ -962,11 +962,11 @@ } pool = objc_autoreleasePoolPush(); buffer_append(_buffer, buffer + *last, _encoding, *i - *last); - CDATA = transform_string(_buffer, 2, NO, nil); + CDATA = transform_string(_buffer, 2, false, nil); if ([_delegate respondsToSelector: @selector(parser:foundCDATA:)]) [_delegate parser: self foundCDATA: CDATA]; @@ -1017,11 +1017,11 @@ parser: self]; pool = objc_autoreleasePoolPush(); buffer_append(_buffer, buffer + *last, _encoding, *i - *last); - comment = transform_string(_buffer, 2, NO, nil); + comment = transform_string(_buffer, 2, false, nil); if ([_delegate respondsToSelector: @selector(parser:foundComment:)]) [_delegate parser: self foundComment: comment]; @@ -1060,11 +1060,11 @@ - (size_t)lineNumber { return _lineNumber; } -- (BOOL)finishedParsing +- (bool)finishedParsing { return _finishedParsing; } - (OFString*)string: (OFString*)string Index: src/OFXMLProcessingInstructions.m ================================================================== --- src/OFXMLProcessingInstructions.m +++ src/OFXMLProcessingInstructions.m @@ -68,16 +68,16 @@ } return self; } -- (BOOL)isEqual: (id)object +- (bool)isEqual: (id)object { OFXMLProcessingInstructions *processingInstructions; if (![object isKindOfClass: [OFXMLProcessingInstructions class]]) - return NO; + return false; processingInstructions = object; return ([processingInstructions->_processingInstructions isEqual: _processingInstructions]); Index: src/atomic.h ================================================================== --- src/atomic.h +++ src/atomic.h @@ -654,20 +654,20 @@ #else # error No atomic operations available! #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_atomic_cmpswap_int(volatile int *p, int o, int n) { #if !defined(OF_HAVE_THREADS) if (*p == o) { *p = n; - return YES; + return true; } - return NO; + return false; #elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM) int r; __asm__ ( "xorl %0, %0\n\t" @@ -688,20 +688,20 @@ #else # error No atomic operations available! #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_atomic_cmpswap_32(volatile int32_t *p, int32_t o, int32_t n) { #if !defined(OF_HAVE_THREADS) if (*p == o) { *p = n; - return YES; + return true; } - return NO; + return false; #elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM) int r; __asm__ ( "xorl %0, %0\n\t" @@ -722,20 +722,20 @@ #else # error No atomic operations available! #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_atomic_cmpswap_ptr(void* volatile *p, void *o, void *n) { #if !defined(OF_HAVE_THREADS) if (*p == o) { *p = n; - return YES; + return true; } - return NO; + return false; #elif defined(OF_X86_ASM) || defined(OF_AMD64_ASM) int r; __asm__ ( "xorl %0, %0\n\t" Index: src/base64.h ================================================================== --- src/base64.h +++ src/base64.h @@ -35,9 +35,9 @@ #ifdef __cplusplus extern "C" { #endif extern const char of_base64_table[64]; extern OFString *of_base64_encode(const void*, size_t); -extern BOOL of_base64_decode(OFDataArray*, const char*, size_t); +extern bool of_base64_decode(OFDataArray*, const char*, size_t); #ifdef __cplusplus } #endif Index: src/base64.m ================================================================== --- src/base64.m +++ src/base64.m @@ -93,58 +93,58 @@ [ret makeImmutable]; return ret; } -BOOL +bool of_base64_decode(OFDataArray *data, const char *string, size_t length) { const uint8_t *buffer = (const uint8_t*)string; size_t i; if ((length & 3) != 0) - return NO; + return false; if ([data itemSize] != 1) - return NO; + return false; for (i = 0; i < length; i += 4) { uint32_t sb = 0; uint8_t count = 3; char db[3]; int8_t tmp; if (buffer[i] > 0x7F || buffer[i + 1] > 0x7F || buffer[i + 2] > 0x7F || buffer[i + 3] > 0x7F) - return NO; + return false; if (buffer[i] == '=' || buffer[i + 1] == '=' || (buffer[i + 2] == '=' && buffer[i + 3] != '=')) - return NO; + return false; if (buffer[i + 2] == '=') count--; if (buffer[i + 3] == '=') count--; if ((tmp = of_base64_decode_table[buffer[i]]) == -1) - return NO; + return false; sb |= tmp << 18; if ((tmp = of_base64_decode_table[buffer[i + 1]]) == -1) - return NO; + return false; sb |= tmp << 12; if ((tmp = of_base64_decode_table[buffer[i + 2]]) == -1) - return NO; + return false; sb |= tmp << 6; if ((tmp = of_base64_decode_table[buffer[i + 3]]) == -1) - return NO; + return false; sb |= tmp; db[0] = (sb & 0xFF0000) >> 16; db[1] = (sb & 0x00FF00) >> 8; @@ -152,7 +152,7 @@ [data addItems: db count: count]; } - return YES; + return true; } Index: src/exceptions/OFAcceptFailedException.m ================================================================== --- src/exceptions/OFAcceptFailedException.m +++ src/exceptions/OFAcceptFailedException.m @@ -69,13 +69,13 @@ _inClass, ERRPARAM]; } - (OFTCPSocket*)socket { - OF_GETTER(_socket, NO) + OF_GETTER(_socket, false) } - (int)errNo { return _errNo; } @end Index: src/exceptions/OFAddressTranslationFailedException.m ================================================================== --- src/exceptions/OFAddressTranslationFailedException.m +++ src/exceptions/OFAddressTranslationFailedException.m @@ -82,18 +82,18 @@ _inClass, AT_ERRPARAM]; } - (OFTCPSocket*)socket { - OF_GETTER(_socket, NO) + OF_GETTER(_socket, false) } - (OFString*)host { - OF_GETTER(_host, NO) + OF_GETTER(_host, false) } - (int)errNo { return _errNo; } @end Index: src/exceptions/OFAlreadyConnectedException.m ================================================================== --- src/exceptions/OFAlreadyConnectedException.m +++ src/exceptions/OFAlreadyConnectedException.m @@ -68,8 +68,8 @@ @"can't be connected or bound again!", _inClass]; } - (OFTCPSocket*)socket { - OF_GETTER(_socket, NO) + OF_GETTER(_socket, false) } @end Index: src/exceptions/OFBindFailedException.m ================================================================== --- src/exceptions/OFBindFailedException.m +++ src/exceptions/OFBindFailedException.m @@ -83,16 +83,16 @@ ERRFMT, _port, _host, _inClass, ERRPARAM]; } - (OFTCPSocket*)socket { - OF_GETTER(_socket, NO) + OF_GETTER(_socket, false) } - (OFString*)host { - OF_GETTER(_host, NO) + OF_GETTER(_host, false) } - (uint16_t)port { return _port; Index: src/exceptions/OFChangeDirectoryFailedException.m ================================================================== --- src/exceptions/OFChangeDirectoryFailedException.m +++ src/exceptions/OFChangeDirectoryFailedException.m @@ -78,8 +78,8 @@ return _errNo; } - (OFString*)path { - OF_GETTER(_path, NO) + OF_GETTER(_path, false) } @end Index: src/exceptions/OFChangeFileModeFailedException.m ================================================================== --- src/exceptions/OFChangeFileModeFailedException.m +++ src/exceptions/OFChangeFileModeFailedException.m @@ -82,13 +82,13 @@ return _errNo; } - (OFString*)path { - OF_GETTER(_path, NO) + OF_GETTER(_path, false) } - (mode_t)mode { return _mode; } @end Index: src/exceptions/OFChangeFileOwnerFailedException.m ================================================================== --- src/exceptions/OFChangeFileOwnerFailedException.m +++ src/exceptions/OFChangeFileOwnerFailedException.m @@ -98,19 +98,19 @@ return _errNo; } - (OFString*)path { - OF_GETTER(_path, NO) + OF_GETTER(_path, false) } - (OFString*)owner { - OF_GETTER(_owner, NO) + OF_GETTER(_owner, false) } - (OFString*)group { - OF_GETTER(_group, NO) + OF_GETTER(_group, false) } @end #endif Index: src/exceptions/OFConditionBroadcastFailedException.m ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.m +++ src/exceptions/OFConditionBroadcastFailedException.m @@ -65,8 +65,8 @@ @"Broadcasting a condition of type %@ failed!", _inClass]; } - (OFCondition*)condition { - OF_GETTER(_condition, NO) + OF_GETTER(_condition, false) } @end Index: src/exceptions/OFConditionSignalFailedException.m ================================================================== --- src/exceptions/OFConditionSignalFailedException.m +++ src/exceptions/OFConditionSignalFailedException.m @@ -65,8 +65,8 @@ @"Signaling a condition of type %@ failed!", _inClass]; } - (OFCondition*)condition { - OF_GETTER(_condition, NO) + OF_GETTER(_condition, false) } @end Index: src/exceptions/OFConditionStillWaitingException.m ================================================================== --- src/exceptions/OFConditionStillWaitingException.m +++ src/exceptions/OFConditionStillWaitingException.m @@ -66,8 +66,8 @@ @"thread was still waiting for it!", _inClass]; } - (OFCondition*)condition { - OF_GETTER(_condition, NO) + OF_GETTER(_condition, false) } @end Index: src/exceptions/OFConditionWaitFailedException.m ================================================================== --- src/exceptions/OFConditionWaitFailedException.m +++ src/exceptions/OFConditionWaitFailedException.m @@ -65,8 +65,8 @@ @"Waiting for a condition of type %@ failed!", _inClass]; } - (OFCondition*)condition { - OF_GETTER(_condition, NO) + OF_GETTER(_condition, false) } @end Index: src/exceptions/OFConnectionFailedException.m ================================================================== --- src/exceptions/OFConnectionFailedException.m +++ src/exceptions/OFConnectionFailedException.m @@ -84,16 +84,16 @@ ERRPARAM]; } - (OFTCPSocket*)socket { - OF_GETTER(_socket, NO) + OF_GETTER(_socket, false) } - (OFString*)host { - OF_GETTER(_host, NO) + OF_GETTER(_host, false) } - (uint16_t)port { return _port; Index: src/exceptions/OFCopyFileFailedException.m ================================================================== --- src/exceptions/OFCopyFileFailedException.m +++ src/exceptions/OFCopyFileFailedException.m @@ -83,13 +83,13 @@ return _errNo; } - (OFString*)sourcePath { - OF_GETTER(_sourcePath, NO) + OF_GETTER(_sourcePath, false) } - (OFString*)destinationPath { - OF_GETTER(_destinationPath, NO) + OF_GETTER(_destinationPath, false) } @end Index: src/exceptions/OFCreateDirectoryFailedException.m ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.m +++ src/exceptions/OFCreateDirectoryFailedException.m @@ -78,8 +78,8 @@ return _errNo; } - (OFString*)path { - OF_GETTER(_path, NO) + OF_GETTER(_path, false) } @end Index: src/exceptions/OFDeleteDirectoryFailedException.m ================================================================== --- src/exceptions/OFDeleteDirectoryFailedException.m +++ src/exceptions/OFDeleteDirectoryFailedException.m @@ -78,8 +78,8 @@ return _errNo; } - (OFString*)path { - OF_GETTER(_path, NO) + OF_GETTER(_path, false) } @end Index: src/exceptions/OFDeleteFileFailedException.m ================================================================== --- src/exceptions/OFDeleteFileFailedException.m +++ src/exceptions/OFDeleteFileFailedException.m @@ -78,8 +78,8 @@ return _errNo; } - (OFString*)path { - OF_GETTER(_path, NO) + OF_GETTER(_path, false) } @end Index: src/exceptions/OFEnumerationMutationException.m ================================================================== --- src/exceptions/OFEnumerationMutationException.m +++ src/exceptions/OFEnumerationMutationException.m @@ -66,8 +66,8 @@ @"Object of class %@ was mutated during enumeration!", _inClass]; } - (id)object { - OF_GETTER(_object, NO) + OF_GETTER(_object, false) } @end Index: src/exceptions/OFHTTPRequestFailedException.m ================================================================== --- src/exceptions/OFHTTPRequestFailedException.m +++ src/exceptions/OFHTTPRequestFailedException.m @@ -88,13 +88,13 @@ type, _inClass, [_request URL], [_reply statusCode]]; } - (OFHTTPRequest*)request { - OF_GETTER(_request, NO) + OF_GETTER(_request, false) } - (OFHTTPRequestReply*)reply { - OF_GETTER(_reply, NO) + OF_GETTER(_reply, false) } @end Index: src/exceptions/OFHashAlreadyCalculatedException.m ================================================================== --- src/exceptions/OFHashAlreadyCalculatedException.m +++ src/exceptions/OFHashAlreadyCalculatedException.m @@ -67,8 +67,8 @@ @"data can be added", _inClass]; } - (id )hashObject { - OF_GETTER(_hashObject, NO) + OF_GETTER(_hashObject, false) } @end Index: src/exceptions/OFLinkFailedException.m ================================================================== --- src/exceptions/OFLinkFailedException.m +++ src/exceptions/OFLinkFailedException.m @@ -84,14 +84,14 @@ return _errNo; } - (OFString*)sourcePath { - OF_GETTER(_sourcePath, NO) + OF_GETTER(_sourcePath, false) } - (OFString*)destinationPath { - OF_GETTER(_destinationPath, NO) + OF_GETTER(_destinationPath, false) } @end #endif Index: src/exceptions/OFListenFailedException.m ================================================================== --- src/exceptions/OFListenFailedException.m +++ src/exceptions/OFListenFailedException.m @@ -73,11 +73,11 @@ ERRFMT, _inClass, _backLog, ERRPARAM]; } - (OFTCPSocket*)socket { - OF_GETTER(_socket, NO) + OF_GETTER(_socket, false) } - (int)backLog { return _backLog; Index: src/exceptions/OFLockFailedException.m ================================================================== --- src/exceptions/OFLockFailedException.m +++ src/exceptions/OFLockFailedException.m @@ -53,8 +53,8 @@ [_lock class], _inClass]; } - (id )lock { - OF_GETTER(_lock, NO) + OF_GETTER(_lock, false) } @end Index: src/exceptions/OFMalformedXMLException.m ================================================================== --- src/exceptions/OFMalformedXMLException.m +++ src/exceptions/OFMalformedXMLException.m @@ -57,8 +57,8 @@ return @"An XML parser encountered malformed XML!"; } - (OFXMLParser*)parser { - OF_GETTER(_parser, NO) + OF_GETTER(_parser, false) } @end Index: src/exceptions/OFNotConnectedException.m ================================================================== --- src/exceptions/OFNotConnectedException.m +++ src/exceptions/OFNotConnectedException.m @@ -67,8 +67,8 @@ @"The socket of type %@ is not connected or bound!", _inClass]; } - (OFStreamSocket*)socket { - OF_GETTER(_socket, NO) + OF_GETTER(_socket, false) } @end Index: src/exceptions/OFOpenFileFailedException.m ================================================================== --- src/exceptions/OFOpenFileFailedException.m +++ src/exceptions/OFOpenFileFailedException.m @@ -83,13 +83,13 @@ return _errNo; } - (OFString*)path { - OF_GETTER(_path, NO) + OF_GETTER(_path, false) } - (OFString*)mode { - OF_GETTER(_mode, NO) + OF_GETTER(_mode, false) } @end Index: src/exceptions/OFReadOrWriteFailedException.m ================================================================== --- src/exceptions/OFReadOrWriteFailedException.m +++ src/exceptions/OFReadOrWriteFailedException.m @@ -70,11 +70,11 @@ [super dealloc]; } - (OFStream*)stream { - OF_GETTER(_stream, NO) + OF_GETTER(_stream, false) } - (size_t)requestedLength { return _requestedLength; Index: src/exceptions/OFRenameFileFailedException.m ================================================================== --- src/exceptions/OFRenameFileFailedException.m +++ src/exceptions/OFRenameFileFailedException.m @@ -83,13 +83,13 @@ return _errNo; } - (OFString*)sourcePath { - OF_GETTER(_sourcePath, NO) + OF_GETTER(_sourcePath, false) } - (OFString*)destinationPath { - OF_GETTER(_destinationPath, NO) + OF_GETTER(_destinationPath, false) } @end Index: src/exceptions/OFSeekFailedException.m ================================================================== --- src/exceptions/OFSeekFailedException.m +++ src/exceptions/OFSeekFailedException.m @@ -76,11 +76,11 @@ @"Seeking failed in class %@! " ERRFMT, _inClass, ERRPARAM]; } - (OFSeekableStream*)stream { - OF_GETTER(_stream, NO) + OF_GETTER(_stream, false) } - (off_t)offset { return _offset; Index: src/exceptions/OFSetOptionFailedException.m ================================================================== --- src/exceptions/OFSetOptionFailedException.m +++ src/exceptions/OFSetOptionFailedException.m @@ -67,8 +67,8 @@ @"Setting an option in class %@ failed!", _inClass]; } - (OFStream*)stream { - OF_GETTER(_stream, NO) + OF_GETTER(_stream, false) } @end Index: src/exceptions/OFStillLockedException.m ================================================================== --- src/exceptions/OFStillLockedException.m +++ src/exceptions/OFStillLockedException.m @@ -53,8 +53,8 @@ @"though it was still locked!", [_lock class], _inClass]; } - (id )lock { - OF_GETTER(_lock, NO) + OF_GETTER(_lock, false) } @end Index: src/exceptions/OFSymlinkFailedException.m ================================================================== --- src/exceptions/OFSymlinkFailedException.m +++ src/exceptions/OFSymlinkFailedException.m @@ -84,14 +84,14 @@ return _errNo; } - (OFString*)sourcePath { - OF_GETTER(_sourcePath, NO) + OF_GETTER(_sourcePath, false) } - (OFString*)destinationPath { - OF_GETTER(_destinationPath, NO) + OF_GETTER(_destinationPath, false) } @end #endif Index: src/exceptions/OFThreadJoinFailedException.m ================================================================== --- src/exceptions/OFThreadJoinFailedException.m +++ src/exceptions/OFThreadJoinFailedException.m @@ -66,8 +66,8 @@ @"already waits for the thread to join.", _inClass]; } - (OFThread*)thread { - OF_GETTER(_thread, NO) + OF_GETTER(_thread, false) } @end Index: src/exceptions/OFThreadStartFailedException.m ================================================================== --- src/exceptions/OFThreadStartFailedException.m +++ src/exceptions/OFThreadStartFailedException.m @@ -65,8 +65,8 @@ @"Starting a thread of class %@ failed!", _inClass]; } - (OFThread*)thread { - OF_GETTER(_thread, NO) + OF_GETTER(_thread, false) } @end Index: src/exceptions/OFThreadStillRunningException.m ================================================================== --- src/exceptions/OFThreadStillRunningException.m +++ src/exceptions/OFThreadStillRunningException.m @@ -66,8 +66,8 @@ @"was still running!", _inClass]; } - (OFThread*)thread { - OF_GETTER(_thread, NO) + OF_GETTER(_thread, false) } @end Index: src/exceptions/OFUnboundNamespaceException.m ================================================================== --- src/exceptions/OFUnboundNamespaceException.m +++ src/exceptions/OFUnboundNamespaceException.m @@ -104,13 +104,13 @@ _inClass]; } - (OFString*)namespace { - OF_GETTER(_namespace, NO) + OF_GETTER(_namespace, false) } - (OFString*)prefix { - OF_GETTER(_prefix, NO) + OF_GETTER(_prefix, false) } @end Index: src/exceptions/OFUnlockFailedException.m ================================================================== --- src/exceptions/OFUnlockFailedException.m +++ src/exceptions/OFUnlockFailedException.m @@ -53,8 +53,8 @@ [_lock class], _inClass]; } - (id )lock { - OF_GETTER(_lock, NO) + OF_GETTER(_lock, false) } @end Index: src/exceptions/OFUnsupportedProtocolException.m ================================================================== --- src/exceptions/OFUnsupportedProtocolException.m +++ src/exceptions/OFUnsupportedProtocolException.m @@ -73,8 +73,8 @@ _inClass]; } - (OFURL*)URL { - OF_GETTER(_URL, NO) + OF_GETTER(_URL, false) } @end Index: src/exceptions/OFUnsupportedVersionException.m ================================================================== --- src/exceptions/OFUnsupportedVersionException.m +++ src/exceptions/OFUnsupportedVersionException.m @@ -72,8 +72,8 @@ @"%@", _version, _inClass]; } - (OFString*)version { - OF_GETTER(_version, NO) + OF_GETTER(_version, false) } @end Index: src/instance.m ================================================================== --- src/instance.m +++ src/instance.m @@ -19,36 +19,36 @@ #import "OFObject.h" static SEL cxx_construct = NULL; static SEL cxx_destruct = NULL; -static BOOL +static bool call_ctors(Class cls, id obj) { Class super = class_getSuperclass(cls); id (*ctor)(id, SEL); id (*last)(id, SEL); if (super != nil) if (!call_ctors(super, obj)) - return NO; + return false; if (cxx_construct == NULL) cxx_construct = sel_registerName(".cxx_construct"); if (!class_respondsToSelector(cls, cxx_construct)) - return YES; + return true; ctor = (id(*)(id, SEL)) class_getMethodImplementation(cls, cxx_construct); last = (id(*)(id, SEL)) class_getMethodImplementation(super, cxx_construct); if (ctor == last) - return YES; + return true; - return (ctor(obj, cxx_construct) != nil ? YES : NO); + return (ctor(obj, cxx_construct) != nil); } id objc_constructInstance(Class cls, void *bytes) { Index: src/runtime/class.m ================================================================== --- src/runtime/class.m +++ src/runtime/class.m @@ -97,11 +97,11 @@ if (sel_isEqual((SEL)&ml->methods[i].sel, selector)) ((void(*)(id, SEL))ml->methods[i].imp)(cls, selector); } -static BOOL +static bool has_load(Class cls) { struct objc_method_list *ml; SEL selector; unsigned int i; @@ -109,13 +109,13 @@ selector = sel_registerName("load"); for (ml = cls->isa->methodlist; ml != NULL; ml = ml->next) for (i = 0; i < ml->count; i++) if (sel_isEqual((SEL)&ml->methods[i].sel, selector)) - return YES; + return true; - return NO; + return false; } static void call_load(Class cls) { @@ -404,11 +404,11 @@ objc_get_class(const char *name) { return objc_getRequiredClass(name); } -BOOL +bool class_isMetaClass(Class cls) { return (cls->info & OBJC_CLASS_INFO_METACLASS); } @@ -422,20 +422,20 @@ class_getSuperclass(Class cls) { return cls->superclass; } -BOOL +bool class_isKindOfClass(Class cls1, Class cls2) { Class iter; for (iter = cls1; iter != Nil; iter = iter->superclass) if (iter == cls2) - return YES; + return true; - return NO; + return false; } unsigned long class_getInstanceSize(Class cls) { Index: src/runtime/exception.m ================================================================== --- src/runtime/exception.m +++ src/runtime/exception.m @@ -332,11 +332,11 @@ lsda->callsites = ptr; lsda->actiontable = lsda->callsites + callsites_size; } -static BOOL +static bool find_callsite(struct _Unwind_Context *ctx, struct lsda *lsda, uintptr_t *landingpad, const uint8_t **actionrecords) { uintptr_t ip = _Unwind_GetIP(ctx); const uint8_t *ptr; @@ -366,39 +366,39 @@ callsite_landingpad; if (callsite_action != 0) *actionrecords = lsda->actiontable + callsite_action - 1; - return YES; + return true; } } - return NO; + return false; } -static BOOL +static bool class_matches(Class class, id object) { Class iter; if (class == Nil) - return YES; + return true; if (object == nil) - return NO; + return false; for (iter = object_getClass(object); iter != Nil; iter = class_getSuperclass(iter)) if (iter == class) - return YES; + return true; - return NO; + return false; } static uint8_t find_actionrecord(const uint8_t *actionrecords, struct lsda *lsda, int actions, - BOOL foreign, struct objc_exception *e, intptr_t *filtervalue) + bool foreign, struct objc_exception *e, intptr_t *filtervalue) { const uint8_t *ptr; intptr_t filter, displacement; do { @@ -488,11 +488,11 @@ __gnu_objc_personality_v0(int version, int actions, uint64_t ex_class, struct _Unwind_Exception *ex, struct _Unwind_Context *ctx) { #endif struct objc_exception *e = (struct objc_exception*)ex; - BOOL foreign = (ex_class != objc_exception_class); + bool foreign = (ex_class != objc_exception_class); const uint8_t *lsda_addr, *actionrecords; struct lsda lsda; uintptr_t landingpad = 0; uint8_t found = 0; intptr_t filter = 0; Index: src/runtime/lookup.m ================================================================== --- src/runtime/lookup.m +++ src/runtime/lookup.m @@ -26,11 +26,11 @@ IMP (*objc_forward_handler)(id, SEL) = NULL; IMP objc_not_found_handler(id obj, SEL sel) { - BOOL is_class = object_getClass(obj)->info & OBJC_CLASS_INFO_METACLASS; + bool is_class = object_getClass(obj)->info & OBJC_CLASS_INFO_METACLASS; if (!(object_getClass(obj)->info & OBJC_CLASS_INFO_INITIALIZED)) { Class cls = (is_class ? (Class)obj : object_getClass(obj)); objc_initialize_class(cls); @@ -57,18 +57,17 @@ OBJC_ERROR("Selector %c[%s] is not implemented for class %s!", (is_class ? '+' : '-'), sel_getName(sel), object_getClassName(obj)); } -BOOL +bool class_respondsToSelector(Class cls, SEL sel) { if (cls == Nil) - return NO; + return false; - return (objc_sparsearray_get(cls->dtable, (uint32_t)sel->uid) != NULL - ? YES : NO); + return (objc_sparsearray_get(cls->dtable, (uint32_t)sel->uid) != NULL); } #ifndef OF_ASM_LOOKUP static id nil_method(id self, SEL _cmd) Index: src/runtime/protocol.m ================================================================== --- src/runtime/protocol.m +++ src/runtime/protocol.m @@ -28,63 +28,63 @@ protocol_getName(Protocol *p) { return p->name; } -inline BOOL +inline bool protocol_isEqual(Protocol *a, Protocol *b) { return !strcmp(protocol_getName(a), protocol_getName(b)); } -BOOL +bool protocol_conformsToProtocol(Protocol *a, Protocol *b) { struct objc_protocol_list *pl; size_t i; if (protocol_isEqual(a, b)) - return YES; + return true; for (pl = a->protocol_list; pl != NULL; pl = pl->next) for (i = 0; i < pl->count; i++) if (protocol_conformsToProtocol(pl->list[i], b)) - return YES; + return true; - return NO; + return false; } -BOOL +bool class_conformsToProtocol(Class cls, Protocol *p) { struct objc_protocol_list *pl; struct objc_category **cats; long i, j; for (pl = cls->protocols; pl != NULL; pl = pl->next) for (i = 0; i < pl->count; i++) if (protocol_conformsToProtocol(pl->list[i], p)) - return YES; + return true; objc_global_mutex_lock(); if ((cats = objc_categories_for_class(cls)) == NULL) { objc_global_mutex_unlock(); - return NO; + return false; } for (i = 0; cats[i] != NULL; i++) { for (pl = cats[i]->protocols; pl != NULL; pl = pl->next) { for (j = 0; j < pl->count; j++) { if (protocol_conformsToProtocol( pl->list[j], p)) { objc_global_mutex_unlock(); - return YES; + return true; } } } } objc_global_mutex_unlock(); - return NO; + return false; } Index: src/runtime/runtime-private.h ================================================================== --- src/runtime/runtime-private.h +++ src/runtime/runtime-private.h @@ -107,21 +107,21 @@ }; #ifdef OF_SELUID24 struct objc_sparsearray_level2 { struct objc_sparsearray_level3 *buckets[256]; - BOOL empty; + bool empty; }; struct objc_sparsearray_level3 { const void *buckets[256]; - BOOL empty; + bool empty; }; #else struct objc_sparsearray_level2 { const void *buckets[256]; - BOOL empty; + bool empty; }; #endif extern void objc_register_all_categories(struct objc_abi_symtab*); extern struct objc_category** objc_categories_for_class(Class); Index: src/runtime/runtime.h ================================================================== --- src/runtime/runtime.h +++ src/runtime/runtime.h @@ -15,10 +15,11 @@ */ #ifndef __OBJFW_RUNTIME_H__ #define __OBJFW_RUNTIME_H__ #include +#include #ifndef __has_feature # define __has_feature(x) 0 #endif @@ -167,32 +168,32 @@ #ifdef __cplusplus extern "C" { #endif extern SEL sel_registerName(const char*); extern const char* sel_getName(SEL); -extern BOOL sel_isEqual(SEL, SEL); +extern bool sel_isEqual(SEL, SEL); extern id objc_lookUpClass(const char*); extern id objc_getClass(const char*); extern id objc_getRequiredClass(const char*); -extern BOOL class_isMetaClass(Class); +extern bool class_isMetaClass(Class); extern const char* class_getName(Class); extern Class class_getSuperclass(Class); -extern BOOL class_isKindOfClass(Class, Class); +extern bool class_isKindOfClass(Class, Class); extern unsigned long class_getInstanceSize(Class); -extern BOOL class_respondsToSelector(Class, SEL); -extern BOOL class_conformsToProtocol(Class, Protocol*); +extern bool class_respondsToSelector(Class, SEL); +extern bool class_conformsToProtocol(Class, Protocol*); extern IMP class_getMethodImplementation(Class, SEL); extern IMP class_replaceMethod(Class, SEL, IMP, const char*); extern const char* objc_get_type_encoding(Class, SEL); extern Class object_getClass(id); extern Class object_setClass(id, Class); extern const char* object_getClassName(id); extern IMP objc_msg_lookup(id, SEL); extern IMP objc_msg_lookup_super(struct objc_super*, SEL); extern const char* protocol_getName(Protocol*); -extern BOOL protocol_isEqual(Protocol*, Protocol*); -extern BOOL protocol_conformsToProtocol(Protocol*, Protocol*); +extern bool protocol_isEqual(Protocol*, Protocol*); +extern bool protocol_conformsToProtocol(Protocol*, Protocol*); extern void objc_exit(void); extern objc_uncaught_exception_handler objc_setUncaughtExceptionHandler( objc_uncaught_exception_handler); extern IMP (*objc_forward_handler)(id, SEL); extern id objc_autorelease(id); Index: src/runtime/selector.m ================================================================== --- src/runtime/selector.m +++ src/runtime/selector.m @@ -111,14 +111,14 @@ objc_global_mutex_unlock(); return ret; } -BOOL +bool sel_isEqual(SEL sel1, SEL sel2) { - return sel1->uid == sel2->uid; + return (sel1->uid == sel2->uid); } void objc_free_all_selectors(void) { Index: src/runtime/sparsearray.m ================================================================== --- src/runtime/sparsearray.m +++ src/runtime/sparsearray.m @@ -34,18 +34,18 @@ empty_level2 = malloc(sizeof(struct objc_sparsearray_level2)); if (empty_level2 == NULL) OBJC_ERROR("Not enough memory to allocate sparse array!"); - empty_level2->empty = YES; + empty_level2->empty = true; #ifdef OF_SELUID24 empty_level3 = malloc(sizeof(struct objc_sparsearray_level3)); if (empty_level3 == NULL) OBJC_ERROR("Not enough memory to allocate sparse array!"); - empty_level3->empty = YES; + empty_level3->empty = true; #endif #ifdef OF_SELUID24 for (i = 0; i < 256; i++) { empty_level2->buckets[i] = empty_level3; @@ -148,11 +148,11 @@ if (t == NULL) OBJC_ERROR("Not enough memory to insert into sparse " "array!"); - t->empty = NO; + t->empty = false; for (l = 0; l < 256; l++) #ifdef OF_SELUID24 t->buckets[l] = empty_level3; #else @@ -171,11 +171,11 @@ if (t == NULL) OBJC_ERROR("Not enough memory to insert into sparse " "array!"); - t->empty = NO; + t->empty = false; for (l = 0; l < 256; l++) t->buckets[l] = NULL; s->buckets[i]->buckets[j] = t; Index: src/runtime/threading.m ================================================================== --- src/runtime/threading.m +++ src/runtime/threading.m @@ -22,19 +22,19 @@ #import "runtime.h" #import "runtime-private.h" #import "threading.h" static of_rmutex_t global_mutex; -static BOOL global_mutex_init = NO; +static bool global_mutex_init = false; static void objc_global_mutex_new(void) { if (!of_rmutex_new(&global_mutex)) OBJC_ERROR("Failed to create global mutex!"); - global_mutex_init = YES; + global_mutex_init = true; } void objc_global_mutex_lock(void) { Index: src/threading.h ================================================================== --- src/threading.h +++ src/threading.h @@ -65,11 +65,11 @@ #elif defined(_WIN32) # define of_thread_is_current(t) (t == GetCurrentThread()) # define of_thread_current GetCurrentThread #endif -static OF_INLINE BOOL +static OF_INLINE bool of_thread_new(of_thread_t *thread, id (*function)(id), id data) { #if defined(OF_HAVE_PTHREADS) return !pthread_create(thread, NULL, (void*(*)(void*))function, (__bridge void*)data); @@ -79,38 +79,38 @@ return (thread != NULL); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_thread_join(of_thread_t thread) { #if defined(OF_HAVE_PTHREADS) void *ret; if (pthread_join(thread, &ret)) - return NO; + return false; return (ret != PTHREAD_CANCELED); #elif defined(_WIN32) if (WaitForSingleObject(thread, INFINITE)) - return NO; + return false; CloseHandle(thread); - return YES; + return true; #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_thread_detach(of_thread_t thread) { #if defined(OF_HAVE_PTHREADS) return !pthread_detach(thread); #elif defined(_WIN32) /* FIXME */ - return YES; + return true; #endif } static OF_INLINE void of_thread_exit(void) @@ -120,144 +120,144 @@ #elif defined(_WIN32) ExitThread(0); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_mutex_new(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) return !pthread_mutex_init(mutex, NULL); #elif defined(_WIN32) InitializeCriticalSection(mutex); - return YES; + return true; #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_mutex_free(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) return !pthread_mutex_destroy(mutex); #elif defined(_WIN32) DeleteCriticalSection(mutex); - return YES; + return true; #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_mutex_lock(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) return !pthread_mutex_lock(mutex); #elif defined(_WIN32) EnterCriticalSection(mutex); - return YES; + return true; #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_mutex_trylock(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) return !pthread_mutex_trylock(mutex); #elif defined(_WIN32) return TryEnterCriticalSection(mutex); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_mutex_unlock(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) return !pthread_mutex_unlock(mutex); #elif defined(_WIN32) LeaveCriticalSection(mutex); - return YES; + return true; #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_condition_new(of_condition_t *condition) { #if defined(OF_HAVE_PTHREADS) return !pthread_cond_init(condition, NULL); #elif defined(_WIN32) condition->count = 0; if ((condition->event = CreateEvent(NULL, FALSE, 0, NULL)) == NULL) - return NO; + return false; - return YES; + return true; #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_condition_wait(of_condition_t *condition, of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) return !pthread_cond_wait(condition, mutex); #elif defined(_WIN32) if (!of_mutex_unlock(mutex)) - return NO; + return false; of_atomic_inc_int(&condition->count); if (WaitForSingleObject(condition->event, INFINITE) != WAIT_OBJECT_0) { of_mutex_lock(mutex); - return NO; + return false; } of_atomic_dec_int(&condition->count); if (!of_mutex_lock(mutex)) - return NO; + return false; - return YES; + return true; #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_condition_signal(of_condition_t *condition) { #if defined(OF_HAVE_PTHREADS) return !pthread_cond_signal(condition); #elif defined(_WIN32) return SetEvent(condition->event); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_condition_broadcast(of_condition_t *condition) { #if defined(OF_HAVE_PTHREADS) return !pthread_cond_broadcast(condition); #elif defined(_WIN32) size_t i; for (i = 0; i < condition->count; i++) if (!SetEvent(condition->event)) - return NO; + return false; - return YES; + return true; #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_condition_free(of_condition_t *condition) { #if defined(OF_HAVE_PTHREADS) return !pthread_cond_destroy(condition); #elif defined(_WIN32) if (condition->count) - return NO; + return false; return CloseHandle(condition->event); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_tlskey_new(of_tlskey_t *key) { #if defined(OF_HAVE_PTHREADS) return !pthread_key_create(key, NULL); #elif defined(_WIN32) @@ -273,44 +273,44 @@ #elif defined(_WIN32) return TlsGetValue(key); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_tlskey_set(of_tlskey_t key, void *ptr) { #if defined(OF_HAVE_PTHREADS) return !pthread_setspecific(key, ptr); #elif defined(_WIN32) return TlsSetValue(key, ptr); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_tlskey_free(of_tlskey_t key) { #if defined(OF_HAVE_PTHREADS) return !pthread_key_delete(key); #elif defined(_WIN32) return TlsFree(key); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_spinlock_new(of_spinlock_t *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) *spinlock = 0; - return YES; + return true; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_init(spinlock, 0); #else return of_mutex_new(spinlock); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_spinlock_trylock(of_spinlock_t *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) return of_atomic_cmpswap_int(spinlock, 0, 1); #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) @@ -318,20 +318,20 @@ #else return of_mutex_trylock(spinlock); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_spinlock_lock(of_spinlock_t *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) # if defined(OF_HAVE_SCHED_YIELD) || defined(_WIN32) int i; for (i = 0; i < OF_SPINCOUNT; i++) if (of_spinlock_trylock(spinlock)) - return YES; + return true; while (!of_spinlock_trylock(spinlock)) # ifndef _WIN32 sched_yield(); # else @@ -339,152 +339,155 @@ # endif # else while (!of_spinlock_trylock(spinlock)); # endif - return YES; + return true; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_lock(spinlock); #else return of_mutex_lock(spinlock); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_spinlock_unlock(of_spinlock_t *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) *spinlock = 0; - return YES; + return true; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_unlock(spinlock); #else return of_mutex_unlock(spinlock); #endif } -static OF_INLINE BOOL +static OF_INLINE bool of_spinlock_free(of_spinlock_t *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) - return YES; + return true; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_destroy(spinlock); #else return of_mutex_free(spinlock); #endif } #ifdef OF_HAVE_RECURSIVE_PTHREAD_MUTEXES -static OF_INLINE BOOL +static OF_INLINE bool of_rmutex_new(of_mutex_t *mutex) { pthread_mutexattr_t attr; if (pthread_mutexattr_init(&attr)) - return NO; + return false; if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) - return NO; + return false; if (pthread_mutex_init(mutex, &attr)) - return NO; + return false; if (pthread_mutexattr_destroy(&attr)) - return NO; + return false; - return YES; + return true; } # define of_rmutex_lock of_mutex_lock # define of_rmutex_trylock of_mutex_trylock # define of_rmutex_unlock of_mutex_unlock # define of_rmutex_free of_mutex_free #else -static OF_INLINE BOOL +static OF_INLINE bool of_rmutex_new(of_rmutex_t *rmutex) { if (!of_mutex_new(&rmutex->mutex)) - return NO; + return false; if (!of_tlskey_new(&rmutex->count)) - return NO; + return false; - return YES; + return true; } -static OF_INLINE BOOL +static OF_INLINE bool of_rmutex_lock(of_rmutex_t *rmutex) { uintptr_t count = (uintptr_t)of_tlskey_get(rmutex->count); if (count > 0) { if (!of_tlskey_set(rmutex->count, (void*)(count + 1))) - return NO; - return YES; + return false; + + return true; } if (!of_mutex_lock(&rmutex->mutex)) - return NO; + return false; if (!of_tlskey_set(rmutex->count, (void*)1)) { of_mutex_unlock(&rmutex->mutex); - return NO; + return false; } - return YES; + return true; } -static OF_INLINE BOOL +static OF_INLINE bool of_rmutex_trylock(of_rmutex_t *rmutex) { uintptr_t count = (uintptr_t)of_tlskey_get(rmutex->count); if (count > 0) { if (!of_tlskey_set(rmutex->count, (void*)(count + 1))) - return NO; - return YES; + return false; + + return true; } if (!of_mutex_trylock(&rmutex->mutex)) - return NO; + return false; if (!of_tlskey_set(rmutex->count, (void*)1)) { of_mutex_unlock(&rmutex->mutex); - return NO; + return false; } - return YES; + return true; } -static OF_INLINE BOOL +static OF_INLINE bool of_rmutex_unlock(of_rmutex_t *rmutex) { uintptr_t count = (uintptr_t)of_tlskey_get(rmutex->count); if (count > 1) { if (!of_tlskey_set(rmutex->count, (void*)(count - 1))) - return NO; - return YES; + return false; + + return true; } if (!of_tlskey_set(rmutex->count, (void*)0)) - return NO; + return false; if (!of_mutex_unlock(&rmutex->mutex)) - return NO; + return false; - return YES; + return true; } -static OF_INLINE BOOL +static OF_INLINE bool of_rmutex_free(of_rmutex_t *rmutex) { if (!of_mutex_free(&rmutex->mutex)) - return NO; + return false; if (!of_tlskey_free(rmutex->count)) - return NO; + return false; - return YES; + return true; } #endif Index: tests/ForwardingTests.m ================================================================== --- tests/ForwardingTests.m +++ tests/ForwardingTests.m @@ -21,11 +21,11 @@ #import "TestsAppDelegate.h" static OFString *module = @"Forwarding"; static size_t forwardings = 0; -static BOOL success = NO; +static bool success = false; @interface ForwardingTest: OFObject @end @interface ForwardingTest (Test) @@ -34,40 +34,40 @@ @end static void test(id self, SEL _cmd) { - success = YES; + success = true; } @implementation ForwardingTest -+ (BOOL)resolveClassMethod: (SEL)selector ++ (bool)resolveClassMethod: (SEL)selector { forwardings++; if (sel_isEqual(selector, @selector(test))) { [self replaceClassMethod: @selector(test) withImplementation: (IMP)test typeEncoding: "v#:"]; - return YES; + return true; } - return NO; + return false; } -+ (BOOL)resolveInstanceMethod: (SEL)selector ++ (bool)resolveInstanceMethod: (SEL)selector { forwardings++; if (sel_isEqual(selector, @selector(test))) { [self replaceInstanceMethod: @selector(test) withImplementation: (IMP)test typeEncoding: "v@:"]; - return YES; + return true; } - return NO; + return false; } @end @implementation TestsAppDelegate (ForwardingTests) - (void)forwardingTests @@ -78,14 +78,14 @@ R([ForwardingTest test]) && success && R([ForwardingTest test]) && forwardings == 1); ForwardingTest *t = [[[ForwardingTest alloc] init] autorelease]; - success = NO; + success = false; forwardings = 0; TEST(@"Forwarding a message and adding an instance method", R([t test]) && success && R([t test]) && forwardings == 1); [pool drain]; } @end Index: tests/OFArrayTests.m ================================================================== --- tests/OFArrayTests.m +++ tests/OFArrayTests.m @@ -40,11 +40,11 @@ OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFArray *a[3]; OFMutableArray *m[2]; OFEnumerator *enumerator; id obj; - BOOL ok; + bool ok; size_t i; TEST(@"+[array]", (m[0] = [OFMutableArray array])) TEST(@"+[arrayWithObjects:]", @@ -79,17 +79,17 @@ [[a[1] objectAtIndex: 0] isEqual: c_ary[0]] && [[a[1] objectAtIndex: 1] isEqual: c_ary[1]] && [[a[1] objectAtIndex: 2] isEqual: c_ary[2]]) TEST(@"-[containsObject:]", - [a[0] containsObject: c_ary[1]] == YES && - [a[0] containsObject: @"nonexistant"] == NO) + [a[0] containsObject: c_ary[1]] && + ![a[0] containsObject: @"nonexistant"]) TEST(@"-[containsObjectIdenticalTo:]", - [a[0] containsObjectIdenticalTo: c_ary[1]] == YES && - [a[0] containsObjectIdenticalTo: - [OFString stringWithString: c_ary[1]]] == NO) + [a[0] containsObjectIdenticalTo: c_ary[1]] && + ![a[0] containsObjectIdenticalTo: + [OFString stringWithString: c_ary[1]]]) TEST(@"-[indexOfObject:]", [a[0] indexOfObject: c_ary[1]] == 1) TEST(@"-[indexOfObjectIdenticalTo:]", [a[1] indexOfObjectIdenticalTo: c_ary[1]] == 1) @@ -170,25 +170,25 @@ [[a[1] componentsJoinedByString: @" "] isEqual: @"foo bar baz"] && (a[1] = [OFArray arrayWithObject: @"foo"]) && [[a[1] componentsJoinedByString: @" "] isEqual: @"foo"]) m[0] = [[a[0] mutableCopy] autorelease]; - ok = YES; + ok = true; i = 0; TEST(@"-[objectEnumerator]", (enumerator = [m[0] objectEnumerator])) while ((obj = [enumerator nextObject]) != nil) { if (![obj isEqual: c_ary[i]]) - ok = NO; + ok = false; [m[0] replaceObjectAtIndex: i withObject: @""]; i++; } if ([m[0] count] != i) - ok = NO; + ok = false; TEST(@"OFEnumerator's -[nextObject]", ok) [enumerator reset]; [m[0] removeObjectAtIndex: 0]; @@ -196,23 +196,23 @@ EXPECT_EXCEPTION(@"Detection of mutation during enumeration", OFEnumerationMutationException, [enumerator nextObject]) #ifdef OF_HAVE_FAST_ENUMERATION m[0] = [[a[0] mutableCopy] autorelease]; - ok = YES; + ok = true; i = 0; for (OFString *s in m[0]) { if (![s isEqual: c_ary[i]]) - ok = NO; + ok = false; [m[0] replaceObjectAtIndex: i withObject: @""]; i++; } if ([m[0] count] != i) - ok = NO; + ok = false; TEST(@"Fast Enumeration", ok) [m[0] replaceObjectAtIndex: 0 withObject: c_ary[0]]; @@ -219,56 +219,56 @@ [m[0] replaceObjectAtIndex: 1 withObject: c_ary[1]]; [m[0] replaceObjectAtIndex: 2 withObject: c_ary[2]]; - ok = NO; + ok = false; i = 0; @try { for (OFString *s in m[0]) { if (i == 0) [m[0] addObject: @""]; i++; } } @catch (OFEnumerationMutationException *e) { - ok = YES; + ok = true; } TEST(@"Detection of mutation during Fast Enumeration", ok) [m[0] removeLastObject]; #endif #ifdef OF_HAVE_BLOCKS { - __block BOOL ok = YES; + __block bool ok = true; __block size_t count = 0; OFArray *cmp = a[0]; OFMutableArray *a2; m[0] = [[a[0] mutableCopy] autorelease]; [m[0] enumerateObjectsUsingBlock: - ^ (id obj, size_t idx, BOOL *stop) { + ^ (id obj, size_t idx, bool *stop) { count++; if (![obj isEqual: [cmp objectAtIndex: idx]]) - ok = NO; + ok = false; }]; if (count != [cmp count]) - ok = NO; + ok = false; TEST(@"Enumeration using blocks", ok) - ok = NO; + ok = false; a2 = m[0]; @try { [a2 enumerateObjectsUsingBlock: - ^ (id obj, size_t idx, BOOL *stop) { + ^ (id obj, size_t idx, bool *stop) { [a2 removeObjectAtIndex: idx]; }]; } @catch (OFEnumerationMutationException *e) { - ok = YES; + ok = true; } @catch (OFOutOfRangeException *e) { /* * Out of bounds access due to enumeration not being * detected. */ @@ -278,11 +278,11 @@ ok) } TEST(@"-[replaceObjectsUsingBlock:]", R([m[0] replaceObjectsUsingBlock: - ^ id (id obj, size_t idx, BOOL *stop) { + ^ id (id obj, size_t idx, bool *stop) { switch (idx) { case 0: return @"foo"; case 1: return @"bar"; @@ -302,12 +302,12 @@ return nil; }] description] isEqual: @"(\n\tfoobar,\n\tqux\n)"]) TEST(@"-[filteredArrayUsingBlock:]", - [[[m[0] filteredArrayUsingBlock: ^ BOOL (id obj, size_t idx) { - return ([obj isEqual: @"foo"] ? YES : NO); + [[[m[0] filteredArrayUsingBlock: ^ bool (id obj, size_t idx) { + return [obj isEqual: @"foo"]; }] description] isEqual: @"(\n\tfoo\n)"]) TEST(@"-[foldUsingBlock:]", [([OFArray arrayWithObjects: [OFMutableString string], @"foo", @"bar", @"baz", nil]) foldUsingBlock: ^ id (id left, id right) { Index: tests/OFDictionaryTests.m ================================================================== --- tests/OFDictionaryTests.m +++ tests/OFDictionaryTests.m @@ -53,17 +53,17 @@ [[dict objectForKey: keys[0]] isEqual: values[0]] && [[dict objectForKey: keys[1]] isEqual: values[1]] && [dict objectForKey: @"key3"] == nil) TEST(@"-[containsObject:]", - [dict containsObject: values[0]] == YES && - [dict containsObject: @"nonexistant"] == NO) + [dict containsObject: values[0]] && + ![dict containsObject: @"nonexistant"]) TEST(@"-[containsObjectIdenticalTo:]", - [dict containsObjectIdenticalTo: values[0]] == YES && - [dict containsObjectIdenticalTo: - [OFString stringWithString: values[0]]] == NO) + [dict containsObjectIdenticalTo: values[0]] && + ![dict containsObjectIdenticalTo: + [OFString stringWithString: values[0]]]) TEST(@"-[description]", [[dict description] isEqual: @"{\n\tkey1 = value1;\n\tkey2 = value2;\n}"]) @@ -94,15 +94,15 @@ [dict setObject: values[0] forKey: keys[0]]; #ifdef OF_HAVE_FAST_ENUMERATION size_t i = 0; - BOOL ok = YES; + bool ok = true; for (OFString *key in dict) { if (i > 1 || ![key isEqual: keys[i]]) { - ok = NO; + ok = false; break; } [dict setObject: [dict objectForKey: key] forKey: key]; @@ -109,17 +109,17 @@ i++; } TEST(@"Fast Enumeration", ok) - ok = NO; + ok = false; @try { for (OFString *key in dict) [dict setObject: @"" forKey: @""]; } @catch (OFEnumerationMutationException *e) { - ok = YES; + ok = true; } TEST(@"Detection of mutation during Fast Enumeration", ok) [dict removeObjectForKey: @""]; @@ -126,17 +126,17 @@ #endif #ifdef OF_HAVE_BLOCKS { __block size_t i = 0; - __block BOOL ok = YES; + __block bool ok = true; [dict enumerateKeysAndObjectsUsingBlock: - ^ (id key, id obj, BOOL *stop) { + ^ (id key, id obj, bool *stop) { if (i > 1 || ![key isEqual: keys[i]]) { - ok = NO; - *stop = YES; + ok = false; + *stop = true; return; } [dict setObject: [dict objectForKey: key] forKey: key]; @@ -143,19 +143,19 @@ i++; }]; TEST(@"Enumeration using blocks", ok) - ok = NO; + ok = false; @try { [dict enumerateKeysAndObjectsUsingBlock: - ^ (id key, id obj, BOOL *stop) { + ^ (id key, id obj, bool *stop) { [dict setObject: @"" forKey: @""]; }]; } @catch (OFEnumerationMutationException *e) { - ok = YES; + ok = true; } TEST(@"Detection of mutation during enumeration using blocks", ok) @@ -162,11 +162,11 @@ [dict removeObjectForKey: @""]; } TEST(@"-[replaceObjectsUsingBlock:]", R([dict replaceObjectsUsingBlock: - ^ id (id key, id obj, BOOL *stop) { + ^ id (id key, id obj, bool *stop) { if ([key isEqual: keys[0]]) return @"value_1"; if ([key isEqual: keys[1]]) return @"value_2"; @@ -183,12 +183,12 @@ return nil; }] description] isEqual: @"{\n\tkey1 = val1;\n\tkey2 = val2;\n}"]) TEST(@"-[filteredDictionaryUsingBlock:]", - [[[dict filteredDictionaryUsingBlock: ^ BOOL (id key, id obj) { - return ([key isEqual: keys[0]] ? YES : NO); + [[[dict filteredDictionaryUsingBlock: ^ bool (id key, id obj) { + return [key isEqual: keys[0]]; }] description] isEqual: @"{\n\tkey1 = value_1;\n}"]) #endif TEST(@"-[count]", [dict count] == 2) Index: tests/OFJSONTests.m ================================================================== --- tests/OFJSONTests.m +++ tests/OFJSONTests.m @@ -40,11 +40,11 @@ @"x", [OFArray arrayWithObjects: [OFNumber numberWithFloat: .5f], [OFNumber numberWithInt: 0xF], [OFNull null], @"foo", - [OFNumber numberWithBool: NO], + [OFNumber numberWithBool: false], nil], nil]; TEST(@"-[JSONValue #1]", [[s JSONValue] isEqual: d]) Index: tests/OFListTests.m ================================================================== --- tests/OFListTests.m +++ tests/OFListTests.m @@ -38,11 +38,11 @@ OFList *list; OFEnumerator *enumerator; of_list_object_t *loe; OFString *obj; size_t i; - BOOL ok; + bool ok; TEST(@"+[list]", (list = [OFList list])) TEST(@"-[appendObject:]", [list appendObject: strings[0]] && [list appendObject: strings[1]] && [list appendObject: strings[2]]) @@ -77,17 +77,17 @@ [[list lastListObject]->object isEqual: strings[2]]) TEST(@"-[count]", [list count] == 3) TEST(@"-[containsObject:]", - [list containsObject: strings[1]] == YES && - [list containsObject: @"nonexistant"] == NO) + [list containsObject: strings[1]] && + ![list containsObject: @"nonexistant"]) TEST(@"-[containsObjectIdenticalTo:]", - [list containsObjectIdenticalTo: strings[1]] == YES && - [list containsObjectIdenticalTo: - [OFString stringWithString: strings[1]]] == NO) + [list containsObjectIdenticalTo: strings[1]] && + ![list containsObjectIdenticalTo: + [OFString stringWithString: strings[1]]]) TEST(@"-[copy]", (list = [[list copy] autorelease]) && [[list firstListObject]->object isEqual: strings[0]] && [[list firstListObject]->next->object isEqual: strings[1]] && [[list lastListObject]->object isEqual: strings[2]]) @@ -99,21 +99,21 @@ TEST(@"-[objectEnumerator]", (enumerator = [list objectEnumerator])) loe = [list firstListObject]; i = 0; - ok = YES; + ok = true; while ((obj = [enumerator nextObject]) != nil) { if (![obj isEqual: loe->object]) - ok = NO; + ok = false; loe = loe->next; i++; } if ([list count] != i) - ok = NO; + ok = false; TEST(@"OFEnumerator's -[nextObject]", ok); [enumerator reset]; [list removeListObject: [list firstListObject]]; @@ -124,34 +124,34 @@ [list prependObject: strings[0]]; #ifdef OF_HAVE_FAST_ENUMERATION loe = [list firstListObject]; i = 0; - ok = YES; + ok = true; for (OFString *obj in list) { if (![obj isEqual: loe->object]) - ok = NO; + ok = false; loe = loe->next; i++; } if ([list count] != i) - ok = NO; + ok = false; TEST(@"Fast Enumeration", ok) - ok = NO; + ok = false; @try { for (OFString *obj in list) [list removeListObject: [list lastListObject]]; } @catch (OFEnumerationMutationException *e) { - ok = YES; + ok = true; } TEST(@"Detection of mutation during Fast Enumeration", ok) #endif [pool drain]; } @end Index: tests/OFSet.m ================================================================== --- tests/OFSet.m +++ tests/OFSet.m @@ -31,11 +31,11 @@ { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSet *set1, *set2; OFMutableSet *mutableSet; #ifdef OF_HAVE_FAST_ENUMERATION - BOOL ok; + bool ok; size_t i; #endif TEST(@"+[setWithArray:]", (set1 = [OFSet setWithArray: [OFArray arrayWithObjects: @"foo", @@ -90,50 +90,50 @@ R([mutableSet unionSet: ([OFSet setWithObjects: @"x", @"bar", nil])]) && [mutableSet isEqual: ([OFSet setWithObjects: @"baz", @"bar", @"x", nil])]) #ifdef OF_HAVE_FAST_ENUMERATION - ok = YES; + ok = true; i = 0; for (OFString *s in set1) { switch (i) { case 0: if (![s isEqual: @"x"]) - ok = NO; + ok = false; break; case 1: if (![s isEqual: @"bar"]) - ok = NO; + ok = false; break; case 2: if (![s isEqual: @"foo"]) - ok = NO; + ok = false; break; case 3: if (![s isEqual: @"baz"]) - ok = NO; + ok = false; break; } i++; } if (i != 4) - ok = NO; + ok = false; TEST(@"Fast enumeration", ok) - ok = NO; + ok = false; @try { for (OFString *s in mutableSet) [mutableSet removeObject: s]; } @catch (OFEnumerationMutationException *e) { - ok = YES; + ok = true; } TEST(@"Detection of mutation during Fast Enumeration", ok); #endif [pool drain]; } @end Index: tests/OFStreamTests.m ================================================================== --- tests/OFStreamTests.m +++ tests/OFStreamTests.m @@ -32,13 +32,13 @@ int state; } @end @implementation StreamTester -- (BOOL)lowlevelIsAtEndOfStream +- (bool)lowlevelIsAtEndOfStream { - return (state > 1 ? YES : NO); + return (state > 1); } - (size_t)lowlevelReadIntoBuffer: (void*)buffer length: (size_t)size { Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -78,11 +78,11 @@ int i; const of_unichar_t *ua; const uint16_t *u16a; EntityHandler *h; #ifdef OF_HAVE_BLOCKS - __block BOOL ok; + __block bool ok; #endif s[0] = [OFMutableString stringWithString: @"täs€"]; s[1] = [OFMutableString string]; s[2] = [[s[0] copy] autorelease]; @@ -107,11 +107,11 @@ [@"ß" caseInsensitiveCompare: @"→"] == OF_ORDERED_ASCENDING && [@"AA" caseInsensitiveCompare: @"z"] == OF_ORDERED_ASCENDING && [[OFString stringWithUTF8String: "ABC"] caseInsensitiveCompare: [OFString stringWithUTF8String: "AbD"]] == [@"abc" compare: @"abd"]) - TEST(@"-[hash] is the same if -[isEqual:] is YES", + TEST(@"-[hash] is the same if -[isEqual:] is true", [s[0] hash] == [s[2] hash]) TEST(@"-[description]", [[s[0] description] isEqual: s[0]]) TEST(@"-[appendString:] and -[appendUTF8String:]", @@ -587,30 +587,30 @@ return @"bar"; return nil; }] isEqual: @"xbary"]) - ok = YES; + ok = true; [@"foo\nbar\nbaz" enumerateLinesUsingBlock: - ^ (OFString *line, BOOL *stop) { + ^ (OFString *line, bool *stop) { static int i = 0; switch (i) { case 0: if (![line isEqual: @"foo"]) - ok = NO; + ok = false; break; case 1: if (![line isEqual: @"bar"]) - ok = NO; + ok = false; break; case 2: if (![line isEqual: @"baz"]) - ok = NO; + ok = false; break; default: - ok = NO; + ok = false; } i++; }]; TEST(@"-[enumerateLinesUsingBlock:]", ok) Index: tests/TestsAppDelegate.h ================================================================== --- tests/TestsAppDelegate.h +++ tests/TestsAppDelegate.h @@ -31,19 +31,19 @@ _fails++; \ } \ } #define EXPECT_EXCEPTION(test, exception, code) \ { \ - BOOL caught = NO; \ + bool caught = false; \ \ [self outputTesting: test \ inModule: module]; \ \ @try { \ code; \ } @catch (exception *e) { \ - caught = YES; \ + caught = true; \ } \ \ if (caught) \ [self outputSuccess: test \ inModule: module]; \