Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -258,13 +258,11 @@ continue; } key = [tmp substringToIndex: pos]; value = [tmp substringFromIndex: pos + 1]; - - [_environment setObject: value - forKey: key]; + [_environment setObject: value forKey: key]; objc_autoreleasePoolPop(pool); } FreeEnvironmentStringsW(env0); @@ -302,13 +300,11 @@ continue; } key = [tmp substringToIndex: pos]; value = [tmp substringFromIndex: pos + 1]; - - [_environment setObject: value - forKey: key]; + [_environment setObject: value forKey: key]; objc_autoreleasePoolPop(pool); } FreeEnvironmentStringsA(env0); @@ -338,12 +334,11 @@ file = [OFFile fileWithPath: path mode: @"r"]; value = [file readLineWithEncoding: encoding]; if (value != nil) - [_environment setObject: value - forKey: name]; + [_environment setObject: value forKey: name]; objc_autoreleasePoolPop(pool2); } /* Local variables override global variables */ @@ -372,13 +367,11 @@ encoding: encoding]; value = [OFString stringWithCString: (const char *)iter->lv_Value encoding: encoding length: length]; - - [_environment setObject: value - forKey: key]; + [_environment setObject: value forKey: key]; } objc_autoreleasePoolPop(pool); #elif !defined(OF_IOS) # ifndef OF_MACOS @@ -407,13 +400,11 @@ encoding: encoding length: sep - *env]; value = [OFString stringWithCString: sep + 1 encoding: encoding]; - - [_environment setObject: value - forKey: key]; + [_environment setObject: value forKey: key]; objc_autoreleasePoolPop(pool); } } #else @@ -429,40 +420,35 @@ if ((env = getenv("HOME")) != NULL) { OFString *home = [[[OFString alloc] initWithUTF8StringNoCopy: env freeWhenDone: false] autorelease]; - [_environment setObject: home - forKey: @"HOME"]; + [_environment setObject: home forKey: @"HOME"]; } if ((env = getenv("PATH")) != NULL) { OFString *path = [[[OFString alloc] initWithUTF8StringNoCopy: env freeWhenDone: false] autorelease]; - [_environment setObject: path - forKey: @"PATH"]; + [_environment setObject: path forKey: @"PATH"]; } if ((env = getenv("SHELL")) != NULL) { OFString *shell = [[[OFString alloc] initWithUTF8StringNoCopy: env freeWhenDone: false] autorelease]; - [_environment setObject: shell - forKey: @"SHELL"]; + [_environment setObject: shell forKey: @"SHELL"]; } if ((env = getenv("TMPDIR")) != NULL) { OFString *tmpdir = [[[OFString alloc] initWithUTF8StringNoCopy: env freeWhenDone: false] autorelease]; - [_environment setObject: tmpdir - forKey: @"TMPDIR"]; + [_environment setObject: tmpdir forKey: @"TMPDIR"]; } if ((env = getenv("USER")) != NULL) { OFString *user = [[[OFString alloc] initWithUTF8StringNoCopy: env freeWhenDone: false] autorelease]; - [_environment setObject: user - forKey: @"USER"]; + [_environment setObject: user forKey: @"USER"]; } objc_autoreleasePoolPop(pool); #endif Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -252,12 +252,11 @@ * @note A @ref OFNull value is translated to nil! * * @param value The value for the specified key * @param key The key of the value to set */ -- (void)setValue: (nullable id)value - forKey: (OFString *)key; +- (void)setValue: (nullable id)value forKey: (OFString *)key; /** * @brief Copies the objects at the specified range to the specified buffer. * * @param buffer The buffer to copy the objects to Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -193,12 +193,11 @@ { id ret; va_list arguments; va_start(arguments, firstObject); - ret = [self initWithObject: firstObject - arguments: arguments]; + ret = [self initWithObject: firstObject arguments: arguments]; va_end(arguments); return ret; } @@ -240,12 +239,11 @@ { size_t count = self.count; id *buffer = of_alloc(count, sizeof(id)); @try { - [self getObjects: buffer - inRange: of_range(0, count)]; + [self getObjects: buffer inRange: of_range(0, count)]; return [[OFData dataWithItemsNoCopy: buffer count: count itemSize: sizeof(id) freeWhenDone: true] items]; @@ -296,16 +294,14 @@ [ret makeImmutable]; return ret; } -- (void)setValue: (id)value - forKey: (OFString *)key +- (void)setValue: (id)value forKey: (OFString *)key { for (id object in self) - [object setValue: value - forKey: key]; + [object setValue: value forKey: key]; } - (size_t)indexOfObject: (id)object { size_t i = 0; @@ -376,20 +372,17 @@ if (range.length > SIZE_MAX - range.location || range.location + range.length < self.count) @throw [OFOutOfRangeException exception]; if (![self isKindOfClass: [OFMutableArray class]]) - return [OFSubarray arrayWithArray: self - range: range]; + return [OFSubarray arrayWithArray: self range: range]; buffer = of_alloc(range.length, sizeof(*buffer)); @try { - [self getObjects: buffer - inRange: range]; + [self getObjects: buffer inRange: range]; - ret = [OFArray arrayWithObjects: buffer - count: range.length]; + ret = [OFArray arrayWithObjects: buffer count: range.length]; } @finally { free(buffer); } return ret; @@ -538,12 +531,11 @@ pool = objc_autoreleasePoolPush(); ret = [[self componentsJoinedByString: @",\n"] mutableCopy]; @try { [ret prependString: @"(\n"]; - [ret replaceOccurrencesOfString: @"\n" - withString: @"\n\t"]; + [ret replaceOccurrencesOfString: @"\n" withString: @"\n\t"]; [ret appendString: @"\n)"]; } @catch (id e) { [ret release]; @throw e; } @@ -582,18 +574,16 @@ return [element autorelease]; } - (OFString *)JSONRepresentation { - return [self of_JSONRepresentationWithOptions: 0 - depth: 0]; + return [self of_JSONRepresentationWithOptions: 0 depth: 0]; } - (OFString *)JSONRepresentationWithOptions: (int)options { - return [self of_JSONRepresentationWithOptions: options - depth: 0]; + return [self of_JSONRepresentationWithOptions: options depth: 0]; } - (OFString *)of_JSONRepresentationWithOptions: (int)options depth: (size_t)depth { @@ -667,19 +657,17 @@ } else if (count <= UINT16_MAX) { uint8_t type = 0xDC; uint16_t tmp = OF_BSWAP16_IF_LE((uint16_t)count); [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (count <= UINT32_MAX) { uint8_t type = 0xDD; uint32_t tmp = OF_BSWAP32_IF_LE((uint32_t)count); [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else @throw [OFOutOfRangeException exception]; pool = objc_autoreleasePoolPush(); @@ -689,12 +677,11 @@ OFData *child; i++; child = [object messagePackRepresentation]; - [data addItems: child.items - count: child.count]; + [data addItems: child.items count: child.count]; objc_autoreleasePoolPop(pool2); } assert(i == count); @@ -714,61 +701,46 @@ - (void)makeObjectsPerformSelector: (SEL)selector withObject: (id)object { for (id objectIter in self) - [objectIter performSelector: selector - withObject: object]; + [objectIter performSelector: selector withObject: object]; } - (OFArray *)sortedArray { OFMutableArray *new = [[self mutableCopy] autorelease]; - [new sort]; - [new makeImmutable]; - return new; } - (OFArray *)sortedArrayUsingSelector: (SEL)selector options: (int)options { OFMutableArray *new = [[self mutableCopy] autorelease]; - - [new sortUsingSelector: selector - options: options]; - + [new sortUsingSelector: selector options: options]; [new makeImmutable]; - return new; } #ifdef OF_HAVE_BLOCKS - (OFArray *)sortedArrayUsingComparator: (of_comparator_t)comparator options: (int)options { OFMutableArray *new = [[self mutableCopy] autorelease]; - - [new sortUsingComparator: comparator - options: options]; - + [new sortUsingComparator: comparator options: options]; [new makeImmutable]; - return new; } #endif - (OFArray *)reversedArray { OFMutableArray *new = [[self mutableCopy] autorelease]; - [new reverse]; - [new makeImmutable]; - return new; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state objects: (id *)objects @@ -780,12 +752,11 @@ @throw [OFOutOfRangeException exception]; if (range.location + range.length > self.count) range.length = self.count - range.location; - [self getObjects: objects - inRange: range]; + [self getObjects: objects inRange: range]; if (range.location + range.length > ULONG_MAX) @throw [OFOutOfRangeException exception]; state->state = (unsigned long)(range.location + range.length); @@ -822,34 +793,30 @@ if (object == nil) @throw [OFInvalidArgumentException exception]; ret = [[self mutableCopy] autorelease]; - [ret addObject: object]; [ret makeImmutable]; return ret; } - (OFArray *)arrayByAddingObjectsFromArray: (OFArray *)array { OFMutableArray *ret = [[self mutableCopy] autorelease]; - [ret addObjectsFromArray: array]; [ret makeImmutable]; return ret; } - (OFArray *)arrayByRemovingObject: (id)object { OFMutableArray *ret = [[self mutableCopy] autorelease]; - [ret removeObject: object]; [ret makeImmutable]; - return ret; } #ifdef OF_HAVE_BLOCKS - (OFArray *)mappedArrayUsingBlock: (of_array_map_block_t)block @@ -862,12 +829,11 @@ [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { tmp[idx] = block(object, idx); }]; - ret = [OFArray arrayWithObjects: tmp - count: count]; + ret = [OFArray arrayWithObjects: tmp count: count]; } @finally { free(tmp); } return ret; @@ -886,12 +852,11 @@ bool *stop) { if (block(object, idx)) tmp[i++] = object; }]; - ret = [OFArray arrayWithObjects: tmp - count: i]; + ret = [OFArray arrayWithObjects: tmp count: i]; } @finally { free(tmp); } return ret; Index: src/OFCountedMapTableSet.m ================================================================== --- src/OFCountedMapTableSet.m +++ src/OFCountedMapTableSet.m @@ -191,12 +191,11 @@ size_t count = (size_t)(uintptr_t)[_mapTable objectForKey: object]; if (SIZE_MAX - count < 1 || UINTPTR_MAX - count < 1) @throw [OFOutOfRangeException exception]; - [_mapTable setObject: (void *)(uintptr_t)(count + 1) - forKey: object]; + [_mapTable setObject: (void *)(uintptr_t)(count + 1) forKey: object]; } - (void)removeObject: (id)object { size_t count = (size_t)(uintptr_t)[_mapTable objectForKey: object]; @@ -205,12 +204,11 @@ return; count--; if (count > 0) - [_mapTable setObject: (void *)(uintptr_t)count - forKey: object]; + [_mapTable setObject: (void *)(uintptr_t)count forKey: object]; else [_mapTable removeObjectForKey: object]; } - (void)removeAllObjects Index: src/OFDNSResolver.m ================================================================== --- src/OFDNSResolver.m +++ src/OFDNSResolver.m @@ -451,12 +451,11 @@ array = [ret objectForKey: name]; if (array == nil) { array = [OFMutableArray array]; - [ret setObject: array - forKey: name]; + [ret setObject: array forKey: name]; } [array addObject: record]; } @@ -714,12 +713,11 @@ runLoopMode: (of_run_loop_mode_t)runLoopMode { OFUDPSocket *sock; OFString *nameServer; - [_queries setObject: context - forKey: context->_ID]; + [_queries setObject: context forKey: context->_ID]; [context->_cancelTimer invalidate]; [context->_cancelTimer release]; context->_cancelTimer = nil; context->_cancelTimer = [[OFTimer alloc] @@ -738,12 +736,11 @@ if (context->_settings->_usesTCP) { OF_ENSURE(context->_TCPSocket == nil); context->_TCPSocket = [[OFTCPSocket alloc] init]; - [_TCPQueries setObject: context - forKey: context->_TCPSocket]; + [_TCPQueries setObject: context forKey: context->_TCPSocket]; context->_TCPSocket.delegate = self; [context->_TCPSocket asyncConnectToHost: nameServer port: 53 runLoopMode: runLoopMode]; Index: src/OFDNSResolverSettings.m ================================================================== --- src/OFDNSResolverSettings.m +++ src/OFDNSResolverSettings.m @@ -286,12 +286,11 @@ OFMutableArray *addresses = [staticHosts objectForKey: host]; if (addresses == nil) { addresses = [OFMutableArray array]; - [staticHosts setObject: addresses - forKey: host]; + [staticHosts setObject: addresses forKey: host]; } [addresses addObject: address]; } } @@ -490,12 +489,11 @@ OFMutableArray *addresses = [staticHosts objectForKey: host]; if (addresses == nil) { addresses = [OFMutableArray array]; - [staticHosts setObject: addresses - forKey: host]; + [staticHosts setObject: addresses forKey: host]; } [addresses addObject: address]; } } Index: src/OFData+MessagePackParsing.m ================================================================== --- src/OFData+MessagePackParsing.m +++ src/OFData+MessagePackParsing.m @@ -116,12 +116,11 @@ pos += parseObject(buffer + pos, length - pos, &key, depthLimit); pos += parseObject(buffer + pos, length - pos, &value, depthLimit); - [*object setObject: value - forKey: key]; + [*object setObject: value forKey: key]; objc_autoreleasePoolPop(pool); } return pos; Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -96,12 +96,11 @@ * * @param key The key * @param object The object * @return A new autoreleased OFDictionary */ -+ (instancetype)dictionaryWithObject: (ObjectType)object - forKey: (KeyType)key; ++ (instancetype)dictionaryWithObject: (ObjectType)object forKey: (KeyType)key; /** * @brief Creates a new OFDictionary with the specified keys and objects. * * @param keys An array of keys @@ -150,12 +149,11 @@ * * @param key The key * @param object The object * @return An initialized OFDictionary */ -- (instancetype)initWithObject: (ObjectType)object - forKey: (KeyType)key; +- (instancetype)initWithObject: (ObjectType)object forKey: (KeyType)key; /** * @brief Initializes an already allocated OFDictionary with the specified keys * and objects. * @@ -194,12 +192,11 @@ * * @param firstKey The first key * @param arguments A va_list of the other arguments * @return An initialized OFDictionary */ -- (instancetype)initWithKey: (KeyType)firstKey - arguments: (va_list)arguments; +- (instancetype)initWithKey: (KeyType)firstKey arguments: (va_list)arguments; /** * @brief Returns the object for the given key or `nil` if the key was not * found. * @@ -232,12 +229,11 @@ * dictionary is immutable, an @ref OFUndefinedKeyException is thrown. * * @param key The key to set * @param value The value to set the key to */ -- (void)setValue: (nullable id)value - forKey: (OFString *)key; +- (void)setValue: (nullable id)value forKey: (OFString *)key; /** * @brief Checks whether the dictionary contains an object equal to the * specified object. * Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -292,12 +292,11 @@ @throw [OFInvalidArgumentException exception]; return [self initWithKeysAndObjects: key, object, nil]; } -- (instancetype)initWithObjects: (OFArray *)objects_ - forKeys: (OFArray *)keys_ +- (instancetype)initWithObjects: (OFArray *)objects_ forKeys: (OFArray *)keys_ { id const *objects, *keys; size_t count; @try { @@ -336,12 +335,11 @@ va_end(arguments); return ret; } -- (instancetype)initWithKey: (id)firstKey - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)firstKey arguments: (va_list)arguments { OF_INVALID_INIT_METHOD } - (instancetype)initWithSerialization: (OFXMLElement *)element @@ -365,20 +363,18 @@ return [super valueForKey: @"count"]; return [self objectForKey: key]; } -- (void)setValue: (id)value - forKey: (OFString *)key +- (void)setValue: (id)value forKey: (OFString *)key { if (![self isKindOfClass: [OFMutableDictionary class]]) @throw [OFUndefinedKeyException exceptionWithObject: self key: key value: value]; - [(OFMutableDictionary *)self setObject: value - forKey: key]; + [(OFMutableDictionary *)self setObject: value forKey: key]; } - (size_t)count { OF_UNRECOGNIZED_SELECTOR @@ -566,12 +562,11 @@ { OFMutableDictionary *new = [OFMutableDictionary dictionary]; [self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object, bool *stop) { - [new setObject: block(key, object) - forKey: key]; + [new setObject: block(key, object) forKey: key]; }]; [new makeImmutable]; return new; @@ -583,12 +578,11 @@ OFMutableDictionary *new = [OFMutableDictionary dictionary]; [self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object, bool *stop) { if (block(key, object)) - [new setObject: object - forKey: key]; + [new setObject: object forKey: key]; }]; [new makeImmutable]; return new; @@ -642,12 +636,11 @@ if (++i < count) [ret appendString: @";\n"]; objc_autoreleasePoolPop(pool2); } - [ret replaceOccurrencesOfString: @"\n" - withString: @"\n\t"]; + [ret replaceOccurrencesOfString: @"\n" withString: @"\n\t"]; [ret appendString: @";\n}"]; [ret makeImmutable]; objc_autoreleasePoolPop(pool); @@ -731,18 +724,16 @@ return [element autorelease]; } - (OFString *)JSONRepresentation { - return [self of_JSONRepresentationWithOptions: 0 - depth: 0]; + return [self of_JSONRepresentationWithOptions: 0 depth: 0]; } - (OFString *)JSONRepresentationWithOptions: (int)options { - return [self of_JSONRepresentationWithOptions: options - depth: 0]; + return [self of_JSONRepresentationWithOptions: options depth: 0]; } - (OFString *)of_JSONRepresentationWithOptions: (int)options depth: (size_t)depth { @@ -866,16 +857,14 @@ OFData *child; i++; child = key.messagePackRepresentation; - [data addItems: child.items - count: child.count]; + [data addItems: child.items count: child.count]; child = object.messagePackRepresentation; - [data addItems: child.items - count: child.count]; + [data addItems: child.items count: child.count]; objc_autoreleasePoolPop(pool2); } assert(i == count); Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -61,12 +61,11 @@ * `w+x` | Read-write, create or fail, exclusive * `a` | Write-only, create or append * `a+` | Read-write, create or append * @return A new autoreleased OFFile */ -+ (instancetype)fileWithPath: (OFString *)path - mode: (OFString *)mode; ++ (instancetype)fileWithPath: (OFString *)path mode: (OFString *)mode; /** * @brief Creates a new OFFile with the specified URL and mode. * * @param URL The URL to the file to open @@ -82,12 +81,11 @@ * `w+x` | Read-write, create or fail, exclusive * `a` | Write-only, create or append * `a+` | Read-write, create or append * @return A new autoreleased OFFile */ -+ (instancetype)fileWithURL: (OFURL *)URL - mode: (OFString *)mode; ++ (instancetype)fileWithURL: (OFURL *)URL mode: (OFString *)mode; /** * @brief Creates a new OFFile with the specified native file handle. * * @param handle A native file handle. If OF_FILE_HANDLE_IS_FD is defined, this @@ -119,12 +117,11 @@ * `ab` | write-only, create, append, binary * `a+` | read-write, create, append * `ab+` or `a+b` | read-write, create, append, binary * @return An initialized OFFile */ -- (instancetype)initWithPath: (OFString *)path - mode: (OFString *)mode; +- (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode; /** * @brief Initializes an already allocated OFFile. * * @param URL The URL to the file to open @@ -144,12 +141,11 @@ * `ab` | write-only, create, append, binary * `a+` | read-write, create, append * `ab+` or `a+b` | read-write, create, append, binary * @return An initialized OFFile */ -- (instancetype)initWithURL: (OFURL *)URL - mode: (OFString *)mode; +- (instancetype)initWithURL: (OFURL *)URL mode: (OFString *)mode; /** * @brief Initializes an already allocated OFFile. * * @param handle A native file handle. If OF_FILE_HANDLE_IS_FD is defined, this Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -180,22 +180,18 @@ @throw [OFInitializationFailedException exceptionWithClass: self]; #endif } -+ (instancetype)fileWithPath: (OFString *)path - mode: (OFString *)mode ++ (instancetype)fileWithPath: (OFString *)path mode: (OFString *)mode { - return [[[self alloc] initWithPath: path - mode: mode] autorelease]; + return [[[self alloc] initWithPath: path mode: mode] autorelease]; } -+ (instancetype)fileWithURL: (OFURL *)URL - mode: (OFString *)mode ++ (instancetype)fileWithURL: (OFURL *)URL mode: (OFString *)mode { - return [[[self alloc] initWithURL: URL - mode: mode] autorelease]; + return [[[self alloc] initWithURL: URL mode: mode] autorelease]; } + (instancetype)fileWithHandle: (of_file_handle_t)handle { return [[[self alloc] initWithHandle: handle] autorelease]; @@ -204,12 +200,11 @@ - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithPath: (OFString *)path - mode: (OFString *)mode +- (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode { of_file_handle_t handle; @try { void *pool = objc_autoreleasePoolPush(); @@ -324,12 +319,11 @@ } return self; } -- (instancetype)initWithURL: (OFURL *)URL - mode: (OFString *)mode +- (instancetype)initWithURL: (OFURL *)URL mode: (OFString *)mode { void *pool = objc_autoreleasePoolPush(); OFString *fileSystemRepresentation; @try { @@ -337,12 +331,11 @@ } @catch (id e) { [self release]; @throw e; } - self = [self initWithPath: fileSystemRepresentation - mode: mode]; + self = [self initWithPath: fileSystemRepresentation mode: mode]; objc_autoreleasePoolPop(pool); return self; } @@ -362,12 +355,11 @@ @throw [OFNotOpenException exceptionWithObject: self]; return _atEndOfStream; } -- (size_t)lowlevelReadIntoBuffer: (void *)buffer - length: (size_t)length +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { ssize_t ret; if (_handle == OF_INVALID_FILE_HANDLE) @throw [OFNotOpenException exceptionWithObject: self]; @@ -399,12 +391,11 @@ _atEndOfStream = true; return ret; } -- (size_t)lowlevelWriteBuffer: (const void *)buffer - length: (size_t)length +- (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { if (_handle == OF_INVALID_FILE_HANDLE) @throw [OFNotOpenException exceptionWithObject: self]; #if defined(OF_WINDOWS) @@ -458,12 +449,11 @@ #endif return (size_t)bytesWritten; } -- (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset - whence: (int)whence +- (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence { of_offset_t ret; if (_handle == OF_INVALID_FILE_HANDLE) @throw [OFNotOpenException exceptionWithObject: self]; Index: src/OFFileURLHandler.m ================================================================== --- src/OFFileURLHandler.m +++ src/OFFileURLHandler.m @@ -481,12 +481,11 @@ destination = [OFString stringWithCString: destinationC encoding: encoding length: length]; key = of_file_attribute_key_symbolic_link_destination; - [attributes setObject: destination - forKey: key]; + [attributes setObject: destination forKey: key]; # else HANDLE handle; OFString *destination; if (func_CreateSymbolicLinkW == NULL) @@ -530,12 +529,11 @@ sizeof(wchar_t)]; [attributes setObject: of_file_type_symbolic_link forKey: of_file_attribute_key_type]; key = of_file_attribute_key_symbolic_link_destination; - [attributes setObject: destination - forKey: key]; + [attributes setObject: destination forKey: key]; # undef slrb } @finally { CloseHandle(handle); } # endif Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -152,15 +152,13 @@ if (port != nil) { OFString *host = [OFString stringWithFormat: @"%@:%@", URL.URLEncodedHost, port]; - [headers setObject: host - forKey: @"Host"]; + [headers setObject: host forKey: @"Host"]; } else - [headers setObject: [URL URLEncodedHost] - forKey: @"Host"]; + [headers setObject: URL.URLEncodedHost forKey: @"Host"]; } if ((user.length > 0 || password.length > 0) && [headers objectForKey: @"Authorization"] == nil) { OFMutableData *authorizationData = [OFMutableData data]; @@ -173,12 +171,11 @@ count: password.UTF8StringLength]; authorization = [OFString stringWithFormat: @"Basic %@", authorizationData.stringByBase64Encoding]; - [headers setObject: authorization - forKey: @"Authorization"]; + [headers setObject: authorization forKey: @"Authorization"]; } if ([headers objectForKey: @"User-Agent"] == nil) [headers setObject: @"Something using ObjFW " @"" @@ -185,12 +182,11 @@ forKey: @"User-Agent"]; if (request.protocolVersion.major == 1 && request.protocolVersion.minor == 0 && [headers objectForKey: @"Connection"] == nil) - [headers setObject: @"keep-alive" - forKey: @"Connection"]; + [headers setObject: @"keep-alive" forKey: @"Connection"]; hasContentLength = ([headers objectForKey: @"Content-Length"] != nil); chunked = [[headers objectForKey: @"Transfer-Encoding"] isEqual: @"chunked"]; @@ -534,12 +530,11 @@ old = [_serverHeaders objectForKey: key]; if (old != nil) value = [old stringByAppendingFormat: @",%@", value]; - [_serverHeaders setObject: value - forKey: key]; + [_serverHeaders setObject: value forKey: key]; return true; } - (bool)stream: (OFStream *)sock Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -194,21 +194,18 @@ headers = [[_headers mutableCopy] autorelease]; if ([headers objectForKey: @"Date"] == nil) { OFString *date = [[OFDate date] dateStringWithFormat: @"%a, %d %b %Y %H:%M:%S GMT"]; - - [headers setObject: date - forKey: @"Date"]; + [headers setObject: date forKey: @"Date"]; } if ([headers objectForKey: @"Server"] == nil) { OFString *name = _server.name; if (name != nil) - [headers setObject: name - forKey: @"Server"]; + [headers setObject: name forKey: @"Server"]; } keyEnumerator = [headers keyEnumerator]; valueEnumerator = [headers objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && @@ -463,12 +460,11 @@ old = [_headers objectForKey: key]; if (old != nil) value = [old stringByAppendingFormat: @",%@", value]; - [_headers setObject: value - forKey: key]; + [_headers setObject: value forKey: key]; if ([key isEqual: @"Host"]) { pos = [value rangeOfString: @":" options: OF_STRING_SEARCH_BACKWARDS].location; Index: src/OFLocale.m ================================================================== --- src/OFLocale.m +++ src/OFLocale.m @@ -569,12 +569,11 @@ size_t last, UTF8StringLength; int state = 0; variables = [OFMutableDictionary dictionary]; while ((name = va_arg(arguments, OFConstantString *)) != nil) - [variables setObject: va_arg(arguments, id) - forKey: name]; + [variables setObject: va_arg(arguments, id) forKey: name]; for (OFDictionary *strings in _localizedStrings) { id string = [strings objectForKey: ID]; if (string == nil) Index: src/OFMapTable.h ================================================================== --- src/OFMapTable.h +++ src/OFMapTable.h @@ -160,12 +160,11 @@ * @brief Sets an object for a key. * * @param key The key to set * @param object The object to set the key to */ -- (void)setObject: (nullable void *)object - forKey: (nullable 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 Index: src/OFMapTable.m ================================================================== --- src/OFMapTable.m +++ src/OFMapTable.m @@ -440,16 +440,13 @@ old = _buckets[i]->object; _buckets[i]->object = _objectFunctions.retain(object); _objectFunctions.release(old); } -- (void)setObject: (void *)object - forKey: (void *)key +- (void)setObject: (void *)object forKey: (void *)key { - [self of_setObject: object - forKey: key - hash: _keyFunctions.hash(key)]; + [self of_setObject: object forKey: key hash: _keyFunctions.hash(key)]; } - (void)removeObjectForKey: (void *)key { unsigned long i, hash, last; Index: src/OFMapTableDictionary.m ================================================================== --- src/OFMapTableDictionary.m +++ src/OFMapTableDictionary.m @@ -135,12 +135,11 @@ keyEnumerator = [dictionary keyEnumerator]; objectEnumerator = [dictionary objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) - [_mapTable setObject: object - forKey: key]; + [_mapTable setObject: object forKey: key]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; @@ -147,18 +146,16 @@ } return self; } -- (instancetype)initWithObject: (id)object - forKey: (id)key +- (instancetype)initWithObject: (id)object forKey: (id)key { self = [self initWithCapacity: 1]; @try { - [_mapTable setObject: object - forKey: key]; + [_mapTable setObject: object forKey: key]; } @catch (id e) { [self release]; @throw e; } @@ -173,12 +170,11 @@ @try { size_t i; for (i = 0; i < count; i++) - [_mapTable setObject: objects[i] - forKey: keys[i]]; + [_mapTable setObject: objects[i] forKey: keys[i]]; } @catch (id e) { [self release]; @throw e; } @@ -216,22 +212,20 @@ _mapTable = [[OFMapTable alloc] initWithKeyFunctions: keyFunctions objectFunctions: objectFunctions capacity: count]; - [_mapTable setObject: object - forKey: key]; + [_mapTable setObject: object forKey: key]; for (i = 1; i < count; i++) { key = va_arg(arguments, id); object = va_arg(arguments, id); if (key == nil || object == nil) @throw [OFInvalidArgumentException exception]; - [_mapTable setObject: object - forKey: key]; + [_mapTable setObject: object forKey: key]; } } @catch (id e) { [self release]; @throw e; } Index: src/OFMapTableSet.m ================================================================== --- src/OFMapTableSet.m +++ src/OFMapTableSet.m @@ -98,12 +98,11 @@ self = [self initWithCapacity: count]; @try { for (id object in set) - [_mapTable setObject: (void *)1 - forKey: object]; + [_mapTable setObject: (void *)1 forKey: object]; } @catch (id e) { [self release]; @throw e; } @@ -126,12 +125,11 @@ self = [self initWithCapacity: count]; @try { for (id object in array) - [_mapTable setObject: (void *)1 - forKey: object]; + [_mapTable setObject: (void *)1 forKey: object]; } @catch (id e) { [self release]; @throw e; } @@ -143,12 +141,11 @@ { self = [self initWithCapacity: count]; @try { for (size_t i = 0; i < count; i++) - [_mapTable setObject: (void *)1 - forKey: objects[i]]; + [_mapTable setObject: (void *)1 forKey: objects[i]]; } @catch (id e) { [self release]; @throw e; } @@ -172,16 +169,14 @@ _mapTable = [[OFMapTable alloc] initWithKeyFunctions: keyFunctions objectFunctions: objectFunctions capacity: count]; - [_mapTable setObject: (void *)1 - forKey: firstObject]; + [_mapTable setObject: (void *)1 forKey: firstObject]; while ((object = va_arg(arguments, id)) != nil) - [_mapTable setObject: (void *)1 - forKey: object]; + [_mapTable setObject: (void *)1 forKey: object]; } @catch (id e) { [self release]; @throw e; } Index: src/OFMutableArray.h ================================================================== --- src/OFMutableArray.h +++ src/OFMutableArray.h @@ -80,12 +80,11 @@ * @brief Inserts an object to the OFArray at the specified index. * * @param object An object to add * @param index The index where the object should be inserted */ -- (void)insertObject: (ObjectType)object - atIndex: (size_t)index; +- (void)insertObject: (ObjectType)object atIndex: (size_t)index; /** * @brief Inserts the objects from the specified OFArray at the specified index. * * @param array An array of objects @@ -99,21 +98,19 @@ * other specified object. * * @param oldObject The object to replace * @param newObject The replacement object */ -- (void)replaceObject: (ObjectType)oldObject - withObject: (ObjectType)newObject; +- (void)replaceObject: (ObjectType)oldObject withObject: (ObjectType)newObject; /** * @brief Replaces the object at the specified index with the specified object. * * @param index The index of the object to replace * @param object The replacement object */ -- (void)replaceObjectAtIndex: (size_t)index - withObject: (ObjectType)object; +- (void)replaceObjectAtIndex: (size_t)index withObject: (ObjectType)object; /** * @brief Replaces the object at the specified index with the specified object. * * This method is the same as @ref replaceObjectAtIndex:withObject:. @@ -121,12 +118,11 @@ * This method is also used by the subscripting syntax. * * @param index The index of the object to replace * @param object The replacement object */ -- (void)setObject: (ObjectType)object - atIndexedSubscript: (size_t)index; +- (void)setObject: (ObjectType)object atIndexedSubscript: (size_t)index; /** * @brief Replaces the first object that has the same address as the specified * object with the other specified object. * @@ -188,12 +184,11 @@ * @brief Exchange the objects at the specified indices. * * @param index1 The index of the first object to exchange * @param index2 The index of the second object to exchange */ -- (void)exchangeObjectAtIndex: (size_t)index1 - withObjectAtIndex: (size_t)index2; +- (void)exchangeObjectAtIndex: (size_t)index1 withObjectAtIndex: (size_t)index2; /** * @brief Sorts the array in ascending order. */ - (void)sort; @@ -207,12 +202,11 @@ * Possible values are: * Value | Description * ---------------------------|------------------------- * `OF_ARRAY_SORT_DESCENDING` | Sort in descending order */ -- (void)sortUsingSelector: (SEL)selector - options: (int)options; +- (void)sortUsingSelector: (SEL)selector options: (int)options; #ifdef OF_HAVE_BLOCKS /** * @brief Sorts the array using the specified comparator and options. * @@ -221,12 +215,11 @@ * Possible values are: * Value | Description * ---------------------------|------------------------- * `OF_ARRAY_SORT_DESCENDING` | Sort in descending order */ -- (void)sortUsingComparator: (of_comparator_t)comparator - options: (int)options; +- (void)sortUsingComparator: (of_comparator_t)comparator options: (int)options; #endif /** * @brief Reverts the order of the objects in the array. */ Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -255,51 +255,42 @@ return [[OFArray alloc] initWithArray: self]; } - (void)addObject: (id)object { - [self insertObject: object - atIndex: self.count]; + [self insertObject: object atIndex: self.count]; } - (void)addObjectsFromArray: (OFArray *)array { - [self insertObjectsFromArray: array - atIndex: self.count]; + [self insertObjectsFromArray: array atIndex: self.count]; } -- (void)insertObject: (id)object - atIndex: (size_t)idx +- (void)insertObject: (id)object atIndex: (size_t)idx { OF_UNRECOGNIZED_SELECTOR } -- (void)insertObjectsFromArray: (OFArray *)array - atIndex: (size_t)idx +- (void)insertObjectsFromArray: (OFArray *)array atIndex: (size_t)idx { size_t i = 0; for (id object in array) - [self insertObject: object - atIndex: idx + i++]; + [self insertObject: object atIndex: idx + i++]; } -- (void)replaceObjectAtIndex: (size_t)idx - withObject: (id)object +- (void)replaceObjectAtIndex: (size_t)idx withObject: (id)object { OF_UNRECOGNIZED_SELECTOR } -- (void)setObject: (id)object - atIndexedSubscript: (size_t)idx +- (void)setObject: (id)object atIndexedSubscript: (size_t)idx { - [self replaceObjectAtIndex: idx - withObject: object]; + [self replaceObjectAtIndex: idx withObject: object]; } -- (void)replaceObject: (id)oldObject - withObject: (id)newObject +- (void)replaceObject: (id)oldObject withObject: (id)newObject { size_t count; if (oldObject == nil || newObject == nil) @throw [OFInvalidArgumentException exception]; @@ -306,19 +297,17 @@ count = self.count; for (size_t i = 0; i < count; i++) { if ([[self objectAtIndex: i] isEqual: oldObject]) { - [self replaceObjectAtIndex: i - withObject: newObject]; + [self replaceObjectAtIndex: i withObject: newObject]; return; } } } -- (void)replaceObjectIdenticalTo: (id)oldObject - withObject: (id)newObject +- (void)replaceObjectIdenticalTo: (id)oldObject withObject: (id)newObject { size_t count; if (oldObject == nil || newObject == nil) @throw [OFInvalidArgumentException exception]; @@ -325,12 +314,11 @@ count = self.count; for (size_t i = 0; i < count; i++) { if ([self objectAtIndex: i] == oldObject) { - [self replaceObjectAtIndex: i - withObject: newObject]; + [self replaceObjectAtIndex: i withObject: newObject]; return; } } } @@ -403,37 +391,32 @@ [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { id new = block(object, idx); if (new != object) - [self replaceObjectAtIndex: idx - withObject: new]; + [self replaceObjectAtIndex: idx withObject: new]; }]; } #endif -- (void)exchangeObjectAtIndex: (size_t)idx1 - withObjectAtIndex: (size_t)idx2 +- (void)exchangeObjectAtIndex: (size_t)idx1 withObjectAtIndex: (size_t)idx2 { id object1 = [self objectAtIndex: idx1]; id object2 = [self objectAtIndex: idx2]; [object1 retain]; @try { - [self replaceObjectAtIndex: idx1 - withObject: object2]; - [self replaceObjectAtIndex: idx2 - withObject: object1]; + [self replaceObjectAtIndex: idx1 withObject: object2]; + [self replaceObjectAtIndex: idx2 withObject: object1]; } @finally { [object1 release]; } } - (void)sort { - [self sortUsingSelector: @selector(compare:) - options: 0]; + [self sortUsingSelector: @selector(compare:) options: 0]; } - (void)sortUsingSelector: (SEL)selector options: (int)options { @@ -464,13 +447,12 @@ if (count == 0 || count == 1) return; for (i = 0, j = count - 1; i < j; i++, j--) - [self exchangeObjectAtIndex: i - withObjectAtIndex: j]; + [self exchangeObjectAtIndex: i withObjectAtIndex: j]; } - (void)makeImmutable { } @end Index: src/OFMutableDictionary.h ================================================================== --- src/OFMutableDictionary.h +++ src/OFMutableDictionary.h @@ -69,12 +69,11 @@ * A key can be any object that conforms to the OFCopying protocol. * * @param key The key to set * @param object The object to set the key to */ -- (void)setObject: (ObjectType)object - forKey: (KeyType)key; +- (void)setObject: (ObjectType)object forKey: (KeyType)key; /** * @brief Sets an object for a key. * * A key can be any object that conforms to the OFCopying protocol. @@ -83,12 +82,11 @@ * * @param key The key to set * @param object The object to set the key to. If it is nil, this is equal to * calling @ref removeObjectForKey:. */ -- (void)setObject: (nullable ObjectType)object - forKeyedSubscript: (KeyType)key; +- (void)setObject: (nullable ObjectType)object forKeyedSubscript: (KeyType)key; /** * @brief Removes the object for the specified key from the dictionary. * * @param key The key whose object should be removed Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -154,22 +154,19 @@ - (instancetype)initWithCapacity: (size_t)capacity { OF_INVALID_INIT_METHOD } -- (void)setObject: (id)object - forKey: (id)key +- (void)setObject: (id)object forKey: (id)key { OF_UNRECOGNIZED_SELECTOR } -- (void)setObject: (id)object - forKeyedSubscript: (id)key +- (void)setObject: (id)object forKeyedSubscript: (id)key { if (object != nil) - [self setObject: object - forKey: key]; + [self setObject: object forKey: key]; else [self removeObjectForKey: key]; } - (void)removeObjectForKey: (id)key @@ -199,12 +196,11 @@ OFEnumerator *objectEnumerator = [dictionary objectEnumerator]; id key, object; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) - [self setObject: object - forKey: key]; + [self setObject: object forKey: key]; objc_autoreleasePoolPop(pool); } #ifdef OF_HAVE_BLOCKS @@ -213,16 +209,15 @@ [self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object, bool *stop) { id new = block(key, object); if (new != object) { - [self setObject: block(key, object) - forKey: key]; + [self setObject: block(key, object) forKey: key]; } }]; } #endif - (void)makeImmutable { } @end Index: src/OFMutableMapTableDictionary.m ================================================================== --- src/OFMutableMapTableDictionary.m +++ src/OFMutableMapTableDictionary.m @@ -29,15 +29,13 @@ { if (self == [OFMutableMapTableDictionary class]) [self inheritMethodsFromClass: [OFMapTableDictionary class]]; } -- (void)setObject: (id)object - forKey: (id)key +- (void)setObject: (id)object forKey: (id)key { - [_mapTable setObject: object - forKey: key]; + [_mapTable setObject: object forKey: key]; } - (void)removeObjectForKey: (id)key { [_mapTable removeObjectForKey: key]; Index: src/OFMutableMapTableSet.m ================================================================== --- src/OFMutableMapTableSet.m +++ src/OFMutableMapTableSet.m @@ -26,12 +26,11 @@ [self inheritMethodsFromClass: [OFMapTableSet class]]; } - (void)addObject: (id)object { - [_mapTable setObject: (void *)1 - forKey: object]; + [_mapTable setObject: (void *)1 forKey: object]; } - (void)removeObject: (id)object { [_mapTable removeObjectForKey: object]; Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -1035,12 +1035,11 @@ OFList *queue = [state->_readQueues objectForKey: object]; \ type *queueItem; \ \ if (queue == nil) { \ queue = [OFList list]; \ - [state->_readQueues setObject: queue \ - forKey: object]; \ + [state->_readQueues setObject: queue forKey: object]; \ } \ \ if (queue.count == 0) \ [state->_kernelEventObserver \ addObjectForReading: object]; \ @@ -1054,12 +1053,11 @@ OFList *queue = [state->_writeQueues objectForKey: object]; \ type *queueItem; \ \ if (queue == nil) { \ queue = [OFList list]; \ - [state->_writeQueues setObject: queue \ - forKey: object]; \ + [state->_writeQueues setObject: queue forKey: object]; \ } \ \ if (queue.count == 0) \ [state->_kernelEventObserver \ addObjectForWriting: object]; \ @@ -1382,12 +1380,11 @@ state = [_states objectForKey: mode]; if (create && state == nil) { state = [[OFRunLoopState alloc] init]; @try { - [_states setObject: state - forKey: mode]; + [_states setObject: state forKey: mode]; } @finally { [state release]; } } #ifdef OF_HAVE_THREADS Index: src/OFSeekableStream.h ================================================================== --- src/OFSeekableStream.h +++ src/OFSeekableStream.h @@ -69,12 +69,11 @@ * `SEEK_SET` | Seek to the specified byte * `SEEK_CUR` | Seek to the current location + offset * `SEEK_END` | Seek to the end of the stream + offset * @return The new offset form the start of the file */ -- (of_offset_t)seekToOffset: (of_offset_t)offset - whence: (int)whence; +- (of_offset_t)seekToOffset: (of_offset_t)offset whence: (int)whence; /** * @brief Seek the stream on the lowlevel. * * @warning Do not call this directly! @@ -90,10 +89,9 @@ * `SEEK_SET` | Seek to the specified byte * `SEEK_CUR` | Seek to the current location + offset * `SEEK_END` | Seek to the end of the stream + offset * @return The new offset from the start of the file */ -- (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset - whence: (int)whence; +- (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence; @end OF_ASSUME_NONNULL_END Index: src/OFSeekableStream.m ================================================================== --- src/OFSeekableStream.m +++ src/OFSeekableStream.m @@ -36,27 +36,24 @@ } return [super init]; } -- (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset - whence: (int)whence +- (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence { OF_UNRECOGNIZED_SELECTOR } -- (of_offset_t)seekToOffset: (of_offset_t)offset - whence: (int)whence +- (of_offset_t)seekToOffset: (of_offset_t)offset whence: (int)whence { if (whence == SEEK_CUR) offset -= _readBufferLength; - offset = [self lowlevelSeekToOffset: offset - whence: whence]; + offset = [self lowlevelSeekToOffset: offset whence: whence]; free(_readBufferMemory); _readBuffer = _readBufferMemory = NULL; _readBufferLength = 0; return offset; } @end Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -246,12 +246,11 @@ * @param buffer The buffer into which the data is read * @param length The length of the data that should be read at most. * The buffer *must* be *at least* this big! * @return The number of bytes read */ -- (size_t)readIntoBuffer: (void *)buffer - length: (size_t)length; +- (size_t)readIntoBuffer: (void *)buffer length: (size_t)length; /** * @brief Reads exactly the specified length bytes from the stream into a * buffer. * @@ -264,12 +263,11 @@ * * @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! */ - - (void)readIntoBuffer: (void *)buffer - exactLength: (size_t)length; + - (void)readIntoBuffer: (void *)buffer exactLength: (size_t)length; #ifdef OF_HAVE_SOCKETS /** * @brief Asynchronously reads *at most* size bytes from the stream into a * buffer. @@ -288,12 +286,11 @@ * @param buffer The buffer into which the data is read. * The buffer must not be freed 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! */ -- (void)asyncReadIntoBuffer: (void *)buffer - length: (size_t)length; +- (void)asyncReadIntoBuffer: (void *)buffer length: (size_t)length; /** * @brief Asynchronously reads *at most* size bytes from the stream into a * buffer. * @@ -332,12 +329,11 @@ * * @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! */ -- (void)asyncReadIntoBuffer: (void *)buffer - exactLength: (size_t)length; +- (void)asyncReadIntoBuffer: (void *)buffer exactLength: (size_t)length; /** * @brief Asynchronously reads exactly the specified length bytes from the * stream into a buffer. * @@ -588,12 +584,11 @@ * @param buffer A buffer of sufficient size to store the specified number of * floats * @param count The number of floats to read * @return The number of bytes read */ -- (size_t)readBigEndianFloatsIntoBuffer: (float *)buffer - count: (size_t)count; +- (size_t)readBigEndianFloatsIntoBuffer: (float *)buffer count: (size_t)count; /** * @brief Reads the specified number of doubles from the stream which are * encoded in big endian. * @@ -603,12 +598,11 @@ * @param buffer A buffer of sufficient size to store the specified number of * doubles * @param count The number of doubles to read * @return The number of bytes read */ -- (size_t)readBigEndianDoublesIntoBuffer: (double *)buffer - count: (size_t)count; +- (size_t)readBigEndianDoublesIntoBuffer: (double *)buffer count: (size_t)count; /** * @brief Reads a uint16_t from the stream which is encoded in little endian. * * @warning Only call this when you know that enough data is available! @@ -754,12 +748,11 @@ * * @param itemSize The size of each item * @param count The number of items to read * @return OFData with count items. */ -- (OFData *)readDataWithItemSize: (size_t)itemSize - count: (size_t)count; +- (OFData *)readDataWithItemSize: (size_t)itemSize count: (size_t)count; /** * @brief Returns OFData with all the remaining data of the stream. * * @return OFData with an item size of 1 with all the data of the stream until @@ -984,12 +977,11 @@ * @param buffer The buffer from which the data is written into the stream * @param length The length of the data that should be written * @return The number of bytes written. This can only differ from the specified * length in non-blocking mode. */ -- (size_t)writeBuffer: (const void *)buffer - length: (size_t)length; +- (size_t)writeBuffer: (const void *)buffer length: (size_t)length; #ifdef OF_HAVE_SOCKETS /** * @brief Asynchronously writes data into the stream. * @@ -1186,12 +1178,11 @@ * @param buffer The buffer from which the data is written to the stream after * it has been byte swapped if necessary * @param count The number of uint16_ts to write * @return The number of bytes written to the stream */ -- (size_t)writeBigEndianInt16s: (const uint16_t *)buffer - count: (size_t)count; +- (size_t)writeBigEndianInt16s: (const uint16_t *)buffer count: (size_t)count; /** * @brief Writes the specified number of uint32_ts into the stream, encoded in * big endian. * @@ -1198,12 +1189,11 @@ * @param buffer The buffer from which the data is written to the stream after * it has been byte swapped if necessary * @param count The number of uint32_ts to write * @return The number of bytes written to the stream */ -- (size_t)writeBigEndianInt32s: (const uint32_t *)buffer - count: (size_t)count; +- (size_t)writeBigEndianInt32s: (const uint32_t *)buffer count: (size_t)count; /** * @brief Writes the specified number of uint64_ts into the stream, encoded in * big endian. * @@ -1210,12 +1200,11 @@ * @param buffer The buffer from which the data is written to the stream after * it has been byte swapped if necessary * @param count The number of uint64_ts to write * @return The number of bytes written to the stream */ -- (size_t)writeBigEndianInt64s: (const uint64_t *)buffer - count: (size_t)count; +- (size_t)writeBigEndianInt64s: (const uint64_t *)buffer count: (size_t)count; /** * @brief Writes the specified number of floats into the stream, encoded in big * endian. * @@ -1222,12 +1211,11 @@ * @param buffer The buffer from which the data is written to the stream after * it has been byte swapped if necessary * @param count The number of floats to write * @return The number of bytes written to the stream */ -- (size_t)writeBigEndianFloats: (const float *)buffer - count: (size_t)count; +- (size_t)writeBigEndianFloats: (const float *)buffer count: (size_t)count; /** * @brief Writes the specified number of doubles into the stream, encoded in * big endian. * @@ -1234,12 +1222,11 @@ * @param buffer The buffer from which the data is written to the stream after * it has been byte swapped if necessary * @param count The number of doubles to write * @return The number of bytes written to the stream */ -- (size_t)writeBigEndianDoubles: (const double *)buffer - count: (size_t)count; +- (size_t)writeBigEndianDoubles: (const double *)buffer count: (size_t)count; /** * @brief Writes a uint16_t into the stream, encoded in little endian. * * @param int16 A uint16_t @@ -1317,12 +1304,11 @@ * @param buffer The buffer from which the data is written to the stream after * it has been byte swapped if necessary * @param count The number of floats to write * @return The number of bytes written to the stream */ -- (size_t)writeLittleEndianFloats: (const float *)buffer - count: (size_t)count; +- (size_t)writeLittleEndianFloats: (const float *)buffer count: (size_t)count; /** * @brief Writes the specified number of doubles into the stream, encoded in * little endian. * @@ -1329,12 +1315,11 @@ * @param buffer The buffer from which the data is written to the stream after * it has been byte swapped if necessary * @param count The number of doubles to write * @return The number of bytes written to the stream */ -- (size_t)writeLittleEndianDoubles: (const double *)buffer - count: (size_t)count; +- (size_t)writeLittleEndianDoubles: (const double *)buffer count: (size_t)count; /** * @brief Writes OFData into the stream. * * @param data The OFData to write into the stream @@ -1401,12 +1386,11 @@ * * @param format A string used as format * @param arguments The arguments used in the format string * @return The number of bytes written */ -- (size_t)writeFormat: (OFConstantString *)format - arguments: (va_list)arguments; +- (size_t)writeFormat: (OFConstantString *)format arguments: (va_list)arguments; #ifdef OF_HAVE_SOCKETS /** * @brief Cancels all pending asynchronous requests on the stream. */ @@ -1432,12 +1416,11 @@ * unread. * * @param buffer The buffer to unread * @param length The length of the buffer to unread */ -- (void)unreadFromBuffer: (const void *)buffer - length: (size_t)length; +- (void)unreadFromBuffer: (const void *)buffer length: (size_t)length; /** * @brief Closes the stream. * * @note If you override this, make sure to call `[super close]`! @@ -1454,12 +1437,11 @@ * * @param buffer The buffer for the data to read * @param length The length of the buffer * @return The number of bytes read */ -- (size_t)lowlevelReadIntoBuffer: (void *)buffer - length: (size_t)length; +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length; /** * @brief Performs a lowlevel write. * * @warning Do not call this directly! @@ -1469,12 +1451,11 @@ * * @param buffer The buffer with the data to write * @param length The length of the data to write * @return The number of bytes written */ -- (size_t)lowlevelWriteBuffer: (const void *)buffer - length: (size_t)length; +- (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length; /** * @brief Returns whether the lowlevel is at the end of the stream. * * @warning Do not call this directly! Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -102,18 +102,16 @@ - (bool)lowlevelIsAtEndOfStream { OF_UNRECOGNIZED_SELECTOR } -- (size_t)lowlevelReadIntoBuffer: (void *)buffer - length: (size_t)length +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { OF_UNRECOGNIZED_SELECTOR } -- (size_t)lowlevelWriteBuffer: (const void *)buffer - length: (size_t)length +- (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { OF_UNRECOGNIZED_SELECTOR } - (id)copy @@ -161,12 +159,11 @@ memcpy(buffer, tmp, bytesRead); return bytesRead; } } - return [self lowlevelReadIntoBuffer: buffer - length: length]; + return [self lowlevelReadIntoBuffer: buffer length: length]; } if (length >= _readBufferLength) { size_t ret = _readBufferLength; memcpy(buffer, _readBuffer, _readBufferLength); @@ -184,12 +181,11 @@ return length; } } -- (void)readIntoBuffer: (void *)buffer - exactLength: (size_t)length +- (void)readIntoBuffer: (void *)buffer exactLength: (size_t)length { size_t readLength = 0; while (readLength < length) { if (self.atEndOfStream) @@ -199,12 +195,11 @@ length: length - readLength]; } } #ifdef OF_HAVE_SOCKETS -- (void)asyncReadIntoBuffer: (void *)buffer - length: (size_t)length +- (void)asyncReadIntoBuffer: (void *)buffer length: (size_t)length { [self asyncReadIntoBuffer: buffer length: length runLoopMode: of_run_loop_mode_default]; } @@ -224,12 +219,11 @@ block: NULL # endif delegate: _delegate]; } -- (void)asyncReadIntoBuffer: (void *)buffer - exactLength: (size_t)length +- (void)asyncReadIntoBuffer: (void *)buffer exactLength: (size_t)length { [self asyncReadIntoBuffer: buffer exactLength: length runLoopMode: of_run_loop_mode_default]; } @@ -307,163 +301,135 @@ #endif - (uint8_t)readInt8 { uint8_t ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 1]; - + [self readIntoBuffer: (char *)&ret exactLength: 1]; return ret; } - (uint16_t)readBigEndianInt16 { uint16_t ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 2]; - + [self readIntoBuffer: (char *)&ret exactLength: 2]; return OF_BSWAP16_IF_LE(ret); } - (uint32_t)readBigEndianInt32 { uint32_t ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 4]; - + [self readIntoBuffer: (char *)&ret exactLength: 4]; return OF_BSWAP32_IF_LE(ret); } - (uint64_t)readBigEndianInt64 { uint64_t ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 8]; - + [self readIntoBuffer: (char *)&ret exactLength: 8]; return OF_BSWAP64_IF_LE(ret); } - (float)readBigEndianFloat { float ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 4]; - + [self readIntoBuffer: (char *)&ret exactLength: 4]; return OF_BSWAP_FLOAT_IF_LE(ret); } - (double)readBigEndianDouble { double ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 8]; - + [self readIntoBuffer: (char *)&ret exactLength: 8]; return OF_BSWAP_DOUBLE_IF_LE(ret); } -- (size_t)readBigEndianInt16sIntoBuffer: (uint16_t *)buffer - count: (size_t)count +- (size_t)readBigEndianInt16sIntoBuffer: (uint16_t *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint16_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint16_t); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP16(buffer[i]); #endif return size; } -- (size_t)readBigEndianInt32sIntoBuffer: (uint32_t *)buffer - count: (size_t)count +- (size_t)readBigEndianInt32sIntoBuffer: (uint32_t *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint32_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint32_t); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP32(buffer[i]); #endif return size; } -- (size_t)readBigEndianInt64sIntoBuffer: (uint64_t *)buffer - count: (size_t)count +- (size_t)readBigEndianInt64sIntoBuffer: (uint64_t *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint64_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint64_t); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP64(buffer[i]); #endif return size; } -- (size_t)readBigEndianFloatsIntoBuffer: (float *)buffer - count: (size_t)count +- (size_t)readBigEndianFloatsIntoBuffer: (float *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(float)) @throw [OFOutOfRangeException exception]; size = count * sizeof(float); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_FLOAT_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP_FLOAT(buffer[i]); #endif return size; } -- (size_t)readBigEndianDoublesIntoBuffer: (double *)buffer - count: (size_t)count +- (size_t)readBigEndianDoublesIntoBuffer: (double *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(double)) @throw [OFOutOfRangeException exception]; size = count * sizeof(double); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_FLOAT_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP_DOUBLE(buffer[i]); #endif @@ -472,54 +438,39 @@ } - (uint16_t)readLittleEndianInt16 { uint16_t ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 2]; - + [self readIntoBuffer: (char *)&ret exactLength: 2]; return OF_BSWAP16_IF_BE(ret); } - (uint32_t)readLittleEndianInt32 { uint32_t ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 4]; - + [self readIntoBuffer: (char *)&ret exactLength: 4]; return OF_BSWAP32_IF_BE(ret); } - (uint64_t)readLittleEndianInt64 { uint64_t ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 8]; - + [self readIntoBuffer: (char *)&ret exactLength: 8]; return OF_BSWAP64_IF_BE(ret); } - (float)readLittleEndianFloat { float ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 4]; - + [self readIntoBuffer: (char *)&ret exactLength: 4]; return OF_BSWAP_FLOAT_IF_BE(ret); } - (double)readLittleEndianDouble { double ret; - - [self readIntoBuffer: (char *)&ret - exactLength: 8]; - + [self readIntoBuffer: (char *)&ret exactLength: 8]; return OF_BSWAP_DOUBLE_IF_BE(ret); } - (size_t)readLittleEndianInt16sIntoBuffer: (uint16_t *)buffer count: (size_t)count @@ -529,12 +480,11 @@ if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint16_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint16_t); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP16(buffer[i]); #endif @@ -550,12 +500,11 @@ if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint32_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint32_t); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP32(buffer[i]); #endif @@ -571,12 +520,11 @@ if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint64_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint64_t); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP64(buffer[i]); #endif @@ -592,12 +540,11 @@ if OF_UNLIKELY (count > SIZE_MAX / sizeof(float)) @throw [OFOutOfRangeException exception]; size = count * sizeof(float); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_FLOAT_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP_FLOAT(buffer[i]); #endif @@ -613,12 +560,11 @@ if OF_UNLIKELY (count > SIZE_MAX / sizeof(double)) @throw [OFOutOfRangeException exception]; size = count * sizeof(double); - [self readIntoBuffer: buffer - exactLength: size]; + [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_FLOAT_BIG_ENDIAN for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP_DOUBLE(buffer[i]); #endif @@ -626,28 +572,24 @@ return size; } - (OFData *)readDataWithCount: (size_t)count { - return [self readDataWithItemSize: 1 - count: count]; + return [self readDataWithItemSize: 1 count: count]; } -- (OFData *)readDataWithItemSize: (size_t)itemSize - count: (size_t)count +- (OFData *)readDataWithItemSize: (size_t)itemSize count: (size_t)count { OFData *ret; char *buffer; if OF_UNLIKELY (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; buffer = of_alloc(count, itemSize); @try { - [self readIntoBuffer: buffer - exactLength: count * itemSize]; - + [self readIntoBuffer: buffer exactLength: count * itemSize]; ret = [OFData dataWithItemsNoCopy: buffer count: count itemSize: itemSize freeWhenDone: true]; } @catch (id e) { @@ -664,16 +606,13 @@ size_t pageSize = [OFSystemInfo pageSize]; char *buffer = of_alloc(1, pageSize); @try { while (!self.atEndOfStream) { - size_t length; - - length = [self readIntoBuffer: buffer - length: pageSize]; - [data addItems: buffer - count: length]; + size_t length = + [self readIntoBuffer: buffer length: pageSize]; + [data addItems: buffer count: length]; } } @finally { free(buffer); } @@ -694,15 +633,12 @@ OFString *ret; char *buffer = of_alloc(length + 1, 1); buffer[length] = 0; @try { - [self readIntoBuffer: buffer - exactLength: length]; - - ret = [OFString stringWithCString: buffer - encoding: encoding]; + [self readIntoBuffer: buffer exactLength: length]; + ret = [OFString stringWithCString: buffer encoding: encoding]; } @finally { free(buffer); } return ret; @@ -1125,12 +1061,11 @@ - (void)flushWriteBuffer { if (_writeBuffer == NULL) return; - [self lowlevelWriteBuffer: _writeBuffer - length: _writeBufferLength]; + [self lowlevelWriteBuffer: _writeBuffer length: _writeBufferLength]; free(_writeBuffer); _writeBuffer = NULL; _writeBufferLength = 0; } @@ -1161,12 +1096,11 @@ } #ifdef OF_HAVE_SOCKETS - (void)asyncWriteData: (OFData *)data { - [self asyncWriteData: data - runLoopMode: of_run_loop_mode_default]; + [self asyncWriteData: data runLoopMode: of_run_loop_mode_default]; } - (void)asyncWriteData: (OFData *)data runLoopMode: (of_run_loop_mode_t)runLoopMode { @@ -1274,196 +1208,170 @@ # endif #endif - (void)writeInt8: (uint8_t)int8 { - [self writeBuffer: (char *)&int8 - length: 1]; + [self writeBuffer: (char *)&int8 length: 1]; } - (void)writeBigEndianInt16: (uint16_t)int16 { int16 = OF_BSWAP16_IF_LE(int16); - - [self writeBuffer: (char *)&int16 - length: 2]; + [self writeBuffer: (char *)&int16 length: 2]; } - (void)writeBigEndianInt32: (uint32_t)int32 { int32 = OF_BSWAP32_IF_LE(int32); - - [self writeBuffer: (char *)&int32 - length: 4]; + [self writeBuffer: (char *)&int32 length: 4]; } - (void)writeBigEndianInt64: (uint64_t)int64 { int64 = OF_BSWAP64_IF_LE(int64); - - [self writeBuffer: (char *)&int64 - length: 8]; + [self writeBuffer: (char *)&int64 length: 8]; } - (void)writeBigEndianFloat: (float)float_ { float_ = OF_BSWAP_FLOAT_IF_LE(float_); - - [self writeBuffer: (char *)&float_ - length: 4]; + [self writeBuffer: (char *)&float_ length: 4]; } - (void)writeBigEndianDouble: (double)double_ { double_ = OF_BSWAP_DOUBLE_IF_LE(double_); - - [self writeBuffer: (char *)&double_ - length: 8]; + [self writeBuffer: (char *)&double_ length: 8]; } -- (size_t)writeBigEndianInt16s: (const uint16_t *)buffer - count: (size_t)count +- (size_t)writeBigEndianInt16s: (const uint16_t *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint16_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint16_t); #ifdef OF_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else uint16_t *tmp = of_alloc(count, sizeof(uint16_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP16(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif return size; } -- (size_t)writeBigEndianInt32s: (const uint32_t *)buffer - count: (size_t)count +- (size_t)writeBigEndianInt32s: (const uint32_t *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint32_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint32_t); #ifdef OF_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else uint32_t *tmp = of_alloc(count, sizeof(uint32_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP32(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif return size; } -- (size_t)writeBigEndianInt64s: (const uint64_t *)buffer - count: (size_t)count +- (size_t)writeBigEndianInt64s: (const uint64_t *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint64_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint64_t); #ifdef OF_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else uint64_t *tmp = of_alloc(count, sizeof(uint64_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP64(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif return size; } -- (size_t)writeBigEndianFloats: (const float *)buffer - count: (size_t)count +- (size_t)writeBigEndianFloats: (const float *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(float)) @throw [OFOutOfRangeException exception]; size = count * sizeof(float); #ifdef OF_FLOAT_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else float *tmp = of_alloc(count, sizeof(float)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_FLOAT(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif return size; } -- (size_t)writeBigEndianDoubles: (const double *)buffer - count: (size_t)count +- (size_t)writeBigEndianDoubles: (const double *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(double)) @throw [OFOutOfRangeException exception]; size = count * sizeof(double); #ifdef OF_FLOAT_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else double *tmp = of_alloc(count, sizeof(double)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_DOUBLE(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif @@ -1471,189 +1379,164 @@ } - (void)writeLittleEndianInt16: (uint16_t)int16 { int16 = OF_BSWAP16_IF_BE(int16); - - [self writeBuffer: (char *)&int16 - length: 2]; + [self writeBuffer: (char *)&int16 length: 2]; } - (void)writeLittleEndianInt32: (uint32_t)int32 { int32 = OF_BSWAP32_IF_BE(int32); - - [self writeBuffer: (char *)&int32 - length: 4]; + [self writeBuffer: (char *)&int32 length: 4]; } - (void)writeLittleEndianInt64: (uint64_t)int64 { int64 = OF_BSWAP64_IF_BE(int64); - - [self writeBuffer: (char *)&int64 - length: 8]; + [self writeBuffer: (char *)&int64 length: 8]; } - (void)writeLittleEndianFloat: (float)float_ { float_ = OF_BSWAP_FLOAT_IF_BE(float_); - - [self writeBuffer: (char *)&float_ - length: 4]; + [self writeBuffer: (char *)&float_ length: 4]; } - (void)writeLittleEndianDouble: (double)double_ { double_ = OF_BSWAP_DOUBLE_IF_BE(double_); - - [self writeBuffer: (char *)&double_ - length: 8]; + [self writeBuffer: (char *)&double_ length: 8]; } -- (size_t)writeLittleEndianInt16s: (const uint16_t *)buffer - count: (size_t)count +- (size_t)writeLittleEndianInt16s: (const uint16_t *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint16_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint16_t); #ifndef OF_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else uint16_t *tmp = of_alloc(count, sizeof(uint16_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP16(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif return size; } -- (size_t)writeLittleEndianInt32s: (const uint32_t *)buffer - count: (size_t)count +- (size_t)writeLittleEndianInt32s: (const uint32_t *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint32_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint32_t); #ifndef OF_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else uint32_t *tmp = of_alloc(count, sizeof(uint32_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP32(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif return size; } -- (size_t)writeLittleEndianInt64s: (const uint64_t *)buffer - count: (size_t)count +- (size_t)writeLittleEndianInt64s: (const uint64_t *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(uint64_t)) @throw [OFOutOfRangeException exception]; size = count * sizeof(uint64_t); #ifndef OF_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else uint64_t *tmp = of_alloc(count, sizeof(uint64_t)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP64(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif return size; } -- (size_t)writeLittleEndianFloats: (const float *)buffer - count: (size_t)count +- (size_t)writeLittleEndianFloats: (const float *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(float)) @throw [OFOutOfRangeException exception]; size = count * sizeof(float); #ifndef OF_FLOAT_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else float *tmp = of_alloc(count, sizeof(float)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_FLOAT(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif return size; } -- (size_t)writeLittleEndianDoubles: (const double *)buffer - count: (size_t)count +- (size_t)writeLittleEndianDoubles: (const double *)buffer count: (size_t)count { size_t size; if OF_UNLIKELY (count > SIZE_MAX / sizeof(double)) @throw [OFOutOfRangeException exception]; size = count * sizeof(double); #ifndef OF_FLOAT_BIG_ENDIAN - [self writeBuffer: buffer - length: size]; + [self writeBuffer: buffer length: size]; #else double *tmp = of_alloc(count, sizeof(double)); @try { for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_DOUBLE(buffer[i]); - [self writeBuffer: tmp - length: size]; + [self writeBuffer: tmp length: size]; } @finally { free(tmp); } #endif @@ -1667,24 +1550,22 @@ if (data == nil) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); + length = data.count * data.itemSize; - - [self writeBuffer: data.items - length: length]; + [self writeBuffer: data.items length: length]; objc_autoreleasePoolPop(pool); return length; } - (size_t)writeString: (OFString *)string { - return [self writeString: string - encoding: OF_STRING_ENCODING_UTF_8]; + return [self writeString: string encoding: OF_STRING_ENCODING_UTF_8]; } - (size_t)writeString: (OFString *)string encoding: (of_string_encoding_t)encoding { @@ -1705,16 +1586,14 @@ return length; } - (size_t)writeLine: (OFString *)string { - return [self writeLine: string - encoding: OF_STRING_ENCODING_UTF_8]; + return [self writeLine: string encoding: OF_STRING_ENCODING_UTF_8]; } -- (size_t)writeLine: (OFString *)string - encoding: (of_string_encoding_t)encoding +- (size_t)writeLine: (OFString *)string encoding: (of_string_encoding_t)encoding { size_t stringLength = [string cStringLengthWithEncoding: encoding]; char *buffer; buffer = of_alloc(stringLength + 1, 1); @@ -1722,12 +1601,11 @@ @try { memcpy(buffer, [string cStringWithEncoding: encoding], stringLength); buffer[stringLength] = '\n'; - [self writeBuffer: buffer - length: stringLength + 1]; + [self writeBuffer: buffer length: stringLength + 1]; } @finally { free(buffer); } return stringLength + 1; @@ -1737,19 +1615,17 @@ { va_list arguments; size_t ret; va_start(arguments, format); - ret = [self writeFormat: format - arguments: arguments]; + ret = [self writeFormat: format arguments: arguments]; va_end(arguments); return ret; } -- (size_t)writeFormat: (OFConstantString *)format - arguments: (va_list)arguments +- (size_t)writeFormat: (OFConstantString *)format arguments: (va_list)arguments { char *UTF8String; int length; if (format == nil) @@ -1758,12 +1634,11 @@ if ((length = of_vasprintf(&UTF8String, format.UTF8String, arguments)) == -1) @throw [OFInvalidFormatException exception]; @try { - [self writeBuffer: UTF8String - length: length]; + [self writeBuffer: UTF8String length: length]; } @finally { free(UTF8String); } return length; @@ -1862,12 +1737,11 @@ [OFRunLoop of_cancelAsyncRequestsForObject: self mode: of_run_loop_mode_default]; } #endif -- (void)unreadFromBuffer: (const void *)buffer - length: (size_t)length +- (void)unreadFromBuffer: (const void *)buffer length: (size_t)length { char *readBuffer; if (length > SIZE_MAX - _readBufferLength) @throw [OFOutOfRangeException exception]; Index: src/OFString+JSONParsing.m ================================================================== --- src/OFString+JSONParsing.m +++ src/OFString+JSONParsing.m @@ -502,12 +502,11 @@ object = nextObject(pointer, stop, line, depthLimit); if (object == nil) return nil; - [dictionary setObject: object - forKey: key]; + [dictionary setObject: object forKey: key]; skipWhitespacesAndComments(pointer, stop, line); if (*pointer >= stop) return nil; Index: src/OFString+PropertyListParsing.m ================================================================== --- src/OFString+PropertyListParsing.m +++ src/OFString+PropertyListParsing.m @@ -64,12 +64,11 @@ (object = [enumerator nextObject])) { if (key.namespace != nil || key.attributes.count != 0 || ![key.name isEqual: @"key"]) @throw [OFInvalidFormatException exception]; - [ret setObject: parseElement(object) - forKey: key.stringValue]; + [ret setObject: parseElement(object) forKey: key.stringValue]; } [ret makeImmutable]; objc_autoreleasePoolPop(pool); Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -907,12 +907,11 @@ * buffer. * * @param buffer The buffer to store the Unicode characters * @param range The range of the Unicode characters to copy */ -- (void)getCharacters: (of_unichar_t *)buffer - inRange: (of_range_t)range; +- (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range; /** * @brief Returns the range of the first occurrence of the string. * * @param string The string to search @@ -931,12 +930,11 @@ * -----------------------------|------------------------------- * `OF_STRING_SEARCH_BACKWARDS` | Search backwards in the string * @return The range of the first occurrence of the string or a range with * `OF_NOT_FOUND` as start position if it was not found */ -- (of_range_t)rangeOfString: (OFString *)string - options: (int)options; +- (of_range_t)rangeOfString: (OFString *)string options: (int)options; /** * @brief Returns the range of the string in the specified range. * * @param string The string to search @@ -1242,12 +1240,11 @@ * encoding. * * @param path The path of the file to write to * @param encoding The encoding to use to write the string into the file */ -- (void)writeToFile: (OFString *)path - encoding: (of_string_encoding_t)encoding; +- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding; # endif /** * @brief Writes the string to the specified URL using UTF-8 encoding. * @@ -1259,12 +1256,11 @@ * @brief Writes the string to the specified URL using the specified encoding. * * @param URL The URL to write to * @param encoding The encoding to use to write the string to the URL */ -- (void)writeToURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding; +- (void)writeToURL: (OFURL *)URL encoding: (of_string_encoding_t)encoding; # ifdef OF_HAVE_BLOCKS /** * Enumerates all lines in the receiver using the specified block. * Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -349,21 +349,19 @@ for (size_t i = 0; i < length; i++) { of_unichar_t c = characters[i]; const char *const *page; if (c >= size) { - [ret appendCharacters: &c - length: 1]; + [ret appendCharacters: &c length: 1]; continue; } page = table[c >> 8]; if (page != NULL && page[c & 0xFF] != NULL) [ret appendUTF8String: page[c & 0xFF]]; else - [ret appendCharacters: &c - length: 1]; + [ret appendCharacters: &c length: 1]; } objc_autoreleasePoolPop(pool); return ret; @@ -966,12 +964,11 @@ { id ret; va_list arguments; va_start(arguments, format); - ret = [self initWithFormat: format - arguments: arguments]; + ret = [self initWithFormat: format arguments: arguments]; va_end(arguments); return ret; } @@ -1022,12 +1019,11 @@ if (SIZE_MAX - (size_t)fileSize < 1) @throw [OFOutOfRangeException exception]; tmp = of_alloc((size_t)fileSize + 1, 1); @try { - file = [[OFFile alloc] initWithPath: path - mode: @"r"]; + file = [[OFFile alloc] initWithPath: path mode: @"r"]; [file readIntoBuffer: tmp exactLength: (size_t)fileSize]; } @catch (id e) { free(tmp); @@ -1443,18 +1439,16 @@ } } - (const char *)cStringWithEncoding: (of_string_encoding_t)encoding { - return [self of_cStringWithEncoding: encoding - lossy: false]; + return [self of_cStringWithEncoding: encoding lossy: false]; } - (const char *)lossyCStringWithEncoding: (of_string_encoding_t)encoding { - return [self of_cStringWithEncoding: encoding - lossy: true]; + return [self of_cStringWithEncoding: encoding lossy: true]; } - (const char *)UTF8String { return [self cStringWithEncoding: OF_STRING_ENCODING_UTF_8]; @@ -1720,42 +1714,33 @@ return [element autorelease]; } - (OFString *)JSONRepresentation { - return [self of_JSONRepresentationWithOptions: 0 - depth: 0]; + return [self of_JSONRepresentationWithOptions: 0 depth: 0]; } - (OFString *)JSONRepresentationWithOptions: (int)options { - return [self of_JSONRepresentationWithOptions: options - depth: 0]; + return [self of_JSONRepresentationWithOptions: options depth: 0]; } - (OFString *)of_JSONRepresentationWithOptions: (int)options depth: (size_t)depth { OFMutableString *JSON = [[self mutableCopy] autorelease]; /* FIXME: This is slow! Write it in pure C! */ - [JSON replaceOccurrencesOfString: @"\\" - withString: @"\\\\"]; - [JSON replaceOccurrencesOfString: @"\"" - withString: @"\\\""]; - [JSON replaceOccurrencesOfString: @"\b" - withString: @"\\b"]; - [JSON replaceOccurrencesOfString: @"\f" - withString: @"\\f"]; - [JSON replaceOccurrencesOfString: @"\r" - withString: @"\\r"]; - [JSON replaceOccurrencesOfString: @"\t" - withString: @"\\t"]; + [JSON replaceOccurrencesOfString: @"\\" withString: @"\\\\"]; + [JSON replaceOccurrencesOfString: @"\"" withString: @"\\\""]; + [JSON replaceOccurrencesOfString: @"\b" withString: @"\\b"]; + [JSON replaceOccurrencesOfString: @"\f" withString: @"\\f"]; + [JSON replaceOccurrencesOfString: @"\r" withString: @"\\r"]; + [JSON replaceOccurrencesOfString: @"\t" withString: @"\\t"]; if (options & OF_JSON_REPRESENTATION_JSON5) { - [JSON replaceOccurrencesOfString: @"\n" - withString: @"\\\n"]; + [JSON replaceOccurrencesOfString: @"\n" withString: @"\\\n"]; if (options & OF_JSON_REPRESENTATION_IDENTIFIER) { const char *cString = self.UTF8String; if ((!of_ascii_isalpha(cString[0]) && @@ -1767,12 +1752,11 @@ } else { [JSON prependString: @"\""]; [JSON appendString: @"\""]; } } else { - [JSON replaceOccurrencesOfString: @"\n" - withString: @"\\n"]; + [JSON replaceOccurrencesOfString: @"\n" withString: @"\\n"]; [JSON prependString: @"\""]; [JSON appendString: @"\""]; } @@ -1789,48 +1773,41 @@ length = self.UTF8StringLength; if (length <= 31) { uint8_t tmp = 0xA0 | ((uint8_t)length & 0x1F); - data = [OFMutableData dataWithItemSize: 1 - capacity: length + 1]; + data = [OFMutableData dataWithItemSize: 1 capacity: length + 1]; [data addItem: &tmp]; } else if (length <= UINT8_MAX) { uint8_t type = 0xD9; uint8_t tmp = (uint8_t)length; - data = [OFMutableData dataWithItemSize: 1 - capacity: length + 2]; + data = [OFMutableData dataWithItemSize: 1 capacity: length + 2]; [data addItem: &type]; [data addItem: &tmp]; } else if (length <= UINT16_MAX) { uint8_t type = 0xDA; uint16_t tmp = OF_BSWAP16_IF_LE((uint16_t)length); - data = [OFMutableData dataWithItemSize: 1 - capacity: length + 3]; + data = [OFMutableData dataWithItemSize: 1 capacity: length + 3]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (length <= UINT32_MAX) { uint8_t type = 0xDB; uint32_t tmp = OF_BSWAP32_IF_LE((uint32_t)length); - data = [OFMutableData dataWithItemSize: 1 - capacity: length + 5]; + data = [OFMutableData dataWithItemSize: 1 capacity: length + 5]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else @throw [OFOutOfRangeException exception]; - [data addItems: self.UTF8String - count: length]; + [data addItems: self.UTF8String count: length]; return data; } - (of_range_t)rangeOfString: (OFString *)string @@ -1870,12 +1847,11 @@ searchCharacters = string.characters; characters = of_alloc(range.length, sizeof(of_unichar_t)); @try { - [self getCharacters: characters - inRange: range]; + [self getCharacters: characters inRange: range]; if (options & OF_STRING_SEARCH_BACKWARDS) { for (size_t i = range.length - searchLength;; i--) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(of_unichar_t)) == 0) { @@ -1938,12 +1914,11 @@ if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exception]; characters = of_alloc(range.length, sizeof(of_unichar_t)); @try { - [self getCharacters: characters - inRange: range]; + [self getCharacters: characters inRange: range]; if (options & OF_STRING_SEARCH_BACKWARDS) { for (size_t i = range.length - 1;; i--) { if (characterIsMember(characterSet, @selector(characterIsMember:), @@ -2042,135 +2017,101 @@ { OFString *ret; va_list arguments; va_start(arguments, format); - ret = [self stringByAppendingFormat: format - arguments: arguments]; + ret = [self stringByAppendingFormat: format arguments: arguments]; va_end(arguments); return ret; } - (OFString *)stringByAppendingFormat: (OFConstantString *)format arguments: (va_list)arguments { - OFMutableString *new; - - new = [OFMutableString stringWithString: self]; - [new appendFormat: format - arguments: arguments]; - + OFMutableString *new = [OFMutableString stringWithString: self]; + [new appendFormat: format arguments: arguments]; [new makeImmutable]; - return new; } - (OFString *)stringByPrependingString: (OFString *)string { OFMutableString *new = [[string mutableCopy] autorelease]; - [new appendString: self]; - [new makeImmutable]; - return new; } - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string withString: (OFString *)replacement { OFMutableString *new = [[self mutableCopy] autorelease]; - - [new replaceOccurrencesOfString: string - withString: replacement]; - + [new replaceOccurrencesOfString: string withString: replacement]; [new makeImmutable]; - return new; } - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options range: (of_range_t)range { OFMutableString *new = [[self mutableCopy] autorelease]; - [new replaceOccurrencesOfString: string withString: replacement options: options range: range]; - [new makeImmutable]; - return new; } - (OFString *)uppercaseString { OFMutableString *new = [[self mutableCopy] autorelease]; - [new uppercase]; - [new makeImmutable]; - return new; } - (OFString *)lowercaseString { OFMutableString *new = [[self mutableCopy] autorelease]; - [new lowercase]; - [new makeImmutable]; - return new; } - (OFString *)capitalizedString { OFMutableString *new = [[self mutableCopy] autorelease]; - [new capitalize]; - [new makeImmutable]; - return new; } - (OFString *)stringByDeletingLeadingWhitespaces { OFMutableString *new = [[self mutableCopy] autorelease]; - [new deleteLeadingWhitespaces]; - [new makeImmutable]; - return new; } - (OFString *)stringByDeletingTrailingWhitespaces { OFMutableString *new = [[self mutableCopy] autorelease]; - [new deleteTrailingWhitespaces]; - [new makeImmutable]; - return new; } - (OFString *)stringByDeletingEnclosingWhitespaces { OFMutableString *new = [[self mutableCopy] autorelease]; - [new deleteEnclosingWhitespaces]; - [new makeImmutable]; - return new; } - (bool)hasPrefix: (OFString *)prefix { @@ -2183,12 +2124,11 @@ tmp = of_alloc(prefixLength, sizeof(of_unichar_t)); @try { void *pool = objc_autoreleasePoolPush(); - [self getCharacters: tmp - inRange: of_range(0, prefixLength)]; + [self getCharacters: tmp inRange: of_range(0, prefixLength)]; hasPrefix = (memcmp(tmp, prefix.characters, prefixLength * sizeof(of_unichar_t)) == 0); objc_autoreleasePoolPop(pool); @@ -2231,12 +2171,11 @@ return hasSuffix; } - (OFArray *)componentsSeparatedByString: (OFString *)delimiter { - return [self componentsSeparatedByString: delimiter - options: 0]; + return [self componentsSeparatedByString: delimiter options: 0]; } - (OFArray *)componentsSeparatedByString: (OFString *)delimiter options: (int)options { @@ -2601,12 +2540,11 @@ size_t length = self.length; of_unichar_t *buffer; buffer = of_alloc(length, sizeof(of_unichar_t)); @try { - [self getCharacters: buffer - inRange: of_range(0, length)]; + [self getCharacters: buffer inRange: of_range(0, length)]; return [[OFData dataWithItemsNoCopy: buffer count: length itemSize: sizeof(of_unichar_t) freeWhenDone: true] items]; @@ -2703,12 +2641,11 @@ size_t length = self.length; of_char32_t *buffer; buffer = of_alloc(length + 1, sizeof(of_char32_t)); @try { - [self getCharacters: buffer - inRange: of_range(0, length)]; + [self getCharacters: buffer inRange: of_range(0, length)]; buffer[length] = 0; if (byteOrder != OF_BYTE_ORDER_NATIVE) for (size_t i = 0; i < length; i++) buffer[i] = OF_BSWAP32(buffer[i]); @@ -2782,33 +2719,29 @@ #endif #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { - [self writeToFile: path - encoding: OF_STRING_ENCODING_UTF_8]; + [self writeToFile: path encoding: OF_STRING_ENCODING_UTF_8]; } - (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding { void *pool = objc_autoreleasePoolPush(); - OFFile *file; - file = [OFFile fileWithPath: path - mode: @"w"]; + OFFile *file = [OFFile fileWithPath: path mode: @"w"]; [file writeString: self encoding: encoding]; objc_autoreleasePoolPop(pool); } #endif - (void)writeToURL: (OFURL *)URL { - [self writeToURL: URL - encoding: OF_STRING_ENCODING_UTF_8]; + [self writeToURL: URL encoding: OF_STRING_ENCODING_UTF_8]; } - (void)writeToURL: (OFURL *)URL encoding: (of_string_encoding_t)encoding { @@ -2817,14 +2750,12 @@ OFStream *stream; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; - stream = [URLHandler openItemAtURL: URL - mode: @"w"]; - [stream writeString: self - encoding: encoding]; + stream = [URLHandler openItemAtURL: URL mode: @"w"]; + [stream writeString: self encoding: encoding]; objc_autoreleasePoolPop(pool); } #ifdef OF_HAVE_BLOCKS Index: src/OFURLHandler.m ================================================================== --- src/OFURLHandler.m +++ src/OFURLHandler.m @@ -80,12 +80,11 @@ if ([handlers objectForKey: scheme] != nil) return false; handler = [[class alloc] initWithScheme: scheme]; @try { - [handlers setObject: handler - forKey: scheme]; + [handlers setObject: handler forKey: scheme]; } @finally { [handler release]; } #ifdef OF_HAVE_THREADS } @finally { Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -436,12 +436,11 @@ tmp = [[allNS mutableCopy] autorelease]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) - [tmp setObject: object - forKey: key]; + [tmp setObject: object forKey: key]; allNS = tmp; } else allNS = _namespaces; @@ -824,12 +823,11 @@ if (prefix.length == 0) @throw [OFInvalidArgumentException exception]; if (namespace == nil) namespace = @""; - [_namespaces setObject: prefix - forKey: namespace]; + [_namespaces setObject: prefix forKey: namespace]; } - (void)bindPrefix: (OFString *)prefix forNamespace: (OFString *)namespace { Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -370,12 +370,11 @@ if ([_pathToEntryMap objectForKey: entry.fileName] != nil) @throw [OFInvalidFormatException exception]; [_entries addObject: entry]; - [_pathToEntryMap setObject: entry - forKey: entry.fileName]; + [_pathToEntryMap setObject: entry forKey: entry.fileName]; } objc_autoreleasePoolPop(pool); }