Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -187,10 +187,12 @@ [OBJCFLAGS="$OBJCFLAGS -Wobjc-missing-property-synthesis"]) AX_CHECK_COMPILER_FLAGS([-Watomic-properties -Werror], [ OBJCFLAGS="$OBJCFLAGS -Watomic-properties" TESTS_OBJCFLAGS="$TESTS_OBJCFLAGS -Wno-atomic-properties" ]) +AX_CHECK_COMPILER_FLAGS([-Wnullable-to-nonnull-conversion -Werror], + [OBJCFLAGS="$OBJCFLAGS -Wnullable-to-nonnull-conversion"]) AC_MSG_CHECKING(whether Objective C compiler supports properties) AC_TRY_COMPILE([ #ifdef __has_attribute # if __has_attribute(objc_root_class) Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -97,11 +97,12 @@ #define SIGNAL_HANDLER(sig) \ static void \ handle##sig(int signal) \ { \ - app->_##sig##Handler(app->_delegate, \ + app->_##sig##Handler( \ + (id )app->_delegate, \ @selector(applicationDidReceive##sig)); \ } SIGNAL_HANDLER(SIGINT) #ifdef SIGHUP SIGNAL_HANDLER(SIGHUP) Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -642,23 +642,23 @@ - (OFDate *)earlierDate: (OFDate *)otherDate { if (otherDate == nil) return self; - if ([self compare: otherDate] == OF_ORDERED_DESCENDING) - return otherDate; + if ([self compare: (OFDate *)otherDate] == OF_ORDERED_DESCENDING) + return (OFDate *)otherDate; return self; } - (OFDate *)laterDate: (OFDate *)otherDate { if (otherDate == nil) return self; - if ([self compare: otherDate] == OF_ORDERED_ASCENDING) - return otherDate; + if ([self compare: (OFDate *)otherDate] == OF_ORDERED_ASCENDING) + return (OFDate *)otherDate; return self; } - (of_time_interval_t)timeIntervalSince1970 Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -229,21 +229,21 @@ * specified object. * * @param object The object which is checked for being in the dictionary * @return A boolean whether the dictionary contains the specified object */ -- (bool)containsObject: (nullable ObjectType)object; +- (bool)containsObject: (ObjectType)object; /*! * @brief Checks whether the dictionary contains an object with the specified * address. * * @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: (nullable ObjectType)object; +- (bool)containsObjectIdenticalTo: (ObjectType)object; /*! * @brief Returns an array of all keys. * * @return An array of all keys Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -468,11 +468,11 @@ (of_dictionary_enumeration_block_t)block { bool stop = false; for (id key in self) { - block(key, [self objectForKey: key], &stop); + block(key, (id)[self objectForKey: key], &stop); if (stop) break; } } Index: src/OFDictionary_hashtable.m ================================================================== --- src/OFDictionary_hashtable.m +++ src/OFDictionary_hashtable.m @@ -344,19 +344,19 @@ count: count]; @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; - id key; + void **keyPtr; size_t i; i = 0; enumerator = [_mapTable keyEnumerator]; - while ((key = [enumerator nextObject]) != nil) { + while ((keyPtr = [enumerator nextObject]) != NULL) { assert(i < count); - keys[i++] = key; + keys[i++] = (id)*keyPtr; } objc_autoreleasePoolPop(pool); ret = [OFArray arrayWithObjects: keys @@ -379,19 +379,19 @@ count: count]; @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; - id object; + void **objectPtr; size_t i; i = 0; enumerator = [_mapTable objectEnumerator]; - while ((object = [enumerator nextObject]) != nil) { + while ((objectPtr = [enumerator nextObject]) != NULL) { assert(i < count); - objects[i++] = object; + objects[i++] = (id)*objectPtr; } objc_autoreleasePoolPop(pool); ret = [OFArray arrayWithObjects: objects Index: src/OFHMAC.m ================================================================== --- src/OFHMAC.m +++ src/OFHMAC.m @@ -125,17 +125,17 @@ { if (_outerHash == nil || _innerHash == nil) @throw [OFInvalidArgumentException exception]; if (_calculated) - return [_outerHash digest]; + return (const unsigned char *)[_outerHash digest]; - [_outerHash updateWithBuffer: [_innerHash digest] + [_outerHash updateWithBuffer: (const unsigned char *)[_innerHash digest] length: [_hashClass digestSize]]; _calculated = true; - return [_outerHash digest]; + return (const unsigned char *)[_outerHash digest]; } - (size_t)digestSize { return [_hashClass digestSize]; Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -95,11 +95,11 @@ requestString = [OFMutableString stringWithFormat: @"%s %@", of_http_request_method_to_string(method), path]; if ([URL query] != nil) { [requestString appendString: @"?"]; - [requestString appendString: [URL query]]; + [requestString appendString: (OFString *)[URL query]]; } [requestString appendString: @" HTTP/"]; [requestString appendString: [request protocolVersionString]]; [requestString appendString: @"\r\n"]; Index: src/OFHTTPCookie.m ================================================================== --- src/OFHTTPCookie.m +++ src/OFHTTPCookie.m @@ -403,13 +403,13 @@ void *pool = objc_autoreleasePoolPush(); [ret appendFormat: @"; Domain=%@; Path=%@", _domain, _path]; if (_expires != nil) - [ret appendString: - [_expires dateStringWithFormat: @"; Expires=%a, %d %b %Y " - @"%H:%M:%S +0000"]]; + [ret appendString: [(OFDate *)_expires + dateStringWithFormat: @"; Expires=%a, %d %b %Y " + @"%H:%M:%S +0000"]]; if (_secure) [ret appendString: @"; Secure"]; if (_HTTPOnly) Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -723,11 +723,11 @@ if (_listeningSocket != nil) @throw [OFAlreadyConnectedException exception]; _listeningSocket = [[OFTCPSocket alloc] init]; - _port = [_listeningSocket bindToHost: _host + _port = [_listeningSocket bindToHost: (OFString *)_host port: _port]; [_listeningSocket listen]; [_listeningSocket asyncAcceptWithTarget: self selector: @selector(of_socket: Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -133,20 +133,20 @@ * object. * * @param object The object which is checked for being in the list * @return A boolean whether the list contains the specified object */ -- (bool)containsObject: (nullable ObjectType)object; +- (bool)containsObject: (ObjectType)object; /*! * @brief Checks whether the list contains an object with the specified address. * * @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: (nullable ObjectType)object; +- (bool)containsObjectIdenticalTo: (ObjectType)object; /*! * @brief Returns an OFEnumerator to enumerate through all objects of the list. * * @returns An OFEnumerator to enumerate through all objects of the list Index: src/OFMapTable.h ================================================================== --- src/OFMapTable.h +++ src/OFMapTable.h @@ -45,21 +45,22 @@ * @param key The current key * @param object The current object * @param stop A pointer to a variable that can be set to true to stop the * enumeration */ -typedef void (^of_map_table_enumeration_block_t)(void *key, void *object, - bool *stop); +typedef void (^of_map_table_enumeration_block_t)(void *_Nullable key, + void *_Nullable object, bool *stop); /*! * @brief A block for replacing objects in an OFMapTable. * * @param key The key of the object to replace * @param object The object to replace * @return The object to replace the object with */ -typedef void *_Nonnull (^of_map_table_replace_block_t)(void *key, void *object); +typedef void *_Nullable (^of_map_table_replace_block_t)(void *_Nullable key, + void *_Nullable object); #endif @class OFMapTableEnumerator; /*! @@ -159,19 +160,19 @@ * @brief Sets an object for a key. * * @param key The key to set * @param object The object to set the key to */ -- (void)setObject: (void *)object - forKey: (void *)key; +- (void)setObject: (nullable void *)object + forKey: (nullable void *)key; /*! * @brief Removes the object for the specified key from the map table. * * @param key The key whose object should be removed */ -- (void)removeObjectForKey: (void *)key; +- (void)removeObjectForKey: (nullable void *)key; /*! * @brief Removes all objects. */ - (void)removeAllObjects; @@ -246,19 +247,20 @@ } - init OF_UNAVAILABLE; /*! - * @brief Returns the next object. + * @brief Returns a pointer to the next object, or NULL if the enumeration + * finished. * * @return The next object */ -- (nullable void *)nextObject; +- (void *_Nullable *_Nullable)nextObject; /*! - * @brief Resets the enumerator, so the next call to @ref nextKey returns the - * first key again. + * @brief Resets the enumerator, so the next call to @ref nextObject returns the + * first object again. */ - (void)reset; @end OF_ASSUME_NONNULL_END Index: src/OFMapTable.m ================================================================== --- src/OFMapTable.m +++ src/OFMapTable.m @@ -687,11 +687,11 @@ [_mapTable release]; [super dealloc]; } -- (void *)nextObject +- (void **)nextObject { OF_UNRECOGNIZED_SELECTOR } - (void)reset @@ -703,38 +703,38 @@ _position = 0; } @end @implementation OFMapTableKeyEnumerator -- (void *)nextObject +- (void **)nextObject { if (*_mutationsPtr != _mutations) @throw [OFEnumerationMutationException exceptionWithObject: _mapTable]; for (; _position < _capacity && (_buckets[_position] == NULL || _buckets[_position] == &deleted); _position++); if (_position < _capacity) - return _buckets[_position++]->key; + return &_buckets[_position++]->key; else return NULL; } @end @implementation OFMapTableObjectEnumerator -- (void *)nextObject +- (void **)nextObject { if (*_mutationsPtr != _mutations) @throw [OFEnumerationMutationException exceptionWithObject: _mapTable]; for (; _position < _capacity && (_buckets[_position] == NULL || _buckets[_position] == &deleted); _position++); if (_position < _capacity) - return _buckets[_position++]->object; + return &_buckets[_position++]->object; else return NULL; } @end @@ -758,20 +758,23 @@ [super dealloc]; } - (id)nextObject { - id ret; + void **objectPtr; @try { - ret = [_enumerator nextObject]; + objectPtr = [_enumerator nextObject]; + + if (objectPtr == NULL) + return nil; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException exceptionWithObject: _object]; } - return ret; + return (id)*objectPtr; } - (void)reset { @try { Index: src/OFMutableString_UTF8.m ================================================================== --- src/OFMutableString_UTF8.m +++ src/OFMutableString_UTF8.m @@ -211,13 +211,13 @@ _s->hashed = false; if (lenNew == (size_t)lenOld) memcpy(_s->cString + index, buffer, lenNew); else if (lenNew > (size_t)lenOld) { - _s->cString = [self resizeMemory: _s->cString - size: _s->cStringLength - - lenOld + lenNew + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: _s->cStringLength - + lenOld + lenNew + 1]; memmove(_s->cString + index + lenNew, _s->cString + index + lenOld, _s->cStringLength - index - lenOld); memcpy(_s->cString + index, buffer, lenNew); @@ -240,11 +240,11 @@ if (character >= 0x80) _s->isUTF8 = true; @try { - _s->cString = [self + _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } @@ -269,13 +269,13 @@ case -1: @throw [OFInvalidEncodingException exception]; } _s->hashed = false; - _s->cString = [self resizeMemory: _s->cString - size: _s->cStringLength + - UTF8StringLength + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: _s->cStringLength + + UTF8StringLength + 1]; memcpy(_s->cString + _s->cStringLength, UTF8String, UTF8StringLength + 1); _s->cStringLength += UTF8StringLength; _s->length += length; @@ -299,13 +299,13 @@ case -1: @throw [OFInvalidEncodingException exception]; } _s->hashed = false; - _s->cString = [self resizeMemory: _s->cString - size: _s->cStringLength + - UTF8StringLength + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: _s->cStringLength + + UTF8StringLength + 1]; memcpy(_s->cString + _s->cStringLength, UTF8String, UTF8StringLength); _s->cStringLength += UTF8StringLength; _s->length += length; @@ -347,13 +347,13 @@ @throw [OFInvalidArgumentException exception]; UTF8StringLength = [string UTF8StringLength]; _s->hashed = false; - _s->cString = [self resizeMemory: _s->cString - size: _s->cStringLength + - UTF8StringLength + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: _s->cStringLength + + UTF8StringLength + 1]; memcpy(_s->cString + _s->cStringLength, [string UTF8String], UTF8StringLength); _s->cStringLength += UTF8StringLength; _s->length += [string length]; @@ -392,12 +392,13 @@ } tmp[j] = '\0'; _s->hashed = false; - _s->cString = [self resizeMemory: _s->cString - size: _s->cStringLength + j + 1]; + _s->cString = (void *)[self + resizeMemory: _s->cString + size: _s->cStringLength + j + 1]; memcpy(_s->cString + _s->cStringLength, tmp, j + 1); _s->cStringLength += j; _s->length += length; @@ -521,12 +522,12 @@ index = of_string_utf8_get_position(_s->cString, index, _s->cStringLength); newCStringLength = _s->cStringLength + [string UTF8StringLength]; _s->hashed = false; - _s->cString = [self resizeMemory: _s->cString - size: newCStringLength + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: newCStringLength + 1]; memmove(_s->cString + index + [string UTF8StringLength], _s->cString + index, _s->cStringLength - index); memcpy(_s->cString + index, [string UTF8String], [string UTF8StringLength]); @@ -564,12 +565,13 @@ _s->length -= range.length; _s->cStringLength -= end - start; _s->cString[_s->cStringLength] = 0; @try { - _s->cString = [self resizeMemory: _s->cString - size: _s->cStringLength + 1]; + _s->cString = (void *)[self + resizeMemory: _s->cString + size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } @@ -606,12 +608,12 @@ * We must not resize the string if the new string is smaller, because * then we can't memmove() the rest of the string forward as the rest is * lost due to the resize! */ if (newCStringLength > _s->cStringLength) - _s->cString = [self resizeMemory: _s->cString - size: newCStringLength + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: newCStringLength + 1]; memmove(_s->cString + start + [replacement UTF8StringLength], _s->cString + end, _s->cStringLength - end); memcpy(_s->cString + start, [replacement UTF8String], [replacement UTF8StringLength]); @@ -620,12 +622,12 @@ /* * If the new string is smaller, we can safely resize it now as we're * done with memmove(). */ if (newCStringLength < _s->cStringLength) - _s->cString = [self resizeMemory: _s->cString - size: newCStringLength + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: newCStringLength + 1]; _s->cStringLength = newCStringLength; _s->length = newLength; if ([replacement isKindOfClass: [OFString_UTF8 class]] || @@ -737,12 +739,13 @@ memmove(_s->cString, _s->cString + i, _s->cStringLength); _s->cString[_s->cStringLength] = '\0'; @try { - _s->cString = [self resizeMemory: _s->cString - size: _s->cStringLength + 1]; + _s->cString = (void *)[self + resizeMemory: _s->cString + size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } @@ -764,12 +767,13 @@ _s->cStringLength -= d; _s->length -= d; @try { - _s->cString = [self resizeMemory: _s->cString - size: _s->cStringLength + 1]; + _s->cString = (void *)[self + resizeMemory: _s->cString + size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } @@ -801,12 +805,13 @@ memmove(_s->cString, _s->cString + i, _s->cStringLength); _s->cString[_s->cStringLength] = '\0'; @try { - _s->cString = [self resizeMemory: _s->cString - size: _s->cStringLength + 1]; + _s->cString = (void *)[self + resizeMemory: _s->cString + size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -675,11 +675,11 @@ * * @param size The size of the memory to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size is 0. */ -- (void *)allocMemoryWithSize: (size_t)size; +- (nullable void *)allocMemoryWithSize: (size_t)size; /*! * @brief Allocates memory for the specified number of items and stores it in * the object's memory pool. * @@ -688,12 +688,12 @@ * @param size The size of each item to allocate * @param count The number of items to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size or count is 0. */ -- (void *)allocMemoryWithSize: (size_t)size - count: (size_t)count; +- (nullable void *)allocMemoryWithSize: (size_t)size + count: (size_t)count; /*! * @brief Resizes memory in the object's memory pool to the specified size. * * If the pointer is NULL, this is equivalent to allocating memory. Index: src/OFOptionsParser.m ================================================================== --- src/OFOptionsParser.m +++ src/OFOptionsParser.m @@ -105,18 +105,20 @@ @try { iter2->longOption = [iter->longOption copy]; if ([_longOptions objectForKey: - iter2->longOption] != NULL) + (OFString *)iter2->longOption] != + NULL) @throw [OFInvalidArgumentException exception]; [_longOptions setObject: iter2 - forKey: iter2->longOption]; + forKey: (OFString *) + iter2->longOption]; } @catch (id e) { /* * Make sure we are in a consistent * state where dealloc works. */ @@ -207,11 +209,12 @@ _lastLongOption = [[argument substringWithRange: of_range(2, pos - 2)] copy]; objc_autoreleasePoolPop(pool); - option = [_longOptions objectForKey: _lastLongOption]; + option = [_longOptions objectForKey: + (OFString *)_lastLongOption]; if (option == NULL) return '?'; if (option->hasArgument == 1 && _argument == nil) return ':'; Index: src/OFSet.h ================================================================== --- src/OFSet.h +++ src/OFSet.h @@ -213,11 +213,11 @@ * object. * * @param object The object which is checked for being in the set * @return A boolean whether the set contains the specified object */ -- (bool)containsObject: (nullable ObjectType)object; +- (bool)containsObject: (ObjectType)object; /*! * @brief Returns the value for the specified key * * If the key starts with an `@`, the `@` is stripped and Index: src/OFSet_hashtable.m ================================================================== --- src/OFSet_hashtable.m +++ src/OFSet_hashtable.m @@ -255,14 +255,21 @@ } - (id)anyObject { void *pool = objc_autoreleasePoolPush(); + void **objectPtr; id object; - object = [[_mapTable keyEnumerator] nextObject]; - object = [object retain]; + objectPtr = [[_mapTable keyEnumerator] nextObject]; + + if (objectPtr == NULL) { + objc_autoreleasePoolPop(pool); + return nil; + } + + object = [(id)*objectPtr retain]; objc_autoreleasePoolPop(pool); return [object autorelease]; } Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -659,13 +659,14 @@ retLength = i; if (i > 0 && _readBuffer[i - 1] == '\r') retLength--; - ret = [OFString stringWithCString: _readBuffer - encoding: encoding - length: retLength]; + ret = [OFString + stringWithCString: (char *)_readBuffer + encoding: encoding + length: retLength]; _readBuffer += i + 1; _readBufferLength -= i + 1; _waitingForDelimiter = false; @@ -688,11 +689,11 @@ retLength = _readBufferLength; if (retLength > 0 && _readBuffer[retLength - 1] == '\r') retLength--; - ret = [OFString stringWithCString: _readBuffer + ret = [OFString stringWithCString: (char *)_readBuffer encoding: encoding length: retLength]; [self freeMemory: _readBufferMemory]; _readBuffer = _readBufferMemory = NULL; @@ -883,11 +884,11 @@ if (j == delimiterLength || _readBuffer[i] == '\0') { if (_readBuffer[i] == '\0') delimiterLength = 1; ret = [OFString - stringWithCString: _readBuffer + stringWithCString: (char *)_readBuffer encoding: encoding length: i + 1 - delimiterLength]; _readBuffer += i + 1; _readBufferLength -= i + 1; @@ -907,11 +908,11 @@ if (_readBuffer == NULL) { _waitingForDelimiter = false; return nil; } - ret = [OFString stringWithCString: _readBuffer + ret = [OFString stringWithCString: (char *)_readBuffer encoding: encoding length: _readBufferLength]; [self freeMemory: _readBufferMemory]; _readBuffer = _readBufferMemory = NULL; @@ -1037,11 +1038,11 @@ - (void)flushWriteBuffer { if (_writeBuffer == NULL) return; - [self lowlevelWriteBuffer: _writeBuffer + [self lowlevelWriteBuffer: (char *)_writeBuffer length: _writeBufferLength]; [self freeMemory: _writeBuffer]; _writeBuffer = NULL; _writeBufferLength = 0; Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -177,11 +177,11 @@ self = [super init]; @try { _s = &_storage; - _s->cString = [self allocMemoryWithSize: 1]; + _s->cString = (void *)[self allocMemoryWithSize: 1]; _s->cString[0] = '\0'; } @catch (id e) { [self release]; @throw e; } @@ -243,11 +243,12 @@ cStringLength -= 3; } _s = &_storage; - _s->cString = [self allocMemoryWithSize: cStringLength + 1]; + _s->cString = (void *)[self + allocMemoryWithSize: cStringLength + 1]; _s->cStringLength = cStringLength; if (encoding == OF_STRING_ENCODING_UTF_8 || encoding == OF_STRING_ENCODING_ASCII) { switch (of_string_utf8_check(cString, cStringLength, @@ -290,11 +291,11 @@ if (bytes == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += bytes - 1; - _s->cString = [self + _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; memcpy(_s->cString + j, buffer, bytes); j += bytes; @@ -371,11 +372,11 @@ if (byteLength == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += byteLength - 1; - _s->cString = [self + _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; memcpy(_s->cString + j, buffer, byteLength); j += byteLength; @@ -443,11 +444,12 @@ else _s->isUTF8 = true; _s->length = [string length]; - _s->cString = [self allocMemoryWithSize: _s->cStringLength + 1]; + _s->cString = (void *)[self + allocMemoryWithSize: _s->cStringLength + 1]; memcpy(_s->cString, [string UTF8String], _s->cStringLength + 1); } @catch (id e) { [self release]; @throw e; } @@ -463,11 +465,12 @@ @try { size_t j; _s = &_storage; - _s->cString = [self allocMemoryWithSize: (length * 4) + 1]; + _s->cString = (void *)[self + allocMemoryWithSize: (length * 4) + 1]; _s->length = length; j = 0; for (size_t i = 0; i < length; i++) { size_t len = of_string_utf8_encode(characters[i], @@ -484,12 +487,12 @@ _s->cString[j] = '\0'; _s->cStringLength = j; @try { - _s->cString = [self resizeMemory: _s->cString - size: j + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: j + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } } @catch (id e) { [self release]; @@ -519,11 +522,12 @@ } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; - _s->cString = [self allocMemoryWithSize: (length * 4) + 1]; + _s->cString = (void *)[self + allocMemoryWithSize: (length * 4) + 1]; _s->length = length; j = 0; for (size_t i = 0; i < length; i++) { of_unichar_t character = @@ -569,12 +573,12 @@ _s->cString[j] = '\0'; _s->cStringLength = j; @try { - _s->cString = [self resizeMemory: _s->cString - size: j + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: j + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } } @catch (id e) { [self release]; @@ -604,11 +608,12 @@ } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; - _s->cString = [self allocMemoryWithSize: (length * 4) + 1]; + _s->cString = (void *)[self + allocMemoryWithSize: (length * 4) + 1]; _s->length = length; j = 0; for (size_t i = 0; i < length; i++) { char buffer[4]; @@ -636,12 +641,12 @@ _s->cString[j] = '\0'; _s->cStringLength = j; @try { - _s->cString = [self resizeMemory: _s->cString - size: j + 1]; + _s->cString = (void *)[self resizeMemory: _s->cString + size: j + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } } @catch (id e) { [self release]; @@ -679,11 +684,11 @@ break; case -1: @throw [OFInvalidEncodingException exception]; } - _s->cString = [self + _s->cString = (void *)[self allocMemoryWithSize: cStringLength + 1]; memcpy(_s->cString, tmp, cStringLength + 1); } @finally { free(tmp); } Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -263,11 +263,11 @@ if (_socket != INVALID_SOCKET) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; if (_SOCKS5Host != nil) { /* Connect to the SOCKS5 proxy instead */ - host = _SOCKS5Host; + host = (OFString *)_SOCKS5Host; port = _SOCKS5Port; } results = of_resolve_host(host, port, SOCK_STREAM); @@ -605,11 +605,12 @@ @throw [OFNotOpenException exceptionWithObject: self]; if (_address == NULL) @throw [OFInvalidArgumentException exception]; - of_address_to_string_and_port(_address, _addressLength, &ret, NULL); + of_address_to_string_and_port((struct sockaddr *)_address, + _addressLength, &ret, NULL); return ret; } - (bool)isListening Index: src/OFTarArchive.m ================================================================== --- src/OFTarArchive.m +++ src/OFTarArchive.m @@ -206,11 +206,14 @@ - (OFStream *)streamForReadingCurrentEntry { if (_mode != OF_TAR_ARCHIVE_MODE_READ) @throw [OFInvalidArgumentException exception]; - return [[_lastReturnedStream retain] autorelease]; + if (_lastReturnedStream == nil) + @throw [OFInvalidArgumentException exception]; + + return [[(OFStream *)_lastReturnedStream retain] autorelease]; } - (OFStream *)streamForWritingEntry: (OFTarArchiveEntry *)entry { void *pool; @@ -231,11 +234,11 @@ initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); - return [[_lastReturnedStream retain] autorelease]; + return [[(OFStream *)_lastReturnedStream retain] autorelease]; } - (void)close { if (_stream == nil) Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -385,11 +385,11 @@ if (_runLoop == nil) _runLoop = [[OFRunLoop alloc] init]; } # endif - return _runLoop; + return (OFRunLoop *)_runLoop; } - (OFString *)name { return [[_name copy] autorelease]; Index: src/OFXMLAttribute.m ================================================================== --- src/OFXMLAttribute.m +++ src/OFXMLAttribute.m @@ -163,11 +163,11 @@ [element addAttributeWithName: @"name" stringValue: _name]; if (_namespace != nil) [element addAttributeWithName: @"namespace" - stringValue: _namespace]; + stringValue: (OFString *)_namespace]; [element addAttributeWithName: @"stringValue" stringValue: _stringValue]; [element retain]; Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -174,11 +174,11 @@ initWithKeysAndObjects: @"http://www.w3.org/XML/1998/namespace", @"xml", @"http://www.w3.org/2000/xmlns/", @"xmlns", nil]; if (stringValue != nil) - [self setStringValue: stringValue]; + [self setStringValue: (OFString *)stringValue]; } @catch (id e) { [self release]; @throw e; } @@ -436,11 +436,11 @@ pool = objc_autoreleasePoolPush(); parentPrefix = [allNamespaces objectForKey: (parent != nil && parent->_namespace != nil - ? parent->_namespace : (OFString *)@"")]; + ? (OFString *)parent->_namespace : (OFString *)@"")]; /* Add the namespaces of the current element */ if (allNamespaces != nil) { OFEnumerator *keyEnumerator = [_namespaces keyEnumerator]; OFEnumerator *objectEnumerator = [_namespaces objectEnumerator]; @@ -457,11 +457,11 @@ allNamespaces = tmp; } else allNamespaces = _namespaces; prefix = [allNamespaces objectForKey: - (_namespace != nil ? _namespace : (OFString *)@"")]; + (_namespace != nil ? (OFString *)_namespace : (OFString *)@"")]; if (parent != nil && parent->_namespace != nil && parentPrefix == nil) defaultNS = parent->_namespace; else if (parent != nil && parent->_defaultNamespace != nil) defaultNS = parent->_defaultNamespace; @@ -525,13 +525,14 @@ OFString *attributePrefix = nil; OFString *tmp = [[attribute stringValue] stringByXMLEscaping]; if ([attribute namespace] != nil && (attributePrefix = [allNamespaces objectForKey: - [attribute namespace]]) == nil) + (OFString *)[attribute namespace]]) == nil) @throw [OFUnboundNamespaceException - exceptionWithNamespace: [attribute namespace] + exceptionWithNamespace: (OFString *) + [attribute namespace] element: self]; length += [attributeName UTF8StringLength] + (attributePrefix != nil ? [attributePrefix UTF8StringLength] + 1 : 0) + @@ -701,24 +702,24 @@ [element addAttributeWithName: @"name" stringValue: _name]; if (_namespace != nil) [element addAttributeWithName: @"namespace" - stringValue: _namespace]; + stringValue: (OFString *)_namespace]; if (_defaultNamespace != nil) [element addAttributeWithName: @"defaultNamespace" - stringValue: _defaultNamespace]; + stringValue: (OFString *)_defaultNamespace]; if (_attributes != nil) { OFXMLElement *attributesElement; attributesElement = [OFXMLElement elementWithName: @"attributes" namespace: OF_SERIALIZATION_NS]; [attributesElement addChild: - [_attributes XMLElementBySerializing]]; + [(OFArray *)_attributes XMLElementBySerializing]]; [element addChild: attributesElement]; } if (_namespaces != nil) { OFXMLElement *namespacesElement; @@ -744,11 +745,12 @@ OFXMLElement *childrenElement; childrenElement = [OFXMLElement elementWithName: @"children" namespace: OF_SERIALIZATION_NS]; - [childrenElement addChild: [_children XMLElementBySerializing]]; + [childrenElement addChild: + [(OFArray *)_children XMLElementBySerializing]]; [element addChild: childrenElement]; } [element retain]; Index: src/OFXMLElementBuilder.m ================================================================== --- src/OFXMLElementBuilder.m +++ src/OFXMLElementBuilder.m @@ -115,11 +115,12 @@ @throw [OFMalformedXMLException exception]; return; case 1: [_delegate elementBuilder: self - didBuildElement: [_stack firstObject]]; + didBuildElement: (OFXMLElement *) + [_stack firstObject]]; break; } [_stack removeLastObject]; } Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -545,26 +545,26 @@ namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) @throw [OFUnboundPrefixException - exceptionWithPrefix: _prefix + exceptionWithPrefix: (OFString *)_prefix parser: self]; if ([_delegate respondsToSelector: @selector(parser: didStartElement:prefix:namespace:attributes:)]) [_delegate parser: self - didStartElement: _name + didStartElement: (OFString *)_name prefix: _prefix namespace: namespace attributes: nil]; if (_data[_i] == '/') { if ([_delegate respondsToSelector: @selector(parser:didEndElement:prefix:namespace:)]) [_delegate parser: self - didEndElement: _name + didEndElement: (OFString *)_name prefix: _prefix namespace: namespace]; if ([_previous count] == 0) _finishedParsing = true; @@ -632,17 +632,18 @@ [_buffer removeAllItems]; namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) - @throw [OFUnboundPrefixException exceptionWithPrefix: _prefix - parser: self]; + @throw [OFUnboundPrefixException + exceptionWithPrefix: (OFString *)_prefix + parser: self]; if ([_delegate respondsToSelector: @selector(parser:didEndElement:prefix:namespace:)]) [_delegate parser: self - didEndElement: _name + didEndElement: (OFString *)_name prefix: _prefix namespace: namespace]; objc_autoreleasePoolPop(pool); @@ -683,12 +684,13 @@ attributesCount = [_attributes count]; namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) - @throw [OFUnboundPrefixException exceptionWithPrefix: _prefix - parser: self]; + @throw [OFUnboundPrefixException + exceptionWithPrefix: (OFString *)_prefix + parser: self]; for (size_t j = 0; j < attributesCount; j++) resolveAttributeNamespace(attributesObjects[j], _namespaces, self); @@ -695,20 +697,20 @@ pool = objc_autoreleasePoolPush(); if ([_delegate respondsToSelector: @selector(parser:didStartElement:prefix:namespace:attributes:)]) [_delegate parser: self - didStartElement: _name + didStartElement: (OFString *)_name prefix: _prefix namespace: namespace attributes: _attributes]; if (_data[_i] == '/') { if ([_delegate respondsToSelector: @selector(parser:didEndElement:prefix:namespace:)]) [_delegate parser: self - didEndElement: _name + didEndElement: (OFString *)_name prefix: _prefix namespace: namespace]; if ([_previous count] == 0) _finishedParsing = true; @@ -717,11 +719,11 @@ } else if (_prefix != nil) { OFString *str = [OFString stringWithFormat: @"%@:%@", _prefix, _name]; [_previous addObject: str]; } else - [_previous addObject: _name]; + [_previous addObject: (OFString *)_name]; objc_autoreleasePoolPop(pool); [_name release]; [_prefix release]; @@ -828,15 +830,16 @@ if (_attributePrefix == nil && [_attributeName isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: @""]; if ([_attributePrefix isEqual: @"xmlns"]) - [[_namespaces lastObject] setObject: attributeValue - forKey: _attributeName]; + [[_namespaces lastObject] + setObject: attributeValue + forKey: (OFString *)_attributeName]; [_attributes addObject: - [OFXMLAttribute attributeWithName: _attributeName + [OFXMLAttribute attributeWithName: (OFString *)_attributeName namespace: _attributePrefix stringValue: attributeValue]]; objc_autoreleasePoolPop(pool); Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -465,11 +465,11 @@ initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); - return [[_lastReturnedStream retain] autorelease]; + return [[(OFStream *)_lastReturnedStream retain] autorelease]; } - (OFStream *)streamForWritingEntry: (OFZIPArchiveEntry *)entry_ { /* TODO: Avoid data descriptor when _stream is an OFSeekableStream */ @@ -556,11 +556,11 @@ initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); - return [[_lastReturnedStream retain] autorelease]; + return [[(OFStream *)_lastReturnedStream retain] autorelease]; } - (void)of_writeCentralDirectory { void *pool = objc_autoreleasePoolPush(); @@ -603,11 +603,11 @@ [_stream writeLittleEndianInt16: 0xFFFF]; /* CD entries */ [_stream writeLittleEndianInt32: 0xFFFFFFFF]; /* CD size */ [_stream writeLittleEndianInt32: 0xFFFFFFFF]; /* CD offset */ [_stream writeLittleEndianInt16: [_archiveComment UTF8StringLength]]; if (_archiveComment != nil) - [_stream writeString: _archiveComment]; + [_stream writeString: (OFString *)_archiveComment]; objc_autoreleasePoolPop(pool); } - (void)close Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -463,17 +463,17 @@ [stream writeLittleEndianInt64: _localFileHeaderOffset]; [stream writeLittleEndianInt32: _startDiskNumber]; size += (2 * 2) + (3 * 8) + 4; if (_extraField != nil) - [stream writeData: _extraField]; + [stream writeData: (OFData *)_extraField]; size += (uint64_t)[_extraField count]; if (_fileComment != nil) - [stream writeString: _fileComment]; + [stream writeString: (OFString *)_fileComment]; size += (uint64_t)[_fileComment UTF8StringLength]; objc_autoreleasePoolPop(pool); return size; } @end Index: src/bridge/NSString+OFObject.m ================================================================== --- src/bridge/NSString+OFObject.m +++ src/bridge/NSString+OFObject.m @@ -18,8 +18,8 @@ #import "OFString.h" @implementation NSString (OFObject) - (id)OFObject { - return [OFString stringWithUTF8String: [self UTF8String]]; + return [OFString stringWithUTF8String: (const char *)[self UTF8String]]; } @end Index: src/bridge/OFString+NSObject.m ================================================================== --- src/bridge/OFString+NSObject.m +++ src/bridge/OFString+NSObject.m @@ -16,11 +16,19 @@ #import #import "OFString+NSObject.h" +#import "OFInitializationFailedException.h" + @implementation OFString (NSObject) - (id)NSObject { - return [NSString stringWithUTF8String: [self UTF8String]]; + NSString *string = [NSString stringWithUTF8String: [self UTF8String]]; + + if (string == nil) + @throw [OFInitializationFailedException + exceptionWithClass: [NSString class]]; + + return string; } @end Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -575,154 +575,154 @@ # define OF_BSWAP_FLOAT_IF_LE(i) OF_BSWAP_FLOAT(i) # define OF_BSWAP_DOUBLE_IF_LE(i) OF_BSWAP_DOUBLE(i) #endif static OF_INLINE uint16_t -of_be16_ptr_read(void *ptr) +of_be16_ptr_read(void *_Nonnull ptr) { uint16_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP16_IF_LE(value); } static OF_INLINE uint32_t -of_be32_ptr_read(void *ptr) +of_be32_ptr_read(void *_Nonnull ptr) { uint32_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP32_IF_LE(value); } static OF_INLINE uint64_t -of_be64_ptr_read(void *ptr) +of_be64_ptr_read(void *_Nonnull ptr) { uint64_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP64_IF_LE(value); } static OF_INLINE float -of_be_float_ptr_read(void *ptr) +of_be_float_ptr_read(void *_Nonnull ptr) { float value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP_FLOAT_IF_LE(value); } static OF_INLINE double -of_be_double_ptr_read(void *ptr) +of_be_double_ptr_read(void *_Nonnull ptr) { double value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP_DOUBLE_IF_LE(value); } static OF_INLINE uint16_t -of_le16_ptr_read(void *ptr) +of_le16_ptr_read(void *_Nonnull ptr) { uint16_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP16_IF_BE(value); } static OF_INLINE uint32_t -of_le32_ptr_read(void *ptr) +of_le32_ptr_read(void *_Nonnull ptr) { uint32_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP32_IF_BE(value); } static OF_INLINE uint64_t -of_le64_ptr_read(void *ptr) +of_le64_ptr_read(void *_Nonnull ptr) { uint64_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP64_IF_BE(value); } static OF_INLINE float -of_le_float_ptr_read(void *ptr) +of_le_float_ptr_read(void *_Nonnull ptr) { float value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP_FLOAT_IF_BE(value); } static OF_INLINE double -of_le_double_ptr_read(void *ptr) +of_le_double_ptr_read(void *_Nonnull ptr) { double value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP_DOUBLE_IF_BE(value); } static OF_INLINE void -of_be16_ptr_write(void *ptr, uint16_t value) +of_be16_ptr_write(void *_Nonnull ptr, uint16_t value) { value = OF_BSWAP16_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void -of_be32_ptr_write(void *ptr, uint32_t value) +of_be32_ptr_write(void *_Nonnull ptr, uint32_t value) { value = OF_BSWAP32_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void -of_be64_ptr_write(void *ptr, uint64_t value) +of_be64_ptr_write(void *_Nonnull ptr, uint64_t value) { value = OF_BSWAP64_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void -of_be_float_ptr_write(void *ptr, float value) +of_be_float_ptr_write(void *_Nonnull ptr, float value) { value = OF_BSWAP_FLOAT_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void -of_be_double_ptr_write(void *ptr, double value) +of_be_double_ptr_write(void *_Nonnull ptr, double value) { value = OF_BSWAP_DOUBLE_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void -of_le16_ptr_write(void *ptr, uint16_t value) +of_le16_ptr_write(void *_Nonnull ptr, uint16_t value) { value = OF_BSWAP16_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void -of_le32_ptr_write(void *ptr, uint32_t value) +of_le32_ptr_write(void *_Nonnull ptr, uint32_t value) { value = OF_BSWAP32_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void -of_le64_ptr_write(void *ptr, uint64_t value) +of_le64_ptr_write(void *_Nonnull ptr, uint64_t value) { value = OF_BSWAP64_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void -of_le_float_ptr_write(void *ptr, float value) +of_le_float_ptr_write(void *_Nonnull ptr, float value) { value = OF_BSWAP_FLOAT_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void -of_le_double_ptr_write(void *ptr, double value) +of_le_double_ptr_write(void *_Nonnull ptr, double value) { value = OF_BSWAP_DOUBLE_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } @@ -760,29 +760,29 @@ OF_HASH_ADD(hash, (otherCopy >> 8) & 0xFF); \ OF_HASH_ADD(hash, otherCopy & 0xFF); \ } static OF_INLINE bool -of_bitset_isset(uint8_t *storage, size_t index) +of_bitset_isset(uint8_t *_Nonnull storage, size_t index) { return storage[index / 8] & (1 << (index % 8)); } static OF_INLINE void -of_bitset_set(uint8_t *storage, size_t index) +of_bitset_set(uint8_t *_Nonnull storage, size_t index) { storage[index / 8] |= (1 << (index % 8)); } static OF_INLINE void -of_bitset_clear(uint8_t *storage, size_t index) +of_bitset_clear(uint8_t *_Nonnull storage, size_t index) { storage[index / 8] &= ~(1 << (index % 8)); } -static OF_INLINE char * -of_strdup(const char *string) +static OF_INLINE char *_Nullable +of_strdup(const char *_Nonnull string) { char *copy; size_t length = strlen(string); if ((copy = (char *)malloc(length + 1)) == NULL) @@ -792,11 +792,11 @@ return copy; } static OF_INLINE void -of_explicit_memset(void *buffer_, int character, size_t length) +of_explicit_memset(void *_Nonnull buffer_, int character, size_t length) { volatile unsigned char *buffer = (volatile unsigned char *)buffer_; while (buffer < (unsigned char *)buffer_ + length) *buffer++ = character; Index: tests/OFDictionaryTests.m ================================================================== --- tests/OFDictionaryTests.m +++ tests/OFDictionaryTests.m @@ -236,11 +236,11 @@ if (i > 1 || ![key isEqual: keys[i]]) { ok = false; break; } - [mutDict setObject: [mutDict objectForKey: key] + [mutDict setObject: (OFString *)[mutDict objectForKey: key] forKey: key]; i++; } TEST(@"Fast Enumeration", ok) @@ -277,12 +277,13 @@ ok = false; *stop = true; return; } - [mutDict setObject: [mutDict objectForKey: key] - forKey: key]; + [mutDict + setObject: (OFString *)[mutDict objectForKey: key] + forKey: key]; i++; }]; TEST(@"Enumeration using blocks", ok) Index: tests/OFInvocationTests.m ================================================================== --- tests/OFInvocationTests.m +++ tests/OFInvocationTests.m @@ -253,11 +253,12 @@ - (void)invocationTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; SEL selector = @selector(invocationTestMethod1::::); - OFMethodSignature *sig = [self methodSignatureForSelector: selector]; + OFMethodSignature *sig = + (OFMethodSignature *)[self methodSignatureForSelector: selector]; OFInvocation *invocation; struct test_struct st, st2, *stp = &st, *stp2; unsigned const char c = 0xAA; unsigned char c2; const unsigned int i = 0x55555555; @@ -311,11 +312,11 @@ #ifdef OF_INVOCATION_CAN_INVOKE /* -[invoke] #1 */ selector = @selector(invocationTestMethod2::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: - [self methodSignatureForSelector: selector]]; + (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; @@ -329,11 +330,11 @@ R([invocation getReturnValue: &intResult]) && intResult == 8) /* -[invoke] #2 */ selector = @selector(invocationTestMethod3::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: - [self methodSignatureForSelector: selector]]; + (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; @@ -350,11 +351,11 @@ doubleResult == 8.5) /* -[invoke] #3 */ selector = @selector(invocationTestMethod4::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: - [self methodSignatureForSelector: selector]]; + (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; @@ -378,10 +379,11 @@ /* Only when encoding long doubles is supported */ if (strcmp(@encode(double), @encode(long double)) != 0) { /* -[invoke] #4 */ selector = @selector(invocationTestMethod5::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: + (OFMethodSignature *) [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector @@ -401,11 +403,11 @@ # ifndef __STDC_NO_COMPLEX__ /* -[invoke] #5 */ selector = @selector(invocationTestMethod6::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: - [self methodSignatureForSelector: selector]]; + (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; @@ -431,10 +433,11 @@ if (strcmp(@encode(complex double), @encode(complex long double)) != 0) { /* -[invoke] #6 */ selector = @selector(invocationTestMethod7::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: + (OFMethodSignature *) [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector @@ -470,11 +473,11 @@ # ifdef __SIZEOF_INT128__ /* -[invoke] #7 */ selector = @selector(invocationTestMethod8::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: - [self methodSignatureForSelector: selector]]; + (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; Index: tests/OFListTests.m ================================================================== --- tests/OFListTests.m +++ tests/OFListTests.m @@ -58,24 +58,27 @@ TEST(@"-[lastListObject]->previous", [[list lastListObject]->previous->object isEqual: strings[1]]) TEST(@"-[removeListObject:]", - R([list removeListObject: [list lastListObject]]) && + R([list removeListObject: + (of_list_object_t *)[list lastListObject]]) && [[list lastListObject]->object isEqual: strings[1]] && - R([list removeListObject: [list firstListObject]]) && + R([list removeListObject: + (of_list_object_t *)[list firstListObject]]) && [[list firstListObject]->object isEqual: [list lastListObject]->object]) TEST(@"-[insertObject:beforeListObject:]", [list insertObject: strings[0] - beforeListObject: [list lastListObject]] && + beforeListObject: (of_list_object_t *)[list lastListObject]] && [[list lastListObject]->previous->object isEqual: strings[0]]) TEST(@"-[insertObject:afterListObject:]", [list insertObject: strings[2] - afterListObject: [list firstListObject]->next] && + afterListObject: (of_list_object_t *) + [list firstListObject]->next] && [[list lastListObject]->object isEqual: strings[2]]) TEST(@"-[count]", [list count] == 3) TEST(@"-[containsObject:]", @@ -114,11 +117,11 @@ ok = false; TEST(@"OFEnumerator's -[nextObject]", ok); [enumerator reset]; - [list removeListObject: [list firstListObject]]; + [list removeListObject: (of_list_object_t *)[list firstListObject]]; EXPECT_EXCEPTION(@"Detection of mutation during enumeration", OFEnumerationMutationException, [enumerator nextObject]) [list prependObject: strings[0]]; @@ -143,11 +146,12 @@ ok = false; @try { for (OFString *obj in list) { (void)obj; - [list removeListObject: [list lastListObject]]; + [list removeListObject: + (of_list_object_t *)[list lastListObject]]; } } @catch (OFEnumerationMutationException *e) { ok = true; }