Index: src/OFASN1BitString.m ================================================================== --- src/OFASN1BitString.m +++ src/OFASN1BitString.m @@ -138,14 +138,12 @@ bitStringValueCount != roundedUpLength / 8) @throw [OFInvalidFormatException exception]; data = [OFMutableData dataWithCapacity: sizeof(header) + bitStringValueCount]; - [data addItems: header - count: sizeof(header)]; - [data addItems: [_bitStringValue items] - count: bitStringValueCount]; + [data addItems: header count: sizeof(header)]; + [data addItems: [_bitStringValue items] count: bitStringValueCount]; [data makeImmutable]; return data; } Index: src/OFASN1Boolean.m ================================================================== --- src/OFASN1Boolean.m +++ src/OFASN1Boolean.m @@ -78,12 +78,11 @@ OF_ASN1_TAG_NUMBER_BOOLEAN, 1, (_booleanValue ? 0xFF : 0x00) }; - return [OFData dataWithItems: buffer - count: sizeof(buffer)]; + return [OFData dataWithItems: buffer count: sizeof(buffer)]; } - (bool)isEqual: (id)object { OFASN1Boolean *boolean; Index: src/OFAdjacentArray.m ================================================================== --- src/OFAdjacentArray.m +++ src/OFAdjacentArray.m @@ -59,12 +59,11 @@ } return self; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { self = [self init]; @try { id object; @@ -107,12 +106,11 @@ @try { for (size_t i = 0; i < count; i++) [objects[i] retain]; - [_array addItems: objects - count: count]; + [_array addItems: objects count: count]; } @catch (id e) { for (size_t i = 0; i < count; i++) [objects[i] release]; /* Prevent double-release of objects */ @@ -124,12 +122,11 @@ } return self; } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { self = [self init]; @try { bool ok = true; @@ -142,12 +139,11 @@ } if (!ok) @throw [OFInvalidArgumentException exception]; - [_array addItems: objects - count: count]; + [_array addItems: objects count: count]; } @catch (id e) { for (size_t i = 0; i < count; i++) [objects[i] release]; [self release]; @@ -208,12 +204,11 @@ - (id)objectAtIndexedSubscript: (size_t)idx { return *((id *)[_array itemAtIndex: idx]); } -- (void)getObjects: (id *)buffer - inRange: (of_range_t)range +- (void)getObjects: (id *)buffer inRange: (of_range_t)range { id const *objects = _array.items; size_t count = _array.count; if (range.length > SIZE_MAX - range.location || @@ -270,12 +265,11 @@ if ([self isKindOfClass: [OFMutableArray class]]) return [OFArray arrayWithObjects: (id *)_array.items + range.location count: range.length]; - return [OFAdjacentSubarray arrayWithArray: self - range: range]; + return [OFAdjacentSubarray arrayWithArray: self range: range]; } - (bool)isEqual: (id)object { OFArray *otherArray; Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -71,15 +71,13 @@ #endif OF_DIRECT_MEMBERS @interface OFApplication () - (instancetype)of_init OF_METHOD_FAMILY(init); -- (void)of_setArgumentCount: (int *)argc - andArgumentValues: (char **[])argv; +- (void)of_setArgumentCount: (int *)argc andArgumentValues: (char **[])argv; #ifdef OF_WINDOWS -- (void)of_setArgumentCount: (int)argc - andWideArgumentValues: (wchar_t *[])argv; +- (void)of_setArgumentCount: (int)argc andWideArgumentValues: (wchar_t *[])argv; #endif - (void)of_run; @end static OFApplication *app = nil; @@ -114,16 +112,14 @@ app = [[OFApplication alloc] of_init]; #ifdef OF_WINDOWS if ([OFSystemInfo isWindowsNT]) { __wgetmainargs(&wargc, &wargv, &wenvp, _CRT_glob, &si); - [app of_setArgumentCount: wargc - andWideArgumentValues: wargv]; + [app of_setArgumentCount: wargc andWideArgumentValues: wargv]; } else #endif - [app of_setArgumentCount: argc - andArgumentValues: argv]; + [app of_setArgumentCount: argc andArgumentValues: argv]; app.delegate = delegate; [app of_run]; @@ -329,12 +325,11 @@ path = [@"ENV:" stringByAppendingString: name]; if ([fileManager directoryExistsAtPath: path]) continue; - file = [OFFile fileWithPath: path - mode: @"r"]; + file = [OFFile fileWithPath: path mode: @"r"]; value = [file readLineWithEncoding: encoding]; if (value != nil) [_environment setObject: value forKey: name]; @@ -467,12 +462,11 @@ [_environment release]; [super dealloc]; } -- (void)of_setArgumentCount: (int *)argc - andArgumentValues: (char ***)argv +- (void)of_setArgumentCount: (int *)argc andArgumentValues: (char ***)argv { void *pool = objc_autoreleasePoolPush(); OFMutableArray *arguments; of_string_encoding_t encoding; @@ -501,12 +495,11 @@ objc_autoreleasePoolPop(pool); } #ifdef OF_WINDOWS -- (void)of_setArgumentCount: (int)argc - andWideArgumentValues: (wchar_t **)argv +- (void)of_setArgumentCount: (int)argc andWideArgumentValues: (wchar_t **)argv { void *pool = objc_autoreleasePoolPush(); OFMutableArray *arguments; if (argc > 0) { @@ -523,12 +516,11 @@ objc_autoreleasePoolPop(pool); } #endif -- (void)getArgumentCount: (int **)argc - andArgumentValues: (char ****)argv +- (void)getArgumentCount: (int **)argc andArgumentValues: (char ****)argv { *argc = _argc; *argv = _argv; } Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -226,12 +226,11 @@ - (size_t)count { OF_UNRECOGNIZED_SELECTOR } -- (void)getObjects: (id *)buffer - inRange: (of_range_t)range +- (void)getObjects: (id *)buffer inRange: (of_range_t)range { for (size_t i = 0; i < range.length; i++) buffer[i] = [self objectAtIndex: range.location + i]; } @@ -423,11 +422,11 @@ if (self.count == 0) return @""; if (self.count == 1) { OFString *component = - [[self firstObject] performSelector: selector]; + [[self objectAtIndex: 0] performSelector: selector]; if (component == nil) @throw [OFInvalidArgumentException exception]; return component; @@ -868,11 +867,11 @@ __block id current; if (count == 0) return nil; if (count == 1) - return [[[self firstObject] retain] autorelease]; + return [[[self objectAtIndex: 0] retain] autorelease]; [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { id new; Index: src/OFBytesValue.m ================================================================== --- src/OFBytesValue.m +++ src/OFBytesValue.m @@ -45,14 +45,13 @@ free(_bytes); [super dealloc]; } -- (void)getValue: (void *)value - size: (size_t)size +- (void)getValue: (void *)value size: (size_t)size { if (size != _size) @throw [OFOutOfRangeException exception]; memcpy(value, _bytes, _size); } @end Index: src/OFCondition.m ================================================================== --- src/OFCondition.m +++ src/OFCondition.m @@ -124,12 +124,11 @@ { return [self waitForTimeInterval: date.timeIntervalSinceNow]; } #ifdef OF_AMIGAOS -- (bool)waitUntilDate: (OFDate *)date - orExecSignal: (ULONG *)signalMask +- (bool)waitUntilDate: (OFDate *)date orExecSignal: (ULONG *)signalMask { return [self waitForTimeInterval: date.timeIntervalSinceNow orExecSignal: signalMask]; } #endif Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -166,239 +166,201 @@ /* From protocol OFCopying */ - (id)copy { [self finishInitialization]; - return [self copy]; } /* From protocol OFMutableCopying */ - (id)mutableCopy { [self finishInitialization]; - return [self mutableCopy]; } /* From protocol OFComparing */ - (of_comparison_result_t)compare: (id )object { [self finishInitialization]; - return [self compare: object]; } /* From OFObject, but reimplemented in OFString */ - (bool)isEqual: (id)object { [self finishInitialization]; - return [self isEqual: object]; } - (unsigned long)hash { [self finishInitialization]; - return self.hash; } - (OFString *)description { [self finishInitialization]; - return self.description; } /* From OFString */ - (const char *)UTF8String { [self finishInitialization]; - return self.UTF8String; } - (size_t)getCString: (char *)cString_ maxLength: (size_t)maxLength encoding: (of_string_encoding_t)encoding { [self finishInitialization]; - return [self getCString: cString_ maxLength: maxLength encoding: encoding]; } - (const char *)cStringWithEncoding: (of_string_encoding_t)encoding { [self finishInitialization]; - return [self cStringWithEncoding: encoding]; } - (size_t)length { [self finishInitialization]; - return self.length; } - (size_t)UTF8StringLength { [self finishInitialization]; - return self.UTF8StringLength; } - (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding { [self finishInitialization]; - return [self cStringLengthWithEncoding: encoding]; } - (of_comparison_result_t)caseInsensitiveCompare: (OFString *)otherString { [self finishInitialization]; - return [self caseInsensitiveCompare: otherString]; } - (of_unichar_t)characterAtIndex: (size_t)idx { [self finishInitialization]; - return [self characterAtIndex: idx]; } -- (void)getCharacters: (of_unichar_t *)buffer - inRange: (of_range_t)range +- (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range { [self finishInitialization]; - - [self getCharacters: buffer - inRange: range]; + [self getCharacters: buffer inRange: range]; } - (of_range_t)rangeOfString: (OFString *)string { [self finishInitialization]; - return [self rangeOfString: string]; } -- (of_range_t)rangeOfString: (OFString *)string - options: (int)options +- (of_range_t)rangeOfString: (OFString *)string options: (int)options { [self finishInitialization]; - - return [self rangeOfString: string - options: options]; + return [self rangeOfString: string options: options]; } - (of_range_t)rangeOfString: (OFString *)string options: (int)options range: (of_range_t)range { [self finishInitialization]; - - return [self rangeOfString: string - options: options - range: range]; + return [self rangeOfString: string options: options range: range]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet { [self finishInitialization]; - return [self indexOfCharacterFromSet: characterSet]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (int)options { [self finishInitialization]; - - return [self indexOfCharacterFromSet: characterSet - options: options]; + return [self indexOfCharacterFromSet: characterSet options: options]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (int)options range: (of_range_t)range { [self finishInitialization]; - return [self indexOfCharacterFromSet: characterSet options: options range: range]; } - (bool)containsString: (OFString *)string { [self finishInitialization]; - return [self containsString: string]; } - (OFString *)substringFromIndex: (size_t)idx { [self finishInitialization]; - return [self substringFromIndex: idx]; } - (OFString *)substringToIndex: (size_t)idx { [self finishInitialization]; - return [self substringToIndex: idx]; } - (OFString *)substringWithRange: (of_range_t)range { [self finishInitialization]; - return [self substringWithRange: range]; } - (OFString *)stringByAppendingString: (OFString *)string { [self finishInitialization]; - return [self stringByAppendingString: string]; } - (OFString *)stringByAppendingFormat: (OFConstantString *)format arguments: (va_list)arguments { [self finishInitialization]; - - return [self stringByAppendingFormat: format - arguments: arguments]; + return [self stringByAppendingFormat: format arguments: arguments]; } - (OFString *)stringByAppendingPathComponent: (OFString *)component { [self finishInitialization]; - return [self stringByAppendingPathComponent: component]; } - (OFString *)stringByPrependingString: (OFString *)string { [self finishInitialization]; - return [self stringByPrependingString: string]; } - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string withString: (OFString *)replacement { [self finishInitialization]; - return [self stringByReplacingOccurrencesOfString: string withString: replacement]; } - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string @@ -405,282 +367,240 @@ withString: (OFString *)replacement options: (int)options range: (of_range_t)range { [self finishInitialization]; - return [self stringByReplacingOccurrencesOfString: string withString: replacement options: options range: range]; } - (OFString *)uppercaseString { [self finishInitialization]; - return self.uppercaseString; } - (OFString *)lowercaseString { [self finishInitialization]; - return self.lowercaseString; } - (OFString *)capitalizedString { [self finishInitialization]; - return self.capitalizedString; } - (OFString *)stringByDeletingLeadingWhitespaces { [self finishInitialization]; - return self.stringByDeletingLeadingWhitespaces; } - (OFString *)stringByDeletingTrailingWhitespaces { [self finishInitialization]; - return self.stringByDeletingTrailingWhitespaces; } - (OFString *)stringByDeletingEnclosingWhitespaces { [self finishInitialization]; - return self.stringByDeletingEnclosingWhitespaces; } - (bool)hasPrefix: (OFString *)prefix { [self finishInitialization]; - return [self hasPrefix: prefix]; } - (bool)hasSuffix: (OFString *)suffix { [self finishInitialization]; - return [self hasSuffix: suffix]; } - (OFArray *)componentsSeparatedByString: (OFString *)delimiter { [self finishInitialization]; - return [self componentsSeparatedByString: delimiter]; } - (OFArray *)componentsSeparatedByString: (OFString *)delimiter options: (int)options { [self finishInitialization]; - - return [self componentsSeparatedByString: delimiter - options: options]; + return [self componentsSeparatedByString: delimiter options: options]; } - (OFArray *) componentsSeparatedByCharactersInSet: (OFCharacterSet *)characterSet { [self finishInitialization]; - return [self componentsSeparatedByCharactersInSet: characterSet]; } - (OFArray *) componentsSeparatedByCharactersInSet: (OFCharacterSet *)characterSet options: (int)options { [self finishInitialization]; - return [self componentsSeparatedByCharactersInSet: characterSet options: options]; } - (OFArray *)pathComponents { [self finishInitialization]; - return self.pathComponents; } - (OFString *)lastPathComponent { [self finishInitialization]; - return self.lastPathComponent; } - (OFString *)stringByDeletingLastPathComponent { [self finishInitialization]; - return self.stringByDeletingLastPathComponent; } - (long long)longLongValue { [self finishInitialization]; - return self.longLongValue; } - (long long)longLongValueWithBase: (int)base { [self finishInitialization]; - return [self longLongValueWithBase: base]; } - (unsigned long long)unsignedLongLongValue { [self finishInitialization]; - return self.unsignedLongLongValue; } - (unsigned long long)unsignedLongLongValueWithBase: (int)base { [self finishInitialization]; - return [self unsignedLongLongValueWithBase: base]; } - (float)floatValue { [self finishInitialization]; - return self.floatValue; } - (double)doubleValue { [self finishInitialization]; - return self.doubleValue; } - (const of_unichar_t *)characters { [self finishInitialization]; - return self.characters; } - (const of_char16_t *)UTF16String { [self finishInitialization]; - return self.UTF16String; } - (const of_char16_t *)UTF16StringWithByteOrder: (of_byte_order_t)byteOrder { [self finishInitialization]; - return [self UTF16StringWithByteOrder: byteOrder]; } - (size_t)UTF16StringLength { [self finishInitialization]; - return self.UTF16StringLength; } - (const of_char32_t *)UTF32String { [self finishInitialization]; - return self.UTF32String; } - (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder { [self finishInitialization]; - return [self UTF32StringWithByteOrder: byteOrder]; } - (OFData *)dataWithEncoding: (of_string_encoding_t)encoding { [self finishInitialization]; - return [self dataWithEncoding: encoding]; } #ifdef OF_HAVE_UNICODE_TABLES - (OFString *)decomposedStringWithCanonicalMapping { [self finishInitialization]; - return self.decomposedStringWithCanonicalMapping; } - (OFString *)decomposedStringWithCompatibilityMapping { [self finishInitialization]; - return self.decomposedStringWithCompatibilityMapping; } #endif #ifdef OF_WINDOWS - (OFString *)stringByExpandingWindowsEnvironmentStrings { [self finishInitialization]; - return self.stringByExpandingWindowsEnvironmentStrings; } #endif #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { [self finishInitialization]; - [self writeToFile: path]; } -- (void)writeToFile: (OFString *)path - encoding: (of_string_encoding_t)encoding +- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding { [self finishInitialization]; - - [self writeToFile: path - encoding: encoding]; + [self writeToFile: path encoding: encoding]; } #endif - (void)writeToURL: (OFURL *)URL { [self finishInitialization]; - [self writeToURL: URL]; } -- (void)writeToURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding +- (void)writeToURL: (OFURL *)URL encoding: (of_string_encoding_t)encoding { [self finishInitialization]; - - [self writeToURL: URL - encoding: encoding]; + [self writeToURL: URL encoding: encoding]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateLinesUsingBlock: (of_string_line_enumeration_block_t)block { [self finishInitialization]; - [self enumerateLinesUsingBlock: block]; } #endif @end Index: src/OFCountedMapTableSet.m ================================================================== --- src/OFCountedMapTableSet.m +++ src/OFCountedMapTableSet.m @@ -81,12 +81,11 @@ } return self; } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { self = [self init]; @try { for (size_t i = 0; i < count; i++) @@ -97,12 +96,11 @@ } return self; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { self = [self init]; @try { id object; Index: src/OFCountedSet.m ================================================================== --- src/OFCountedSet.m +++ src/OFCountedSet.m @@ -57,19 +57,17 @@ va_end(arguments); return ret; } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { return (id)[[OFCountedMapTableSet alloc] initWithObjects: objects count: count]; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { return (id)[[OFCountedMapTableSet alloc] initWithObject: firstObject arguments: arguments]; } @@ -158,14 +156,12 @@ 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); return ret; Index: src/OFDNSResolver.m ================================================================== --- src/OFDNSResolver.m +++ src/OFDNSResolver.m @@ -489,23 +489,17 @@ queryData = [OFMutableData dataWithCapacity: 512]; /* Header */ tmp = OF_BSWAP16_IF_LE(_ID.unsignedShortValue); - [queryData addItems: &tmp - count: 2]; - + [queryData addItems: &tmp count: 2]; /* RD */ tmp = OF_BSWAP16_IF_LE(1u << 8); - [queryData addItems: &tmp - count: 2]; - + [queryData addItems: &tmp count: 2]; /* QDCOUNT */ tmp = OF_BSWAP16_IF_LE(1); - [queryData addItems: &tmp - count: 2]; - + [queryData addItems: &tmp count: 2]; /* ANCOUNT, NSCOUNT and ARCOUNT */ [queryData increaseCountBy: 6]; /* Question */ @@ -524,18 +518,14 @@ count: length]; } /* QTYPE */ tmp = OF_BSWAP16_IF_LE(_query.recordType); - [queryData addItems: &tmp - count: 2]; - + [queryData addItems: &tmp count: 2]; /* QCLASS */ tmp = OF_BSWAP16_IF_LE(_query.DNSClass); - [queryData addItems: &tmp - count: 2]; - + [queryData addItems: &tmp count: 2]; [queryData makeImmutable]; _queryData = [queryData copy]; objc_autoreleasePoolPop(pool); @@ -830,12 +820,11 @@ context = [[[OFDNSResolverContext alloc] initWithQuery: query ID: ID settings: _settings delegate: delegate] autorelease]; - [self of_sendQueryForContext: context - runLoopMode: runLoopMode]; + [self of_sendQueryForContext: context runLoopMode: runLoopMode]; objc_autoreleasePoolPop(pool); } - (void)of_contextTimedOut: (OFDNSResolverContext *)context @@ -854,19 +843,17 @@ } if (context->_nameServersIndex + 1 < context->_settings->_nameServers.count) { context->_nameServersIndex++; - [self of_sendQueryForContext: context - runLoopMode: runLoopMode]; + [self of_sendQueryForContext: context runLoopMode: runLoopMode]; return; } if (++context->_attempt < context->_settings->_maxAttempts) { context->_nameServersIndex = 0; - [self of_sendQueryForContext: context - runLoopMode: runLoopMode]; + [self of_sendQueryForContext: context runLoopMode: runLoopMode]; return; } context = [[context retain] autorelease]; [_queries removeObjectForKey: context->_ID]; @@ -874,16 +861,14 @@ /* * Cancel any pending queries, to avoid a send being still pending and * trying to access the query once it no longer exists. */ [_IPv4Socket cancelAsyncRequests]; - [_IPv4Socket asyncReceiveIntoBuffer: _buffer - length: BUFFER_LENGTH]; + [_IPv4Socket asyncReceiveIntoBuffer: _buffer length: BUFFER_LENGTH]; #ifdef OF_HAVE_IPV6 [_IPv6Socket cancelAsyncRequests]; - [_IPv6Socket asyncReceiveIntoBuffer: _buffer - length: BUFFER_LENGTH]; + [_IPv6Socket asyncReceiveIntoBuffer: _buffer length: BUFFER_LENGTH]; #endif exception = [OFDNSQueryFailedException exceptionWithQuery: context->_query error: OF_DNS_RESOLVER_ERROR_TIMEOUT]; @@ -1099,12 +1084,11 @@ context->_TCPQueryData = [[OFMutableData alloc] initWithCapacity: queryDataCount + 2]; tmp = OF_BSWAP16_IF_LE(queryDataCount); - [context->_TCPQueryData addItems: &tmp - count: sizeof(tmp)]; + [context->_TCPQueryData addItems: &tmp count: sizeof(tmp)]; [context->_TCPQueryData addItems: context->_queryData.items count: queryDataCount]; } [sock asyncWriteData: context->_TCPQueryData]; @@ -1133,12 +1117,11 @@ } if (context->_TCPBuffer == nil) context->_TCPBuffer = of_alloc(MAX_DNS_RESPONSE_LENGTH, 1); - [sock asyncReadIntoBuffer: context->_TCPBuffer - exactLength: 2]; + [sock asyncReadIntoBuffer: context->_TCPBuffer exactLength: 2]; return nil; } - (bool)stream: (OFStream *)stream didReadIntoBuffer: (void *)buffer @@ -1181,13 +1164,11 @@ * The connection was closed before we received the entire * response. */ goto done; - [self of_handleResponseBuffer: buffer - length: length - sender: NULL]; + [self of_handleResponseBuffer: buffer length: length sender: NULL]; done: [_TCPQueries removeObjectForKey: context->_TCPSocket]; [context->_TCPSocket release]; context->_TCPSocket = nil; Index: src/OFDNSResolverSettings.m ================================================================== --- src/OFDNSResolverSettings.m +++ src/OFDNSResolverSettings.m @@ -251,12 +251,11 @@ OFMutableDictionary *staticHosts; OFFile *file; OFString *line; @try { - file = [OFFile fileWithPath: path - mode: @"r"]; + file = [OFFile fileWithPath: path mode: @"r"]; } @catch (OFOpenItemFailedException *e) { objc_autoreleasePoolPop(pool); return; } @@ -351,12 +350,11 @@ OFMutableArray *nameServers = [[_nameServers mutableCopy] autorelease]; OFFile *file; OFString *line; @try { - file = [OFFile fileWithPath: path - mode: @"r"]; + file = [OFFile fileWithPath: path mode: @"r"]; } @catch (OFOpenItemFailedException *e) { objc_autoreleasePoolPop(pool); return; } @@ -390,11 +388,11 @@ if (arguments.count != 1) { objc_autoreleasePoolPop(pool2); continue; } - [nameServers addObject: [arguments firstObject]]; + [nameServers addObject: arguments.firstObject]; } else if ([option isEqual: @"domain"]) { if (arguments.count != 1) { objc_autoreleasePoolPop(pool2); continue; } Index: src/OFData+CryptoHashing.m ================================================================== --- src/OFData+CryptoHashing.m +++ src/OFData+CryptoHashing.m @@ -36,12 +36,11 @@ [class cryptoHashWithAllowsSwappableMemory: true]; size_t digestSize = [class digestSize]; const unsigned char *digest; char cString[digestSize * 2]; - [hash updateWithBuffer: _items - length: _count * _itemSize]; + [hash updateWithBuffer: _items length: _count * _itemSize]; digest = hash.digest; for (size_t i = 0; i < digestSize; i++) { uint8_t high, low; Index: src/OFData+MessagePackParsing.m ================================================================== --- src/OFData+MessagePackParsing.m +++ src/OFData+MessagePackParsing.m @@ -319,12 +319,11 @@ count = buffer[1]; if (length < count + 2) @throw [OFTruncatedDataException exception]; - *object = [OFData dataWithItems: buffer + 2 - count: count]; + *object = [OFData dataWithItems: buffer + 2 count: count]; return count + 2; case 0xC5: /* bin 16 */ if (length < 3) @throw [OFTruncatedDataException exception]; @@ -332,12 +331,11 @@ count = readUInt16(buffer + 1); if (length < count + 3) @throw [OFTruncatedDataException exception]; - *object = [OFData dataWithItems: buffer + 3 - count: count]; + *object = [OFData dataWithItems: buffer + 3 count: count]; return count + 3; case 0xC6: /* bin 32 */ if (length < 5) @throw [OFTruncatedDataException exception]; @@ -345,12 +343,11 @@ count = readUInt32(buffer + 1); if (length < count + 5) @throw [OFTruncatedDataException exception]; - *object = [OFData dataWithItems: buffer + 5 - count: count]; + *object = [OFData dataWithItems: buffer + 5 count: count]; return count + 5; /* Extensions */ case 0xC7: /* ext 8 */ if (length < 3) @@ -359,12 +356,11 @@ count = buffer[1]; if (length < count + 3) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 3 - count: count]; + data = [[OFData alloc] initWithItems: buffer + 3 count: count]; @try { *object = createExtension(buffer[2], data); } @finally { [data release]; } @@ -377,12 +373,11 @@ count = readUInt16(buffer + 1); if (length < count + 4) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 4 - count: count]; + data = [[OFData alloc] initWithItems: buffer + 4 count: count]; @try { *object = createExtension(buffer[3], data); } @finally { [data release]; } @@ -395,12 +390,11 @@ count = readUInt32(buffer + 1); if (length < count + 6) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 6 - count: count]; + data = [[OFData alloc] initWithItems: buffer + 6 count: count]; @try { *object = createExtension(buffer[5], data); } @finally { [data release]; } @@ -408,12 +402,11 @@ return count + 6; case 0xD4: /* fixext 1 */ if (length < 3) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 1]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 1]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; } @@ -421,12 +414,11 @@ return 3; case 0xD5: /* fixext 2 */ if (length < 4) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 2]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 2]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; } @@ -434,12 +426,11 @@ return 4; case 0xD6: /* fixext 4 */ if (length < 6) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 4]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 4]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; } @@ -447,12 +438,11 @@ return 6; case 0xD7: /* fixext 8 */ if (length < 10) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 8]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 8]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; } @@ -460,12 +450,11 @@ return 10; case 0xD8: /* fixext 16 */ if (length < 18) @throw [OFTruncatedDataException exception]; - data = [[OFData alloc] initWithItems: buffer + 2 - count: 16]; + data = [[OFData alloc] initWithItems: buffer + 2 count: 16]; @try { *object = createExtension(buffer[1], data); } @finally { [data release]; } Index: src/OFData.m ================================================================== --- src/OFData.m +++ src/OFData.m @@ -52,15 +52,13 @@ } @implementation OFData @synthesize itemSize = _itemSize; -+ (instancetype)dataWithItems: (const void *)items - count: (size_t)count ++ (instancetype)dataWithItems: (const void *)items count: (size_t)count { - return [[[self alloc] initWithItems: items - count: count] autorelease]; + return [[[self alloc] initWithItems: items count: count] autorelease]; } + (instancetype)dataWithItems: (const void *)items count: (size_t)count itemSize: (size_t)itemSize @@ -111,16 +109,13 @@ + (instancetype)dataWithBase64EncodedString: (OFString *)string { return [[[self alloc] initWithBase64EncodedString: string] autorelease]; } -- (instancetype)initWithItems: (const void *)items - count: (size_t)count +- (instancetype)initWithItems: (const void *)items count: (size_t)count { - return [self initWithItems: items - count: count - itemSize: 1]; + return [self initWithItems: items count: count itemSize: 1]; } - (instancetype)initWithItems: (const void *)items count: (size_t)count itemSize: (size_t)itemSize @@ -194,15 +189,13 @@ if (size > SIZE_MAX) @throw [OFOutOfRangeException exception]; # endif buffer = of_alloc((size_t)size, 1); - file = [[OFFile alloc] initWithPath: path - mode: @"r"]; + file = [[OFFile alloc] initWithPath: path mode: @"r"]; @try { - [file readIntoBuffer: buffer - exactLength: (size_t)size]; + [file readIntoBuffer: buffer exactLength: (size_t)size]; } @finally { [file release]; } } @catch (id e) { free(buffer); @@ -237,12 +230,11 @@ if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; - stream = [URLHandler openItemAtURL: URL - mode: @"r"]; + stream = [URLHandler openItemAtURL: URL mode: @"r"]; _count = 0; _itemSize = 1; _freeWhenDone = true; @@ -601,16 +593,13 @@ } #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { - OFFile *file = [[OFFile alloc] initWithPath: path - mode: @"w"]; - + OFFile *file = [[OFFile alloc] initWithPath: path mode: @"w"]; @try { - [file writeBuffer: _items - length: _count * _itemSize]; + [file writeBuffer: _items length: _count * _itemSize]; } @finally { [file release]; } } #endif @@ -617,18 +606,15 @@ - (void)writeToURL: (OFURL *)URL { void *pool = objc_autoreleasePoolPush(); OFURLHandler *URLHandler; - OFStream *stream; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; - stream = [URLHandler openItemAtURL: URL - mode: @"w"]; - [stream writeData: self]; + [[URLHandler openItemAtURL: URL mode: @"w"] writeData: self]; objc_autoreleasePoolPop(pool); } - (OFXMLElement *)XMLElementBySerializing @@ -661,41 +647,31 @@ if (_count <= UINT8_MAX) { uint8_t type = 0xC4; uint8_t tmp = (uint8_t)_count; - data = [OFMutableData dataWithItemSize: 1 - capacity: _count + 2]; - + data = [OFMutableData dataWithCapacity: _count + 2]; [data addItem: &type]; [data addItem: &tmp]; } else if (_count <= UINT16_MAX) { uint8_t type = 0xC5; uint16_t tmp = OF_BSWAP16_IF_LE((uint16_t)_count); - data = [OFMutableData dataWithItemSize: 1 - capacity: _count + 3]; - + data = [OFMutableData dataWithCapacity: _count + 3]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (_count <= UINT32_MAX) { uint8_t type = 0xC6; uint32_t tmp = OF_BSWAP32_IF_LE((uint32_t)_count); - data = [OFMutableData dataWithItemSize: 1 - capacity: _count + 5]; - + data = [OFMutableData dataWithCapacity: _count + 5]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else @throw [OFOutOfRangeException exception]; - [data addItems: _items - count: _count]; - + [data addItems: _items count: _count]; [data makeImmutable]; return data; } @end Index: src/OFDatagramSocket.m ================================================================== --- src/OFDatagramSocket.m +++ src/OFDatagramSocket.m @@ -215,12 +215,11 @@ } return ret; } -- (void)asyncReceiveIntoBuffer: (void *)buffer - length: (size_t)length +- (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length { [self asyncReceiveIntoBuffer: buffer length: length runLoopMode: of_run_loop_mode_default]; } Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -641,17 +641,14 @@ data: data] messagePackRepresentation]; } } else { OFMutableData *data = [OFMutableData dataWithCapacity: 12]; - seconds = OF_BSWAP64_IF_LE(seconds); nanoseconds = OF_BSWAP32_IF_LE(nanoseconds); - - [data addItems: &nanoseconds - count: sizeof(nanoseconds)]; - [data addItems: &seconds - count: sizeof(seconds)]; + [data addItems: &nanoseconds count: sizeof(nanoseconds)]; + seconds = OF_BSWAP64_IF_LE(seconds); + [data addItems: &seconds count: sizeof(seconds)]; ret = [[OFMessagePackExtension extensionWithType: -1 data: data] messagePackRepresentation]; } Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -71,19 +71,17 @@ { return (id)[[OFMapTableDictionary alloc] initWithDictionary: dictionary]; } -- (instancetype)initWithObject: (id)object - forKey: (id)key +- (instancetype)initWithObject: (id)object forKey: (id)key { return (id)[[OFMapTableDictionary alloc] initWithObject: object forKey: key]; } -- (instancetype)initWithObjects: (OFArray *)objects - forKeys: (OFArray *)keys +- (instancetype)initWithObjects: (OFArray *)objects forKeys: (OFArray *)keys { return (id)[[OFMapTableDictionary alloc] initWithObjects: objects forKeys: keys]; } @@ -226,15 +224,13 @@ { return [[(OFDictionary *)[self alloc] initWithDictionary: dictionary] autorelease]; } -+ (instancetype)dictionaryWithObject: (id)object - forKey: (id)key ++ (instancetype)dictionaryWithObject: (id)object forKey: (id)key { - return [[[self alloc] initWithObject: object - forKey: key] autorelease]; + return [[[self alloc] initWithObject: object forKey: key] autorelease]; } + (instancetype)dictionaryWithObjects: (OFArray *)objects forKeys: (OFArray *)keys { @@ -242,11 +238,11 @@ forKeys: keys] autorelease]; } + (instancetype)dictionaryWithObjects: (id const *)objects forKeys: (id const *)keys - count: (size_t)count + count: (size_t)count { return [[[self alloc] initWithObjects: objects forKeys: keys count: count] autorelease]; } @@ -283,12 +279,11 @@ - (instancetype)initWithDictionary: (OFDictionary *)dictionary { OF_INVALID_INIT_METHOD } -- (instancetype)initWithObject: (id)object - forKey: (id)key +- (instancetype)initWithObject: (id)object forKey: (id)key { if (key == nil || object == nil) @throw [OFInvalidArgumentException exception]; return [self initWithKeysAndObjects: key, object, nil]; @@ -310,13 +305,11 @@ } @catch (id e) { [self release]; @throw e; } - return [self initWithObjects: objects - forKeys: keys - count: count]; + return [self initWithObjects: objects forKeys: keys count: count]; } - (instancetype)initWithObjects: (id const *)objects forKeys: (id const *)keys count: (size_t)count @@ -328,12 +321,11 @@ { id ret; va_list arguments; va_start(arguments, firstKey); - ret = [self initWithKey: firstKey - arguments: arguments]; + ret = [self initWithKey: firstKey arguments: arguments]; va_end(arguments); return ret; } @@ -832,19 +824,17 @@ } else if (count <= UINT16_MAX) { uint8_t type = 0xDE; 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 = 0xDF; 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(); Index: src/OFDimensionValue.m ================================================================== --- src/OFDimensionValue.m +++ src/OFDimensionValue.m @@ -34,12 +34,11 @@ - (const char *)objCType { return @encode(of_dimension_t); } -- (void)getValue: (void *)value - size: (size_t)size +- (void)getValue: (void *)value size: (size_t)size { if (size != sizeof(_dimension)) @throw [OFOutOfRangeException exception]; memcpy(value, &_dimension, sizeof(_dimension)); Index: src/OFFileManager.m ================================================================== --- src/OFFileManager.m +++ src/OFFileManager.m @@ -269,23 +269,20 @@ @throw [OFInvalidArgumentException exception]; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; - [URLHandler setAttributes: attributes - ofItemAtURL: URL]; + [URLHandler setAttributes: attributes ofItemAtURL: URL]; } #ifdef OF_HAVE_FILES - (void)setAttributes: (of_file_attributes_t)attributes ofItemAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); - [self setAttributes: attributes ofItemAtURL: [OFURL fileURLWithPath: path]]; - objc_autoreleasePoolPop(pool); } #endif - (bool)fileExistsAtURL: (OFURL *)URL @@ -550,12 +547,11 @@ [self changeCurrentDirectoryPath: URL.fileSystemRepresentation]; objc_autoreleasePoolPop(pool); } -- (void)copyItemAtPath: (OFString *)source - toPath: (OFString *)destination +- (void)copyItemAtPath: (OFString *)source toPath: (OFString *)destination { void *pool = objc_autoreleasePoolPush(); [self copyItemAtURL: [OFURL fileURLWithPath: source] toURL: [OFURL fileURLWithPath: destination]]; @@ -562,12 +558,11 @@ objc_autoreleasePoolPop(pool); } #endif -- (void)copyItemAtURL: (OFURL *)source - toURL: (OFURL *)destination +- (void)copyItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool; OFURLHandler *URLHandler; of_file_attributes_t attributes; of_file_type_t type; @@ -579,12 +574,11 @@ if ((URLHandler = [OFURLHandler handlerForURL: source]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: source]; - if ([URLHandler copyItemAtURL: source - toURL: destination]) + if ([URLHandler copyItemAtURL: source toURL: destination]) return; if ([self fileExistsAtURL: destination]) @throw [OFCopyItemFailedException exceptionWithSourceURL: source @@ -650,12 +644,11 @@ sourceURL = [source URLByAppendingPathComponent: item]; destinationURL = [destination URLByAppendingPathComponent: item]; - [self copyItemAtURL: sourceURL - toURL: destinationURL]; + [self copyItemAtURL: sourceURL toURL: destinationURL]; objc_autoreleasePoolPop(pool2); } } else if ([type isEqual: of_file_type_regular]) { size_t pageSize = [OFSystemInfo pageSize]; @@ -748,24 +741,20 @@ objc_autoreleasePoolPop(pool); } #ifdef OF_HAVE_FILES -- (void)moveItemAtPath: (OFString *)source - toPath: (OFString *)destination +- (void)moveItemAtPath: (OFString *)source toPath: (OFString *)destination { void *pool = objc_autoreleasePoolPush(); - [self moveItemAtURL: [OFURL fileURLWithPath: source] toURL: [OFURL fileURLWithPath: destination]]; - objc_autoreleasePoolPop(pool); } #endif -- (void)moveItemAtURL: (OFURL *)source - toURL: (OFURL *)destination +- (void)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool; OFURLHandler *URLHandler; if (source == nil || destination == nil) @@ -776,12 +765,11 @@ if ((URLHandler = [OFURLHandler handlerForURL: source]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: source]; @try { - if ([URLHandler moveItemAtURL: source - toURL: destination]) + if ([URLHandler moveItemAtURL: source toURL: destination]) return; } @catch (OFMoveItemFailedException *e) { if (e.errNo != EXDEV) @throw e; } @@ -791,12 +779,11 @@ exceptionWithSourceURL: source destinationURL: destination errNo: EEXIST]; @try { - [self copyItemAtURL: source - toURL: destination]; + [self copyItemAtURL: source toURL: destination]; } @catch (OFCopyItemFailedException *e) { [self removeItemAtURL: destination]; @throw [OFMoveItemFailedException exceptionWithSourceURL: source @@ -831,19 +818,16 @@ #ifdef OF_HAVE_FILES - (void)removeItemAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); - [self removeItemAtURL: [OFURL fileURLWithPath: path]]; - objc_autoreleasePoolPop(pool); } #endif -- (void)linkItemAtURL: (OFURL *)source - toURL: (OFURL *)destination +- (void)linkItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool = objc_autoreleasePoolPush(); OFURLHandler *URLHandler; if (source == nil || destination == nil) @@ -856,25 +840,21 @@ if (URLHandler == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: source]; - [URLHandler linkItemAtURL: source - toURL: destination]; + [URLHandler linkItemAtURL: source toURL: destination]; objc_autoreleasePoolPop(pool); } #ifdef OF_FILE_MANAGER_SUPPORTS_LINKS -- (void)linkItemAtPath: (OFString *)source - toPath: (OFString *)destination +- (void)linkItemAtPath: (OFString *)source toPath: (OFString *)destination { void *pool = objc_autoreleasePoolPush(); - [self linkItemAtURL: [OFURL fileURLWithPath: source] toURL: [OFURL fileURLWithPath: destination]]; - objc_autoreleasePoolPop(pool); } #endif - (void)createSymbolicLinkAtURL: (OFURL *)URL @@ -889,25 +869,22 @@ URLHandler = [OFURLHandler handlerForURL: URL]; if (URLHandler == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; - [URLHandler createSymbolicLinkAtURL: URL - withDestinationPath: target]; + [URLHandler createSymbolicLinkAtURL: URL withDestinationPath: target]; objc_autoreleasePoolPop(pool); } #ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS - (void)createSymbolicLinkAtPath: (OFString *)path withDestinationPath: (OFString *)target { void *pool = objc_autoreleasePoolPush(); - [self createSymbolicLinkAtURL: [OFURL fileURLWithPath: path] withDestinationPath: target]; - objc_autoreleasePoolPop(pool); } #endif @end Index: src/OFFileURLHandler.m ================================================================== --- src/OFFileURLHandler.m +++ src/OFFileURLHandler.m @@ -590,12 +590,11 @@ return false; return S_ISDIR(s.st_mode); } -- (OFStream *)openItemAtURL: (OFURL *)URL - mode: (OFString *)mode +- (OFStream *)openItemAtURL: (OFURL *)URL mode: (OFString *)mode { void *pool = objc_autoreleasePoolPush(); OFFile *file = [[OFFile alloc] initWithPath: URL.fileSystemRepresentation mode: mode]; @@ -1156,11 +1155,10 @@ while (ExNext(lock, &fib)) { OFString *file = [[OFString alloc] initWithCString: fib.fib_FileName encoding: encoding]; - @try { [files addObject: file]; } @finally { [file release]; } @@ -1176,11 +1174,10 @@ UnLock(lock); } #else of_string_encoding_t encoding = [OFLocale encoding]; DIR *dir; - if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL) @throw [OFOpenItemFailedException exceptionWithURL: URL mode: nil errNo: errno]; @@ -1341,12 +1338,11 @@ objc_autoreleasePoolPop(pool); } #ifdef OF_FILE_MANAGER_SUPPORTS_LINKS -- (void)linkItemAtURL: (OFURL *)source - toURL: (OFURL *)destination +- (void)linkItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool = objc_autoreleasePoolPush(); OFString *sourcePath, *destinationPath; if (source == nil || destination == nil) @@ -1423,12 +1419,11 @@ objc_autoreleasePoolPop(pool); } #endif -- (bool)moveItemAtURL: (OFURL *)source - toURL: (OFURL *)destination +- (bool)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination { void *pool; if (![source.scheme isEqual: _scheme] || ![destination.scheme isEqual: _scheme]) Index: src/OFGZIPStream.m ================================================================== --- src/OFGZIPStream.m +++ src/OFGZIPStream.m @@ -29,24 +29,21 @@ @implementation OFGZIPStream @synthesize operatingSystemMadeOn = _operatingSystemMadeOn; @synthesize modificationDate = _modificationDate; -+ (instancetype)streamWithStream: (OFStream *)stream - mode: (OFString *)mode ++ (instancetype)streamWithStream: (OFStream *)stream mode: (OFString *)mode { - return [[[self alloc] initWithStream: stream - mode: mode] autorelease]; + return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithStream: (OFStream *)stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode { self = [super init]; @try { if (![mode isEqual: @"r"]) @@ -75,12 +72,11 @@ [_modificationDate release]; [super dealloc]; } -- (size_t)lowlevelReadIntoBuffer: (void *)buffer - length: (size_t)length +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; for (;;) { @@ -96,12 +92,11 @@ switch (_state) { case OF_GZIP_STREAM_ID1: case OF_GZIP_STREAM_ID2: case OF_GZIP_STREAM_COMPRESSION_METHOD: - if ([_stream readIntoBuffer: &byte - length: 1] < 1) + if ([_stream readIntoBuffer: &byte length: 1] < 1) return 0; if ((_state == OF_GZIP_STREAM_ID1 && byte != 0x1F) || (_state == OF_GZIP_STREAM_ID2 && byte != 0x8B) || (_state == OF_GZIP_STREAM_COMPRESSION_METHOD && @@ -109,12 +104,11 @@ @throw [OFInvalidFormatException exception]; _state++; break; case OF_GZIP_STREAM_FLAGS: - if ([_stream readIntoBuffer: &byte - length: 1] < 1) + if ([_stream readIntoBuffer: &byte length: 1] < 1) return 0; _flags = byte; _state++; break; @@ -136,20 +130,18 @@ _bytesRead = 0; _state++; break; case OF_GZIP_STREAM_EXTRA_FLAGS: - if ([_stream readIntoBuffer: &byte - length: 1] < 1) + if ([_stream readIntoBuffer: &byte length: 1] < 1) return 0; _extraFlags = byte; _state++; break; case OF_GZIP_STREAM_OPERATING_SYSTEM: - if ([_stream readIntoBuffer: &byte - length: 1] < 1) + if ([_stream readIntoBuffer: &byte length: 1] < 1) return 0; _operatingSystemMadeOn = byte; _state++; break; Index: src/OFHMAC.m ================================================================== --- src/OFHMAC.m +++ src/OFHMAC.m @@ -57,12 +57,11 @@ [_innerHashCopy release]; [super dealloc]; } -- (void)setKey: (const void *)key - length: (size_t)length +- (void)setKey: (const void *)key length: (size_t)length { void *pool = objc_autoreleasePoolPush(); size_t blockSize = [_hashClass blockSize]; OFSecureData *outerKeyPad = [OFSecureData dataWithCount: blockSize @@ -82,13 +81,11 @@ @try { if (length > blockSize) { id hash = [_hashClass cryptoHashWithAllowsSwappableMemory: _allowsSwappableMemory]; - - [hash updateWithBuffer: key - length: length]; + [hash updateWithBuffer: key length: length]; length = hash.digestSize; if OF_UNLIKELY (length > blockSize) length = blockSize; @@ -129,22 +126,20 @@ _innerHashCopy = [_innerHash copy]; _calculated = false; } -- (void)updateWithBuffer: (const void *)buffer - length: (size_t)length +- (void)updateWithBuffer: (const void *)buffer length: (size_t)length { if (_innerHash == nil) @throw [OFInvalidArgumentException exception]; if (_calculated) @throw [OFHashAlreadyCalculatedException exceptionWithObject: self]; - [_innerHash updateWithBuffer: buffer - length: length]; + [_innerHash updateWithBuffer: buffer length: length]; } - (const unsigned char *)digest { if (_outerHash == nil || _innerHash == nil) Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -716,12 +716,11 @@ URLPort = URL.port; if (URLPort != nil) port = URLPort.unsignedShortValue; sock.delegate = self; - [sock asyncConnectToHost: URL.host - port: port]; + [sock asyncConnectToHost: URL.host port: port]; } @catch (id e) { [self raiseException: e]; } } @end @@ -798,12 +797,11 @@ if (_chunked) [_socket writeFormat: @"%zX\r\n", length]; else if (length > _toWrite) length = (size_t)_toWrite; - ret = [_socket writeBuffer: buffer - length: length]; + ret = [_socket writeBuffer: buffer length: length]; if (_chunked) [_socket writeString: @"\r\n"]; if (ret > length) @throw [OFOutOfRangeException exception]; @@ -903,22 +901,20 @@ @throw [OFInvalidServerReplyException exception]; } } } -- (size_t)lowlevelReadIntoBuffer: (void *)buffer - length: (size_t)length +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { if (_socket == nil) @throw [OFNotOpenException exceptionWithObject: self]; if (_atEndOfStream) return 0; if (!_hasContentLength && !_chunked) - return [_socket readIntoBuffer: buffer - length: length]; + return [_socket readIntoBuffer: buffer length: length]; if (_socket.atEndOfStream) @throw [OFTruncatedDataException exception]; /* Content-Length */ @@ -926,13 +922,11 @@ size_t ret; if (length > (unsigned long long)_toRead) length = (size_t)_toRead; - ret = [_socket readIntoBuffer: buffer - length: length]; - + ret = [_socket readIntoBuffer: buffer length: length]; if (ret > length) @throw [OFOutOfRangeException exception]; _toRead -= ret; @@ -944,12 +938,11 @@ /* Chunked */ if (_toRead == -2) { char tmp[2]; - switch ([_socket readIntoBuffer: tmp - length: 2]) { + switch ([_socket readIntoBuffer: tmp length: 2]) { case 2: _toRead++; if (tmp[1] != '\n') @throw [OFInvalidServerReplyException exception]; @@ -965,12 +958,11 @@ return 0; } else if (_toRead == -1) { char tmp; - if ([_socket readIntoBuffer: &tmp - length: 1] == 1) { + if ([_socket readIntoBuffer: &tmp length: 1] == 1) { _toRead++; if (tmp != '\n') @throw [OFInvalidServerReplyException exception]; } @@ -981,15 +973,13 @@ return 0; } else if (_toRead > 0) { if (length > (unsigned long long)_toRead) length = (size_t)_toRead; - length = [_socket readIntoBuffer: buffer - length: length]; + length = [_socket readIntoBuffer: buffer length: length]; _toRead -= length; - if (_toRead == 0) _toRead = -2; return length; } else { @@ -1113,15 +1103,12 @@ } - (OFHTTPResponse *)performRequest: (OFHTTPRequest *)request redirects: (unsigned int)redirects { - [_client asyncPerformRequest: request - redirects: redirects]; - + [_client asyncPerformRequest: request redirects: redirects]; [[OFRunLoop currentRunLoop] run]; - return _response; } - (void)client: (OFHTTPClient *)client didPerformRequest: (OFHTTPRequest *)request @@ -1219,12 +1206,11 @@ [super dealloc]; } - (OFHTTPResponse *)performRequest: (OFHTTPRequest *)request { - return [self performRequest: request - redirects: REDIRECTS_DEFAULT]; + return [self performRequest: request redirects: REDIRECTS_DEFAULT]; } - (OFHTTPResponse *)performRequest: (OFHTTPRequest *)request redirects: (unsigned int)redirects { @@ -1242,12 +1228,11 @@ return [response autorelease]; } - (void)asyncPerformRequest: (OFHTTPRequest *)request { - [self asyncPerformRequest: request - redirects: REDIRECTS_DEFAULT]; + [self asyncPerformRequest: request redirects: REDIRECTS_DEFAULT]; } - (void)asyncPerformRequest: (OFHTTPRequest *)request redirects: (unsigned int)redirects { Index: src/OFHTTPCookieManager.m ================================================================== --- src/OFHTTPCookieManager.m +++ src/OFHTTPCookieManager.m @@ -51,12 +51,11 @@ - (OFArray OF_GENERIC(OFHTTPCookie *) *)cookies { return [[_cookies copy] autorelease]; } -- (void)addCookie: (OFHTTPCookie *)cookie - forURL: (OFURL *)URL +- (void)addCookie: (OFHTTPCookie *)cookie forURL: (OFURL *)URL { void *pool = objc_autoreleasePoolPush(); OFString *cookieDomain, *URLHost; size_t i; @@ -85,13 +84,11 @@ i = 0; for (OFHTTPCookie *iter in _cookies) { if ([iter.name isEqual: cookie.name] && [iter.domain isEqual: cookie.domain] && [iter.path isEqual: cookie.path]) { - [_cookies replaceObjectAtIndex: i - withObject: cookie]; - + [_cookies replaceObjectAtIndex: i withObject: cookie]; objc_autoreleasePoolPop(pool); return; } i++; @@ -104,12 +101,11 @@ - (void)addCookies: (OFArray OF_GENERIC(OFHTTPCookie *) *)cookies forURL: (OFURL *)URL { for (OFHTTPCookie *cookie in cookies) - [self addCookie: cookie - forURL: URL]; + [self addCookie: cookie forURL: URL]; } - (OFArray OF_GENERIC(OFHTTPCookie *) *)cookiesForURL: (OFURL *)URL { OFMutableArray *ret = [OFMutableArray array]; Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -219,12 +219,11 @@ isEqual: @"chunked"]; objc_autoreleasePoolPop(pool); } -- (size_t)lowlevelWriteBuffer: (const void *)buffer - length: (size_t)length +- (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { /* TODO: Use non-blocking writes */ void *pool; @@ -233,19 +232,17 @@ if (!_headersSent) [self of_sendHeaders]; if (!_chunked) - return [_socket writeBuffer: buffer - length: length]; + return [_socket writeBuffer: buffer length: length]; pool = objc_autoreleasePoolPush(); [_socket writeString: [OFString stringWithFormat: @"%zX\r\n", length]]; objc_autoreleasePoolPop(pool); - [_socket writeBuffer: buffer - length: length]; + [_socket writeBuffer: buffer length: length]; [_socket writeString: @"\r\n"]; return length; } @@ -497,19 +494,17 @@ - (bool)sendErrorAndClose: (short)statusCode { OFString *date = [[OFDate date] dateStringWithFormat: @"%a, %d %b %Y %H:%M:%S GMT"]; - [_socket writeFormat: @"HTTP/1.1 %hd %@\r\n" @"Date: %@\r\n" @"Server: %@\r\n" @"\r\n", statusCode, of_http_status_code_to_string(statusCode), date, _server.name]; - return false; } - (void)createResponse { @@ -610,12 +605,11 @@ - (bool)lowlevelIsAtEndOfStream { return _atEndOfStream; } -- (size_t)lowlevelReadIntoBuffer: (void *)buffer - length: (size_t)length +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { if (_socket == nil) @throw [OFNotOpenException exceptionWithObject: self]; if (_atEndOfStream) @@ -629,12 +623,11 @@ size_t ret; if (length > (unsigned long long)_toRead) length = (size_t)_toRead; - ret = [_socket readIntoBuffer: buffer - length: length]; + ret = [_socket readIntoBuffer: buffer length: length]; _toRead -= ret; if (_toRead == 0) _atEndOfStream = true; @@ -644,12 +637,11 @@ /* Chunked */ if (_toRead == -2) { char tmp[2]; - switch ([_socket readIntoBuffer: tmp - length: 2]) { + switch ([_socket readIntoBuffer: tmp length: 2]) { case 2: _toRead++; if (tmp[1] != '\n') @throw [OFInvalidFormatException exception]; case 1: @@ -663,12 +655,11 @@ return 0; } else if (_toRead == -1) { char tmp; - if ([_socket readIntoBuffer: &tmp - length: 1] == 1) { + if ([_socket readIntoBuffer: &tmp length: 1] == 1) { _toRead++; if (tmp != '\n') @throw [OFInvalidFormatException exception]; } @@ -678,15 +669,13 @@ return 0; } else if (_toRead > 0) { if (length > (unsigned long long)_toRead) length = (size_t)_toRead; - length = [_socket readIntoBuffer: buffer - length: length]; + length = [_socket readIntoBuffer: buffer length: length]; _toRead -= length; - if (_toRead == 0) _toRead = -2; return length; } else { @@ -930,12 +919,11 @@ TLSSocket.privateKeyFile = _privateKeyFile; TLSSocket.privateKeyPassphrase = _privateKeyPassphrase; } else _listeningSocket = [[OFTCPSocket alloc] init]; - _port = [_listeningSocket bindToHost: _host - port: _port]; + _port = [_listeningSocket bindToHost: _host port: _port]; [_listeningSocket listen]; #ifdef OF_HAVE_THREADS if (_numberOfThreads > 1) { OFMutableArray *threads = @@ -993,11 +981,11 @@ if (exception != nil) { if (![_delegate respondsToSelector: @selector(server:didReceiveExceptionOnListeningSocket:)]) return false; - return [_delegate server: self + return [_delegate server: self didReceiveExceptionOnListeningSocket: exception]; } #ifdef OF_HAVE_THREADS if (_numberOfThreads > 1) { Index: src/OFHostAddressResolver.m ================================================================== --- src/OFHostAddressResolver.m +++ src/OFHostAddressResolver.m @@ -349,24 +349,20 @@ _delegate = [delegate retain]; [self asyncResolve]; while (!delegate->_done) - [runLoop runMode: resolveRunLoopMode - beforeDate: nil]; + [runLoop runMode: resolveRunLoopMode beforeDate: nil]; /* Cleanup */ - [runLoop runMode: resolveRunLoopMode - beforeDate: [OFDate date]]; + [runLoop runMode: resolveRunLoopMode beforeDate: [OFDate date]]; if (delegate->_exception != nil) @throw delegate->_exception; ret = [delegate->_addresses copy]; - objc_autoreleasePoolPop(pool); - return [ret autorelease]; } @end @implementation OFHostAddressResolverDelegate Index: src/OFINICategory.m ================================================================== --- src/OFINICategory.m +++ src/OFINICategory.m @@ -477,15 +477,13 @@ OFINICategoryPair *pair = line; OFString *key = escapeString(pair->_key); OFString *value = escapeString(pair->_value); OFString *tmp = [OFString stringWithFormat: @"%@=%@\r\n", key, value]; - - [stream writeString: tmp - encoding: encoding]; + [stream writeString: tmp encoding: encoding]; } else @throw [OFInvalidArgumentException exception]; } return true; } @end Index: src/OFINIFile.m ================================================================== --- src/OFINIFile.m +++ src/OFINIFile.m @@ -136,11 +136,10 @@ if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: of_range(1, line.length - 2)]; - category = [[[OFINICategory alloc] of_initWithName: categoryName] autorelease]; [_categories addObject: category]; } else { if (category == nil) @@ -156,12 +155,11 @@ - (void)writeToFile: (OFString *)path { [self writeToFile: path encoding: OF_STRING_ENCODING_UTF_8]; } -- (void)writeToFile: (OFString *)path - encoding: (of_string_encoding_t)encoding +- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; bool first = true; Index: src/OFIPSocketAsyncConnector.m ================================================================== --- src/OFIPSocketAsyncConnector.m +++ src/OFIPSocketAsyncConnector.m @@ -83,21 +83,20 @@ OF_ENSURE(0); } else { #endif if ([_delegate respondsToSelector: @selector(socket:didConnectToHost:port:exception:)]) - [_delegate socket: _socket + [_delegate socket: _socket didConnectToHost: _host port: _port exception: _exception]; #ifdef OF_HAVE_BLOCKS } #endif } -- (void)of_socketDidConnect: (id)sock - exception: (id)exception +- (void)of_socketDidConnect: (id)sock exception: (id)exception { if (exception != nil) { /* * self might be retained only by the pending async requests, * which we're about to cancel. @@ -123,12 +122,11 @@ timerWithTimeInterval: 0 target: self selector: selector object: runLoop.currentMode repeats: false]; - [runLoop addTimer: timer - forMode: runLoop.currentMode]; + [runLoop addTimer: timer forMode: runLoop.currentMode]; } return; } @@ -149,12 +147,11 @@ [_socketAddresses itemAtIndex: _socketAddressesIndex++]; int errNo; of_socket_address_set_port(&address, _port); - if (![_socket of_createSocketForAddress: &address - errNo: &errNo]) { + if (![_socket of_createSocketForAddress: &address errNo: &errNo]) { if (_socketAddressesIndex >= _socketAddresses.count) { _exception = [[OFConnectionFailedException alloc] initWithHost: _host port: _port socket: _socket @@ -181,12 +178,11 @@ [_socket setCanBlock: true]; #else [_socket setCanBlock: false]; #endif - if (![_socket of_connectSocketToAddress: &address - errNo: &errNo]) { + if (![_socket of_connectSocketToAddress: &address errNo: &errNo]) { #if !defined(OF_NINTENDO_3DS) && !defined(OF_WII) if (errNo == EINPROGRESS) { [OFRunLoop of_addAsyncConnectForSocket: _socket mode: runLoopMode delegate: self]; Index: src/OFIPXSocket.m ================================================================== --- src/OFIPXSocket.m +++ src/OFIPXSocket.m @@ -121,11 +121,9 @@ /* If it's not IPX, no fix-up needed - it will fail anyway. */ if (fixedReceiver.family == OF_SOCKET_ADDRESS_FAMILY_IPX) fixedReceiver.sockaddr.ipx.sipx_type = _packetType; - [super sendBuffer: buffer - length: length - receiver: &fixedReceiver]; + [super sendBuffer: buffer length: length receiver: &fixedReceiver]; } #endif @end Index: src/OFInvocation.m ================================================================== --- src/OFInvocation.m +++ src/OFInvocation.m @@ -86,23 +86,19 @@ [_returnValue release]; [super dealloc]; } -- (void)setArgument: (const void *)buffer - atIndex: (size_t)idx +- (void)setArgument: (const void *)buffer atIndex: (size_t)idx { OFMutableData *data = [_arguments objectAtIndex: idx]; - memcpy(data.mutableItems, buffer, data.itemSize); } -- (void)getArgument: (void *)buffer - atIndex: (size_t)idx +- (void)getArgument: (void *)buffer atIndex: (size_t)idx { OFData *data = [_arguments objectAtIndex: idx]; - memcpy(buffer, data.items, data.itemSize); } - (void)setReturnValue: (const void *)buffer { Index: src/OFLHAArchive.m ================================================================== --- src/OFLHAArchive.m +++ src/OFLHAArchive.m @@ -68,33 +68,28 @@ @end @implementation OFLHAArchive @synthesize encoding = _encoding; -+ (instancetype)archiveWithStream: (OFStream *)stream - mode: (OFString *)mode ++ (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode { - return [[[self alloc] initWithStream: stream - mode: mode] autorelease]; + return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } #ifdef OF_HAVE_FILES -+ (instancetype)archiveWithPath: (OFString *)path - mode: (OFString *)mode ++ (instancetype)archiveWithPath: (OFString *)path mode: (OFString *)mode { - return [[[self alloc] initWithPath: path - mode: mode] autorelease]; + return [[[self alloc] initWithPath: path mode: mode] autorelease]; } #endif - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithStream: (OFStream *)stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode { self = [super init]; @try { _stream = [stream retain]; @@ -125,25 +120,21 @@ return self; } #ifdef OF_HAVE_FILES -- (instancetype)initWithPath: (OFString *)path - mode: (OFString *)mode +- (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode { OFFile *file; if ([mode isEqual: @"a"]) - file = [[OFFile alloc] initWithPath: path - mode: @"r+"]; + file = [[OFFile alloc] initWithPath: path mode: @"r+"]; else - file = [[OFFile alloc] initWithPath: path - mode: mode]; + file = [[OFFile alloc] initWithPath: path mode: mode]; @try { - self = [self initWithStream: file - mode: mode]; + self = [self initWithStream: file mode: mode]; } @finally { [file release]; } return self; @@ -323,12 +314,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 { size_t ret; if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; @@ -340,12 +330,11 @@ @throw [OFTruncatedDataException exception]; if (length > _toRead) length = _toRead; - ret = [_decompressedStream readIntoBuffer: buffer - length: length]; + ret = [_decompressedStream readIntoBuffer: buffer length: length]; _toRead -= ret; _CRC16 = of_crc16(_CRC16, buffer, ret); if (_toRead == 0) { @@ -415,12 +404,11 @@ size_t min = toRead; if (min > 512) min = 512; - toRead -= [stream readIntoBuffer: buffer - length: min]; + toRead -= [stream readIntoBuffer: buffer length: min]; } } _toRead = 0; _skipped = true; @@ -452,14 +440,12 @@ @try { _entry = [entry mutableCopy]; _encoding = encoding; - _headerOffset = [stream seekToOffset: 0 - whence: SEEK_CUR]; - [_entry of_writeToStream: stream - encoding: _encoding]; + _headerOffset = [stream seekToOffset: 0 whence: SEEK_CUR]; + [_entry of_writeToStream: stream encoding: _encoding]; /* * Retain stream last, so that -[close] called by -[dealloc] * doesn't write in case of an error. */ @@ -480,12 +466,11 @@ [_entry release]; [super dealloc]; } -- (size_t)lowlevelWriteBuffer: (const void *)buffer - length: (size_t)length +- (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { uint32_t bytesWritten; if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; @@ -532,20 +517,16 @@ _entry.uncompressedSize = _bytesWritten; _entry.compressedSize = _bytesWritten; _entry.CRC16 = _CRC16; - offset = [_stream seekToOffset: 0 - whence:SEEK_CUR]; - [_stream seekToOffset: _headerOffset - whence: SEEK_SET]; - [_entry of_writeToStream: _stream - encoding: _encoding]; - [_stream seekToOffset: offset - whence: SEEK_SET]; + offset = [_stream seekToOffset: 0 whence: SEEK_CUR]; + [_stream seekToOffset: _headerOffset whence: SEEK_SET]; + [_entry of_writeToStream: _stream encoding: _encoding]; + [_stream seekToOffset: offset whence: SEEK_SET]; [_stream release]; _stream = nil; [super close]; } @end Index: src/OFLHAArchiveEntry.m ================================================================== --- src/OFLHAArchiveEntry.m +++ src/OFLHAArchiveEntry.m @@ -582,56 +582,47 @@ [data addItems: [_compressionMethod cStringWithEncoding: OF_STRING_ENCODING_ASCII] count: 5]; tmp32 = OF_BSWAP32_IF_BE(_compressedSize); - [data addItems: &tmp32 - count: sizeof(tmp32)]; + [data addItems: &tmp32 count: sizeof(tmp32)]; tmp32 = OF_BSWAP32_IF_BE(_uncompressedSize); - [data addItems: &tmp32 - count: sizeof(tmp32)]; + [data addItems: &tmp32 count: sizeof(tmp32)]; tmp32 = OF_BSWAP32_IF_BE((uint32_t)_date.timeIntervalSince1970); - [data addItems: &tmp32 - count: sizeof(tmp32)]; + [data addItems: &tmp32 count: sizeof(tmp32)]; /* Reserved */ [data increaseCountBy: 1]; /* Header level */ [data addItem: "\x02"]; /* CRC16 */ tmp16 = OF_BSWAP16_IF_BE(_CRC16); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; /* Operating system identifier */ [data addItem: "U"]; /* Common header. Contains CRC16, which is written at the end. */ tmp16 = OF_BSWAP16_IF_BE(5); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x00"]; [data increaseCountBy: 2]; tmp16 = OF_BSWAP16_IF_BE((uint16_t)fileNameLength + 3); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x01"]; - [data addItems: fileName - count: fileNameLength]; + [data addItems: fileName count: fileNameLength]; if (directoryNameLength > 0) { tmp16 = OF_BSWAP16_IF_BE((uint16_t)directoryNameLength + 3); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x02"]; - [data addItems: directoryName - count: directoryNameLength]; + [data addItems: directoryName count: directoryNameLength]; } if (_fileComment != nil) { size_t fileCommentLength = [_fileComment cStringLengthWithEncoding: encoding]; @@ -638,44 +629,38 @@ if (fileCommentLength > UINT16_MAX - 3) @throw [OFOutOfRangeException exception]; tmp16 = OF_BSWAP16_IF_BE((uint16_t)fileCommentLength + 3); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x3F"]; [data addItems: [_fileComment cStringWithEncoding: encoding] count: fileCommentLength]; } if (_mode != nil) { tmp16 = OF_BSWAP16_IF_BE(5); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x50"]; tmp16 = OF_BSWAP16_IF_BE(_mode.unsignedShortValue); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; } if (_UID != nil || _GID != nil) { if (_UID == nil || _GID == nil) @throw [OFInvalidArgumentException exception]; tmp16 = OF_BSWAP16_IF_BE(7); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x51"]; tmp16 = OF_BSWAP16_IF_BE(_GID.unsignedShortValue); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; tmp16 = OF_BSWAP16_IF_BE(_UID.unsignedShortValue); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; } if (_group != nil) { size_t groupLength = [_group cStringLengthWithEncoding: encoding]; @@ -682,12 +667,11 @@ if (groupLength > UINT16_MAX - 3) @throw [OFOutOfRangeException exception]; tmp16 = OF_BSWAP16_IF_BE((uint16_t)groupLength + 3); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x52"]; [data addItems: [_group cStringWithEncoding: encoding] count: groupLength]; } @@ -697,27 +681,24 @@ if (ownerLength > UINT16_MAX - 3) @throw [OFOutOfRangeException exception]; tmp16 = OF_BSWAP16_IF_BE((uint16_t)ownerLength + 3); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x53"]; [data addItems: [_owner cStringWithEncoding: encoding] count: ownerLength]; } if (_modificationDate != nil) { tmp16 = OF_BSWAP16_IF_BE(7); - [data addItems: &tmp16 - count: sizeof(tmp16)]; + [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x54"]; tmp32 = OF_BSWAP32_IF_BE( (uint32_t)_modificationDate.timeIntervalSince1970); - [data addItems: &tmp32 - count: sizeof(tmp32)]; + [data addItems: &tmp32 count: sizeof(tmp32)]; } for (OFData *extension in _extensions) { size_t extensionLength = extension.count; @@ -726,14 +707,12 @@ if (extensionLength > UINT16_MAX - 2) @throw [OFOutOfRangeException exception]; tmp16 = OF_BSWAP16_IF_BE((uint16_t)extensionLength + 2); - [data addItems: &tmp16 - count: sizeof(tmp16)]; - [data addItems: extension.items - count: extension.count]; + [data addItems: &tmp16 count: sizeof(tmp16)]; + [data addItems: extension.items count: extension.count]; } /* Zero-length extension to terminate */ [data increaseCountBy: 2]; Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -356,12 +356,11 @@ if (iter->next != NULL) [ret appendString: @",\n"]; objc_autoreleasePoolPop(pool); } - [ret replaceOccurrencesOfString: @"\n" - withString: @"\n\t"]; + [ret replaceOccurrencesOfString: @"\n" withString: @"\n\t"]; [ret appendString: @"\n]"]; [ret makeImmutable]; return ret; @@ -414,13 +413,13 @@ return count; } - (OFEnumerator *)objectEnumerator { - return [[[OFListEnumerator alloc] - initWithList: self - mutationsPointer: &_mutations] autorelease]; + return [[[OFListEnumerator alloc] initWithList: self + mutationsPointer: &_mutations] + autorelease]; } @end @implementation OFListEnumerator - (instancetype)initWithList: (OFList *)list Index: src/OFLocale.m ================================================================== --- src/OFLocale.m +++ src/OFLocale.m @@ -83,12 +83,13 @@ } } #endif static bool -evaluateCondition(OFString *condition, OFDictionary *variables) +evaluateCondition(OFString *condition_, OFDictionary *variables) { + OFMutableString *condition = [[condition_ mutableCopy] autorelease]; OFMutableArray *tokens, *operators, *stack; /* Empty condition is the fallback that's always true */ if (condition.length == 0) return true; @@ -96,16 +97,13 @@ /* * Dirty hack to allow not needing spaces after "!" or "(" and spaces * before ")". * TODO: Replace with a proper tokenizer. */ - condition = [condition stringByReplacingOccurrencesOfString: @"!" - withString: @"! "]; - condition = [condition stringByReplacingOccurrencesOfString: @"(" - withString: @"( "]; - condition = [condition stringByReplacingOccurrencesOfString: @")" - withString: @" )"]; + [condition replaceOccurrencesOfString: @"!" withString: @"! "]; + [condition replaceOccurrencesOfString: @"(" withString: @"( "]; + [condition replaceOccurrencesOfString: @")" withString: @" )"]; /* Substitute variables and convert to RPN first */ tokens = [OFMutableArray array]; operators = [OFMutableArray array]; for (OFString *token in [condition Index: src/OFMD5Hash.m ================================================================== --- src/OFMD5Hash.m +++ src/OFMD5Hash.m @@ -206,12 +206,11 @@ _iVars->state[1] = 0xEFCDAB89; _iVars->state[2] = 0x98BADCFE; _iVars->state[3] = 0x10325476; } -- (void)updateWithBuffer: (const void *)buffer_ - length: (size_t)length +- (void)updateWithBuffer: (const void *)buffer_ length: (size_t)length { const unsigned char *buffer = buffer_; if (_calculated) @throw [OFHashAlreadyCalculatedException Index: src/OFMapTable.m ================================================================== --- src/OFMapTable.m +++ src/OFMapTable.m @@ -57,17 +57,10 @@ defaultEqual(void *object1, void *object2) { return (object1 == object2); } -OF_DIRECT_MEMBERS -@interface OFMapTable () -- (void)of_setObject: (void *)object - forKey: (void *)key - hash: (unsigned long)hash; -@end - OF_DIRECT_MEMBERS @interface OFMapTableEnumerator () - (instancetype)of_initWithMapTable: (OFMapTable *)mapTable buckets: (struct of_map_table_bucket **)buckets capacity: (unsigned long)capacity @@ -242,14 +235,13 @@ capacity: _capacity]; @try { for (unsigned long i = 0; i < _capacity; i++) if (_buckets[i] != NULL && _buckets[i] != &deleted) - [copy of_setObject: _buckets[i]->object - forKey: _buckets[i]->key - hash: OF_ROR(_buckets[i]->hash, - _rotate)]; + setObject(copy, _buckets[i]->key, + _buckets[i]->object, + OF_ROR(_buckets[i]->hash, _rotate)); } @catch (id e) { [copy release]; @throw e; } @@ -294,159 +286,167 @@ } return NULL; } -- (void)of_resizeForCount: (unsigned long)count OF_DIRECT +static void +resizeForCount(OFMapTable *self, unsigned long count) { unsigned long fullness, capacity; struct of_map_table_bucket **buckets; - if (count > ULONG_MAX / sizeof(*_buckets) || count > ULONG_MAX / 8) + if (count > ULONG_MAX / sizeof(*self->_buckets) || + count > ULONG_MAX / 8) @throw [OFOutOfRangeException exception]; - fullness = count * 8 / _capacity; + fullness = count * 8 / self->_capacity; if (fullness >= 6) { - if (_capacity > ULONG_MAX / 2) + if (self->_capacity > ULONG_MAX / 2) return; - capacity = _capacity * 2; + capacity = self->_capacity * 2; } else if (fullness <= 1) - capacity = _capacity / 2; + capacity = self->_capacity / 2; else return; /* * Don't downsize if we have an initial capacity or if we would fall * below the minimum capacity. */ - if ((capacity < _capacity && count > _count) || capacity < MIN_CAPACITY) + if ((capacity < self->_capacity && count > self->_count) || + capacity < MIN_CAPACITY) return; buckets = of_alloc_zeroed(capacity, sizeof(*buckets)); - for (unsigned long i = 0; i < _capacity; i++) { - if (_buckets[i] != NULL && _buckets[i] != &deleted) { + for (unsigned long i = 0; i < self->_capacity; i++) { + if (self->_buckets[i] != NULL && + self->_buckets[i] != &deleted) { unsigned long j, last; last = capacity; - for (j = _buckets[i]->hash & (capacity - 1); + for (j = self->_buckets[i]->hash & (capacity - 1); j < last && buckets[j] != NULL; j++); /* In case the last bucket is already used */ if (j >= last) { - last = _buckets[i]->hash & (capacity - 1); + last = self->_buckets[i]->hash & (capacity - 1); for (j = 0; j < last && buckets[j] != NULL; j++); } if (j >= last) @throw [OFOutOfRangeException exception]; - buckets[j] = _buckets[i]; + buckets[j] = self->_buckets[i]; } } - free(_buckets); - _buckets = buckets; - _capacity = capacity; + free(self->_buckets); + self->_buckets = buckets; + self->_capacity = capacity; } -- (void)of_setObject: (void *)object - forKey: (void *)key - hash: (unsigned long)hash +static void +setObject(OFMapTable *restrict self, void *key, void *object, + unsigned long hash) { unsigned long i, last; void *old; if (key == NULL || object == NULL) @throw [OFInvalidArgumentException exception]; - hash = OF_ROL(hash, _rotate); - last = _capacity; + hash = OF_ROL(hash, self->_rotate); + last = self->_capacity; - for (i = hash & (_capacity - 1); i < last && _buckets[i] != NULL; i++) { - if (_buckets[i] == &deleted) + for (i = hash & (self->_capacity - 1); + i < last && self->_buckets[i] != NULL; i++) { + if (self->_buckets[i] == &deleted) continue; - if (_keyFunctions.equal(_buckets[i]->key, key)) + if (self->_keyFunctions.equal(self->_buckets[i]->key, key)) break; } /* In case the last bucket is already used */ if (i >= last) { - last = hash & (_capacity - 1); + last = hash & (self->_capacity - 1); - for (i = 0; i < last && _buckets[i] != NULL; i++) { - if (_buckets[i] == &deleted) + for (i = 0; i < last && self->_buckets[i] != NULL; i++) { + if (self->_buckets[i] == &deleted) continue; - if (_keyFunctions.equal(_buckets[i]->key, key)) + if (self->_keyFunctions.equal( + self->_buckets[i]->key, key)) break; } } /* Key not in map table */ - if (i >= last || _buckets[i] == NULL || _buckets[i] == &deleted || - !_keyFunctions.equal(_buckets[i]->key, key)) { + if (i >= last || self->_buckets[i] == NULL || + self->_buckets[i] == &deleted || + !self->_keyFunctions.equal(self->_buckets[i]->key, key)) { struct of_map_table_bucket *bucket; - [self of_resizeForCount: _count + 1]; + resizeForCount(self, self->_count + 1); - _mutations++; - last = _capacity; + self->_mutations++; + last = self->_capacity; - for (i = hash & (_capacity - 1); i < last && - _buckets[i] != NULL && _buckets[i] != &deleted; i++); + for (i = hash & (self->_capacity - 1); i < last && + self->_buckets[i] != NULL && self->_buckets[i] != &deleted; + i++); /* In case the last bucket is already used */ if (i >= last) { - last = hash & (_capacity - 1); + last = hash & (self->_capacity - 1); - for (i = 0; i < last && _buckets[i] != NULL && - _buckets[i] != &deleted; i++); + for (i = 0; i < last && self->_buckets[i] != NULL && + self->_buckets[i] != &deleted; i++); } if (i >= last) @throw [OFOutOfRangeException exception]; bucket = of_alloc(1, sizeof(*bucket)); @try { - bucket->key = _keyFunctions.retain(key); + bucket->key = self->_keyFunctions.retain(key); } @catch (id e) { free(bucket); @throw e; } @try { - bucket->object = _objectFunctions.retain(object); + bucket->object = self->_objectFunctions.retain(object); } @catch (id e) { - _keyFunctions.release(bucket->key); + self->_keyFunctions.release(bucket->key); free(bucket); @throw e; } bucket->hash = hash; - _buckets[i] = bucket; - _count++; + self->_buckets[i] = bucket; + self->_count++; return; } - old = _buckets[i]->object; - _buckets[i]->object = _objectFunctions.retain(object); - _objectFunctions.release(old); + old = self->_buckets[i]->object; + self->_buckets[i]->object = self->_objectFunctions.retain(object); + self->_objectFunctions.release(old); } - (void)setObject: (void *)object forKey: (void *)key { - [self of_setObject: object forKey: key hash: _keyFunctions.hash(key)]; + setObject(self, key, object,_keyFunctions.hash(key)); } - (void)removeObjectForKey: (void *)key { unsigned long i, hash, last; @@ -469,11 +469,11 @@ free(_buckets[i]); _buckets[i] = &deleted; _count--; - [self of_resizeForCount: _count]; + resizeForCount(self, _count); return; } } @@ -494,11 +494,11 @@ free(_buckets[i]); _buckets[i] = &deleted; _count--; _mutations++; - [self of_resizeForCount: _count]; + resizeForCount(self, _count); return; } } } Index: src/OFMapTableDictionary.m ================================================================== --- src/OFMapTableDictionary.m +++ src/OFMapTableDictionary.m @@ -179,12 +179,11 @@ } return self; } -- (instancetype)initWithKey: (id)firstKey - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)firstKey arguments: (va_list)arguments { self = [super init]; @try { va_list argumentsCopy; @@ -352,12 +351,11 @@ keys[i++] = (id)*keyPtr; } objc_autoreleasePoolPop(pool); - ret = [OFArray arrayWithObjects: keys - count: count]; + ret = [OFArray arrayWithObjects: keys count: count]; } @finally { free(keys); } return ret; @@ -386,12 +384,11 @@ objects[i++] = (id)*objectPtr; } objc_autoreleasePoolPop(pool); - ret = [OFArray arrayWithObjects: objects - count: count]; + ret = [OFArray arrayWithObjects: objects count: count]; } @finally { free(objects); } return ret; Index: src/OFMapTableSet.m ================================================================== --- src/OFMapTableSet.m +++ src/OFMapTableSet.m @@ -134,12 +134,11 @@ } return self; } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { self = [self initWithCapacity: count]; @try { for (size_t i = 0; i < count; i++) @@ -150,12 +149,11 @@ } return self; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { self = [super init]; @try { id object; Index: src/OFMessagePackExtension.m ================================================================== --- src/OFMessagePackExtension.m +++ src/OFMessagePackExtension.m @@ -22,24 +22,21 @@ #import "OFInvalidArgumentException.h" @implementation OFMessagePackExtension @synthesize type = _type, data = _data; -+ (instancetype)extensionWithType: (int8_t)type - data: (OFData *)data ++ (instancetype)extensionWithType: (int8_t)type data: (OFData *)data { - return [[[self alloc] initWithType: type - data: data] autorelease]; + return [[[self alloc] initWithType: type data: data] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithType: (int8_t)type - data: (OFData *)data +- (instancetype)initWithType: (int8_t)type data: (OFData *)data { self = [super init]; @try { if (data == nil || data.itemSize != 1) @@ -122,12 +119,11 @@ prefix = 0xC8; [ret addItem: &prefix]; length = OF_BSWAP16_IF_LE((uint16_t)count); - [ret addItems: &length - count: 2]; + [ret addItems: &length count: 2]; [ret addItem: &_type]; } else { uint32_t length; @@ -135,19 +131,16 @@ prefix = 0xC9; [ret addItem: &prefix]; length = OF_BSWAP32_IF_LE((uint32_t)count); - [ret addItems: &length - count: 4]; + [ret addItems: &length count: 4]; [ret addItem: &_type]; } - [ret addItems: _data.items - count: _data.count]; - + [ret addItems: _data.items count: _data.count]; [ret makeImmutable]; return ret; } Index: src/OFMutableAdjacentArray.m ================================================================== --- src/OFMutableAdjacentArray.m +++ src/OFMutableAdjacentArray.m @@ -57,37 +57,32 @@ [object retain]; _mutations++; } -- (void)insertObject: (id)object - atIndex: (size_t)idx +- (void)insertObject: (id)object atIndex: (size_t)idx { if (object == nil) @throw [OFInvalidArgumentException exception]; @try { - [_array insertItem: &object - atIndex: idx]; + [_array insertItem: &object atIndex: idx]; } @catch (OFOutOfRangeException *e) { @throw [OFOutOfRangeException exception]; } [object retain]; _mutations++; } -- (void)insertObjectsFromArray: (OFArray *)array - atIndex: (size_t)idx +- (void)insertObjectsFromArray: (OFArray *)array atIndex: (size_t)idx { id const *objects = array.objects; size_t count = array.count; @try { - [_array insertItems: objects - atIndex: idx - count: count]; + [_array insertItems: objects atIndex: idx count: count]; } @catch (OFOutOfRangeException *e) { @throw [OFOutOfRangeException exception]; } for (size_t i = 0; i < count; i++) @@ -94,12 +89,11 @@ [objects[i] retain]; _mutations++; } -- (void)replaceObject: (id)oldObject - withObject: (id)newObject +- (void)replaceObject: (id)oldObject withObject: (id)newObject { id *objects; size_t count; if (oldObject == nil || newObject == nil) @@ -117,12 +111,11 @@ return; } } } -- (void)replaceObjectAtIndex: (size_t)idx - withObject: (id)object +- (void)replaceObjectAtIndex: (size_t)idx withObject: (id)object { id *objects; id oldObject; if (object == nil) @@ -136,12 +129,11 @@ oldObject = objects[idx]; objects[idx] = [object retain]; [oldObject release]; } -- (void)replaceObjectIdenticalTo: (id)oldObject - withObject: (id)newObject +- (void)replaceObjectIdenticalTo: (id)oldObject withObject: (id)newObject { id *objects; size_t count; if (oldObject == nil || newObject == nil) @@ -270,12 +262,11 @@ _mutations++; #endif } -- (void)exchangeObjectAtIndex: (size_t)idx1 - withObjectAtIndex: (size_t)idx2 +- (void)exchangeObjectAtIndex: (size_t)idx1 withObjectAtIndex: (size_t)idx2 { id *objects = _array.mutableItems; size_t count = _array.count; id tmp; Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -163,12 +163,11 @@ va_end(arguments); return ret; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { return (id)[[OFMutableAdjacentArray alloc] initWithObject: firstObject arguments: arguments]; } @@ -175,12 +174,11 @@ - (instancetype)initWithArray: (OFArray *)array { return (id)[[OFMutableAdjacentArray alloc] initWithArray: array]; } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { return (id)[[OFMutableAdjacentArray alloc] initWithObjects: objects count: count]; } @@ -427,12 +425,11 @@ quicksort(self, 0, count - 1, selector, options); } #ifdef OF_HAVE_BLOCKS -- (void)sortUsingComparator: (of_comparator_t)comparator - options: (int)options +- (void)sortUsingComparator: (of_comparator_t)comparator options: (int)options { size_t count = self.count; if (count == 0 || count == 1) return; Index: src/OFMutableData.m ================================================================== --- src/OFMutableData.m +++ src/OFMutableData.m @@ -40,12 +40,11 @@ + (instancetype)dataWithCapacity: (size_t)capacity { return [[[self alloc] initWithCapacity: capacity] autorelease]; } -+ (instancetype)dataWithItemSize: (size_t)itemSize - capacity: (size_t)capacity ++ (instancetype)dataWithItemSize: (size_t)itemSize capacity: (size_t)capacity { return [[[self alloc] initWithItemSize: itemSize capacity: capacity] autorelease]; } @@ -81,12 +80,11 @@ { return [self initWithItemSize: 1 capacity: capacity]; } -- (instancetype)initWithItemSize: (size_t)itemSize - capacity: (size_t)capacity +- (instancetype)initWithItemSize: (size_t)itemSize capacity: (size_t)capacity { self = [super init]; @try { if (itemSize == 0) @@ -106,13 +104,11 @@ - (instancetype)initWithItems: (const void *)items count: (size_t)count itemSize: (size_t)itemSize { - self = [super initWithItems: items - count: count - itemSize: itemSize]; + self = [super initWithItems: items count: count itemSize: itemSize]; _capacity = _count; return self; } @@ -120,13 +116,11 @@ - (instancetype)initWithItemsNoCopy: (void *)items count: (size_t)count itemSize: (size_t)itemSize freeWhenDone: (bool)freeWhenDone { - self = [self initWithItems: items - count: count - itemSize: itemSize]; + self = [self initWithItems: items count: count itemSize: itemSize]; if (freeWhenDone) free(items); return self; @@ -194,20 +188,16 @@ memcpy(_items + _count * _itemSize, item, _itemSize); _count++; } -- (void)insertItem: (const void *)item - atIndex: (size_t)idx +- (void)insertItem: (const void *)item atIndex: (size_t)idx { - [self insertItems: item - atIndex: idx - count: 1]; + [self insertItems: item atIndex: idx count: 1]; } -- (void)addItems: (const void *)items - count: (size_t)count +- (void)addItems: (const void *)items count: (size_t)count { if (count > SIZE_MAX - _count) @throw [OFOutOfRangeException exception]; if (_count + count > _capacity) { Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -38,19 +38,17 @@ { return (id)[[OFMutableMapTableDictionary alloc] initWithDictionary: dictionary]; } -- (instancetype)initWithObject: (id)object - forKey: (id)key +- (instancetype)initWithObject: (id)object forKey: (id)key { return (id)[[OFMutableMapTableDictionary alloc] initWithObject: object forKey: key]; } -- (instancetype)initWithObjects: (OFArray *)objects - forKeys: (OFArray *)keys +- (instancetype)initWithObjects: (OFArray *)objects forKeys: (OFArray *)keys { return (id)[[OFMutableMapTableDictionary alloc] initWithObjects: objects forKeys: keys]; } @@ -74,12 +72,11 @@ va_end(arguments); return ret; } -- (instancetype)initWithKey: (id)firstKey - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)firstKey arguments: (va_list)arguments { return (id)[[OFMutableMapTableDictionary alloc] initWithKey: firstKey arguments: arguments]; } Index: src/OFMutablePair.m ================================================================== --- src/OFMutablePair.m +++ src/OFMutablePair.m @@ -35,16 +35,14 @@ } - (id)copy { OFMutablePair *copy = [self mutableCopy]; - [copy makeImmutable]; - return copy; } - (void)makeImmutable { object_setClass(self, [OFPair class]); } @end Index: src/OFMutableSet.m ================================================================== --- src/OFMutableSet.m +++ src/OFMutableSet.m @@ -56,19 +56,17 @@ va_end(arguments); return ret; } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { return (id)[[OFMutableMapTableSet alloc] initWithObjects: objects count: count]; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { return (id)[[OFMutableMapTableSet alloc] initWithObject: firstObject arguments: arguments]; } @@ -180,11 +178,11 @@ cArray[i++] = object; } for (i = 0; i < count; i++) if (![set containsObject: cArray[i]]) - [self removeObject: cArray[i]]; + [self removeObject: cArray[i]]; } @finally { free(cArray); } objc_autoreleasePoolPop(pool); Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -231,11 +231,11 @@ #ifdef OF_HAVE_UNICODE_TABLES - (void)of_convertWithWordStartTable: (const of_unichar_t *const [])startTable wordMiddleTable: (const of_unichar_t *const [])middleTable wordStartTableSize: (size_t)startTableSize - wordMiddleTableSize: (size_t)middleTableSize OF_DIRECT + wordMiddleTableSize: (size_t)middleTableSize { void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = self.characters; size_t length = self.length; bool isStart = true; @@ -252,22 +252,21 @@ table = middleTable; tableSize = middleTableSize; } if (c >> 8 < tableSize && table[c >> 8][c & 0xFF]) - [self setCharacter: table[c >> 8][c & 0xFF] - atIndex: i]; + [self setCharacter: table[c >> 8][c & 0xFF] atIndex: i]; isStart = of_ascii_isspace(c); } objc_autoreleasePoolPop(pool); } #else -- (void)of_convertWithWordStartFunction: (char (*)(char))startFunction - wordMiddleFunction: (char (*)(char))middleFunction - OF_DIRECT +static void +convert(OFMutableString *self, char (*startFunction)(char), + char (*middleFunction)(char)) { void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = self.characters; size_t length = self.length; bool isStart = true; @@ -276,93 +275,75 @@ char (*function)(char) = (isStart ? startFunction : middleFunction); of_unichar_t c = characters[i]; if (c <= 0x7F) - [self setCharacter: (int)function(c) - atIndex: i]; + [self setCharacter: (int)function(c) atIndex: i]; isStart = of_ascii_isspace(c); } objc_autoreleasePoolPop(pool); } #endif -- (void)setCharacter: (of_unichar_t)character - atIndex: (size_t)idx +- (void)setCharacter: (of_unichar_t)character atIndex: (size_t)idx { void *pool = objc_autoreleasePoolPush(); - OFString *string; - - string = [OFString stringWithCharacters: &character - length: 1]; - - [self replaceCharactersInRange: of_range(idx, 1) - withString: string]; - + OFString *string = + [OFString stringWithCharacters: &character length: 1]; + [self replaceCharactersInRange: of_range(idx, 1) withString: string]; objc_autoreleasePoolPop(pool); } - (void)appendString: (OFString *)string { - [self insertString: string - atIndex: self.length]; + [self insertString: string atIndex: self.length]; } - (void)appendCharacters: (const of_unichar_t *)characters length: (size_t)length { void *pool = objc_autoreleasePoolPush(); - [self appendString: [OFString stringWithCharacters: characters length: length]]; - objc_autoreleasePoolPop(pool); } - (void)appendUTF8String: (const char *)UTF8String { void *pool = objc_autoreleasePoolPush(); - [self appendString: [OFString stringWithUTF8String: UTF8String]]; - objc_autoreleasePoolPop(pool); } - (void)appendUTF8String: (const char *)UTF8String length: (size_t)UTF8StringLength { void *pool = objc_autoreleasePoolPush(); - [self appendString: [OFString stringWithUTF8String: UTF8String length: UTF8StringLength]]; - objc_autoreleasePoolPop(pool); } - (void)appendCString: (const char *)cString encoding: (of_string_encoding_t)encoding { void *pool = objc_autoreleasePoolPush(); - [self appendString: [OFString stringWithCString: cString encoding: encoding]]; - objc_autoreleasePoolPop(pool); } - (void)appendCString: (const char *)cString encoding: (of_string_encoding_t)encoding length: (size_t)cStringLength { void *pool = objc_autoreleasePoolPush(); - [self appendString: [OFString stringWithCString: cString encoding: encoding length: cStringLength]]; - objc_autoreleasePoolPop(pool); } - (void)appendFormat: (OFConstantString *)format, ... { @@ -372,12 +353,11 @@ [self appendFormat: format arguments: arguments]; va_end(arguments); } -- (void)appendFormat: (OFConstantString *)format - arguments: (va_list)arguments +- (void)appendFormat: (OFConstantString *)format arguments: (va_list)arguments { char *UTF8String; int UTF8StringLength; if (format == nil) @@ -386,33 +366,29 @@ if ((UTF8StringLength = of_vasprintf(&UTF8String, format.UTF8String, arguments)) == -1) @throw [OFInvalidFormatException exception]; @try { - [self appendUTF8String: UTF8String - length: UTF8StringLength]; + [self appendUTF8String: UTF8String length: UTF8StringLength]; } @finally { free(UTF8String); } } - (void)prependString: (OFString *)string { - [self insertString: string - atIndex: 0]; + [self insertString: string atIndex: 0]; } - (void)reverse { size_t i, j, length = self.length; for (i = 0, j = length - 1; i < length / 2; i++, j--) { of_unichar_t tmp = [self characterAtIndex: j]; - [self setCharacter: [self characterAtIndex: i] - atIndex: j]; - [self setCharacter: tmp - atIndex: i]; + [self setCharacter: [self characterAtIndex: i] atIndex: j]; + [self setCharacter: tmp atIndex: i]; } } #ifdef OF_HAVE_UNICODE_TABLES - (void)uppercase @@ -439,38 +415,32 @@ wordMiddleTableSize: OF_UNICODE_LOWERCASE_TABLE_SIZE]; } #else - (void)uppercase { - [self of_convertWithWordStartFunction: of_ascii_toupper - wordMiddleFunction: of_ascii_toupper]; + convert(self, of_ascii_toupper, of_ascii_toupper); } - (void)lowercase { - [self of_convertWithWordStartFunction: of_ascii_tolower - wordMiddleFunction: of_ascii_tolower]; + convert(self, of_ascii_tolower, of_ascii_tolower); } - (void)capitalize { - [self of_convertWithWordStartFunction: of_ascii_toupper - wordMiddleFunction: of_ascii_tolower]; + convert(self, of_ascii_toupper, of_ascii_tolower); } #endif -- (void)insertString: (OFString *)string - atIndex: (size_t)idx +- (void)insertString: (OFString *)string atIndex: (size_t)idx { - [self replaceCharactersInRange: of_range(idx, 0) - withString: string]; + [self replaceCharactersInRange: of_range(idx, 0) withString: string]; } - (void)deleteCharactersInRange: (of_range_t)range { - [self replaceCharactersInRange: range - withString: @""]; + [self replaceCharactersInRange: range withString: @""]; } - (void)replaceCharactersInRange: (of_range_t)range withString: (OFString *)replacement { Index: src/OFMutableURL.m ================================================================== --- src/OFMutableURL.m +++ src/OFMutableURL.m @@ -310,12 +310,11 @@ return copy; } - (void)appendPathComponent: (OFString *)component { - [self appendPathComponent: component - isDirectory: false]; + [self appendPathComponent: component isDirectory: false]; #ifdef OF_HAVE_FILES if ([_URLEncodedScheme isEqual: @"file"] && ![_URLEncodedPath hasSuffix: @"/"] && [[OFFileManager defaultManager] directoryExistsAtURL: self]) { @@ -411,12 +410,11 @@ break; } } } - [array insertObject: @"" - atIndex: 0]; + [array insertObject: @"" atIndex: 0]; if (endsWithEmpty) [array addObject: @""]; path = [array componentsJoinedByString: @"/"]; if (path.length == 0) Index: src/OFMutableUTF8String.m ================================================================== --- src/OFMutableUTF8String.m +++ src/OFMutableUTF8String.m @@ -53,23 +53,23 @@ - (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String length: (size_t)UTF8StringLength freeWhenDone: (bool)freeWhenDone { - self = [self initWithUTF8String: UTF8String - length: UTF8StringLength]; + self = [self initWithUTF8String: UTF8String length: UTF8StringLength]; if (freeWhenDone) free(UTF8String); return self; } -- (void)of_convertWithWordStartTable: (const of_unichar_t *const[])startTable - wordMiddleTable: (const of_unichar_t *const[])middleTable +#ifdef OF_HAVE_UNICODE_TABLES +- (void)of_convertWithWordStartTable: (const of_unichar_t *const [])startTable + wordMiddleTable: (const of_unichar_t *const [])middleTable wordStartTableSize: (size_t)startTableSize - wordMiddleTableSize: (size_t)middleTableSize OF_DIRECT + wordMiddleTableSize: (size_t)middleTableSize { of_unichar_t *unicodeString; size_t unicodeLen, newCStringLength; size_t i, j; char *newCString; @@ -185,13 +185,13 @@ /* * Even though cStringLength can change, length cannot, therefore no * need to change it. */ } +#endif -- (void)setCharacter: (of_unichar_t)character - atIndex: (size_t)idx +- (void)setCharacter: (of_unichar_t)character atIndex: (size_t)idx { char buffer[4]; of_unichar_t c; size_t lenNew; ssize_t lenOld; @@ -326,12 +326,11 @@ - (void)appendCString: (const char *)cString encoding: (of_string_encoding_t)encoding length: (size_t)cStringLength { if (encoding == OF_STRING_ENCODING_UTF_8) - [self appendUTF8String: cString - length: cStringLength]; + [self appendUTF8String: cString length: cStringLength]; else { void *pool = objc_autoreleasePoolPush(); [self appendString: [OFString stringWithCString: cString @@ -407,12 +406,11 @@ } @finally { free(tmp); } } -- (void)appendFormat: (OFConstantString *)format - arguments: (va_list)arguments +- (void)appendFormat: (OFConstantString *)format arguments: (va_list)arguments { char *UTF8String; int UTF8StringLength; if (format == nil) @@ -421,12 +419,11 @@ if ((UTF8StringLength = of_vasprintf(&UTF8String, format.UTF8String, arguments)) == -1) @throw [OFInvalidFormatException exception]; @try { - [self appendUTF8String: UTF8String - length: UTF8StringLength]; + [self appendUTF8String: UTF8String length: UTF8StringLength]; } @finally { free(UTF8String); } } @@ -508,12 +505,11 @@ /* UTF-8 does not allow more than 4 bytes per character */ @throw [OFInvalidEncodingException exception]; } } -- (void)insertString: (OFString *)string - atIndex: (size_t)idx +- (void)insertString: (OFString *)string atIndex: (size_t)idx { size_t newCStringLength; if (idx > _s->length) @throw [OFOutOfRangeException exception]; Index: src/OFMutableZIPArchiveEntry.m ================================================================== --- src/OFMutableZIPArchiveEntry.m +++ src/OFMutableZIPArchiveEntry.m @@ -31,13 +31,11 @@ @dynamic of_localFileHeaderOffset; - (id)copy { OFMutableZIPArchiveEntry *copy = [self mutableCopy]; - [copy makeImmutable]; - return copy; } - (void)setFileName: (OFString *)fileName { Index: src/OFNonretainedObjectValue.m ================================================================== --- src/OFNonretainedObjectValue.m +++ src/OFNonretainedObjectValue.m @@ -33,12 +33,11 @@ - (const char *)objCType { return @encode(id); } -- (void)getValue: (void *)value - size: (size_t)size +- (void)getValue: (void *)value size: (size_t)size { if (size != sizeof(_object)) @throw [OFOutOfRangeException exception]; memcpy(value, &_object, sizeof(_object)); Index: src/OFNull.m ================================================================== --- src/OFNull.m +++ src/OFNull.m @@ -82,18 +82,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 { @@ -101,21 +99,17 @@ } - (OFData *)messagePackRepresentation { uint8_t type = 0xC0; - - return [OFData dataWithItems: &type - count: 1]; + return [OFData dataWithItems: &type count: 1]; } - (OFData *)ASN1DERRepresentation { const unsigned char bytes[] = { OF_ASN1_TAG_NUMBER_NULL, 0 }; - - return [OFData dataWithItems: bytes - count: sizeof(bytes)]; + return [OFData dataWithItems: bytes count: sizeof(bytes)]; } - (instancetype)autorelease { return self; Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -792,12 +792,11 @@ - (const char *)objCType { return _typeEncoding; } -- (void)getValue: (void *)value - size: (size_t)size +- (void)getValue: (void *)value size: (size_t)size { switch (*self.objCType) { #define CASE(enc, type, property) \ case enc: { \ type tmp = (type)self.property; \ @@ -1049,22 +1048,19 @@ element = [OFXMLElement elementWithName: @"OFNumber" namespace: OF_SERIALIZATION_NS stringValue: self.description]; if (*self.objCType == 'B') - [element addAttributeWithName: @"type" - stringValue: @"bool"]; + [element addAttributeWithName: @"type" stringValue: @"bool"]; else if (isFloat(self)) { - [element addAttributeWithName: @"type" - stringValue: @"float"]; + [element addAttributeWithName: @"type" stringValue: @"float"]; element.stringValue = [OFString stringWithFormat: @"%016" PRIx64, OF_BSWAP64_IF_LE(OF_DOUBLE_TO_INT_RAW(OF_BSWAP_DOUBLE_IF_LE( self.doubleValue)))]; } else if (isSigned(self)) - [element addAttributeWithName: @"type" - stringValue: @"signed"]; + [element addAttributeWithName: @"type" stringValue: @"signed"]; else if (isUnsigned(self)) [element addAttributeWithName: @"type" stringValue: @"unsigned"]; else @throw [OFInvalidFormatException exception]; @@ -1076,18 +1072,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 { @@ -1115,129 +1109,96 @@ OFMutableData *data; const char *typeEncoding = self.objCType; if (*typeEncoding == 'B') { uint8_t type = (self.boolValue ? 0xC3 : 0xC2); - - data = [OFMutableData dataWithItems: &type - count: 1]; + data = [OFMutableData dataWithItems: &type count: 1]; } else if (*typeEncoding == 'f') { uint8_t type = 0xCA; float tmp = OF_BSWAP_FLOAT_IF_LE(self.floatValue); - data = [OFMutableData dataWithItemSize: 1 - capacity: 5]; - + data = [OFMutableData dataWithCapacity: 5]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (*typeEncoding == 'd') { uint8_t type = 0xCB; double tmp = OF_BSWAP_DOUBLE_IF_LE(self.doubleValue); - data = [OFMutableData dataWithItemSize: 1 - capacity: 9]; - + data = [OFMutableData dataWithCapacity: 9]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (isSigned(self)) { long long value = self.longLongValue; if (value >= -32 && value < 0) { uint8_t tmp = 0xE0 | ((uint8_t)(value - 32) & 0x1F); - data = [OFMutableData dataWithItems: &tmp - count: 1]; + data = [OFMutableData dataWithItems: &tmp count: 1]; } else if (value >= INT8_MIN && value <= INT8_MAX) { uint8_t type = 0xD0; int8_t tmp = (int8_t)value; - data = [OFMutableData dataWithItemSize: 1 - capacity: 2]; - + data = [OFMutableData dataWithCapacity: 2]; [data addItem: &type]; [data addItem: &tmp]; } else if (value >= INT16_MIN && value <= INT16_MAX) { uint8_t type = 0xD1; int16_t tmp = OF_BSWAP16_IF_LE((int16_t)value); - data = [OFMutableData dataWithItemSize: 1 - capacity: 3]; - + data = [OFMutableData dataWithCapacity: 3]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (value >= INT32_MIN && value <= INT32_MAX) { uint8_t type = 0xD2; int32_t tmp = OF_BSWAP32_IF_LE((int32_t)value); - data = [OFMutableData dataWithItemSize: 1 - capacity: 5]; - + data = [OFMutableData dataWithCapacity: 5]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (value >= INT64_MIN && value <= INT64_MAX) { uint8_t type = 0xD3; int64_t tmp = OF_BSWAP64_IF_LE((int64_t)value); - data = [OFMutableData dataWithItemSize: 1 - capacity: 9]; - + data = [OFMutableData dataWithCapacity: 9]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else @throw [OFOutOfRangeException exception]; } else if (isUnsigned(self)) { unsigned long long value = self.unsignedLongLongValue; if (value <= 127) { uint8_t tmp = ((uint8_t)value & 0x7F); - - data = [OFMutableData dataWithItems: &tmp - count: 1]; + data = [OFMutableData dataWithItems: &tmp count: 1]; } else if (value <= UINT8_MAX) { uint8_t type = 0xCC; uint8_t tmp = (uint8_t)value; - data = [OFMutableData dataWithItemSize: 1 - capacity: 2]; - + data = [OFMutableData dataWithCapacity: 2]; [data addItem: &type]; [data addItem: &tmp]; } else if (value <= UINT16_MAX) { uint8_t type = 0xCD; uint16_t tmp = OF_BSWAP16_IF_LE((uint16_t)value); - data = [OFMutableData dataWithItemSize: 1 - capacity: 3]; - + data = [OFMutableData dataWithCapacity: 3]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (value <= UINT32_MAX) { uint8_t type = 0xCE; uint32_t tmp = OF_BSWAP32_IF_LE((uint32_t)value); - data = [OFMutableData dataWithItemSize: 1 - capacity: 5]; - + data = [OFMutableData dataWithCapacity: 5]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (value <= UINT64_MAX) { uint8_t type = 0xCF; uint64_t tmp = OF_BSWAP64_IF_LE((uint64_t)value); - data = [OFMutableData dataWithItemSize: 1 - capacity: 9]; - + data = [OFMutableData dataWithCapacity: 9]; [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else @throw [OFOutOfRangeException exception]; } else @throw [OFInvalidFormatException exception]; Index: src/OFObject+KeyValueCoding.m ================================================================== --- src/OFObject+KeyValueCoding.m +++ src/OFObject+KeyValueCoding.m @@ -137,16 +137,14 @@ return [ret autorelease]; } - (id)valueForUndefinedKey: (OFString *)key { - @throw [OFUndefinedKeyException exceptionWithObject: self - key: key]; + @throw [OFUndefinedKeyException exceptionWithObject: self key: key]; } -- (void)setValue: (id)value - forKey: (OFString *)key +- (void)setValue: (id)value forKey: (OFString *)key { void *pool = objc_autoreleasePoolPush(); size_t keyLength; char *name; SEL selector; @@ -153,12 +151,11 @@ OFMethodSignature *methodSignature; const char *valueType; if ((keyLength = key.UTF8StringLength) < 1) { objc_autoreleasePoolPop(pool); - [self setValue: value - forUndefinedKey: key]; + [self setValue: value forUndefinedKey: key]; return; } name = of_alloc(keyLength + 5, 1); @try { @@ -179,12 +176,11 @@ methodSignature.numberOfArguments != 3 || *methodSignature.methodReturnType != 'v' || *[methodSignature argumentTypeAtIndex: 0] != '@' || *[methodSignature argumentTypeAtIndex: 1] != ':') { objc_autoreleasePoolPop(pool); - [self setValue: value - forUndefinedKey: key]; + [self setValue: value forUndefinedKey: key]; return; } valueType = [methodSignature argumentTypeAtIndex: 2]; @@ -226,40 +222,36 @@ CASE('f', float, floatValue) CASE('d', double, doubleValue) #undef CASE default: objc_autoreleasePoolPop(pool); - [self setValue: value - forUndefinedKey: key]; + [self setValue: value forUndefinedKey: key]; return; } objc_autoreleasePoolPop(pool); } -- (void)setValue: (id)value - forKeyPath: (OFString *)keyPath +- (void)setValue: (id)value forKeyPath: (OFString *)keyPath { void *pool = objc_autoreleasePoolPush(); OFArray *keys = [keyPath componentsSeparatedByString: @"."]; size_t keysCount = keys.count; id object = self; size_t i = 0; for (OFString *key in keys) { if (++i == keysCount) - [object setValue: value - forKey: key]; + [object setValue: value forKey: key]; else object = [object valueForKey: key]; } objc_autoreleasePoolPop(pool); } -- (void)setValue: (id)value - forUndefinedKey: (OFString *)key +- (void)setValue: (id)value forUndefinedKey: (OFString *)key { @throw [OFUndefinedKeyException exceptionWithObject: self key: key value: value]; } Index: src/OFObject+Serialization.m ================================================================== --- src/OFObject+Serialization.m +++ src/OFObject+Serialization.m @@ -41,12 +41,11 @@ pool = objc_autoreleasePoolPush(); element = ((id )self).XMLElementBySerializing; root = [OFXMLElement elementWithName: @"serialization" namespace: OF_SERIALIZATION_NS]; - [root addAttributeWithName: @"version" - stringValue: @"1"]; + [root addAttributeWithName: @"version" stringValue: @"1"]; [root addChild: element]; ret = [@"\n" stringByAppendingString: [root XMLStringWithIndentation: 2]]; Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -458,12 +458,11 @@ + (OFString *)description { return [self className]; } -+ (IMP)replaceClassMethod: (SEL)selector - withMethodFromClass: (Class)class ++ (IMP)replaceClassMethod: (SEL)selector withMethodFromClass: (Class)class { IMP method = [class methodForSelector: selector]; if (method == NULL) @throw [OFInvalidArgumentException exception]; @@ -470,12 +469,11 @@ return class_replaceMethod(object_getClass(self), selector, method, typeEncodingForSelector(object_getClass(class), selector)); } -+ (IMP)replaceInstanceMethod: (SEL)selector - withMethodFromClass: (Class)class ++ (IMP)replaceInstanceMethod: (SEL)selector withMethodFromClass: (Class)class { IMP method = [class instanceMethodForSelector: selector]; if (method == NULL) @throw [OFInvalidArgumentException exception]; @@ -606,12 +604,11 @@ #endif return imp(self, selector); } -- (id)performSelector: (SEL)selector - withObject: (id)object +- (id)performSelector: (SEL)selector withObject: (id)object { #if defined(OF_OBJFW_RUNTIME) id (*imp)(id, SEL, id) = (id (*)(id, SEL, id))objc_msg_lookup(self, selector); #elif defined(OF_APPLE_RUNTIME) @@ -666,12 +663,11 @@ #endif return imp(self, selector, object1, object2, object3, object4); } -- (void)performSelector: (SEL)selector - afterDelay: (of_time_interval_t)delay +- (void)performSelector: (SEL)selector afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self Index: src/OFPointValue.m ================================================================== --- src/OFPointValue.m +++ src/OFPointValue.m @@ -34,12 +34,11 @@ - (const char *)objCType { return @encode(of_point_t); } -- (void)getValue: (void *)value - size: (size_t)size +- (void)getValue: (void *)value size: (size_t)size { if (size != sizeof(_point)) @throw [OFOutOfRangeException exception]; memcpy(value, &_point, sizeof(_point)); Index: src/OFPointerValue.m ================================================================== --- src/OFPointerValue.m +++ src/OFPointerValue.m @@ -33,12 +33,11 @@ - (const char *)objCType { return @encode(void *); } -- (void)getValue: (void *)value - size: (size_t)size +- (void)getValue: (void *)value size: (size_t)size { if (size != sizeof(_pointer)) @throw [OFOutOfRangeException exception]; memcpy(value, &_pointer, sizeof(_pointer)); Index: src/OFPollKernelEventObserver.m ================================================================== --- src/OFPollKernelEventObserver.m +++ src/OFPollKernelEventObserver.m @@ -65,24 +65,23 @@ free(_FDToObject); [super dealloc]; } -- (void)of_addObject: (id)object - fileDescriptor: (int)fd - events: (short)events OF_DIRECT +static void +addObject(OFPollKernelEventObserver *self, id object, int fd, short events) { struct pollfd *FDs; size_t count; bool found; if (fd < 0) @throw [OFObserveFailedException exceptionWithObserver: self errNo: EBADF]; - FDs = _FDs.mutableItems; - count = _FDs.count; + FDs = self->_FDs.mutableItems; + count = self->_FDs.count; found = false; for (size_t i = 0; i < count; i++) { if (FDs[i].fd == fd) { FDs[i].events |= events; @@ -92,34 +91,33 @@ } if (!found) { struct pollfd p = { fd, events, 0 }; - if (fd > _maxFD) { - _maxFD = fd; - _FDToObject = of_realloc(_FDToObject, - (size_t)_maxFD + 1, sizeof(id)); + if (fd > self->_maxFD) { + self->_maxFD = fd; + self->_FDToObject = of_realloc(self->_FDToObject, + (size_t)self->_maxFD + 1, sizeof(id)); } - _FDToObject[fd] = object; - [_FDs addItem: &p]; + self->_FDToObject[fd] = object; + [self->_FDs addItem: &p]; } } -- (void)of_removeObject: (id)object - fileDescriptor: (int)fd - events: (short)events OF_DIRECT +static void +removeObject(OFPollKernelEventObserver *self, id object, int fd, short events) { struct pollfd *FDs; size_t nFDs; if (fd < 0) @throw [OFObserveFailedException exceptionWithObserver: self errNo: EBADF]; - FDs = _FDs.mutableItems; - nFDs = _FDs.count; + FDs = self->_FDs.mutableItems; + nFDs = self->_FDs.count; for (size_t i = 0; i < nFDs; i++) { if (FDs[i].fd == fd) { FDs[i].events &= ~events; @@ -126,50 +124,42 @@ if (FDs[i].events == 0) { /* * TODO: Remove from and resize _FDToObject, * adjust _maxFD. */ - [_FDs removeItemAtIndex: i]; + [self->_FDs removeItemAtIndex: i]; } break; } } } - (void)addObjectForReading: (id )object { - [self of_addObject: object - fileDescriptor: object.fileDescriptorForReading - events: POLLIN]; + addObject(self, object, object.fileDescriptorForReading, POLLIN); [super addObjectForReading: object]; } - (void)addObjectForWriting: (id )object { - [self of_addObject: object - fileDescriptor: object.fileDescriptorForWriting - events: POLLOUT]; + addObject(self, object, object.fileDescriptorForWriting, POLLOUT); [super addObjectForWriting: object]; } - (void)removeObjectForReading: (id )object { - [self of_removeObject: object - fileDescriptor: object.fileDescriptorForReading - events: POLLIN]; + removeObject(self, object, object.fileDescriptorForReading, POLLIN); [super removeObjectForReading: object]; } - (void)removeObjectForWriting: (id )object { - [self of_removeObject: object - fileDescriptor: object.fileDescriptorForWriting - events: POLLOUT]; + removeObject(self, object, object.fileDescriptorForWriting, POLLOUT); [super removeObjectForWriting: object]; } - (void)observeForTimeInterval: (of_time_interval_t)timeInterval Index: src/OFRIPEMD160Hash.m ================================================================== --- src/OFRIPEMD160Hash.m +++ src/OFRIPEMD160Hash.m @@ -221,12 +221,11 @@ _iVars->state[2] = 0x98BADCFE; _iVars->state[3] = 0x10325476; _iVars->state[4] = 0xC3D2E1F0; } -- (void)updateWithBuffer: (const void *)buffer_ - length: (size_t)length +- (void)updateWithBuffer: (const void *)buffer_ length: (size_t)length { const unsigned char *buffer = buffer_; if (_calculated) @throw [OFHashAlreadyCalculatedException Index: src/OFRangeValue.m ================================================================== --- src/OFRangeValue.m +++ src/OFRangeValue.m @@ -34,12 +34,11 @@ - (const char *)objCType { return @encode(of_range_t); } -- (void)getValue: (void *)value - size: (size_t)size +- (void)getValue: (void *)value size: (size_t)size { if (size != sizeof(_range)) @throw [OFOutOfRangeException exception]; memcpy(value, &_range, sizeof(_range)); Index: src/OFRectangleValue.m ================================================================== --- src/OFRectangleValue.m +++ src/OFRectangleValue.m @@ -34,12 +34,11 @@ - (const char *)objCType { return @encode(of_rectangle_t); } -- (void)getValue: (void *)value - size: (size_t)size +- (void)getValue: (void *)value size: (size_t)size { if (size != sizeof(_rectangle)) @throw [OFOutOfRangeException exception]; memcpy(value, &_rectangle, sizeof(_rectangle)); Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -74,16 +74,10 @@ # endif #endif } @end -OF_DIRECT_MEMBERS -@interface OFRunLoop () -- (OFRunLoopState *)of_stateForMode: (of_run_loop_mode_t)mode - create: (bool)create; -@end - #ifdef OF_HAVE_SOCKETS @interface OFRunLoopQueueItem: OFObject { @public id _delegate; @@ -427,12 +421,11 @@ { size_t length; id exception = nil; @try { - length = [object readIntoBuffer: _buffer - length: _length]; + length = [object readIntoBuffer: _buffer length: _length]; } @catch (id e) { length = 0; exception = e; } @@ -736,13 +729,11 @@ selector: @selector(of_socketDidConnect: exception:) object: object object: exception repeats: false]; - - [runLoop addTimer: timer - forMode: runLoop.currentMode]; + [runLoop addTimer: timer forMode: runLoop.currentMode]; } return false; } @end @@ -907,12 +898,11 @@ { size_t length; id exception = nil; @try { - length = [object receiveIntoBuffer: _buffer - length: _length]; + length = [object receiveIntoBuffer: _buffer length: _length]; } @catch (id e) { length = 0; exception = e; } @@ -1028,12 +1018,11 @@ #ifdef OF_HAVE_SOCKETS # define NEW_READ(type, object, mode) \ void *pool = objc_autoreleasePoolPush(); \ OFRunLoop *runLoop = [self currentRunLoop]; \ - OFRunLoopState *state = [runLoop of_stateForMode: mode \ - create: true]; \ + OFRunLoopState *state = stateForMode(runLoop, mode, true); \ OFList *queue = [state->_readQueues objectForKey: object]; \ type *queueItem; \ \ if (queue == nil) { \ queue = [OFList list]; \ @@ -1046,12 +1035,11 @@ \ queueItem = [[[type alloc] init] autorelease]; # define NEW_WRITE(type, object, mode) \ void *pool = objc_autoreleasePoolPush(); \ OFRunLoop *runLoop = [self currentRunLoop]; \ - OFRunLoopState *state = [runLoop of_stateForMode: mode \ - create: true]; \ + OFRunLoopState *state = stateForMode(runLoop, mode, true); \ OFList *queue = [state->_writeQueues objectForKey: object]; \ type *queueItem; \ \ if (queue == nil) { \ queue = [OFList list]; \ @@ -1291,12 +1279,11 @@ + (void)of_cancelAsyncRequestsForObject: (id)object mode: (of_run_loop_mode_t)mode { void *pool = objc_autoreleasePoolPush(); OFRunLoop *runLoop = [self currentRunLoop]; - OFRunLoopState *state = [runLoop of_stateForMode: mode - create: false]; + OFRunLoopState *state = stateForMode(runLoop, mode, false); OFList *queue; if (state == nil) return; @@ -1366,49 +1353,46 @@ #endif [super dealloc]; } -- (OFRunLoopState *)of_stateForMode: (of_run_loop_mode_t)mode - create: (bool)create +static OFRunLoopState * +stateForMode(OFRunLoop *self, of_run_loop_mode_t mode, bool create) { OFRunLoopState *state; #ifdef OF_HAVE_THREADS - [_statesMutex lock]; + [self->_statesMutex lock]; @try { #endif - state = [_states objectForKey: mode]; + state = [self->_states objectForKey: mode]; if (create && state == nil) { state = [[OFRunLoopState alloc] init]; @try { - [_states setObject: state forKey: mode]; + [self->_states setObject: state forKey: mode]; } @finally { [state release]; } } #ifdef OF_HAVE_THREADS } @finally { - [_statesMutex unlock]; + [self->_statesMutex unlock]; } #endif return state; } - (void)addTimer: (OFTimer *)timer { - [self addTimer: timer - forMode: of_run_loop_mode_default]; + [self addTimer: timer forMode: of_run_loop_mode_default]; } -- (void)addTimer: (OFTimer *)timer - forMode: (of_run_loop_mode_t)mode +- (void)addTimer: (OFTimer *)timer forMode: (of_run_loop_mode_t)mode { - OFRunLoopState *state = [self of_stateForMode: mode - create: true]; + OFRunLoopState *state = stateForMode(self, mode, true); #ifdef OF_HAVE_THREADS [state->_timersQueueMutex lock]; @try { #endif @@ -1417,25 +1401,22 @@ } @finally { [state->_timersQueueMutex unlock]; } #endif - [timer of_setInRunLoop: self - mode: mode]; + [timer of_setInRunLoop: self mode: mode]; #if defined(OF_HAVE_SOCKETS) [state->_kernelEventObserver cancel]; #elif defined(OF_HAVE_THREADS) [state->_condition signal]; #endif } -- (void)of_removeTimer: (OFTimer *)timer - forMode: (of_run_loop_mode_t)mode +- (void)of_removeTimer: (OFTimer *)timer forMode: (of_run_loop_mode_t)mode { - OFRunLoopState *state = [self of_stateForMode: mode - create: false]; + OFRunLoopState *state = stateForMode(self, mode, false); if (state == nil) return; #ifdef OF_HAVE_THREADS @@ -1457,13 +1438,11 @@ } #endif } #ifdef OF_AMIGAOS -- (void)addExecSignal: (ULONG)signal - target: (id)target - selector: (SEL)selector +- (void)addExecSignal: (ULONG)signal target: (id)target selector: (SEL)selector { [self addExecSignal: signal forMode: of_run_loop_mode_default target: target selector: selector]; @@ -1472,12 +1451,11 @@ - (void)addExecSignal: (ULONG)signal forMode: (of_run_loop_mode_t)mode target: (id)target selector: (SEL)selector { - OFRunLoopState *state = [self of_stateForMode: mode - create: true]; + OFRunLoopState *state = stateForMode(self, mode, true); # ifdef OF_HAVE_THREADS [state->_execSignalsMutex lock]; @try { # endif @@ -1516,12 +1494,11 @@ - (void)removeExecSignal: (ULONG)signal forMode: (of_run_loop_mode_t)mode target: (id)target selector: (SEL)selector { - OFRunLoopState *state = [self of_stateForMode: mode - create: false]; + OFRunLoopState *state = stateForMode(self, mode, false); if (state == nil) return; # ifdef OF_HAVE_THREADS @@ -1577,21 +1554,18 @@ { _stop = false; while (!_stop && (deadline == nil || deadline.timeIntervalSinceNow >= 0)) - [self runMode: of_run_loop_mode_default - beforeDate: deadline]; + [self runMode: of_run_loop_mode_default beforeDate: deadline]; } -- (void)runMode: (of_run_loop_mode_t)mode - beforeDate: (OFDate *)deadline +- (void)runMode: (of_run_loop_mode_t)mode beforeDate: (OFDate *)deadline { void *pool = objc_autoreleasePoolPush(); of_run_loop_mode_t previousMode = _currentMode; - OFRunLoopState *state = [self of_stateForMode: mode - create: false]; + OFRunLoopState *state = stateForMode(self, mode, false); if (state == nil) return; _currentMode = mode; @@ -1617,12 +1591,11 @@ retain] autorelease]; [state->_timersQueue removeListObject: listObject]; - [timer of_setInRunLoop: nil - mode: nil]; + [timer of_setInRunLoop: nil mode: nil]; } else break; #ifdef OF_HAVE_THREADS } @finally { [state->_timersQueueMutex unlock]; @@ -1721,12 +1694,12 @@ } } - (void)stop { - OFRunLoopState *state = [self of_stateForMode: of_run_loop_mode_default - create: false]; + OFRunLoopState *state = + stateForMode(self, of_run_loop_mode_default, false); _stop = true; if (state == nil) return; Index: src/OFSCTPSocket.m ================================================================== --- src/OFSCTPSocket.m +++ src/OFSCTPSocket.m @@ -121,12 +121,11 @@ { closesocket(_socket); _socket = INVALID_SOCKET; } -- (void)connectToHost: (OFString *)host - port: (uint16_t)port +- (void)connectToHost: (OFString *)host port: (uint16_t)port { void *pool = objc_autoreleasePoolPush(); id delegate = _delegate; OFSCTPSocketConnectDelegate *connectDelegate = [[[OFSCTPSocketConnectDelegate alloc] init] autorelease]; @@ -136,27 +135,24 @@ [self asyncConnectToHost: host port: port runLoopMode: connectRunLoopMode]; while (!connectDelegate->_done) - [runLoop runMode: connectRunLoopMode - beforeDate: nil]; + [runLoop runMode: connectRunLoopMode beforeDate: nil]; /* Cleanup */ - [runLoop runMode: connectRunLoopMode - beforeDate: [OFDate date]]; + [runLoop runMode: connectRunLoopMode beforeDate: [OFDate date]]; if (connectDelegate->_exception != nil) @throw connectDelegate->_exception; self.delegate = delegate; objc_autoreleasePoolPop(pool); } -- (void)asyncConnectToHost: (OFString *)host - port: (uint16_t)port +- (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port { [self asyncConnectToHost: host port: port runLoopMode: of_run_loop_mode_default]; } @@ -212,12 +208,11 @@ objc_autoreleasePoolPop(pool); } #endif -- (uint16_t)bindToHost: (OFString *)host - port: (uint16_t)port +- (uint16_t)bindToHost: (OFString *)host port: (uint16_t)port { const int one = 1; void *pool = objc_autoreleasePoolPush(); OFData *socketAddresses; of_socket_address_t address; Index: src/OFSHA1Hash.m ================================================================== --- src/OFSHA1Hash.m +++ src/OFSHA1Hash.m @@ -181,12 +181,11 @@ _iVars->state[2] = 0x98BADCFE; _iVars->state[3] = 0x10325476; _iVars->state[4] = 0xC3D2E1F0; } -- (void)updateWithBuffer: (const void *)buffer_ - length: (size_t)length +- (void)updateWithBuffer: (const void *)buffer_ length: (size_t)length { const unsigned char *buffer = buffer_; if (_calculated) @throw [OFHashAlreadyCalculatedException Index: src/OFSHA224Or256Hash.m ================================================================== --- src/OFSHA224Or256Hash.m +++ src/OFSHA224Or256Hash.m @@ -197,12 +197,11 @@ copy->_calculated = _calculated; return copy; } -- (void)updateWithBuffer: (const void *)buffer_ - length: (size_t)length +- (void)updateWithBuffer: (const void *)buffer_ length: (size_t)length { const unsigned char *buffer = buffer_; if (_calculated) @throw [OFHashAlreadyCalculatedException Index: src/OFSHA384Or512Hash.m ================================================================== --- src/OFSHA384Or512Hash.m +++ src/OFSHA384Or512Hash.m @@ -208,12 +208,11 @@ copy->_calculated = _calculated; return copy; } -- (void)updateWithBuffer: (const void *)buffer_ - length: (size_t)length +- (void)updateWithBuffer: (const void *)buffer_ length: (size_t)length { const unsigned char *buffer = buffer_; if (_calculated) @throw [OFHashAlreadyCalculatedException Index: src/OFSPXSocket.m ================================================================== --- src/OFSPXSocket.m +++ src/OFSPXSocket.m @@ -108,20 +108,18 @@ of_socket_address_t address = of_socket_address_ipx(_node, _network, _port); id exception = nil; int errNo; - if (![_socket of_createSocketForAddress: &address - errNo: &errNo]) { + if (![_socket of_createSocketForAddress: &address errNo: &errNo]) { exception = [self of_connectionFailedExceptionForErrNo: errNo]; goto inform_delegate; } _socket.canBlock = false; - if (![_socket of_connectSocketToAddress: &address - errNo: &errNo]) { + if (![_socket of_connectSocketToAddress: &address errNo: &errNo]) { if (errNo == EINPROGRESS) { [OFRunLoop of_addAsyncConnectForSocket: _socket mode: runLoopMode delegate: self]; return; @@ -137,12 +135,11 @@ withObject: _socket withObject: exception afterDelay: 0]; } -- (void)of_socketDidConnect: (id)sock - exception: (id)exception +- (void)of_socketDidConnect: (id)sock exception: (id)exception { id delegate = ((OFSPXSocket *)sock).delegate; if (exception == nil) ((OFSPXSocket *)sock).canBlock = true; @@ -228,21 +225,19 @@ { of_socket_address_t address = of_socket_address_ipx(node, network, port); int errNo; - if (![self of_createSocketForAddress: &address - errNo: &errNo]) + if (![self of_createSocketForAddress: &address errNo: &errNo]) @throw [OFConnectionFailedException exceptionWithNode: node network: network port: port socket: self errNo: errNo]; - if (![self of_connectSocketToAddress: &address - errNo: &errNo]) { + if (![self of_connectSocketToAddress: &address errNo: &errNo]) { [self of_closeSocket]; @throw [OFConnectionFailedException exceptionWithNode: node network: network Index: src/OFSPXStreamSocket.m ================================================================== --- src/OFSPXStreamSocket.m +++ src/OFSPXStreamSocket.m @@ -111,20 +111,18 @@ of_socket_address_t address = of_socket_address_ipx(_node, _network, _port); id exception = nil; int errNo; - if (![_socket of_createSocketForAddress: &address - errNo: &errNo]) { + if (![_socket of_createSocketForAddress: &address errNo: &errNo]) { exception = [self of_connectionFailedExceptionForErrNo: errNo]; goto inform_delegate; } _socket.canBlock = false; - if (![_socket of_connectSocketToAddress: &address - errNo: &errNo]) { + if (![_socket of_connectSocketToAddress: &address errNo: &errNo]) { if (errNo == EINPROGRESS) { [OFRunLoop of_addAsyncConnectForSocket: _socket mode: runLoopMode delegate: self]; return; @@ -140,12 +138,11 @@ withObject: _socket withObject: exception afterDelay: 0]; } -- (void)of_socketDidConnect: (id)sock - exception: (id)exception +- (void)of_socketDidConnect: (id)sock exception: (id)exception { id delegate = ((OFSPXStreamSocket *)sock).delegate; if (exception == nil) @@ -232,21 +229,19 @@ { of_socket_address_t address = of_socket_address_ipx(node, network, port); int errNo; - if (![self of_createSocketForAddress: &address - errNo: &errNo]) + if (![self of_createSocketForAddress: &address errNo: &errNo]) @throw [OFConnectionFailedException exceptionWithNode: node network: network port: port socket: self errNo: errNo]; - if (![self of_connectSocketToAddress: &address - errNo: &errNo]) { + if (![self of_connectSocketToAddress: &address errNo: &errNo]) { [self of_closeSocket]; @throw [OFConnectionFailedException exceptionWithNode: node network: network Index: src/OFSandbox.m ================================================================== --- src/OFSandbox.m +++ src/OFSandbox.m @@ -585,12 +585,11 @@ return [ret autorelease]; } #endif -- (void)unveilPath: (OFString *)path - permissions: (OFString *)permissions +- (void)unveilPath: (OFString *)path permissions: (OFString *)permissions { void *pool = objc_autoreleasePoolPush(); [_unveiledPaths addObject: [OFPair pairWithFirstObject: path secondObject: permissions]]; Index: src/OFSecureData.m ================================================================== --- src/OFSecureData.m +++ src/OFSecureData.m @@ -332,11 +332,11 @@ autorelease]; } + (instancetype)dataWithCount: (size_t)count itemSize: (size_t)itemSize - allowsSwappableMemory: (bool)allowsSwappableMemory + allowsSwappableMemory: (bool)allowsSwappableMemory { return [[[self alloc] initWithCount: count itemSize: itemSize allowsSwappableMemory: allowsSwappableMemory] autorelease]; @@ -465,12 +465,11 @@ } return self; } -- (instancetype)initWithItems: (const void *)items - count: (size_t)count +- (instancetype)initWithItems: (const void *)items count: (size_t)count { OF_INVALID_INIT_METHOD } - (instancetype)initWithItems: (const void *)items Index: src/OFSequencedPacketSocket.m ================================================================== --- src/OFSequencedPacketSocket.m +++ src/OFSequencedPacketSocket.m @@ -147,12 +147,11 @@ #else OF_UNRECOGNIZED_SELECTOR #endif } -- (size_t)receiveIntoBuffer: (void *)buffer - length: (size_t)length +- (size_t)receiveIntoBuffer: (void *)buffer length: (size_t)length { ssize_t ret; if (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; @@ -175,12 +174,11 @@ #endif return ret; } -- (void)asyncReceiveIntoBuffer: (void *)buffer - length: (size_t)length +- (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length { [self asyncReceiveIntoBuffer: buffer length: length runLoopMode: of_run_loop_mode_default]; } @@ -226,12 +224,11 @@ block: block delegate: nil]; } #endif -- (void)sendBuffer: (const void *)buffer - length: (size_t)length +- (void)sendBuffer: (const void *)buffer length: (size_t)length { if (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; #ifndef OF_WINDOWS @@ -267,12 +264,11 @@ errNo: 0]; } - (void)asyncSendData: (OFData *)data { - [self asyncSendData: data - runLoopMode: of_run_loop_mode_default]; + [self asyncSendData: data runLoopMode: of_run_loop_mode_default]; } - (void)asyncSendData: (OFData *)data runLoopMode: (of_run_loop_mode_t)runLoopMode { Index: src/OFSet.m ================================================================== --- src/OFSet.m +++ src/OFSet.m @@ -58,19 +58,17 @@ va_end(arguments); return ret; } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { return (id)[[OFMapTableSet alloc] initWithObjects: objects count: count]; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { return (id)[[OFMapTableSet alloc] initWithObject: firstObject arguments: arguments]; } @@ -140,12 +138,11 @@ va_end(arguments); return ret; } -+ (instancetype)setWithObjects: (id const *)objects - count: (size_t)count ++ (instancetype)setWithObjects: (id const *)objects count: (size_t)count { return [[[self alloc] initWithObjects: objects count: count] autorelease]; } @@ -173,12 +170,11 @@ - (instancetype)initWithArray: (OFArray *)array { OF_INVALID_INIT_METHOD } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { OF_INVALID_INIT_METHOD } - (instancetype)initWithObjects: (id)firstObject, ... @@ -185,19 +181,17 @@ { 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; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { OF_INVALID_INIT_METHOD } - (instancetype)initWithSerialization: (OFXMLElement *)element @@ -229,16 +223,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]; } - (bool)containsObject: (id)object { OF_UNRECOGNIZED_SELECTOR @@ -331,14 +323,12 @@ 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); return ret; @@ -384,13 +374,11 @@ element = [OFXMLElement elementWithName: @"OFSet" namespace: OF_SERIALIZATION_NS]; for (id object in self) { void *pool2 = objc_autoreleasePoolPush(); - [element addChild: object.XMLElementBySerializing]; - objc_autoreleasePoolPop(pool2); } [element retain]; @@ -399,59 +387,45 @@ return [element autorelease]; } - (OFSet *)setBySubtractingSet: (OFSet *)set { - OFMutableSet *new; - - new = [[self mutableCopy] autorelease]; + OFMutableSet *new = [[self mutableCopy] autorelease]; [new minusSet: set]; - [new makeImmutable]; - return new; } - (OFSet *)setByIntersectingWithSet: (OFSet *)set { - OFMutableSet *new; - - new = [[self mutableCopy] autorelease]; + OFMutableSet *new = [[self mutableCopy] autorelease]; [new intersectSet: set]; - [new makeImmutable]; - return new; } - (OFSet *)setByAddingSet: (OFSet *)set { - OFMutableSet *new; - - new = [[self mutableCopy] autorelease]; + OFMutableSet *new = [[self mutableCopy] autorelease]; [new unionSet: set]; - [new makeImmutable]; - return new; } - (OFArray *)allObjects { void *pool = objc_autoreleasePoolPush(); OFArray *ret = [[[self objectEnumerator] allObjects] retain]; objc_autoreleasePoolPop(pool); - return [ret autorelease]; } - (id)anyObject { void *pool = objc_autoreleasePoolPush(); id ret = [[[self objectEnumerator] nextObject] retain]; objc_autoreleasePoolPop(pool); - return [ret autorelease]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -208,12 +208,11 @@ _fd = fd; return self; } #else -- (instancetype)of_initWithHandle: (BPTR)handle - closable: (bool)closable +- (instancetype)of_initWithHandle: (BPTR)handle closable: (bool)closable { self = [super init]; _handle = handle; _closable = closable; @@ -244,12 +243,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; #ifndef OF_AMIGAOS if (_fd == -1) @@ -286,12 +284,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 { #ifndef OF_AMIGAOS if (_fd == -1) @throw [OFNotOpenException exceptionWithObject: self]; Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -125,12 +125,11 @@ return false; return [self lowlevelIsAtEndOfStream]; } -- (size_t)readIntoBuffer: (void *)buffer - length: (size_t)length +- (size_t)readIntoBuffer: (void *)buffer length: (size_t)length { if (_readBufferLength == 0) { /* * For small sizes, it is cheaper to read more and cache the * remainder - even if that means more copying of data - than @@ -615,11 +614,10 @@ } @finally { free(buffer); } [data makeImmutable]; - return data; } - (OFString *)readStringWithLength: (size_t)length { Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -95,12 +95,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 (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; @@ -126,12 +125,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 (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; #ifndef OF_WINDOWS Index: src/OFString+CryptoHashing.m ================================================================== --- src/OFString+CryptoHashing.m +++ src/OFString+CryptoHashing.m @@ -35,12 +35,11 @@ cryptoHashWithAllowsSwappableMemory: true]; size_t digestSize = [class digestSize]; const unsigned char *digest; char cString[digestSize * 2]; - [hash updateWithBuffer: self.UTF8String - length: self.UTF8StringLength]; + [hash updateWithBuffer: self.UTF8String length: self.UTF8StringLength]; digest = hash.digest; for (size_t i = 0; i < digestSize; i++) { uint8_t high, low; Index: src/OFString+JSONParsing.m ================================================================== --- src/OFString+JSONParsing.m +++ src/OFString+JSONParsing.m @@ -547,12 +547,11 @@ break; } } - string = [[OFString alloc] initWithUTF8String: *pointer - length: i]; + string = [[OFString alloc] initWithUTF8String: *pointer length: i]; *pointer += i; @try { if (hasDecimal) number = [OFNumber numberWithDouble: Index: src/OFString+URLEncoding.m ================================================================== --- src/OFString+URLEncoding.m +++ src/OFString+URLEncoding.m @@ -43,12 +43,11 @@ for (size_t i = 0; i < length; i++) { of_unichar_t c = characters[i]; if (characterIsMember(allowedCharacters, @selector(characterIsMember:), c)) - [ret appendCharacters: &c - length: 1]; + [ret appendCharacters: &c length: 1]; else { char buffer[4]; size_t bufferLen; if ((bufferLen = of_string_utf8_encode(c, buffer)) == 0) @@ -64,12 +63,11 @@ escaped[1] = (high > 9 ? high - 10 + 'A' : high + '0'); escaped[2] = (low > 9 ? low - 10 + 'A' : low + '0'); - [ret appendUTF8String: escaped - length: 3]; + [ret appendUTF8String: escaped length: 3]; } } } objc_autoreleasePoolPop(pool); Index: src/OFString+XMLUnescaping.m ================================================================== --- src/OFString+XMLUnescaping.m +++ src/OFString+XMLUnescaping.m @@ -66,12 +66,11 @@ if ((i = of_string_utf8_encode(c, buffer)) == 0) return nil; buffer[i] = 0; - return [OFString stringWithUTF8String: buffer - length: i]; + return [OFString stringWithUTF8String: buffer length: i]; } static OFString * parseEntities(OFString *self, id (*lookup)(void *, OFString *, OFString *), void *context) @@ -92,13 +91,11 @@ last = 0; inEntity = false; for (i = 0; i < length; i++) { if (!inEntity && string[i] == '&') { - [ret appendUTF8String: string + last - length: i - last]; - + [ret appendUTF8String: string + last length: i - last]; last = i + 1; inEntity = true; } else if (inEntity && string[i] == ';') { const char *entity = string + last; size_t entityLength = i - last; @@ -168,13 +165,11 @@ } if (inEntity) @throw [OFInvalidFormatException exception]; - [ret appendUTF8String: string + last - length: i - last]; - + [ret appendUTF8String: string + last length: i - last]; [ret makeImmutable]; objc_autoreleasePoolPop(pool); return ret; @@ -186,12 +181,11 @@ id delegate = context; if (delegate == nil) return nil; - return [delegate string: self - containsUnknownEntityNamed: entity]; + return [delegate string: self containsUnknownEntityNamed: entity]; } #ifdef OF_HAVE_BLOCKS static id lookupUsingBlock(void *context, OFString *self, OFString *entity) Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -845,12 +845,11 @@ - (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String length: (size_t)UTF8StringLength freeWhenDone: (bool)freeWhenDone { - id ret = [self initWithUTF8String: UTF8String - length: UTF8StringLength]; + id ret = [self initWithUTF8String: UTF8String length: UTF8StringLength]; if (freeWhenDone) free(UTF8String); return ret; @@ -1020,11 +1019,10 @@ @throw [OFOutOfRangeException exception]; tmp = of_alloc((size_t)fileSize + 1, 1); @try { file = [[OFFile alloc] initWithPath: path mode: @"r"]; - [file readIntoBuffer: tmp exactLength: (size_t)fileSize]; } @catch (id e) { free(tmp); @throw e; @@ -1773,35 +1771,31 @@ length = self.UTF8StringLength; if (length <= 31) { uint8_t tmp = 0xA0 | ((uint8_t)length & 0x1F); - data = [OFMutableData dataWithItemSize: 1 capacity: length + 1]; - + data = [OFMutableData dataWithCapacity: 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 dataWithCapacity: 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 dataWithCapacity: length + 3]; [data addItem: &type]; [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 dataWithCapacity: length + 5]; [data addItem: &type]; [data addItems: &tmp count: sizeof(tmp)]; } else @throw [OFOutOfRangeException exception]; @@ -1815,12 +1809,11 @@ return [self rangeOfString: string options: 0 range: of_range(0, self.length)]; } -- (of_range_t)rangeOfString: (OFString *)string - options: (int)options +- (of_range_t)rangeOfString: (OFString *)string options: (int)options { return [self rangeOfString: string options: options range: of_range(0, self.length)]; } @@ -2722,30 +2715,25 @@ - (void)writeToFile: (OFString *)path { [self writeToFile: path encoding: OF_STRING_ENCODING_UTF_8]; } -- (void)writeToFile: (OFString *)path - encoding: (of_string_encoding_t)encoding +- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding { void *pool = objc_autoreleasePoolPush(); - OFFile *file = [OFFile fileWithPath: path mode: @"w"]; - [file writeString: self - encoding: encoding]; - + [file writeString: self encoding: encoding]; objc_autoreleasePoolPop(pool); } #endif - (void)writeToURL: (OFURL *)URL { [self writeToURL: URL encoding: OF_STRING_ENCODING_UTF_8]; } -- (void)writeToURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding +- (void)writeToURL: (OFURL *)URL encoding: (of_string_encoding_t)encoding { void *pool = objc_autoreleasePoolPush(); OFURLHandler *URLHandler; OFStream *stream; Index: src/OFSubarray.m ================================================================== --- src/OFSubarray.m +++ src/OFSubarray.m @@ -18,19 +18,16 @@ #import "OFSubarray.h" #import "OFOutOfRangeException.h" @implementation OFSubarray -+ (instancetype)arrayWithArray: (OFArray *)array - range: (of_range_t)range ++ (instancetype)arrayWithArray: (OFArray *)array range: (of_range_t)range { - return [[[self alloc] initWithArray: array - range: range] autorelease]; + return [[[self alloc] initWithArray: array range: range] autorelease]; } -- (instancetype)initWithArray: (OFArray *)array - range: (of_range_t)range +- (instancetype)initWithArray: (OFArray *)array range: (of_range_t)range { self = [super init]; @try { /* Should usually be retain, as it's useless with a copy */ @@ -62,21 +59,19 @@ @throw [OFOutOfRangeException exception]; return [_array objectAtIndex: idx + _range.location]; } -- (void)getObjects: (id *)buffer - inRange: (of_range_t)range +- (void)getObjects: (id *)buffer inRange: (of_range_t)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _range.length) @throw [OFOutOfRangeException exception]; range.location += _range.location; - [_array getObjects: buffer - inRange: range]; + [_array getObjects: buffer inRange: range]; } - (size_t)indexOfObject: (id)object { size_t idx = [_array indexOfObject: object]; Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -485,11 +485,10 @@ [path deleteCharactersInRange: of_range(0, 1)]; [path prependString: home]; } [path appendString: @"/Preferences"]; - [path makeImmutable]; return path; # elif defined(OF_WINDOWS) OFDictionary *env = [OFApplication environment]; Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -180,12 +180,11 @@ { closesocket(_socket); _socket = INVALID_SOCKET; } -- (void)connectToHost: (OFString *)host - port: (uint16_t)port +- (void)connectToHost: (OFString *)host port: (uint16_t)port { void *pool = objc_autoreleasePoolPush(); id delegate = _delegate; OFTCPSocketConnectDelegate *connectDelegate = [[[OFTCPSocketConnectDelegate alloc] init] autorelease]; @@ -195,27 +194,24 @@ [self asyncConnectToHost: host port: port runLoopMode: connectRunLoopMode]; while (!connectDelegate->_done) - [runLoop runMode: connectRunLoopMode - beforeDate: nil]; + [runLoop runMode: connectRunLoopMode beforeDate: nil]; /* Cleanup */ - [runLoop runMode: connectRunLoopMode - beforeDate: [OFDate date]]; + [runLoop runMode: connectRunLoopMode beforeDate: [OFDate date]]; if (connectDelegate->_exception != nil) @throw connectDelegate->_exception; self.delegate = delegate; objc_autoreleasePoolPop(pool); } -- (void)asyncConnectToHost: (OFString *)host - port: (uint16_t)port +- (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port { [self asyncConnectToHost: host port: port runLoopMode: of_run_loop_mode_default]; } @@ -299,12 +295,11 @@ objc_autoreleasePoolPop(pool); } #endif -- (uint16_t)bindToHost: (OFString *)host - port: (uint16_t)port +- (uint16_t)bindToHost: (OFString *)host port: (uint16_t)port { const int one = 1; void *pool = objc_autoreleasePoolPush(); OFData *socketAddresses; of_socket_address_t address; Index: src/OFTCPSocketSOCKS5Connector.m ================================================================== --- src/OFTCPSocketSOCKS5Connector.m +++ src/OFTCPSocketSOCKS5Connector.m @@ -80,11 +80,11 @@ _block(_exception); else { #endif if ([_delegate respondsToSelector: @selector(socket:didConnectToHost:port:exception:)]) - [_delegate socket: _socket + [_delegate socket: _socket didConnectToHost: _host port: _port exception: _exception]; #ifdef OF_HAVE_BLOCKS } @@ -102,12 +102,11 @@ _exception = [exception retain]; [self didConnect]; return; } - data = [OFData dataWithItems: "\x05\x01\x00" - count: 3]; + data = [OFData dataWithItems: "\x05\x01\x00" count: 3]; _SOCKS5State = OF_SOCKS5_STATE_SEND_AUTHENTICATION; [_socket asyncWriteData: data runLoopMode: [OFRunLoop currentRunLoop].currentMode]; } @@ -146,26 +145,22 @@ } [_request release]; _request = [[OFMutableData alloc] init]; - [_request addItems: "\x05\x01\x00\x03" - count: 4]; + [_request addItems: "\x05\x01\x00\x03" count: 4]; hostLength = (uint8_t)_host.UTF8StringLength; [_request addItem: &hostLength]; - [_request addItems: _host.UTF8String - count: hostLength]; + [_request addItems: _host.UTF8String count: hostLength]; port[0] = _port >> 8; port[1] = _port & 0xFF; - [_request addItems: port - count: 2]; + [_request addItems: port count: 2]; _SOCKS5State = OF_SOCKS5_STATE_SEND_REQUEST; - [_socket asyncWriteData: _request - runLoopMode: runLoopMode]; + [_socket asyncWriteData: _request runLoopMode: runLoopMode]; return false; case OF_SOCKS5_STATE_READ_RESPONSE: response = buffer; if (response[0] != 5 || response[2] != 0) { Index: src/OFTarArchive.m ================================================================== --- src/OFTarArchive.m +++ src/OFTarArchive.m @@ -59,33 +59,28 @@ @end @implementation OFTarArchive: OFObject @synthesize encoding = _encoding; -+ (instancetype)archiveWithStream: (OFStream *)stream - mode: (OFString *)mode ++ (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode { - return [[[self alloc] initWithStream: stream - mode: mode] autorelease]; + return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } #ifdef OF_HAVE_FILES -+ (instancetype)archiveWithPath: (OFString *)path - mode: (OFString *)mode ++ (instancetype)archiveWithPath: (OFString *)path mode: (OFString *)mode { - return [[[self alloc] initWithPath: path - mode: mode] autorelease]; + return [[[self alloc] initWithPath: path mode: mode] autorelease]; } #endif - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithStream: (OFStream *)stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode { self = [super init]; @try { _stream = [stream retain]; @@ -106,12 +101,11 @@ if (![_stream isKindOfClass: [OFSeekableStream class]]) @throw [OFInvalidArgumentException exception]; [(OFSeekableStream *)_stream seekToOffset: -1024 whence: SEEK_END]; - [_stream readIntoBuffer: buffer - exactLength: 1024]; + [_stream readIntoBuffer: buffer exactLength: 1024]; for (size_t i = 0; i < 1024 / sizeof(uint32_t); i++) if (buffer[i] != 0) empty = false; @@ -130,25 +124,21 @@ return self; } #ifdef OF_HAVE_FILES -- (instancetype)initWithPath: (OFString *)path - mode: (OFString *)mode +- (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode { OFFile *file; if ([mode isEqual: @"a"]) - file = [[OFFile alloc] initWithPath: path - mode: @"r+"]; + file = [[OFFile alloc] initWithPath: path mode: @"r+"]; else - file = [[OFFile alloc] initWithPath: path - mode: mode]; + file = [[OFFile alloc] initWithPath: path mode: mode]; @try { - self = [self initWithStream: file - mode: mode]; + self = [self initWithStream: file mode: mode]; } @finally { [file release]; } return self; @@ -181,20 +171,18 @@ _lastReturnedStream = nil; if (_stream.atEndOfStream) return nil; - [_stream readIntoBuffer: buffer - exactLength: 512]; + [_stream readIntoBuffer: buffer exactLength: 512]; for (size_t i = 0; i < 512 / sizeof(uint32_t); i++) if (buffer[i] != 0) empty = false; if (empty) { - [_stream readIntoBuffer: buffer - exactLength: 512]; + [_stream readIntoBuffer: buffer exactLength: 512]; for (size_t i = 0; i < 512 / sizeof(uint32_t); i++) if (buffer[i] != 0) @throw [OFInvalidFormatException exception]; @@ -240,12 +228,11 @@ /* Might have already been closed by the user - that's fine. */ } [_lastReturnedStream release]; _lastReturnedStream = nil; - [entry of_writeToStream: _stream - encoding: _encoding]; + [entry of_writeToStream: _stream encoding: _encoding]; _lastReturnedStream = [[OFTarArchiveFileWriteStream alloc] of_initWithStream: _stream entry: entry]; @@ -326,13 +313,11 @@ #endif if ((uint64_t)length > _toRead) length = (size_t)_toRead; - ret = [_stream readIntoBuffer: buffer - length: length]; - + ret = [_stream readIntoBuffer: buffer length: length]; if (ret == 0) _atEndOfStream = true; _toRead -= ret; @@ -394,12 +379,11 @@ } else { char buffer[512]; uint64_t size; while (_toRead >= 512) { - [_stream readIntoBuffer: buffer - exactLength: 512]; + [_stream readIntoBuffer: buffer exactLength: 512]; _toRead -= 512; } if (_toRead > 0) { [_stream readIntoBuffer: buffer @@ -444,12 +428,11 @@ [_entry release]; [super dealloc]; } -- (size_t)lowlevelWriteBuffer: (const void *)buffer - length: (size_t)length +- (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { size_t bytesWritten; if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; Index: src/OFTarArchiveEntry.m ================================================================== --- src/OFTarArchiveEntry.m +++ src/OFTarArchiveEntry.m @@ -340,9 +340,8 @@ checksum += buffer[i]; stringToBuffer(buffer + 148, [OFString stringWithFormat: @"%06" PRIo16, checksum], 7, OF_STRING_ENCODING_ASCII); - [stream writeBuffer: buffer - length: sizeof(buffer)]; + [stream writeBuffer: buffer length: sizeof(buffer)]; } @end Index: src/OFThreadPool.m ================================================================== --- src/OFThreadPool.m +++ src/OFThreadPool.m @@ -95,12 +95,11 @@ #ifdef OF_HAVE_BLOCKS if (_block != NULL) _block(); else #endif - [_target performSelector: _selector - withObject: _object]; + [_target performSelector: _selector withObject: _object]; } @end OF_DIRECT_MEMBERS @interface OFThreadPoolThread: OFThread Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -516,12 +516,11 @@ timer = (OFTimer *)object; return [_fireDate compare: timer->_fireDate]; } -- (void)of_setInRunLoop: (OFRunLoop *)runLoop - mode: (of_run_loop_mode_t)mode +- (void)of_setInRunLoop: (OFRunLoop *)runLoop mode: (of_run_loop_mode_t)mode { OFRunLoop *oldInRunLoop = _inRunLoop; of_run_loop_mode_t oldInRunLoopMode = _inRunLoopMode; _inRunLoop = [runLoop retain]; @@ -558,12 +557,11 @@ [_fireDate release]; _fireDate = [[OFDate alloc] initWithTimeIntervalSince1970: newFireDate]; runLoop = [OFRunLoop currentRunLoop]; - [runLoop addTimer: self - forMode: runLoop.currentMode]; + [runLoop addTimer: self forMode: runLoop.currentMode]; } else [self invalidate]; #ifdef OF_HAVE_BLOCKS if (_block != NULL) @@ -573,12 +571,11 @@ switch (_arguments) { case 0: [target performSelector: _selector]; break; case 1: - [target performSelector: _selector - withObject: object1]; + [target performSelector: _selector withObject: object1]; break; case 2: [target performSelector: _selector withObject: object1 withObject: object2]; @@ -631,12 +628,11 @@ old = _fireDate; _fireDate = [fireDate copy]; [old release]; - [_inRunLoop addTimer: self - forMode: _inRunLoopMode]; + [_inRunLoop addTimer: self forMode: _inRunLoopMode]; } } @finally { [self release]; } } Index: src/OFUDPSocket.m ================================================================== --- src/OFUDPSocket.m +++ src/OFUDPSocket.m @@ -170,12 +170,11 @@ socket: self errNo: EADDRNOTAVAIL]; #endif } -- (uint16_t)bindToHost: (OFString *)host - port: (uint16_t)port +- (uint16_t)bindToHost: (OFString *)host port: (uint16_t)port { void *pool = objc_autoreleasePoolPush(); OFData *socketAddresses; of_socket_address_t address; @@ -187,13 +186,12 @@ addressFamily: OF_SOCKET_ADDRESS_FAMILY_ANY]; address = *(of_socket_address_t *)[socketAddresses itemAtIndex: 0]; of_socket_address_set_port(&address, port); - port = [self of_bindToAddress: &address - extraType: 0]; + port = [self of_bindToAddress: &address extraType: 0]; objc_autoreleasePoolPop(pool); return port; } @end Index: src/OFURL.m ================================================================== --- src/OFURL.m +++ src/OFURL.m @@ -613,12 +613,11 @@ } return self; } -- (instancetype)initWithString: (OFString *)string - relativeToURL: (OFURL *)URL +- (instancetype)initWithString: (OFString *)string relativeToURL: (OFURL *)URL { char *UTF8String, *UTF8String2 = NULL; if ([string containsString: @"://"]) return [self initWithString: string]; @@ -715,21 +714,18 @@ { bool isDirectory; @try { void *pool = objc_autoreleasePoolPush(); - isDirectory = [path of_isDirectoryPath]; - objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } - self = [self initFileURLWithPath: path - isDirectory: isDirectory]; + self = [self initFileURLWithPath: path isDirectory: isDirectory]; return self; } - (instancetype)initFileURLWithPath: (OFString *)path @@ -948,22 +944,20 @@ OFString *path = [_URLEncodedPath of_URLPathToPathWithURLEncodedHost: nil]; ret = [[path.pathComponents mutableCopy] autorelease]; if (![ret.firstObject isEqual: @"/"]) - [ret insertObject: @"/" - atIndex: 0]; + [ret insertObject: @"/" atIndex: 0]; } else #endif ret = [[[_URLEncodedPath componentsSeparatedByString: @"/"] mutableCopy] autorelease]; count = ret.count; if (count > 0 && [ret.firstObject length] == 0) - [ret replaceObjectAtIndex: 0 - withObject: @"/"]; + [ret replaceObjectAtIndex: 0 withObject: @"/"]; for (size_t i = 0; i < count; i++) { OFString *component = [ret objectAtIndex: i]; #ifdef OF_HAVE_FILES @@ -1160,36 +1154,29 @@ #endif - (OFURL *)URLByAppendingPathComponent: (OFString *)component { OFMutableURL *URL = [[self mutableCopy] autorelease]; - [URL appendPathComponent: component]; [URL makeImmutable]; - return URL; } - (OFURL *)URLByAppendingPathComponent: (OFString *)component isDirectory: (bool)isDirectory { OFMutableURL *URL = [[self mutableCopy] autorelease]; - - [URL appendPathComponent: component - isDirectory: isDirectory]; + [URL appendPathComponent: component isDirectory: isDirectory]; [URL makeImmutable]; - return URL; } - (OFURL *)URLByStandardizingPath { OFMutableURL *URL = [[self mutableCopy] autorelease]; - [URL standardizePath]; [URL makeImmutable]; - return URL; } - (OFString *)description { Index: src/OFURLHandler.m ================================================================== --- src/OFURLHandler.m +++ src/OFURLHandler.m @@ -55,23 +55,19 @@ mutex = [[OFMutex alloc] init]; atexit(releaseMutex); #endif #ifdef OF_HAVE_FILES - [self registerClass: [OFFileURLHandler class] - forScheme: @"file"]; + [self registerClass: [OFFileURLHandler class] forScheme: @"file"]; #endif #if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_THREADS) - [self registerClass: [OFHTTPURLHandler class] - forScheme: @"http"]; - [self registerClass: [OFHTTPURLHandler class] - forScheme: @"https"]; + [self registerClass: [OFHTTPURLHandler class] forScheme: @"http"]; + [self registerClass: [OFHTTPURLHandler class] forScheme: @"https"]; #endif } -+ (bool)registerClass: (Class)class - forScheme: (OFString *)scheme ++ (bool)registerClass: (Class)class forScheme: (OFString *)scheme { #ifdef OF_HAVE_THREADS [mutex lock]; @try { #endif @@ -137,12 +133,11 @@ [_scheme release]; [super dealloc]; } -- (OFStream *)openItemAtURL: (OFURL *)URL - mode: (OFString *)mode +- (OFStream *)openItemAtURL: (OFURL *)URL mode: (OFString *)mode { OF_UNRECOGNIZED_SELECTOR } - (of_file_attributes_t)attributesOfItemAtURL: (OFURL *)URL @@ -179,12 +174,11 @@ - (void)removeItemAtURL: (OFURL *)URL { OF_UNRECOGNIZED_SELECTOR } -- (void)linkItemAtURL: (OFURL *)source - toURL: (OFURL *)destination +- (void)linkItemAtURL: (OFURL *)source toURL: (OFURL *)destination { OF_UNRECOGNIZED_SELECTOR } - (void)createSymbolicLinkAtURL: (OFURL *)destination @@ -191,17 +185,15 @@ withDestinationPath: (OFString *)source { OF_UNRECOGNIZED_SELECTOR } -- (bool)copyItemAtURL: (OFURL *)source - toURL: (OFURL *)destination +- (bool)copyItemAtURL: (OFURL *)source toURL: (OFURL *)destination { return false; } -- (bool)moveItemAtURL: (OFURL *)source - toURL: (OFURL *)destination +- (bool)moveItemAtURL: (OFURL *)source toURL: (OFURL *)destination { return false; } @end Index: src/OFUTF8String.m ================================================================== --- src/OFUTF8String.m +++ src/OFUTF8String.m @@ -969,12 +969,11 @@ @throw [OFInvalidEncodingException exception]; return character; } -- (void)getCharacters: (of_unichar_t *)buffer - inRange: (of_range_t)range +- (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range { /* TODO: Could be slightly optimized */ void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = self.characters; @@ -1237,13 +1236,13 @@ } if (*cString == '\n' || *cString == '\r') { pool = objc_autoreleasePoolPush(); - block([OFString - stringWithUTF8String: last - length: cString - last], &stop); + block([OFString stringWithUTF8String: last + length: cString - last], + &stop); last = cString + 1; objc_autoreleasePoolPop(pool); } Index: src/OFValue.m ================================================================== --- src/OFValue.m +++ src/OFValue.m @@ -188,15 +188,12 @@ free(value); @throw e; } @try { - [self getValue: value - size: size]; - [object getValue: otherValue - size: size]; - + [self getValue: value size: size]; + [object getValue: otherValue size: size]; ret = (memcmp(value, otherValue, size) == 0); } @finally { free(value); free(otherValue); } @@ -210,12 +207,11 @@ unsigned char *value; uint32_t hash; value = of_alloc(1, size); @try { - [self getValue: value - size: size]; + [self getValue: value size: size]; OF_HASH_INIT(hash); for (size_t i = 0; i < size; i++) OF_HASH_ADD(hash, value[i]); @@ -236,73 +232,54 @@ - (const char *)objCType { OF_UNRECOGNIZED_SELECTOR } -- (void)getValue: (void *)value - size: (size_t)size +- (void)getValue: (void *)value size: (size_t)size { OF_UNRECOGNIZED_SELECTOR } - (void *)pointerValue { void *ret; - - [self getValue: &ret - size: sizeof(ret)]; - + [self getValue: &ret size: sizeof(ret)]; return ret; } - (id)nonretainedObjectValue { id ret; - - [self getValue: &ret - size: sizeof(ret)]; - + [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_range_t)rangeValue { of_range_t ret; - - [self getValue: &ret - size: sizeof(ret)]; - + [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_point_t)pointValue { of_point_t ret; - - [self getValue: &ret - size: sizeof(ret)]; - + [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_dimension_t)dimensionValue { of_dimension_t ret; - - [self getValue: &ret - size: sizeof(ret)]; - + [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_rectangle_t)rectangleValue { of_rectangle_t ret; - - [self getValue: &ret - size: sizeof(ret)]; - + [self getValue: &ret size: sizeof(ret)]; return ret; } - (OFString *)description { @@ -311,12 +288,11 @@ size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; value = of_alloc(1, size); @try { - [self getValue: value - size: size]; + [self getValue: value size: size]; for (size_t i = 0; i < size; i++) { if (i > 0) [ret appendString: @" "]; Index: src/OFWin32ConsoleStdIOStream.m ================================================================== --- src/OFWin32ConsoleStdIOStream.m +++ src/OFWin32ConsoleStdIOStream.m @@ -122,12 +122,11 @@ } return self; } -- (size_t)lowlevelReadIntoBuffer: (void *)buffer_ - length: (size_t)length +- (size_t)lowlevelReadIntoBuffer: (void *)buffer_ length: (size_t)length { void *pool = objc_autoreleasePoolPush(); char *buffer = buffer_; of_char16_t *UTF16; size_t j = 0; @@ -188,12 +187,11 @@ j += UTF8Len; } else { if (rest == nil) rest = [OFMutableData data]; - [rest addItems: UTF8 - count: UTF8Len]; + [rest addItems: UTF8 count: UTF8Len]; } _incompleteUTF16Surrogate = 0; i++; } @@ -246,29 +244,26 @@ j += UTF8Len; } else { if (rest == nil) rest = [OFMutableData data]; - [rest addItems: UTF8 - count: UTF8Len]; + [rest addItems: UTF8 count: UTF8Len]; } } if (rest != nil) - [self unreadFromBuffer: rest.items - length: rest.count]; + [self unreadFromBuffer: rest.items length: rest.count]; } @finally { free(UTF16); } objc_autoreleasePoolPop(pool); return j; } -- (size_t)lowlevelWriteBuffer: (const void *)buffer_ - length: (size_t)length +- (size_t)lowlevelWriteBuffer: (const void *)buffer_ length: (size_t)length { const char *buffer = buffer_; of_char16_t *tmp; size_t i = 0, j = 0; @@ -489,14 +484,11 @@ return; csbi.wAttributes &= ~(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); - [color getRed: &red - green: &green - blue: &blue - alpha: NULL]; + [color getRed: &red green: &green blue: &blue alpha: NULL]; if (red >= 0.25) csbi.wAttributes |= FOREGROUND_RED; if (green >= 0.25) csbi.wAttributes |= FOREGROUND_GREEN; @@ -518,14 +510,11 @@ return; csbi.wAttributes &= ~(BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY); - [color getRed: &red - green: &green - blue: &blue - alpha: NULL]; + [color getRed: &red green: &green blue: &blue alpha: NULL]; if (red >= 0.25) csbi.wAttributes |= BACKGROUND_RED; if (green >= 0.25) csbi.wAttributes |= BACKGROUND_GREEN; Index: src/OFWindowsRegistryKey.m ================================================================== --- src/OFWindowsRegistryKey.m +++ src/OFWindowsRegistryKey.m @@ -32,12 +32,11 @@ #import "OFOutOfRangeException.h" #import "OFSetWindowsRegistryValueFailedException.h" OF_DIRECT_MEMBERS @interface OFWindowsRegistryKey () -- (instancetype)of_initWithHKey: (HKEY)hKey - close: (bool)close; +- (instancetype)of_initWithHKey: (HKEY)hKey close: (bool)close; @end @implementation OFWindowsRegistryKey + (instancetype)classesRootKey { @@ -67,12 +66,11 @@ { return [[[self alloc] of_initWithHKey: HKEY_USERS close: false] autorelease]; } -- (instancetype)of_initWithHKey: (HKEY)hKey - close: (bool)close +- (instancetype)of_initWithHKey: (HKEY)hKey close: (bool)close { self = [super init]; _hKey = hKey; _close = close; @@ -183,12 +181,11 @@ return [[[OFWindowsRegistryKey alloc] of_initWithHKey: subKey close: true] autorelease]; } -- (OFData *)dataForValueNamed: (OFString *)name - type: (DWORD *)type +- (OFData *)dataForValueNamed: (OFString *)name type: (DWORD *)type { void *pool = objc_autoreleasePoolPush(); BYTE stackBuffer[256], *buffer = stackBuffer; DWORD length = sizeof(stackBuffer); OFMutableData *ret = nil; @@ -268,21 +265,18 @@ status: status]; } - (OFString *)stringForValueNamed: (OFString *)name { - return [self stringForValueNamed: name - type: NULL]; + return [self stringForValueNamed: name type: NULL]; } -- (OFString *)stringForValueNamed: (OFString *)name - type: (DWORD *)typeOut +- (OFString *)stringForValueNamed: (OFString *)name type: (DWORD *)typeOut { void *pool = objc_autoreleasePoolPush(); DWORD type; - OFData *data = [self dataForValueNamed: name - type: &type]; + OFData *data = [self dataForValueNamed: name type: &type]; OFString *ret; if (data == nil) return nil; @@ -340,16 +334,13 @@ objc_autoreleasePoolPop(pool); return [ret autorelease]; } -- (void)setString: (OFString *)string - forValueNamed: (OFString *)name +- (void)setString: (OFString *)string forValueNamed: (OFString *)name { - [self setString: string - forValueNamed: name - type: REG_SZ]; + [self setString: string forValueNamed: name type: REG_SZ]; } - (void)setString: (OFString *)string forValueNamed: (OFString *)name type: (DWORD)type @@ -364,17 +355,14 @@ else { of_string_encoding_t encoding = [OFLocale encoding]; const char *cString = [string cStringWithEncoding: encoding]; size_t length = [string cStringLengthWithEncoding: encoding]; - data = [OFData dataWithItems: cString - count: length + 1]; + data = [OFData dataWithItems: cString count: length + 1]; } - [self setData: data - forValueNamed: name - type: type]; + [self setData: data forValueNamed: name type: type]; objc_autoreleasePoolPop(pool); } - (void)deleteValueNamed: (OFString *)name Index: src/OFXMLAttribute.m ================================================================== --- src/OFXMLAttribute.m +++ src/OFXMLAttribute.m @@ -158,13 +158,11 @@ void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; element = [OFXMLElement elementWithName: self.className namespace: OF_SERIALIZATION_NS]; - - [element addAttributeWithName: @"name" - stringValue: _name]; + [element addAttributeWithName: @"name" stringValue: _name]; if (_namespace != nil) [element addAttributeWithName: @"namespace" stringValue: _namespace]; Index: src/OFXMLCDATA.m ================================================================== --- src/OFXMLCDATA.m +++ src/OFXMLCDATA.m @@ -120,11 +120,11 @@ { return self.XMLString; } - (OFString *)XMLStringWithIndentation: (unsigned int)indentation - level: (unsigned int)level + level: (unsigned int)level { return self.XMLString; } - (OFString *)description Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -123,13 +123,11 @@ OF_INVALID_INIT_METHOD } - (instancetype)initWithName: (OFString *)name { - return [self initWithName: name - namespace: nil - stringValue: nil]; + return [self initWithName: name namespace: nil stringValue: nil]; } - (instancetype)initWithName: (OFString *)name stringValue: (OFString *)stringValue { @@ -139,13 +137,11 @@ } - (instancetype)initWithName: (OFString *)name namespace: (OFString *)namespace { - return [self initWithName: name - namespace: namespace - stringValue: nil]; + return [self initWithName: name namespace: namespace stringValue: nil]; } - (instancetype)initWithName: (OFString *)name namespace: (OFString *)namespace stringValue: (OFString *)stringValue @@ -660,12 +656,11 @@ element = [OFXMLElement elementWithName: self.className namespace: OF_SERIALIZATION_NS]; if (_name != nil) - [element addAttributeWithName: @"name" - stringValue: _name]; + [element addAttributeWithName: @"name" stringValue: _name]; if (_namespace != nil) [element addAttributeWithName: @"namespace" stringValue: _namespace]; @@ -815,26 +810,23 @@ return; } } } -- (void)setPrefix: (OFString *)prefix - forNamespace: (OFString *)namespace +- (void)setPrefix: (OFString *)prefix forNamespace: (OFString *)namespace { if (prefix.length == 0) @throw [OFInvalidArgumentException exception]; if (namespace == nil) namespace = @""; [_namespaces setObject: prefix forKey: namespace]; } -- (void)bindPrefix: (OFString *)prefix - forNamespace: (OFString *)namespace +- (void)bindPrefix: (OFString *)prefix forNamespace: (OFString *)namespace { - [self setPrefix: prefix - forNamespace: namespace]; + [self setPrefix: prefix forNamespace: namespace]; [self addAttributeWithName: prefix namespace: @"http://www.w3.org/2000/xmlns/" stringValue: namespace]; } @@ -847,32 +839,28 @@ _children = [[OFMutableArray alloc] init]; [_children addObject: child]; } -- (void)insertChild: (OFXMLNode *)child - atIndex: (size_t)idx +- (void)insertChild: (OFXMLNode *)child atIndex: (size_t)idx { if ([child isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; if (_children == nil) _children = [[OFMutableArray alloc] init]; - [_children insertObject: child - atIndex: idx]; + [_children insertObject: child atIndex: idx]; } -- (void)insertChildren: (OFArray *)children - atIndex: (size_t)idx +- (void)insertChildren: (OFArray *)children atIndex: (size_t)idx { for (OFXMLNode *node in children) if ([node isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; - [_children insertObjectsFromArray: children - atIndex: idx]; + [_children insertObjectsFromArray: children atIndex: idx]; } - (void)removeChild: (OFXMLNode *)child { if ([child isKindOfClass: [OFXMLAttribute class]]) @@ -884,29 +872,25 @@ - (void)removeChildAtIndex: (size_t)idx { [_children removeObjectAtIndex: idx]; } -- (void)replaceChild: (OFXMLNode *)child - withNode: (OFXMLNode *)node +- (void)replaceChild: (OFXMLNode *)child withNode: (OFXMLNode *)node { if ([node isKindOfClass: [OFXMLAttribute class]] || [child isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; - [_children replaceObject: child - withObject: node]; + [_children replaceObject: child withObject: node]; } -- (void)replaceChildAtIndex: (size_t)idx - withNode: (OFXMLNode *)node +- (void)replaceChildAtIndex: (size_t)idx withNode: (OFXMLNode *)node { if ([node isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; - [_children replaceObjectAtIndex: idx - withObject: node]; + [_children replaceObjectAtIndex: idx withObject: node]; } - (OFXMLElement *)elementForName: (OFString *)elementName { return [self elementsForName: elementName].firstObject; Index: src/OFXMLElementBuilder.m ================================================================== --- src/OFXMLElementBuilder.m +++ src/OFXMLElementBuilder.m @@ -65,12 +65,11 @@ if (parent != nil) [parent addChild: node]; else if ([_delegate respondsToSelector: @selector(elementBuilder:didBuildParentlessNode:)]) - [_delegate elementBuilder: self - didBuildParentlessNode: node]; + [_delegate elementBuilder: self didBuildParentlessNode: node]; } - (void)parser: (OFXMLParser *)parser didStartElement: (OFString *)name prefix: (OFString *)prefix @@ -134,12 +133,11 @@ if (parent != nil) [parent addChild: node]; else if ([_delegate respondsToSelector: @selector(elementBuilder:didBuildParentlessNode:)]) - [_delegate elementBuilder: self - didBuildParentlessNode: node]; + [_delegate elementBuilder: self didBuildParentlessNode: node]; } - (void)parser: (OFXMLParser *)parser foundCDATA: (OFString *)CDATA { @@ -148,12 +146,11 @@ if (parent != nil) [parent addChild: node]; else if ([_delegate respondsToSelector: @selector(elementBuilder:didBuildParentlessNode:)]) - [_delegate elementBuilder: self - didBuildParentlessNode: node]; + [_delegate elementBuilder: self didBuildParentlessNode: node]; } - (void)parser: (OFXMLParser *)parser foundComment: (OFString *)comment { @@ -162,12 +159,11 @@ if (parent != nil) [parent addChild: node]; else if ([_delegate respondsToSelector: @selector(elementBuilder:didBuildParentlessNode:)]) - [_delegate elementBuilder: self - didBuildParentlessNode: node]; + [_delegate elementBuilder: self didBuildParentlessNode: node]; } - (OFString *)parser: (OFXMLParser *)parser foundUnknownEntityNamed: (OFString *)entity { Index: src/OFXMLNode.m ================================================================== --- src/OFXMLNode.m +++ src/OFXMLNode.m @@ -74,18 +74,16 @@ return self.stringValue.doubleValue; } - (OFString *)XMLString { - return [self XMLStringWithIndentation: 0 - level: 0]; + return [self XMLStringWithIndentation: 0 level: 0]; } - (OFString *)XMLStringWithIndentation: (unsigned int)indentation { - return [self XMLStringWithIndentation: 0 - level: 0]; + return [self XMLStringWithIndentation: 0 level: 0]; } - (OFString *)XMLStringWithIndentation: (unsigned int)indentation level: (unsigned int)level { @@ -92,11 +90,11 @@ OF_UNRECOGNIZED_SELECTOR } - (OFString *)description { - return [self XMLStringWithIndentation: 2]; + return [self XMLStringWithIndentation: 2 level: 0]; } - (OFXMLElement *)XMLElementBySerializing { OF_UNRECOGNIZED_SELECTOR Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -92,19 +92,17 @@ static OF_INLINE void appendToBuffer(OFMutableData *buffer, const char *string, of_string_encoding_t encoding, size_t length) { if OF_LIKELY(encoding == OF_STRING_ENCODING_UTF_8) - [buffer addItems: string - count: length]; + [buffer addItems: string count: length]; else { void *pool = objc_autoreleasePoolPush(); OFString *tmp = [OFString stringWithCString: string encoding: encoding length: length]; - [buffer addItems: tmp.UTF8String - count: tmp.UTF8StringLength]; + [buffer addItems: tmp.UTF8String count: tmp.UTF8StringLength]; objc_autoreleasePoolPop(pool); } } static OFString * @@ -128,12 +126,11 @@ items[i] = '\n'; } else if (items[i] == '&') hasEntities = true; } - ret = [OFString stringWithUTF8String: items - length: length]; + ret = [OFString stringWithUTF8String: items length: length]; if (unescape && hasEntities) { @try { return [ret stringByXMLUnescapingWithDelegate: parser]; } @catch (OFInvalidFormatException *e) { @@ -238,12 +235,11 @@ [_previous release]; [super dealloc]; } -- (void)parseBuffer: (const char *)buffer - length: (size_t)length +- (void)parseBuffer: (const char *)buffer length: (size_t)length { _data = buffer; for (_i = _last = 0; _i < length; _i++) { size_t j = _i; @@ -267,12 +263,11 @@ length - _last); } - (void)parseString: (OFString *)string { - [self parseBuffer: string.UTF8String - length: string.UTF8StringLength]; + [self parseBuffer: string.UTF8String length: string.UTF8StringLength]; } - (void)parseStream: (OFStream *)stream { size_t pageSize = [OFSystemInfo pageSize]; @@ -280,13 +275,11 @@ @try { while (!stream.atEndOfStream) { size_t length = [stream readIntoBuffer: buffer length: pageSize]; - - [self parseBuffer: buffer - length: length]; + [self parseBuffer: buffer length: length]; } } @finally { free(buffer); } } @@ -501,11 +494,11 @@ @throw [OFMalformedXMLException exceptionWithParser: self]; if ([self->_delegate respondsToSelector: @selector(parser:foundProcessingInstructions:)]) - [self->_delegate parser: self + [self->_delegate parser: self foundProcessingInstructions: PI]; objc_autoreleasePoolPop(pool); [self->_buffer removeAllItems]; @@ -955,12 +948,11 @@ self->_encoding, self->_i - self->_last); CDATA = transformString(self, self->_buffer, 2, false); if ([self->_delegate respondsToSelector: @selector(parser:foundCDATA:)]) - [self->_delegate parser: self - foundCDATA: CDATA]; + [self->_delegate parser: self foundCDATA: CDATA]; objc_autoreleasePoolPop(pool); [self->_buffer removeAllItems]; @@ -1009,12 +1001,11 @@ self->_encoding, self->_i - self->_last); comment = transformString(self, self->_buffer, 2, false); if ([self->_delegate respondsToSelector: @selector(parser:foundComment:)]) - [self->_delegate parser: self - foundComment: comment]; + [self->_delegate parser: self foundComment: comment]; objc_autoreleasePoolPop(pool); [self->_buffer removeAllItems]; @@ -1054,11 +1045,10 @@ - (OFString *)string: (OFString *)string containsUnknownEntityNamed: (OFString *)entity { if ([_delegate respondsToSelector: @selector(parser:foundUnknownEntityNamed:)]) - return [_delegate parser: self - foundUnknownEntityNamed: entity]; + return [_delegate parser: self foundUnknownEntityNamed: entity]; return nil; } @end Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -139,12 +139,11 @@ static void seekOrThrowInvalidFormat(OFSeekableStream *stream, of_offset_t offset, int whence) { @try { - [stream seekToOffset: offset - whence: whence]; + [stream seekToOffset: offset whence: whence]; } @catch (OFSeekFailedException *e) { if (e.errNo == EINVAL) @throw [OFInvalidFormatException exception]; @throw e; @@ -152,33 +151,28 @@ } @implementation OFZIPArchive @synthesize archiveComment = _archiveComment; -+ (instancetype)archiveWithStream: (OFStream *)stream - mode: (OFString *)mode ++ (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode { - return [[[self alloc] initWithStream: stream - mode: mode] autorelease]; + return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } #ifdef OF_HAVE_FILES -+ (instancetype)archiveWithPath: (OFString *)path - mode: (OFString *)mode ++ (instancetype)archiveWithPath: (OFString *)path mode: (OFString *)mode { - return [[[self alloc] initWithPath: path - mode: mode] autorelease]; + return [[[self alloc] initWithPath: path mode: mode] autorelease]; } #endif - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithStream: (OFStream *)stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode { self = [super init]; @try { if ([mode isEqual: @"r"]) @@ -223,25 +217,21 @@ return self; } #ifdef OF_HAVE_FILES -- (instancetype)initWithPath: (OFString *)path - mode: (OFString *)mode +- (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode { OFFile *file; if ([mode isEqual: @"a"]) - file = [[OFFile alloc] initWithPath: path - mode: @"r+"]; + file = [[OFFile alloc] initWithPath: path mode: @"r+"]; else - file = [[OFFile alloc] initWithPath: path - mode: mode]; + file = [[OFFile alloc] initWithPath: path mode: mode]; @try { - self = [self initWithStream: file - mode: mode]; + self = [self initWithStream: file mode: mode]; } @finally { [file release]; } return self; @@ -790,12 +780,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 { size_t ret; if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; @@ -812,12 +801,11 @@ #endif if ((uint64_t)length > _toRead) length = (size_t)_toRead; - ret = [_decompressedStream readIntoBuffer: buffer - length: length]; + ret = [_decompressedStream readIntoBuffer: buffer length: length]; _toRead -= ret; _CRC32 = of_crc32(_CRC32, buffer, ret); if (_toRead == 0) { @@ -886,12 +874,11 @@ [_entry release]; [super dealloc]; } -- (size_t)lowlevelWriteBuffer: (const void *)buffer - length: (size_t)length +- (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { size_t bytesWritten; #if SIZE_MAX >= INT64_MAX if (length > INT64_MAX) @@ -899,12 +886,11 @@ #endif if (INT64_MAX - _bytesWritten < (int64_t)length) @throw [OFOutOfRangeException exception]; - bytesWritten = [_stream writeBuffer: buffer - length: length]; + bytesWritten = [_stream writeBuffer: buffer length: length]; _bytesWritten += (int64_t)bytesWritten; _CRC32 = of_crc32(_CRC32, buffer, length); return bytesWritten; Index: src/base64.m ================================================================== --- src/base64.m +++ src/base64.m @@ -147,11 +147,10 @@ db[0] = (sb & 0xFF0000) >> 16; db[1] = (sb & 0x00FF00) >> 8; db[2] = sb & 0x0000FF; - [data addItems: db - count: count]; + [data addItems: db count: count]; } return true; } Index: src/bridge/OFException+Swift.h ================================================================== --- src/bridge/OFException+Swift.h +++ src/bridge/OFException+Swift.h @@ -45,12 +45,11 @@ * @note This is only useful for Swift. * * @param try The try block to execute * @param finally The finally block to call at the end */ -+ (void)try: (void (^)(void))try - finally: (void (^)(void))finally; ++ (void)try: (void (^)(void))try finally: (void (^)(void))finally; /** * @brief Execute the specified try block and call the catch block if an * OFException occurred and finally call the finally block. * Index: src/exceptions/OFAcceptFailedException.m ================================================================== --- src/exceptions/OFAcceptFailedException.m +++ src/exceptions/OFAcceptFailedException.m @@ -24,24 +24,21 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithSocket: (id)socket - errNo: (int)errNo ++ (instancetype)exceptionWithSocket: (id)socket errNo: (int)errNo { - return [[[self alloc] initWithSocket: socket - errNo: errNo] autorelease]; + return [[[self alloc] initWithSocket: socket errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithSocket: (id)socket - errNo: (int)errNo +- (instancetype)initWithSocket: (id)socket errNo: (int)errNo { self = [super init]; _socket = [socket retain]; _errNo = errNo; Index: src/exceptions/OFChangeCurrentDirectoryPathFailedException.m ================================================================== --- src/exceptions/OFChangeCurrentDirectoryPathFailedException.m +++ src/exceptions/OFChangeCurrentDirectoryPathFailedException.m @@ -24,24 +24,21 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithPath: (OFString *)path - errNo: (int)errNo ++ (instancetype)exceptionWithPath: (OFString *)path errNo: (int)errNo { - return [[[self alloc] initWithPath: path - errNo: errNo] autorelease]; + return [[[self alloc] initWithPath: path errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithPath: (OFString *)path - errNo: (int)errNo +- (instancetype)initWithPath: (OFString *)path errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; Index: src/exceptions/OFConditionBroadcastFailedException.m ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.m +++ src/exceptions/OFConditionBroadcastFailedException.m @@ -29,12 +29,11 @@ { return [[[self alloc] initWithCondition: condition errNo: errNo] autorelease]; } -- (instancetype)initWithCondition: (OFCondition *)condition - errNo: (int)errNo +- (instancetype)initWithCondition: (OFCondition *)condition errNo: (int)errNo { self = [super init]; _condition = [condition retain]; _errNo = errNo; Index: src/exceptions/OFConditionSignalFailedException.m ================================================================== --- src/exceptions/OFConditionSignalFailedException.m +++ src/exceptions/OFConditionSignalFailedException.m @@ -29,12 +29,11 @@ { return [[[self alloc] initWithCondition: condition errNo: errNo] autorelease]; } -- (instancetype)initWithCondition: (OFCondition *)condition - errNo: (int)errNo +- (instancetype)initWithCondition: (OFCondition *)condition errNo: (int)errNo { self = [super init]; _condition = [condition retain]; _errNo = errNo; Index: src/exceptions/OFConditionWaitFailedException.m ================================================================== --- src/exceptions/OFConditionWaitFailedException.m +++ src/exceptions/OFConditionWaitFailedException.m @@ -29,12 +29,11 @@ { return [[[self alloc] initWithCondition: condition errNo: errNo] autorelease]; } -- (instancetype)initWithCondition: (OFCondition *)condition - errNo: (int)errNo +- (instancetype)initWithCondition: (OFCondition *)condition errNo: (int)errNo { self = [super init]; _condition = [condition retain]; _errNo = errNo; Index: src/exceptions/OFCreateDirectoryFailedException.m ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.m +++ src/exceptions/OFCreateDirectoryFailedException.m @@ -25,24 +25,21 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithURL: (OFURL *)URL - errNo: (int)errNo ++ (instancetype)exceptionWithURL: (OFURL *)URL errNo: (int)errNo { - return [[[self alloc] initWithURL: URL - errNo: errNo] autorelease]; + return [[[self alloc] initWithURL: URL errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithURL: (OFURL *)URL - errNo: (int)errNo +- (instancetype)initWithURL: (OFURL *)URL errNo: (int)errNo { self = [super init]; @try { _URL = [URL copy]; Index: src/exceptions/OFDNSQueryFailedException.m ================================================================== --- src/exceptions/OFDNSQueryFailedException.m +++ src/exceptions/OFDNSQueryFailedException.m @@ -53,12 +53,11 @@ @synthesize query = _query, error = _error; + (instancetype)exceptionWithQuery: (OFDNSQuery *)query error: (of_dns_resolver_error_t)error { - return [[[self alloc] initWithQuery: query - error: error] autorelease]; + return [[[self alloc] initWithQuery: query error: error] autorelease]; } - (instancetype)initWithQuery: (OFDNSQuery *)query error: (of_dns_resolver_error_t)error { Index: src/exceptions/OFGetOptionFailedException.m ================================================================== --- src/exceptions/OFGetOptionFailedException.m +++ src/exceptions/OFGetOptionFailedException.m @@ -24,24 +24,21 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithObject: (id)object - errNo: (int)errNo ++ (instancetype)exceptionWithObject: (id)object errNo: (int)errNo { - return [[[self alloc] initWithObject: object - errNo: errNo] autorelease]; + return [[[self alloc] initWithObject: object errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithObject: (id)object - errNo: (int)errNo +- (instancetype)initWithObject: (id)object errNo: (int)errNo { self = [super init]; _object = [object retain]; _errNo = errNo; Index: src/exceptions/OFInvalidJSONException.m ================================================================== --- src/exceptions/OFInvalidJSONException.m +++ src/exceptions/OFInvalidJSONException.m @@ -24,24 +24,21 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithString: (OFString *)string - line: (size_t)line ++ (instancetype)exceptionWithString: (OFString *)string line: (size_t)line { - return [[[self alloc] initWithString: string - line: line] autorelease]; + return [[[self alloc] initWithString: string line: line] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithString: (OFString *)string - line: (size_t)line +- (instancetype)initWithString: (OFString *)string line: (size_t)line { self = [super init]; @try { _string = [string copy]; Index: src/exceptions/OFLoadPluginFailedException.m ================================================================== --- src/exceptions/OFLoadPluginFailedException.m +++ src/exceptions/OFLoadPluginFailedException.m @@ -24,24 +24,21 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithPath: (OFString *)path - error: (OFString *)error ++ (instancetype)exceptionWithPath: (OFString *)path error: (OFString *)error { - return [[[self alloc] initWithPath: path - error: error] autorelease]; + return [[[self alloc] initWithPath: path error: error] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithPath: (OFString *)path - error: (OFString *)error +- (instancetype)initWithPath: (OFString *)path error: (OFString *)error { self = [super init]; @try { _path = [path copy]; Index: src/exceptions/OFLockFailedException.m ================================================================== --- src/exceptions/OFLockFailedException.m +++ src/exceptions/OFLockFailedException.m @@ -21,19 +21,16 @@ #import "OFString.h" @implementation OFLockFailedException @synthesize lock = _lock, errNo = _errNo; -+ (instancetype)exceptionWithLock: (id )lock - errNo: (int)errNo ++ (instancetype)exceptionWithLock: (id )lock errNo: (int)errNo { - return [[[self alloc] initWithLock: lock - errNo: errNo] autorelease]; + return [[[self alloc] initWithLock: lock errNo: errNo] autorelease]; } -- (instancetype)initWithLock: (id )lock - errNo: (int)errNo +- (instancetype)initWithLock: (id )lock errNo: (int)errNo { self = [super init]; _lock = [lock retain]; _errNo = errNo; Index: src/exceptions/OFMemoryNotPartOfObjectException.m ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.m +++ src/exceptions/OFMemoryNotPartOfObjectException.m @@ -24,12 +24,11 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithPointer: (void *)pointer - object: (id)object ++ (instancetype)exceptionWithPointer: (void *)pointer object: (id)object { return [[[self alloc] initWithPointer: pointer object: object] autorelease]; } @@ -36,12 +35,11 @@ - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithPointer: (void *)pointer - object: (id)object +- (instancetype)initWithPointer: (void *)pointer object: (id)object { self = [super init]; _pointer = pointer; _object = [object retain]; Index: src/exceptions/OFMoveItemFailedException.m ================================================================== --- src/exceptions/OFMoveItemFailedException.m +++ src/exceptions/OFMoveItemFailedException.m @@ -28,11 +28,11 @@ OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithSourceURL: (OFURL *)sourceURL destinationURL: (OFURL *)destinationURL - errNo: (int)errNo + errNo: (int)errNo { return [[[self alloc] initWithSourceURL: sourceURL destinationURL: destinationURL errNo: errNo] autorelease]; } Index: src/exceptions/OFNotImplementedException.m ================================================================== --- src/exceptions/OFNotImplementedException.m +++ src/exceptions/OFNotImplementedException.m @@ -24,12 +24,11 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithSelector: (SEL)selector - object: (id)object ++ (instancetype)exceptionWithSelector: (SEL)selector object: (id)object { return [[[self alloc] initWithSelector: selector object: object] autorelease]; } @@ -36,12 +35,11 @@ - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithSelector: (SEL)selector - object: (id)object +- (instancetype)initWithSelector: (SEL)selector object: (id)object { self = [super init]; _selector = selector; _object = [object retain]; Index: src/exceptions/OFRemoveItemFailedException.m ================================================================== --- src/exceptions/OFRemoveItemFailedException.m +++ src/exceptions/OFRemoveItemFailedException.m @@ -25,24 +25,21 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithURL: (OFURL *)URL - errNo: (int)errNo ++ (instancetype)exceptionWithURL: (OFURL *)URL errNo: (int)errNo { - return [[[self alloc] initWithURL: URL - errNo: errNo] autorelease]; + return [[[self alloc] initWithURL: URL errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithURL: (OFURL *)URL - errNo: (int)errNo +- (instancetype)initWithURL: (OFURL *)URL errNo: (int)errNo { self = [super init]; @try { _URL = [URL copy]; Index: src/exceptions/OFRetrieveItemAttributesFailedException.m ================================================================== --- src/exceptions/OFRetrieveItemAttributesFailedException.m +++ src/exceptions/OFRetrieveItemAttributesFailedException.m @@ -25,24 +25,21 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithURL: (OFURL *)URL - errNo: (int)errNo ++ (instancetype)exceptionWithURL: (OFURL *)URL errNo: (int)errNo { - return [[[self alloc] initWithURL: URL - errNo: errNo] autorelease]; + return [[[self alloc] initWithURL: URL errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithURL: (OFURL *)URL - errNo: (int)errNo +- (instancetype)initWithURL: (OFURL *)URL errNo: (int)errNo { self = [super init]; @try { _URL = [URL copy]; Index: src/exceptions/OFSandboxActivationFailedException.m ================================================================== --- src/exceptions/OFSandboxActivationFailedException.m +++ src/exceptions/OFSandboxActivationFailedException.m @@ -25,12 +25,11 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithSandbox: (OFSandbox *)sandbox - errNo: (int)errNo ++ (instancetype)exceptionWithSandbox: (OFSandbox *)sandbox errNo: (int)errNo { return [[[self alloc] initWithSandbox: sandbox errNo: errNo] autorelease]; } @@ -37,12 +36,11 @@ - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithSandbox: (OFSandbox *)sandbox - errNo: (int)errNo +- (instancetype)initWithSandbox: (OFSandbox *)sandbox errNo: (int)errNo { self = [super init]; _sandbox = [sandbox retain]; _errNo = errNo; Index: src/exceptions/OFSetOptionFailedException.m ================================================================== --- src/exceptions/OFSetOptionFailedException.m +++ src/exceptions/OFSetOptionFailedException.m @@ -24,24 +24,21 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithObject: (id)object - errNo: (int)errNo ++ (instancetype)exceptionWithObject: (id)object errNo: (int)errNo { - return [[[self alloc] initWithObject: object - errNo: errNo] autorelease]; + return [[[self alloc] initWithObject: object errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithObject: (id)object - errNo: (int)errNo +- (instancetype)initWithObject: (id)object errNo: (int)errNo { self = [super init]; _object = [object retain]; _errNo = errNo; Index: src/exceptions/OFThreadJoinFailedException.m ================================================================== --- src/exceptions/OFThreadJoinFailedException.m +++ src/exceptions/OFThreadJoinFailedException.m @@ -22,19 +22,16 @@ #import "OFThread.h" @implementation OFThreadJoinFailedException @synthesize thread = _thread, errNo = _errNo; -+ (instancetype)exceptionWithThread: (OFThread *)thread - errNo: (int)errNo ++ (instancetype)exceptionWithThread: (OFThread *)thread errNo: (int)errNo { - return [[[self alloc] initWithThread: thread - errNo: errNo] autorelease]; + return [[[self alloc] initWithThread: thread errNo: errNo] autorelease]; } -- (instancetype)initWithThread: (OFThread *)thread - errNo: (int)errNo +- (instancetype)initWithThread: (OFThread *)thread errNo: (int)errNo { self = [super init]; _thread = [thread retain]; _errNo = errNo; Index: src/exceptions/OFThreadStartFailedException.m ================================================================== --- src/exceptions/OFThreadStartFailedException.m +++ src/exceptions/OFThreadStartFailedException.m @@ -22,19 +22,16 @@ #import "OFThread.h" @implementation OFThreadStartFailedException @synthesize thread = _thread, errNo = _errNo; -+ (instancetype)exceptionWithThread: (OFThread *)thread - errNo: (int)errNo ++ (instancetype)exceptionWithThread: (OFThread *)thread errNo: (int)errNo { - return [[[self alloc] initWithThread: thread - errNo: errNo] autorelease]; + return [[[self alloc] initWithThread: thread errNo: errNo] autorelease]; } -- (instancetype)initWithThread: (OFThread *)thread - errNo: (int)errNo +- (instancetype)initWithThread: (OFThread *)thread errNo: (int)errNo { self = [super init]; _thread = [thread retain]; _errNo = errNo; Index: src/exceptions/OFUnboundPrefixException.m ================================================================== --- src/exceptions/OFUnboundPrefixException.m +++ src/exceptions/OFUnboundPrefixException.m @@ -37,12 +37,11 @@ - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithPrefix: (OFString *)prefix - parser: (OFXMLParser *)parser +- (instancetype)initWithPrefix: (OFString *)prefix parser: (OFXMLParser *)parser { self = [super init]; @try { _prefix = [prefix copy]; Index: src/exceptions/OFUndefinedKeyException.m ================================================================== --- src/exceptions/OFUndefinedKeyException.m +++ src/exceptions/OFUndefinedKeyException.m @@ -24,15 +24,13 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ (instancetype)exceptionWithObject: (id)object - key: (OFString *)key ++ (instancetype)exceptionWithObject: (id)object key: (OFString *)key { - return [[[self alloc] initWithObject: object - key: key] autorelease]; + return [[[self alloc] initWithObject: object key: key] autorelease]; } + (instancetype)exceptionWithObject: (id)object key: (OFString *)key value: (id)value @@ -45,21 +43,16 @@ - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithObject: (id)object - key: (OFString *)key +- (instancetype)initWithObject: (id)object key: (OFString *)key { - return [self initWithObject: object - key: key - value: nil]; + return [self initWithObject: object key: key value: nil]; } -- (instancetype)initWithObject: (id)object - key: (OFString *)key - value: (id)value +- (instancetype)initWithObject: (id)object key: (OFString *)key value: (id)value { self = [super init]; @try { _object = [object retain]; Index: src/exceptions/OFUnlockFailedException.m ================================================================== --- src/exceptions/OFUnlockFailedException.m +++ src/exceptions/OFUnlockFailedException.m @@ -21,19 +21,16 @@ #import "OFString.h" @implementation OFUnlockFailedException @synthesize lock = _lock, errNo = _errNo; -+ (instancetype)exceptionWithLock: (id )lock - errNo: (int)errNo ++ (instancetype)exceptionWithLock: (id )lock errNo: (int)errNo { - return [[[self alloc] initWithLock: lock - errNo: errNo] autorelease]; + return [[[self alloc] initWithLock: lock errNo: errNo] autorelease]; } -- (instancetype)initWithLock: (id )lock - errNo: (int)errNo +- (instancetype)initWithLock: (id )lock errNo: (int)errNo { self = [super init]; _lock = [lock retain]; _errNo = errNo; Index: src/platform/amiga/OFString+PathAdditions.m ================================================================== --- src/platform/amiga/OFString+PathAdditions.m +++ src/platform/amiga/OFString+PathAdditions.m @@ -322,12 +322,11 @@ i--; continue; } if ([component isEqual: @".."]) - [components replaceObjectAtIndex: i - withObject: @"/"]; + [components replaceObjectAtIndex: i withObject: @"/"]; } return [OFString pathWithComponents: components]; } Index: src/platform/posix/OFString+PathAdditions.m ================================================================== --- src/platform/posix/OFString+PathAdditions.m +++ src/platform/posix/OFString+PathAdditions.m @@ -284,12 +284,11 @@ } } } if (startsWithSlash) - [array insertObject: @"" - atIndex: 0]; + [array insertObject: @"" atIndex: 0]; if ([self hasSuffix: @"/"]) [array addObject: @""]; ret = [[array componentsJoinedByString: @"/"] retain]; Index: src/platform/windows/OFProcess.m ================================================================== --- src/platform/windows/OFProcess.m +++ src/platform/windows/OFProcess.m @@ -266,21 +266,17 @@ keyEnumerator = [environment keyEnumerator]; objectEnumerator = [environment objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) { - [env addItems: key.UTF16String - count: key.UTF16StringLength]; - [env addItems: &equal - count: 1]; + [env addItems: key.UTF16String count: key.UTF16StringLength]; + [env addItems: &equal count: 1]; [env addItems: object.UTF16String count: object.UTF16StringLength]; - [env addItems: &zero - count: 1]; + [env addItems: &zero count: 1]; } - [env addItems: zero - count: 2]; + [env addItems: zero count: 2]; return env.mutableItems; } - (char *)of_environmentForDictionary: (OFDictionary *)environment @@ -299,19 +295,16 @@ objectEnumerator = [environment objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) { [env addItems: [key cStringWithEncoding: encoding] count: [key cStringLengthWithEncoding: encoding]]; - [env addItems: "=" - count: 1]; + [env addItems: "=" count: 1]; [env addItems: [object cStringWithEncoding: encoding] count: [object cStringLengthWithEncoding: encoding]]; - [env addItems: "" - count: 1]; + [env addItems: "" count: 1]; } - [env addItems: "\0" - count: 2]; + [env addItems: "\0" count: 2]; return env.mutableItems; } - (bool)lowlevelIsAtEndOfStream @@ -320,12 +313,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 { DWORD ret; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; @@ -348,12 +340,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 { DWORD bytesWritten; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; Index: tests/OFASN1DERRepresentationTests.m ================================================================== --- tests/OFASN1DERRepresentationTests.m +++ tests/OFASN1DERRepresentationTests.m @@ -25,47 +25,38 @@ void *pool = objc_autoreleasePoolPush(); OFData *data; module = @"OFASN1BitString"; TEST(@"-[ASN1DERRepresentation]", - (data = [OFData dataWithItems: "\xFF\x00\xF8" - count: 3]) && + (data = [OFData dataWithItems: "\xFF\x00\xF8" count: 3]) && [[[OFASN1BitString bitStringWithBitStringValue: data bitStringLength: 21] ASN1DERRepresentation] isEqual: - [OFData dataWithItems: "\x03\x04\x03\xFF\x00\xF8" - count: 6]] && - (data = [OFData dataWithItems: "abcdefäöü" - count: 12]) && + [OFData dataWithItems: "\x03\x04\x03\xFF\x00\xF8" count: 6]] && + (data = [OFData dataWithItems: "abcdefäöü" count: 12]) && [[[OFASN1BitString bitStringWithBitStringValue: data bitStringLength: 12 * 8] ASN1DERRepresentation] isEqual: - [OFData dataWithItems: "\x03\x0D\x00" "abcdefäöü" - count: 15]] && - (data = [OFData dataWithItems: "" - count: 0]) && + [OFData dataWithItems: "\x03\x0D\x00" "abcdefäöü" count: 15]] && + (data = [OFData dataWithItems: "" count: 0]) && [[[OFASN1BitString bitStringWithBitStringValue: data bitStringLength: 0] ASN1DERRepresentation] isEqual: - [OFData dataWithItems: "\x03\x01\x00" - count: 3]]) + [OFData dataWithItems: "\x03\x01\x00" count: 3]]) module = @"OFASN1Boolean"; TEST(@"-[ASN1DERRepresentation]", [[[OFASN1Boolean booleanWithBooleanValue: false] ASN1DERRepresentation] isEqual: - [OFData dataWithItems: "\x01\x01\x00" - count: 3]] && + [OFData dataWithItems: "\x01\x01\x00" count: 3]] && [[[OFASN1Boolean booleanWithBooleanValue: true] ASN1DERRepresentation] isEqual: - [OFData dataWithItems: "\x01\x01\xFF" - count: 3]]) + [OFData dataWithItems: "\x01\x01\xFF" count: 3]]) module = @"OFNull"; TEST(@"-[OFASN1DERRepresentation]", [[[OFNull null] ASN1DERRepresentation] isEqual: - [OFData dataWithItems: "\x05\x00" - count: 2]]) + [OFData dataWithItems: "\x05\x00" count: 2]]) objc_autoreleasePoolPop(pool); } @end Index: tests/OFArrayTests.m ================================================================== --- tests/OFArrayTests.m +++ tests/OFArrayTests.m @@ -49,12 +49,11 @@ } return self; } -- (instancetype)initWithObject: (id)object - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)object arguments: (va_list)arguments { self = [super init]; @try { _array = [[OFMutableArray alloc] initWithObject: object @@ -65,12 +64,11 @@ } return self; } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { self = [super init]; @try { _array = [[OFMutableArray alloc] initWithObjects: objects @@ -106,22 +104,18 @@ { if (self == [SimpleMutableArray class]) [self inheritMethodsFromClass: [SimpleArray class]]; } -- (void)insertObject: (id)object - atIndex: (size_t)idx +- (void)insertObject: (id)object atIndex: (size_t)idx { - [_array insertObject: object - atIndex: idx]; + [_array insertObject: object atIndex: idx]; } -- (void)replaceObjectAtIndex: (size_t)idx - withObject: (id)object +- (void)replaceObjectAtIndex: (size_t)idx withObject: (id)object { - [_array replaceObjectAtIndex: idx - withObject: object]; + [_array replaceObjectAtIndex: idx withObject: object]; } - (void)removeObjectAtIndex: (size_t)idx { [_array removeObjectAtIndex: idx]; @@ -144,22 +138,21 @@ TEST(@"+[arrayWithObjects:]", (a[0] = [arrayClass arrayWithObjects: @"Foo", @"Bar", @"Baz", nil])) TEST(@"+[arrayWithObjects:count:]", - (a[1] = [arrayClass arrayWithObjects: c_ary - count: 3]) && + (a[1] = [arrayClass arrayWithObjects: c_ary count: 3]) && [a[1] isEqual: a[0]]) TEST(@"-[description]", [a[0].description isEqual: @"(\n\tFoo,\n\tBar,\n\tBaz\n)"]) TEST(@"-[addObject:]", R([m[0] addObject: c_ary[0]]) && R([m[0] addObject: c_ary[2]])) - TEST(@"-[insertObject:atIndex:]", R([m[0] insertObject: c_ary[1] - atIndex: 1])) + TEST(@"-[insertObject:atIndex:]", + R([m[0] insertObject: c_ary[1] atIndex: 1])) TEST(@"-[count]", m[0].count == 3 && a[0].count == 3 && a[1].count == 3) TEST(@"-[isEqual:]", [m[0] isEqual: a[0]] && [a[0] isEqual: a[1]]) @@ -191,26 +184,23 @@ TEST(@"-[objectsInRange:]", [[a[0] objectsInRange: of_range(1, 2)] isEqual: [arrayClass arrayWithObjects: c_ary[1], c_ary[2], nil]]) TEST(@"-[replaceObject:withObject:]", - R([m[0] replaceObject: c_ary[1] - withObject: c_ary[0]]) && + R([m[0] replaceObject: c_ary[1] withObject: c_ary[0]]) && [[m[0] objectAtIndex: 0] isEqual: c_ary[0]] && [[m[0] objectAtIndex: 1] isEqual: c_ary[0]] && [[m[0] objectAtIndex: 2] isEqual: c_ary[2]]) TEST(@"-[replaceObject:identicalTo:]", - R([m[0] replaceObjectIdenticalTo: c_ary[0] - withObject: c_ary[1]]) && + R([m[0] replaceObjectIdenticalTo: c_ary[0] withObject: c_ary[1]]) && [[m[0] objectAtIndex: 0] isEqual: c_ary[1]] && [[m[0] objectAtIndex: 1] isEqual: c_ary[0]] && [[m[0] objectAtIndex: 2] isEqual: c_ary[2]]) TEST(@"-[replaceObjectAtIndex:withObject:]", - R([m[0] replaceObjectAtIndex: 0 - withObject: c_ary[0]]) && + R([m[0] replaceObjectAtIndex: 0 withObject: c_ary[0]]) && [[m[0] objectAtIndex: 0] isEqual: c_ary[0]] && [[m[0] objectAtIndex: 1] isEqual: c_ary[0]] && [[m[0] objectAtIndex: 2] isEqual: c_ary[2]]) TEST(@"-[removeObject:]", @@ -280,12 +270,11 @@ TEST(@"-[objectEnumerator]", (enumerator = [m[0] objectEnumerator])) while ((obj = [enumerator nextObject]) != nil) { if (![obj isEqual: c_ary[i]]) ok = false; - [m[0] replaceObjectAtIndex: i - withObject: @""]; + [m[0] replaceObjectAtIndex: i withObject: @""]; i++; } if (m[0].count != i) ok = false; @@ -302,26 +291,22 @@ i = 0; for (OFString *s in m[0]) { if (![s isEqual: c_ary[i]]) ok = false; - [m[0] replaceObjectAtIndex: i - withObject: @""]; + [m[0] replaceObjectAtIndex: i withObject: @""]; i++; } if (m[0].count != i) ok = false; TEST(@"Fast Enumeration", ok) - [m[0] replaceObjectAtIndex: 0 - withObject: c_ary[0]]; - [m[0] replaceObjectAtIndex: 1 - withObject: c_ary[1]]; - [m[0] replaceObjectAtIndex: 2 - withObject: c_ary[2]]; + [m[0] replaceObjectAtIndex: 0 withObject: c_ary[0]]; + [m[0] replaceObjectAtIndex: 1 withObject: c_ary[1]]; + [m[0] replaceObjectAtIndex: 2 withObject: c_ary[2]]; ok = false; i = 0; @try { for (OFString *s in m[0]) { Index: tests/OFDataTests.m ================================================================== --- tests/OFDataTests.m +++ tests/OFDataTests.m @@ -63,32 +63,27 @@ TEST(@"-[compare]", [mutable compare: immutable] == 0 && R([mutable removeLastItem]) && [immutable compare: mutable] == OF_ORDERED_DESCENDING && [mutable compare: immutable] == OF_ORDERED_ASCENDING && - [[OFData dataWithItems: "aa" - count: 2] compare: - [OFData dataWithItems: "z" - count: 1]] == OF_ORDERED_ASCENDING) + [[OFData dataWithItems: "aa" count: 2] compare: + [OFData dataWithItems: "z" count: 1]] == OF_ORDERED_ASCENDING) TEST(@"-[hash]", immutable.hash == 0x634A529F) - mutable = [OFMutableData dataWithItems: "abcdef" - count: 6]; + mutable = [OFMutableData dataWithItems: "abcdef" count: 6]; TEST(@"-[removeLastItem]", R([mutable removeLastItem]) && mutable.count == 5 && memcmp(mutable.items, "abcde", 5) == 0) TEST(@"-[removeItemsInRange:]", R([mutable removeItemsInRange: of_range(1, 2)]) && mutable.count == 3 && memcmp(mutable.items, "ade", 3) == 0) TEST(@"-[insertItems:atIndex:count:]", - R([mutable insertItems: "bc" - atIndex: 1 - count: 2]) && mutable.count == 5 && - memcmp(mutable.items, "abcde", 5) == 0) + R([mutable insertItems: "bc" atIndex: 1 count: 2]) && + mutable.count == 5 && memcmp(mutable.items, "abcde", 5) == 0) immutable = [OFData dataWithItems: "aaabaccdacaabb" count: 7 itemSize: 2]; @@ -198,21 +193,19 @@ TEST(@"+[dataWithBase64EncodedString:]", memcmp([[OFData dataWithBase64EncodedString: @"YWJjZGU="] items], "abcde", 5) == 0) TEST(@"Building strings", - (mutable = [OFMutableData dataWithItems: str - count: 6]) && + (mutable = [OFMutableData dataWithItems: str count: 6]) && R([mutable addItem: ""]) && strcmp(mutable.items, str) == 0) EXPECT_EXCEPTION(@"Detect out of range in -[itemAtIndex:]", OFOutOfRangeException, [mutable itemAtIndex: mutable.count]) EXPECT_EXCEPTION(@"Detect out of range in -[addItems:count:]", - OFOutOfRangeException, [mutable addItems: raw[0] - count: SIZE_MAX]) + OFOutOfRangeException, [mutable addItems: raw[0] count: SIZE_MAX]) EXPECT_EXCEPTION(@"Detect out of range in -[removeItemsInRange:]", OFOutOfRangeException, [mutable removeItemsInRange: of_range(mutable.count, 1)]) Index: tests/OFDictionaryTests.m ================================================================== --- tests/OFDictionaryTests.m +++ tests/OFDictionaryTests.m @@ -53,12 +53,11 @@ } return self; } -- (instancetype)initWithKey: (id)key - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)key arguments: (va_list)arguments { self = [super init]; @try { _dictionary = [[OFMutableDictionary alloc] @@ -119,17 +118,15 @@ { if (self == [SimpleMutableDictionary class]) [self inheritMethodsFromClass: [SimpleDictionary class]]; } -- (void)setObject: (id)object - forKey: (id)key +- (void)setObject: (id)object forKey: (id)key { bool existed = ([_dictionary objectForKey: key] == nil); - [_dictionary setObject: object - forKey: key]; + [_dictionary setObject: object forKey: key]; if (existed) _mutations++; } @@ -165,14 +162,12 @@ OFMutableDictionary *mutDict = [mutableDictionaryClass dictionary]; OFDictionary *dict; OFEnumerator *keyEnumerator, *objectEnumerator; OFArray *keysArray, *valuesArray; - [mutDict setObject: values[0] - forKey: keys[0]]; - [mutDict setValue: values[1] - forKey: keys[1]]; + [mutDict setObject: values[0] forKey: keys[0]]; + [mutDict setValue: values[1] forKey: keys[1]]; TEST(@"-[objectForKey:]", [[mutDict objectForKey: keys[0]] isEqual: values[0]] && [[mutDict objectForKey: keys[1]] isEqual: values[1]] && [mutDict objectForKey: @"key3"] == nil) @@ -182,12 +177,11 @@ [[mutDict valueForKey: @"@count"] isEqual: [OFNumber numberWithInt: 2]]) EXPECT_EXCEPTION(@"Catching -[setValue:forKey:] on immutable " @"dictionary", OFUndefinedKeyException, - [[dictionaryClass dictionary] setValue: @"x" - forKey: @"x"]) + [[dictionaryClass dictionary] setValue: @"x" forKey: @"x"]) TEST(@"-[containsObject:]", [mutDict containsObject: values[0]] && ![mutDict containsObject: @"nonexistent"]) @@ -223,12 +217,11 @@ [mutDict removeObjectForKey: keys[0]]; EXPECT_EXCEPTION(@"Detection of mutation during enumeration", OFEnumerationMutationException, [keyEnumerator nextObject]); - [mutDict setObject: values[0] - forKey: keys[0]]; + [mutDict setObject: values[0] forKey: keys[0]]; size_t i = 0; bool ok = true; for (OFString *key in mutDict) { @@ -235,24 +228,21 @@ if (i > 1 || ![key isEqual: keys[i]]) { ok = false; break; } - [mutDict setObject: [mutDict objectForKey: key] - forKey: key]; + [mutDict setObject: [mutDict objectForKey: key] forKey: key]; i++; } TEST(@"Fast Enumeration", ok) ok = false; @try { for (OFString *key in mutDict) { (void)key; - - [mutDict setObject: @"" - forKey: @""]; + [mutDict setObject: @"" forKey: @""]; } } @catch (OFEnumerationMutationException *e) { ok = true; } @@ -359,29 +349,25 @@ TEST(@"-[mutableCopy]", (mutDict = [[dict mutableCopy] autorelease]) && mutDict.count == dict.count && [[mutDict objectForKey: keys[0]] isEqual: values[0]] && [[mutDict objectForKey: keys[1]] isEqual: values[1]] && - R([mutDict setObject: @"value3" - forKey: @"key3"]) && + R([mutDict setObject: @"value3" forKey: @"key3"]) && [[mutDict objectForKey: @"key3"] isEqual: @"value3"] && [[mutDict objectForKey: keys[0]] isEqual: values[0]] && - R([mutDict setObject: @"foo" - forKey: keys[0]]) && + R([mutDict setObject: @"foo" forKey: keys[0]]) && [[mutDict objectForKey: keys[0]] isEqual: @"foo"]) TEST(@"-[removeObjectForKey:]", R([mutDict removeObjectForKey: keys[0]]) && [mutDict objectForKey: keys[0]] == nil) - [mutDict setObject: @"foo" - forKey: keys[0]]; + [mutDict setObject: @"foo" forKey: keys[0]]; TEST(@"-[isEqual:]", ![mutDict isEqual: dict] && R([mutDict removeObjectForKey: @"key3"]) && ![mutDict isEqual: dict] && - R([mutDict setObject: values[0] - forKey: keys[0]]) && + R([mutDict setObject: values[0] forKey: keys[0]]) && [mutDict isEqual: dict]) objc_autoreleasePoolPop(pool); } Index: tests/OFHMACTests.m ================================================================== --- tests/OFHMACTests.m +++ tests/OFHMACTests.m @@ -49,12 +49,11 @@ @implementation TestsAppDelegate (OFHMACTests) - (void)HMACTests { void *pool = objc_autoreleasePoolPush(); - OFFile *f = [OFFile fileWithPath: @"testfile.bin" - mode: @"r"]; + OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; OFHMAC *HMAC_MD5, *HMAC_SHA1, *HMAC_RMD160; OFHMAC *HMAC_SHA256, *HMAC_SHA384, *HMAC_SHA512; TEST(@"+[HMACWithHashClass:] with MD5", (HMAC_MD5 = [OFHMAC HMACWithHashClass: [OFMD5Hash class] @@ -78,44 +77,31 @@ EXPECT_EXCEPTION(@"Detection of missing key", OFInvalidArgumentException, [HMAC_MD5 updateWithBuffer: "" length: 0]) TEST(@"-[setKey:length:] with MD5", - R([HMAC_MD5 setKey: key - length: key_length])) + R([HMAC_MD5 setKey: key length: key_length])) TEST(@"-[setKey:length:] with SHA-1", - R([HMAC_SHA1 setKey: key - length: key_length])) + R([HMAC_SHA1 setKey: key length: key_length])) TEST(@"-[setKey:length:] with RIPEMD-160", - R([HMAC_RMD160 setKey: key - length: key_length])) + R([HMAC_RMD160 setKey: key length: key_length])) TEST(@"-[setKey:length:] with SHA-256", - R([HMAC_SHA256 setKey: key - length: key_length])) + R([HMAC_SHA256 setKey: key length: key_length])) TEST(@"-[setKey:length:] with SHA-384", - R([HMAC_SHA384 setKey: key - length: key_length])) + R([HMAC_SHA384 setKey: key length: key_length])) TEST(@"-[setKey:length:] with SHA-512", - R([HMAC_SHA512 setKey: key - length: key_length])) + R([HMAC_SHA512 setKey: key length: key_length])) while (!f.atEndOfStream) { char buf[64]; - size_t len = [f readIntoBuffer: buf - length: 64]; - [HMAC_MD5 updateWithBuffer: buf - length: len]; - [HMAC_SHA1 updateWithBuffer: buf - length: len]; - [HMAC_RMD160 updateWithBuffer: buf - length: len]; - [HMAC_SHA256 updateWithBuffer: buf - length: len]; - [HMAC_SHA384 updateWithBuffer: buf - length: len]; - [HMAC_SHA512 updateWithBuffer: buf - length: len]; + size_t len = [f readIntoBuffer: buf length: 64]; + [HMAC_MD5 updateWithBuffer: buf length: len]; + [HMAC_SHA1 updateWithBuffer: buf length: len]; + [HMAC_RMD160 updateWithBuffer: buf length: len]; + [HMAC_SHA256 updateWithBuffer: buf length: len]; + [HMAC_SHA384 updateWithBuffer: buf length: len]; + [HMAC_SHA512 updateWithBuffer: buf length: len]; } [f close]; TEST(@"-[digest] with MD5", memcmp(HMAC_MD5.digest, digest_md5, HMAC_MD5.digestSize) == 0) Index: tests/OFHTTPClientTests.m ================================================================== --- tests/OFHTTPClientTests.m +++ tests/OFHTTPClientTests.m @@ -41,12 +41,11 @@ char buffer[5]; [cond lock]; listener = [OFTCPSocket socket]; - _port = [listener bindToHost: @"127.0.0.1" - port: 0]; + _port = [listener bindToHost: @"127.0.0.1" port: 0]; [listener listen]; [cond signal]; [cond unlock]; @@ -70,12 +69,11 @@ OF_ENSURE(0); if (![[client readLine] isEqual: @""]) OF_ENSURE(0); - [client readIntoBuffer: buffer - exactLength: 5]; + [client readIntoBuffer: buffer exactLength: 5]; if (memcmp(buffer, "Hello", 5) != 0) OF_ENSURE(0); [client writeString: @"HTTP/1.0 200 OK\r\n" @"cONTeNT-lENgTH: 7\r\n" Index: tests/OFHTTPCookieManagerTests.m ================================================================== --- tests/OFHTTPCookieManagerTests.m +++ tests/OFHTTPCookieManagerTests.m @@ -43,12 +43,12 @@ [OFArray arrayWithObject: cookie[0]]]) cookie[1] = [OFHTTPCookie cookieWithName: @"test" value: @"2" domain: @"webkeks.org"]; - TEST(@"-[addCookie:forURL:] #2", R([manager addCookie: cookie[1] - forURL: URL[0]])) + TEST(@"-[addCookie:forURL:] #2", + R([manager addCookie: cookie[1] forURL: URL[0]])) TEST(@"-[cookiesForURL:] #2", [[manager cookiesForURL: URL[0]] isEqual: [OFArray arrayWithObject: cookie[0]]] && [[manager cookiesForURL: URL[3]] isEqual: [OFArray array]]) @@ -55,12 +55,12 @@ cookie[2] = [OFHTTPCookie cookieWithName: @"test" value: @"3" domain: @"nil.im"]; cookie[2].secure = true; - TEST(@"-[addCookie:forURL:] #3", R([manager addCookie: cookie[2] - forURL: URL[1]])) + TEST(@"-[addCookie:forURL:] #3", + R([manager addCookie: cookie[2] forURL: URL[1]])) TEST(@"-[cookiesForURL:] #3", [[manager cookiesForURL: URL[1]] isEqual: [OFArray arrayWithObject: cookie[2]]] && [[manager cookiesForURL: URL[0]] isEqual: [OFArray array]]) @@ -68,12 +68,12 @@ cookie[2].expires = [OFDate dateWithTimeIntervalSinceNow: -1]; cookie[3] = [OFHTTPCookie cookieWithName: @"test" value: @"4" domain: @"nil.im"]; cookie[3].domain = @".nil.im"; - TEST(@"-[addCookie:forURL:] #4", R([manager addCookie: cookie[3] - forURL: URL[1]])) + TEST(@"-[addCookie:forURL:] #4", + R([manager addCookie: cookie[3] forURL: URL[1]])) TEST(@"-[cookiesForURL:] #4", [[manager cookiesForURL: URL[1]] isEqual: [OFArray arrayWithObject: cookie[3]]] && [[manager cookiesForURL: URL[2]] isEqual: @@ -80,12 +80,12 @@ [OFArray arrayWithObject: cookie[3]]]) cookie[4] = [OFHTTPCookie cookieWithName: @"bar" value: @"5" domain: @"test.nil.im"]; - TEST(@"-[addCookie:forURL:] #5", R([manager addCookie: cookie[4] - forURL: URL[0]])) + TEST(@"-[addCookie:forURL:] #5", + R([manager addCookie: cookie[4] forURL: URL[0]])) TEST(@"-[cookiesForURL:] #5", [[manager cookiesForURL: URL[0]] isEqual: [OFArray arrayWithObject: cookie[3]]] && [[manager cookiesForURL: URL[2]] isEqual: Index: tests/OFINIFileTests.m ================================================================== --- tests/OFINIFileTests.m +++ tests/OFINIFileTests.m @@ -83,18 +83,18 @@ TEST(@"-[setBool:forKey:]", R([types setBool: false forKey: @"bool"])) TEST(@"-[floatForKey:defaultValue:]", [types floatForKey: @"float" defaultValue: 1] == 0.5f) - TEST(@"-[setFloat:forKey:]", R([types setFloat: 0.25f - forKey: @"float"])) + TEST(@"-[setFloat:forKey:]", + R([types setFloat: 0.25f forKey: @"float"])) TEST(@"-[doubleForKey:defaultValue:]", [types doubleForKey: @"double" defaultValue: 3] == 0.25) - TEST(@"-[setDouble:forKey:]", R([types setDouble: 0.75 - forKey: @"double"])) + TEST(@"-[setDouble:forKey:]", + R([types setDouble: 0.75 forKey: @"double"])) array = [OFArray arrayWithObjects: @"1", @"2", nil]; TEST(@"-[stringArrayForKey:]", [[types stringArrayForKey: @"array1"] isEqual: array] && [[types stringArrayForKey: @"array2"] isEqual: array] && Index: tests/OFIPXSocketTests.m ================================================================== --- tests/OFIPXSocketTests.m +++ tests/OFIPXSocketTests.m @@ -31,12 +31,11 @@ TEST(@"+[socket]", (sock = [OFIPXSocket socket])) @try { TEST(@"-[bindToPort:packetType:]", - R(address1 = [sock bindToPort: 0 - packetType: 0])) + R(address1 = [sock bindToPort: 0 packetType: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EAFNOSUPPORT: [of_stdout setForegroundColor: [OFColor lime]]; [of_stdout writeLine: @@ -56,21 +55,17 @@ objc_autoreleasePoolPop(pool); return; } TEST(@"-[sendBuffer:length:receiver:]", - R([sock sendBuffer: "Hello" - length: 5 - receiver: &address1])) + R([sock sendBuffer: "Hello" length: 5 receiver: &address1])) TEST(@"-[receiveIntoBuffer:length:sender:]", - [sock receiveIntoBuffer: buffer - length: 5 - sender: &address2] == 5 && + [sock receiveIntoBuffer: buffer length: 5 sender: &address2] == 5 && memcmp(buffer, "Hello", 5) == 0 && of_socket_address_equal(&address1, &address2) && of_socket_address_hash(&address1) == of_socket_address_hash(&address2)) objc_autoreleasePoolPop(pool); } @end Index: tests/OFInvocationTests.m ================================================================== --- tests/OFInvocationTests.m +++ tests/OFInvocationTests.m @@ -281,66 +281,57 @@ TEST(@"-[getReturnValue]", R([invocation getReturnValue: &st2]) && memcmp(&st, &st2, sizeof(st)) == 0) memset(&st2, '\0', sizeof(st2)); - TEST(@"-[setArgument:atIndex:] #1", R([invocation setArgument: &c - atIndex: 2])) - - TEST(@"-[setArgument:atIndex:] #2", R([invocation setArgument: &i - atIndex: 3])) - - TEST(@"-[setArgument:atIndex:] #3", R([invocation setArgument: &stp - atIndex: 4])) - - TEST(@"-[setArgument:atIndex:] #4", R([invocation setArgument: &st - atIndex: 5])) - - TEST(@"-[getArgument:atIndex:] #1", R([invocation getArgument: &c2 - atIndex: 2]) && - c == c2) - - TEST(@"-[getArgument:atIndex:] #2", R([invocation getArgument: &i2 - atIndex: 3]) && - i == i2) - - TEST(@"-[getArgument:atIndex:] #3", R([invocation getArgument: &stp2 - atIndex: 4]) && - stp == stp2) - - TEST(@"-[getArgument:atIndex:] #4", R([invocation getArgument: &st2 - atIndex: 5]) && + TEST(@"-[setArgument:atIndex:] #1", + R([invocation setArgument: &c atIndex: 2])) + + TEST(@"-[setArgument:atIndex:] #2", + R([invocation setArgument: &i atIndex: 3])) + + TEST(@"-[setArgument:atIndex:] #3", + R([invocation setArgument: &stp atIndex: 4])) + + TEST(@"-[setArgument:atIndex:] #4", + R([invocation setArgument: &st atIndex: 5])) + + TEST(@"-[getArgument:atIndex:] #1", + R([invocation getArgument: &c2 atIndex: 2]) && c == c2) + + TEST(@"-[getArgument:atIndex:] #2", + R([invocation getArgument: &i2 atIndex: 3]) && i == i2) + + TEST(@"-[getArgument:atIndex:] #3", + R([invocation getArgument: &stp2 atIndex: 4]) && stp == stp2) + + TEST(@"-[getArgument:atIndex:] #4", + R([invocation getArgument: &st2 atIndex: 5]) && memcmp(&st, &st2, sizeof(st)) == 0) #ifdef OF_INVOCATION_CAN_INVOKE /* -[invoke] #1 */ selector = @selector(invocationTestMethod2:); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; - [invocation setArgument: &self - atIndex: 0]; - [invocation setArgument: &selector - atIndex: 1]; - [invocation setArgument: &self - atIndex: 2]; + [invocation setArgument: &self atIndex: 0]; + [invocation setArgument: &selector atIndex: 1]; + [invocation setArgument: &self atIndex: 2]; TEST(@"-[invoke] #1", R([invocation invoke])) /* -[invoke] #2 */ selector = @selector(invocationTestMethod3::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; - [invocation setArgument: &self - atIndex: 0]; - [invocation setArgument: &selector - atIndex: 1]; + [invocation setArgument: &self atIndex: 0]; + [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) - [invocation setArgument: &j - atIndex: j + 1]; + [invocation setArgument: &j atIndex: j + 1]; int intResult; TEST(@"-[invoke] #2", R([invocation invoke]) && R([invocation getReturnValue: &intResult]) && intResult == 8) @@ -347,19 +338,16 @@ /* -[invoke] #3 */ selector = @selector(invocationTestMethod4::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; - [invocation setArgument: &self - atIndex: 0]; - [invocation setArgument: &selector - atIndex: 1]; + [invocation setArgument: &self atIndex: 0]; + [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) { double d = j; - [invocation setArgument: &d - atIndex: j + 1]; + [invocation setArgument: &d atIndex: j + 1]; } double doubleResult; TEST(@"-[invoke] #3", R([invocation invoke]) && R([invocation getReturnValue: &doubleResult]) && @@ -368,25 +356,21 @@ /* -[invoke] #4 */ selector = @selector(invocationTestMethod5::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; - [invocation setArgument: &self - atIndex: 0]; - [invocation setArgument: &selector - atIndex: 1]; + [invocation setArgument: &self atIndex: 0]; + [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) { float f = j; double d = j; if (j == 1 || j == 10) - [invocation setArgument: &d - atIndex: j + 1]; + [invocation setArgument: &d atIndex: j + 1]; else - [invocation setArgument: &f - atIndex: j + 1]; + [invocation setArgument: &f atIndex: j + 1]; } float floatResult; TEST(@"-[invoke] #4", R([invocation invoke]) && R([invocation getReturnValue: &floatResult]) && floatResult == 8.5) @@ -396,19 +380,16 @@ /* -[invoke] #5 */ selector = @selector(invocationTestMethod6::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; - [invocation setArgument: &self - atIndex: 0]; - [invocation setArgument: &selector - atIndex: 1]; + [invocation setArgument: &self atIndex: 0]; + [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) { long double d = j; - [invocation setArgument: &d - atIndex: j + 1]; + [invocation setArgument: &d atIndex: j + 1]; } long double longDoubleResult; TEST(@"-[invoke] #5", R([invocation invoke]) && R([invocation getReturnValue: &longDoubleResult]) && @@ -419,25 +400,21 @@ /* -[invoke] #6 */ selector = @selector(invocationTestMethod7::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; - [invocation setArgument: &self - atIndex: 0]; - [invocation setArgument: &selector - atIndex: 1]; + [invocation setArgument: &self atIndex: 0]; + [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) { complex float cf = j + 0.5 * j * I; complex double cd = j + 0.5 * j * I; if (j & 1) - [invocation setArgument: &cf - atIndex: j + 1]; + [invocation setArgument: &cf atIndex: j + 1]; else - [invocation setArgument: &cd - atIndex: j + 1]; + [invocation setArgument: &cd atIndex: j + 1]; } complex double complexDoubleResult; TEST(@"-[invoke] #6", R([invocation invoke]) && R([invocation getReturnValue: &complexDoubleResult]) && @@ -449,32 +426,27 @@ /* -[invoke] #7 */ selector = @selector(invocationTestMethod8::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; - [invocation setArgument: &self - atIndex: 0]; - [invocation setArgument: &selector - atIndex: 1]; + [invocation setArgument: &self atIndex: 0]; + [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) { complex double cd = j + 0.5 * j * I; complex float cf = j + 0.5 * j * I; complex long double cld = j + 0.5 * j * I; switch (j % 3) { case 0: - [invocation setArgument: &cld - atIndex: j + 1]; + [invocation setArgument: &cld atIndex: j + 1]; break; case 1: - [invocation setArgument: &cd - atIndex: j + 1]; + [invocation setArgument: &cd atIndex: j + 1]; break; case 2: - [invocation setArgument: &cf - atIndex: j + 1]; + [invocation setArgument: &cf atIndex: j + 1]; break; } } complex long double complexLongDoubleResult; @@ -488,26 +460,22 @@ /* -[invoke] #8 */ selector = @selector(invocationTestMethod9::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; - [invocation setArgument: &self - atIndex: 0]; - [invocation setArgument: &selector - atIndex: 1]; + [invocation setArgument: &self atIndex: 0]; + [invocation setArgument: &selector atIndex: 1]; for (int j = 1; j <= 16; j++) { __extension__ __int128 i128 = 0xFFFFFFFFFFFFFFFF; i128 <<= 64; i128 |= j; if (j == 1 || j == 5) - [invocation setArgument: &j - atIndex: j + 1]; + [invocation setArgument: &j atIndex: j + 1]; else - [invocation setArgument: &i128 - atIndex: j + 1]; + [invocation setArgument: &i128 atIndex: j + 1]; } __extension__ __int128 int128Result; TEST(@"-[invoke] #8", R([invocation invoke]) && R([invocation getReturnValue: &int128Result]) && Index: tests/OFKernelEventObserverTests.m ================================================================== --- tests/OFKernelEventObserverTests.m +++ tests/OFKernelEventObserverTests.m @@ -56,20 +56,16 @@ uint16_t port; _testsAppDelegate = testsAppDelegate; _server = [[OFTCPSocket alloc] init]; - port = [_server bindToHost: @"127.0.0.1" - port: 0]; + port = [_server bindToHost: @"127.0.0.1" port: 0]; [_server listen]; _client = [[OFTCPSocket alloc] init]; - [_client connectToHost: @"127.0.0.1" - port: port]; - - [_client writeBuffer: "0" - length: 1]; + [_client connectToHost: @"127.0.0.1" port: port]; + [_client writeBuffer: "0" length: 1]; } @catch (id e) { [self release]; @throw e; } @@ -151,12 +147,11 @@ inModule: module]; break; case 1: if (object == _accepted && - [object readIntoBuffer: &buf - length: 1] == 1 && buf == '0') + [object readIntoBuffer: &buf length: 1] == 1 && buf == '0') [_testsAppDelegate outputSuccess: @"-[observe] with data ready to read" inModule: module]; else { [_testsAppDelegate @@ -172,12 +167,11 @@ inModule: module]; break; case 2: if (object == _accepted && - [object readIntoBuffer: &buf - length: 1] == 0) + [object readIntoBuffer: &buf length: 1] == 0) [_testsAppDelegate outputSuccess: @"-[observe] with closed connection" inModule: module]; else { [_testsAppDelegate Index: tests/OFMD5HashTests.m ================================================================== --- tests/OFMD5HashTests.m +++ tests/OFMD5HashTests.m @@ -27,22 +27,19 @@ @implementation TestsAppDelegate (OFMD5HashTests) - (void)MD5HashTests { void *pool = objc_autoreleasePoolPush(); OFMD5Hash *md5, *copy; - OFFile *f = [OFFile fileWithPath: @"testfile.bin" - mode: @"r"]; + OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHashWithAllowsSwappableMemory:]", (md5 = [OFMD5Hash cryptoHashWithAllowsSwappableMemory: true])) while (!f.atEndOfStream) { char buf[64]; - size_t len = [f readIntoBuffer: buf - length: 64]; - [md5 updateWithBuffer: buf - length: len]; + size_t len = [f readIntoBuffer: buf length: 64]; + [md5 updateWithBuffer: buf length: len]; } [f close]; TEST(@"-[copy]", (copy = [[md5 copy] autorelease])) @@ -50,11 +47,10 @@ memcmp(md5.digest, testfile_md5, 16) == 0 && memcmp(copy.digest, testfile_md5, 16) == 0) EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length]", OFHashAlreadyCalculatedException, - [md5 updateWithBuffer: "" - length: 1]) + [md5 updateWithBuffer: "" length: 1]) objc_autoreleasePoolPop(pool); } @end Index: tests/OFObjectTests.m ================================================================== --- tests/OFObjectTests.m +++ tests/OFObjectTests.m @@ -108,20 +108,17 @@ EXPECT_EXCEPTION(@"-[valueForKey:] with undefined key", OFUndefinedKeyException, [m valueForKey: @"undefined"]) TEST(@"-[setValue:forKey:]", - R([m setValue: @"World" - forKey: @"objectValue"]) && - R([m setValue: [OFObject class] - forKey: @"classValue"]) && + R([m setValue: @"World" forKey: @"objectValue"]) && + R([m setValue: [OFObject class] forKey: @"classValue"]) && [m.objectValue isEqual: @"World"] && [m.classValue isEqual: [OFObject class]]) EXPECT_EXCEPTION(@"-[setValue:forKey:] with undefined key", - OFUndefinedKeyException, [m setValue: @"x" - forKey: @"undefined"]) + OFUndefinedKeyException, [m setValue: @"x" forKey: @"undefined"]) m.boolValue = 1; m.charValue = 2; m.shortValue = 3; m.intValue = 4; Index: tests/OFPropertyListTests.m ================================================================== --- tests/OFPropertyListTests.m +++ tests/OFPropertyListTests.m @@ -57,12 +57,11 @@ - (void)propertyListTests { void *pool = objc_autoreleasePoolPush(); OFArray *array = [OFArray arrayWithObjects: @"Hello", - [OFData dataWithItems: "World!" - count: 6], + [OFData dataWithItems: "World!" count: 6], [OFDate dateWithTimeIntervalSince1970: 1521030896], [OFNumber numberWithBool: true], [OFNumber numberWithBool: false], [OFNumber numberWithFloat: 12.25f], [OFNumber numberWithInt: -10], Index: tests/OFRIPEMD160HashTests.m ================================================================== --- tests/OFRIPEMD160HashTests.m +++ tests/OFRIPEMD160HashTests.m @@ -28,23 +28,20 @@ @implementation TestsAppDelegate (OFRIPEMD160HashTests) - (void)RIPEMD160HashTests { void *pool = objc_autoreleasePoolPush(); OFRIPEMD160Hash *rmd160, *copy; - OFFile *f = [OFFile fileWithPath: @"testfile.bin" - mode: @"r"]; + OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHashWithAllowsSwappableMemory:]", (rmd160 = [OFRIPEMD160Hash cryptoHashWithAllowsSwappableMemory: true])) while (!f.atEndOfStream) { char buf[64]; - size_t len = [f readIntoBuffer: buf - length: 64]; - [rmd160 updateWithBuffer: buf - length: len]; + size_t len = [f readIntoBuffer: buf length: 64]; + [rmd160 updateWithBuffer: buf length: len]; } [f close]; TEST(@"-[copy]", (copy = [[rmd160 copy] autorelease])) @@ -52,11 +49,10 @@ memcmp(rmd160.digest, testfile_rmd160, 20) == 0 && memcmp(copy.digest, testfile_rmd160, 20) == 0) EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length]", OFHashAlreadyCalculatedException, - [rmd160 updateWithBuffer: "" - length: 1]) + [rmd160 updateWithBuffer: "" length: 1]) objc_autoreleasePoolPop(pool); } @end Index: tests/OFSCTPSocketTests.m ================================================================== --- tests/OFSCTPSocketTests.m +++ tests/OFSCTPSocketTests.m @@ -33,12 +33,11 @@ TEST(@"+[socket]", (server = [OFSCTPSocket socket]) && (client = [OFSCTPSocket socket])) @try { TEST(@"-[bindToHost:port:]", - (port = [server bindToHost: @"127.0.0.1" - port: 0])) + (port = [server bindToHost: @"127.0.0.1" port: 0])) } @catch (OFBindFailedException *e) { switch (e.errNo) { case EPROTONOSUPPORT: [of_stdout setForegroundColor: [OFColor lime]]; [of_stdout writeLine: @@ -54,24 +53,23 @@ } TEST(@"-[listen]", R([server listen])) TEST(@"-[connectToHost:port:]", - R([client connectToHost: @"127.0.0.1" - port: port])) + R([client connectToHost: @"127.0.0.1" port: port])) TEST(@"-[accept]", (accepted = [server accept])) TEST(@"-[remoteAddress]", [of_socket_address_ip_string(accepted.remoteAddress, NULL) isEqual: @"127.0.0.1"]) - TEST(@"-[sendBuffer:length:]", R([client sendBuffer: "Hello!" - length: 6])) + TEST(@"-[sendBuffer:length:]", + R([client sendBuffer: "Hello!" length: 6])) - TEST(@"-[receiveIntoBuffer:length:]", [accepted receiveIntoBuffer: buf - length: 6] && + TEST(@"-[receiveIntoBuffer:length:]", + [accepted receiveIntoBuffer: buf length: 6] && !memcmp(buf, "Hello!", 6)) objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA1HashTests.m ================================================================== --- tests/OFSHA1HashTests.m +++ tests/OFSHA1HashTests.m @@ -28,22 +28,19 @@ @implementation TestsAppDelegate (SHA1HashTests) - (void)SHA1HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA1Hash *sha1, *copy; - OFFile *f = [OFFile fileWithPath: @"testfile.bin" - mode: @"r"]; + OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHashWithAllowsSwappableMemory:]", (sha1 = [OFSHA1Hash cryptoHashWithAllowsSwappableMemory: true])) while (!f.atEndOfStream) { char buf[64]; - size_t len = [f readIntoBuffer: buf - length: 64]; - [sha1 updateWithBuffer: buf - length: len]; + size_t len = [f readIntoBuffer: buf length: 64]; + [sha1 updateWithBuffer: buf length: len]; } [f close]; TEST(@"-[copy]", (copy = [[sha1 copy] autorelease])) @@ -51,11 +48,10 @@ memcmp(sha1.digest, testfile_sha1, 20) == 0 && memcmp(copy.digest, testfile_sha1, 20) == 0) EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, - [sha1 updateWithBuffer: "" - length: 1]) + [sha1 updateWithBuffer: "" length: 1]) objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA224HashTests.m ================================================================== --- tests/OFSHA224HashTests.m +++ tests/OFSHA224HashTests.m @@ -28,22 +28,19 @@ @implementation TestsAppDelegate (SHA224HashTests) - (void)SHA224HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA224Hash *sha224, *copy; - OFFile *f = [OFFile fileWithPath: @"testfile.bin" - mode: @"r"]; + OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHashWithAllowsSwappableMemory:]", (sha224 = [OFSHA224Hash cryptoHashWithAllowsSwappableMemory: true])) while (!f.atEndOfStream) { char buf[64]; - size_t len = [f readIntoBuffer: buf - length: 64]; - [sha224 updateWithBuffer: buf - length: len]; + size_t len = [f readIntoBuffer: buf length: 64]; + [sha224 updateWithBuffer: buf length: len]; } [f close]; TEST(@"-[copy]", (copy = [[sha224 copy] autorelease])) @@ -51,11 +48,10 @@ memcmp(sha224.digest, testfile_sha224, 28) == 0 && memcmp(copy.digest, testfile_sha224, 28) == 0) EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, - [sha224 updateWithBuffer: "" - length: 1]) + [sha224 updateWithBuffer: "" length: 1]) objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA256HashTests.m ================================================================== --- tests/OFSHA256HashTests.m +++ tests/OFSHA256HashTests.m @@ -28,22 +28,19 @@ @implementation TestsAppDelegate (SHA256HashTests) - (void)SHA256HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA256Hash *sha256, *copy; - OFFile *f = [OFFile fileWithPath: @"testfile.bin" - mode: @"r"]; + OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHashWithAllowsSwappableMemory:]", (sha256 = [OFSHA256Hash cryptoHashWithAllowsSwappableMemory: true])) while (!f.atEndOfStream) { char buf[64]; - size_t len = [f readIntoBuffer: buf - length: 64]; - [sha256 updateWithBuffer: buf - length: len]; + size_t len = [f readIntoBuffer: buf length: 64]; + [sha256 updateWithBuffer: buf length: len]; } [f close]; TEST(@"-[copy]", (copy = [[sha256 copy] autorelease])) @@ -51,11 +48,10 @@ memcmp(sha256.digest, testfile_sha256, 32) == 0 && memcmp(copy.digest, testfile_sha256, 32) == 0) EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, - [sha256 updateWithBuffer: "" - length: 1]) + [sha256 updateWithBuffer: "" length: 1]) objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA384HashTests.m ================================================================== --- tests/OFSHA384HashTests.m +++ tests/OFSHA384HashTests.m @@ -29,22 +29,19 @@ @implementation TestsAppDelegate (SHA384HashTests) - (void)SHA384HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA384Hash *sha384, *copy; - OFFile *f = [OFFile fileWithPath: @"testfile.bin" - mode: @"r"]; + OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHashWithAllowsSwappableMemory:]", (sha384 = [OFSHA384Hash cryptoHashWithAllowsSwappableMemory: true])) while (!f.atEndOfStream) { char buf[128]; - size_t len = [f readIntoBuffer: buf - length: 128]; - [sha384 updateWithBuffer: buf - length: len]; + size_t len = [f readIntoBuffer: buf length: 128]; + [sha384 updateWithBuffer: buf length: len]; } [f close]; TEST(@"-[copy]", (copy = [[sha384 copy] autorelease])) @@ -52,11 +49,10 @@ memcmp(sha384.digest, testfile_sha384, 48) == 0 && memcmp(copy.digest, testfile_sha384, 48) == 0) EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, - [sha384 updateWithBuffer: "" - length: 1]) + [sha384 updateWithBuffer: "" length: 1]) objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA512HashTests.m ================================================================== --- tests/OFSHA512HashTests.m +++ tests/OFSHA512HashTests.m @@ -30,22 +30,19 @@ @implementation TestsAppDelegate (SHA512HashTests) - (void)SHA512HashTests { void *pool = objc_autoreleasePoolPush(); OFSHA512Hash *sha512, *copy; - OFFile *f = [OFFile fileWithPath: @"testfile.bin" - mode: @"r"]; + OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHashWithAllowsSwappableMemory:]", (sha512 = [OFSHA512Hash cryptoHashWithAllowsSwappableMemory: true])) while (!f.atEndOfStream) { char buf[128]; - size_t len = [f readIntoBuffer: buf - length: 128]; - [sha512 updateWithBuffer: buf - length: len]; + size_t len = [f readIntoBuffer: buf length: 128]; + [sha512 updateWithBuffer: buf length: len]; } [f close]; TEST(@"-[copy]", (copy = [[sha512 copy] autorelease])) @@ -53,11 +50,10 @@ memcmp(sha512.digest, testfile_sha512, 64) == 0 && memcmp(copy.digest, testfile_sha512, 64) == 0) EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, - [sha512 updateWithBuffer: "" - length: 1]) + [sha512 updateWithBuffer: "" length: 1]) objc_autoreleasePoolPop(pool); } @end Index: tests/OFSPXSocketTests.m ================================================================== --- tests/OFSPXSocketTests.m +++ tests/OFSPXSocketTests.m @@ -120,23 +120,19 @@ port = of_socket_address_get_port(&address1); TEST(@"-[listen]", R([sockServer listen])) TEST(@"-[connectToNode:network:port:]", - R([sockClient connectToNode: node - network: network - port: port])) + R([sockClient connectToNode: node network: network port: port])) TEST(@"-[accept]", (sockAccepted = [sockServer accept])) TEST(@"-[sendBuffer:length:]", - R([sockAccepted sendBuffer: "Hello" - length: 5])) + R([sockAccepted sendBuffer: "Hello" length: 5])) TEST(@"-[receiveIntoBuffer:length:]", - [sockClient receiveIntoBuffer: buffer - length: 5] == 5 && + [sockClient receiveIntoBuffer: buffer length: 5] == 5 && memcmp(buffer, "Hello", 5) == 0) TEST(@"-[remoteAddress]", (address2 = sockAccepted.remoteAddress) && R(of_socket_address_get_ipx_node(address2, node2)) && Index: tests/OFSPXStreamSocketTests.m ================================================================== --- tests/OFSPXStreamSocketTests.m +++ tests/OFSPXStreamSocketTests.m @@ -120,27 +120,22 @@ port = of_socket_address_get_port(&address1); TEST(@"-[listen]", R([sockServer listen])) TEST(@"-[connectToNode:network:port:]", - R([sockClient connectToNode: node - network: network - port: port])) + R([sockClient connectToNode: node network: network port: port])) TEST(@"-[accept]", (sockAccepted = [sockServer accept])) /* Test reassembly (this would not work with OFSPXSocket) */ TEST(@"-[writeBuffer:length:]", - R([sockAccepted writeBuffer: "Hello" - length: 5])) + R([sockAccepted writeBuffer: "Hello" length: 5])) TEST(@"-[readIntoBuffer:length:]", - [sockClient readIntoBuffer: buffer - length: 2] == 2 && + [sockClient readIntoBuffer: buffer length: 2] == 2 && memcmp(buffer, "He", 2) == 0 && - [sockClient readIntoBuffer: buffer - length: 3] == 3 && + [sockClient readIntoBuffer: buffer length: 3] == 3 && memcmp(buffer, "llo", 3) == 0) TEST(@"-[remoteAddress]", (address2 = sockAccepted.remoteAddress) && R(of_socket_address_get_ipx_node(address2, node2)) && Index: tests/OFSerializationTests.m ================================================================== --- tests/OFSerializationTests.m +++ tests/OFSerializationTests.m @@ -33,14 +33,12 @@ [a addObject: [OFNumber numberWithInt: 1234]]; [a addObject: [OFNumber numberWithDouble: 1234.5678]]; [a addObject: [OFMutableString stringWithString: @"asd"]]; [a addObject: [OFDate dateWithTimeIntervalSince1970: 1234.5678]]; - [d setObject: @"Hello" - forKey: a]; - [d setObject: @"B\"la" - forKey: @"Blub"]; + [d setObject: @"Hello" forKey: a]; + [d setObject: @"B\"la" forKey: @"Blub"]; [l appendObject: @"Hello"]; [l appendObject: @"Wo\rld!\nHow are you?"]; [l appendObject: [OFURL URLWithString: @"https://objfw.nil.im/"]]; [l appendObject: @@ -47,17 +45,15 @@ [OFXMLElement elementWithXMLString: @""]]; [l appendObject: [OFSet setWithObjects: @"foo", @"foo", @"bar", nil]]; [l appendObject: [OFCountedSet setWithObjects: @"foo", @"foo", @"bar", nil]]; - [d setObject: @"list" - forKey: l]; + [d setObject: @"list" forKey: l]; data = [OFData dataWithItems: "0123456789:; 1); } -- (size_t)lowlevelReadIntoBuffer: (void *)buffer - length: (size_t)size +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)size { size_t pageSize = [OFSystemInfo pageSize]; switch (state) { case 0: Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -188,12 +188,11 @@ } - (void)replaceCharactersInRange: (of_range_t)range withString: (OFString *)string { - [_string replaceCharactersInRange: range - withString: string]; + [_string replaceCharactersInRange: range withString: string]; } @end @interface EntityHandler: OFObject @end @@ -273,18 +272,19 @@ TEST(@"-[appendString:] and -[appendUTF8String:]", R([s[1] appendUTF8String: "1𝄞"]) && R([s[1] appendString: @"3"]) && R([s[0] appendString: s[1]]) && [s[0] isEqual: @"täs€1𝄞3"]) TEST(@"-[appendCharacters:length:]", - R([s[1] appendCharacters: ucstr + 6 - length: 2]) && [s[1] isEqual: @"1𝄞3r🀺"]) + R([s[1] appendCharacters: ucstr + 6 length: 2]) && + [s[1] isEqual: @"1𝄞3r🀺"]) TEST(@"-[length]", s[0].length == 7) TEST(@"-[UTF8StringLength]", s[0].UTF8StringLength == 13) TEST(@"-[hash]", s[0].hash == 0x705583C0) - TEST(@"-[characterAtIndex:]", [s[0] characterAtIndex: 0] == 't' && + TEST(@"-[characterAtIndex:]", + [s[0] characterAtIndex: 0] == 't' && [s[0] characterAtIndex: 1] == 0xE4 && [s[0] characterAtIndex: 3] == 0x20AC && [s[0] characterAtIndex: 5] == 0x1D11E) EXPECT_EXCEPTION(@"Detect out of range in -[characterAtIndex:]", @@ -358,12 +358,12 @@ encoding: OF_STRING_ENCODING_ISO_8859_1]) && [is isEqual: @"testäöü"]) #endif TEST(@"-[appendUTFString:length:]", - R([s[0] appendUTF8String: "\xEF\xBB\xBF" "barqux" - length: 6]) && [s[0] isEqual: @"foobar"]) + R([s[0] appendUTF8String: "\xEF\xBB\xBF" "barqux" length: 6]) && + [s[0] isEqual: @"foobar"]) EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #1", OFInvalidEncodingException, [stringClass stringWithUTF8String: "\xE0\x80"]) EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #2", @@ -498,13 +498,11 @@ options: OF_STRING_SEARCH_BACKWARDS].location == OF_NOT_FOUND) EXPECT_EXCEPTION( @"Detect out of range in -[rangeOfString:options:range:]", OFOutOfRangeException, - [C(@"𝄞öö") rangeOfString: @"ö" - options: 0 - range: of_range(3, 1)]) + [C(@"𝄞öö") rangeOfString: @"ö" options: 0 range: of_range(3, 1)]) cs = [OFCharacterSet characterSetWithCharactersInString: @"cđ"]; TEST(@"-[indexOfCharacterFromSet:]", [C(@"abcđabcđe") indexOfCharacterFromSet: cs] == 2 && [C(@"abcđabcđë") @@ -1244,12 +1242,11 @@ [C(@"foo%20bar%22+%24%F0%9F%8D%8C").stringByURLDecoding isEqual: @"foo bar\"+$🍌"]) TEST(@"-[insertString:atIndex:]", (s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && - R([s[0] insertString: @"äöü" - atIndex: 3]) && + R([s[0] insertString: @"äöü" atIndex: 3]) && [s[0] isEqual: @"𝄞ööäöüöbä€"]) EXPECT_EXCEPTION(@"Detect invalid format in -[stringByURLDecoding] " @"#1", OFInvalidFormatException, [C(@"foo%xbar") stringByURLDecoding]) @@ -1257,22 +1254,17 @@ @"#2", OFInvalidEncodingException, [C(@"foo%FFbar") stringByURLDecoding]) TEST(@"-[setCharacter:atIndex:]", (s[0] = [mutableStringClass stringWithString: @"abäde"]) && - R([s[0] setCharacter: 0xF6 - atIndex: 2]) && + R([s[0] setCharacter: 0xF6 atIndex: 2]) && [s[0] isEqual: @"aböde"] && - R([s[0] setCharacter: 'c' - atIndex: 2]) && + R([s[0] setCharacter: 'c' atIndex: 2]) && [s[0] isEqual: @"abcde"] && - R([s[0] setCharacter: 0x20AC - atIndex: 3]) && + R([s[0] setCharacter: 0x20AC atIndex: 3]) && [s[0] isEqual: @"abc€e"] && - R([s[0] setCharacter: 'x' - atIndex: 1]) && - [s[0] isEqual: @"axc€e"]) + R([s[0] setCharacter: 'x' atIndex: 1]) && [s[0] isEqual: @"axc€e"]) TEST(@"-[deleteCharactersInRange:]", (s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && R([s[0] deleteCharactersInRange: of_range(1, 3)]) && [s[0] isEqual: @"𝄞bä€"] && @@ -1303,28 +1295,24 @@ [s[0] deleteCharactersInRange: of_range(4, 0)]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #1", OFOutOfRangeException, - [s[0] replaceCharactersInRange: of_range(2, 2) - withString: @""]) + [s[0] replaceCharactersInRange: of_range(2, 2) withString: @""]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #2", OFOutOfRangeException, - [s[0] replaceCharactersInRange: of_range(4, 0) - withString: @""]) + [s[0] replaceCharactersInRange: of_range(4, 0) withString: @""]) TEST(@"-[replaceOccurrencesOfString:withString:]", (s[0] = [mutableStringClass stringWithString: @"asd fo asd fofo asd"]) && - R([s[0] replaceOccurrencesOfString: @"fo" - withString: @"foo"]) && + R([s[0] replaceOccurrencesOfString: @"fo" withString: @"foo"]) && [s[0] isEqual: @"asd foo asd foofoo asd"] && (s[0] = [mutableStringClass stringWithString: @"XX"]) && - R([s[0] replaceOccurrencesOfString: @"X" - withString: @"XX"]) && + R([s[0] replaceOccurrencesOfString: @"X" withString: @"XX"]) && [s[0] isEqual: @"XXXX"]) TEST(@"-[replaceOccurrencesOfString:withString:options:range:]", (s[0] = [mutableStringClass stringWithString: @"foofoobarfoobarfoo"]) && Index: tests/OFTCPSocketTests.m ================================================================== --- tests/OFTCPSocketTests.m +++ tests/OFTCPSocketTests.m @@ -31,29 +31,27 @@ TEST(@"+[socket]", (server = [OFTCPSocket socket]) && (client = [OFTCPSocket socket])) TEST(@"-[bindToHost:port:]", - (port = [server bindToHost: @"127.0.0.1" - port: 0])) + (port = [server bindToHost: @"127.0.0.1" port: 0])) TEST(@"-[listen]", R([server listen])) TEST(@"-[connectToHost:port:]", - R([client connectToHost: @"127.0.0.1" - port: port])) + R([client connectToHost: @"127.0.0.1" port: port])) TEST(@"-[accept]", (accepted = [server accept])) TEST(@"-[remoteAddress]", [of_socket_address_ip_string(accepted.remoteAddress, NULL) isEqual: @"127.0.0.1"]) TEST(@"-[writeString:]", [client writeString: @"Hello!"]) - TEST(@"-[readIntoBuffer:length:]", [accepted readIntoBuffer: buf - length: 6] && + TEST(@"-[readIntoBuffer:length:]", + [accepted readIntoBuffer: buf length: 6] && !memcmp(buf, "Hello!", 6)) objc_autoreleasePoolPop(pool); } @end Index: tests/OFThreadTests.m ================================================================== --- tests/OFThreadTests.m +++ tests/OFThreadTests.m @@ -23,12 +23,11 @@ @end @implementation TestThread - (id)main { - [[OFThread threadDictionary] setObject: @"bar" - forKey: @"foo"]; + [[OFThread threadDictionary] setObject: @"bar" forKey: @"foo"]; return @"success"; } @end Index: tests/OFUDPSocketTests.m ================================================================== --- tests/OFUDPSocketTests.m +++ tests/OFUDPSocketTests.m @@ -32,24 +32,19 @@ OFString *host; TEST(@"+[socket]", (sock = [OFUDPSocket socket])) TEST(@"-[bindToHost:port:]", - (port1 = [sock bindToHost: @"127.0.0.1" - port: 0])) + (port1 = [sock bindToHost: @"127.0.0.1" port: 0])) addr1 = of_socket_address_parse_ip(@"127.0.0.1", port1); TEST(@"-[sendBuffer:length:receiver:]", - R([sock sendBuffer: "Hello" - length: 6 - receiver: &addr1])) + R([sock sendBuffer: "Hello" length: 6 receiver: &addr1])) TEST(@"-[receiveIntoBuffer:length:sender:]", - [sock receiveIntoBuffer: buf - length: 6 - sender: &addr2] == 6 && + [sock receiveIntoBuffer: buf length: 6 sender: &addr2] == 6 && !memcmp(buf, "Hello", 6) && (host = of_socket_address_ip_string(&addr2, &port2)) && [host isEqual: @"127.0.0.1"] && port2 == port1) addr3 = of_socket_address_parse_ip(@"127.0.0.1", port1 + 1); Index: tests/OFURLTests.m ================================================================== --- tests/OFURLTests.m +++ tests/OFURLTests.m @@ -68,12 +68,11 @@ EXPECT_EXCEPTION(@"+[URLWithString:] fails with invalid characters #8", OFInvalidFormatException, [OFURL URLWithString: @"https://[f]:f/"]) TEST(@"+[URLWithString:relativeToURL:]", - [[[OFURL URLWithString: @"/foo" - relativeToURL: u1] string] isEqual: + [[[OFURL URLWithString: @"/foo" relativeToURL: u1] string] isEqual: @"ht%3atp://us%3Aer:p%40w@ho%3Ast:1234/foo"] && [[[OFURL URLWithString: @"foo/bar?q" relativeToURL: [OFURL URLWithString: @"http://h/qux/quux"]] string] isEqual: @"http://h/qux/foo/bar?q"] && [[[OFURL URLWithString: @"foo/bar" @@ -89,30 +88,26 @@ string] isEqual: @"http://foo/foo"]) EXPECT_EXCEPTION( @"+[URLWithString:relativeToURL:] fails with invalid characters #1", OFInvalidFormatException, - [OFURL URLWithString: @"`" - relativeToURL: u1]) + [OFURL URLWithString: @"`" relativeToURL: u1]) EXPECT_EXCEPTION( @"+[URLWithString:relativeToURL:] fails with invalid characters #2", OFInvalidFormatException, - [OFURL URLWithString: @"/`" - relativeToURL: u1]) + [OFURL URLWithString: @"/`" relativeToURL: u1]) EXPECT_EXCEPTION( @"+[URLWithString:relativeToURL:] fails with invalid characters #3", OFInvalidFormatException, - [OFURL URLWithString: @"?`" - relativeToURL: u1]) + [OFURL URLWithString: @"?`" relativeToURL: u1]) EXPECT_EXCEPTION( @"+[URLWithString:relativeToURL:] fails with invalid characters #4", OFInvalidFormatException, - [OFURL URLWithString: @"#`" - relativeToURL: u1]) + [OFURL URLWithString: @"#`" relativeToURL: u1]) #ifdef OF_HAVE_FILES TEST(@"+[fileURLWithPath:]", [[[OFURL fileURLWithPath: @"testfile.txt"] fileSystemRepresentation] isEqual: [[OFFileManager defaultManager].currentDirectoryPath @@ -289,24 +284,20 @@ @"-[setURLEncodedFragment:] with invalid characters fails", OFInvalidFormatException, mu.URLEncodedFragment = @"`") TEST(@"-[URLByAppendingPathComponent:isDirectory:]", [[[OFURL URLWithString: @"file:///foo/bar"] - URLByAppendingPathComponent: @"qux" - isDirectory: false] isEqual: + URLByAppendingPathComponent: @"qux" isDirectory: false] isEqual: [OFURL URLWithString: @"file:///foo/bar/qux"]] && [[[OFURL URLWithString: @"file:///foo/bar/"] - URLByAppendingPathComponent: @"qux" - isDirectory: false] isEqual: + URLByAppendingPathComponent: @"qux" isDirectory: false] isEqual: [OFURL URLWithString: @"file:///foo/bar/qux"]] && [[[OFURL URLWithString: @"file:///foo/bar/"] - URLByAppendingPathComponent: @"qu?x" - isDirectory: false] isEqual: + URLByAppendingPathComponent: @"qu?x" isDirectory: false] isEqual: [OFURL URLWithString: @"file:///foo/bar/qu%3Fx"]] && [[[OFURL URLWithString: @"file:///foo/bar/"] - URLByAppendingPathComponent: @"qu?x" - isDirectory: true] isEqual: + URLByAppendingPathComponent: @"qu?x" isDirectory: true] isEqual: [OFURL URLWithString: @"file:///foo/bar/qu%3Fx/"]]) TEST(@"-[URLByStandardizingPath]", [[[OFURL URLWithString: @"http://foo/bar/.."] URLByStandardizingPath] isEqual: Index: tests/OFValueTests.m ================================================================== --- tests/OFValueTests.m +++ tests/OFValueTests.m @@ -38,18 +38,16 @@ objCType: @encode(of_range_t)])) TEST(@"-[objCType]", strcmp(value.objCType, @encode(of_range_t)) == 0) TEST(@"-[getValue:size:]", - R([value getValue: &range2 - size: sizeof(of_range_t)]) && + R([value getValue: &range2 size: sizeof(of_range_t)]) && of_range_equal(range2, range)) EXPECT_EXCEPTION(@"-[getValue:size:] with wrong size throws", OFOutOfRangeException, - [value getValue: &range - size: sizeof(of_range_t) - 1]) + [value getValue: &range size: sizeof(of_range_t) - 1]) TEST(@"+[valueWithPointer:]", (value = [OFValue valueWithPointer: pointer])) TEST(@"-[pointerValue]", @@ -84,12 +82,11 @@ objCType: @encode(of_range_t)]) && of_range_equal(value.rangeValue, range)) TEST(@"-[getValue:size:] for OFRangeValue", (value = [OFValue valueWithRange: range]) && - R([value getValue: &range2 - size: sizeof(range2)]) && + R([value getValue: &range2 size: sizeof(range2)]) && of_range_equal(range2, range)) EXPECT_EXCEPTION(@"-[rangeValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" @@ -104,12 +101,11 @@ objCType: @encode(of_point_t)]) && of_point_equal(value.pointValue, point)) TEST(@"-[getValue:size:] for OFPointValue", (value = [OFValue valueWithPoint: point]) && - R([value getValue: &point2 - size: sizeof(point2)]) && + R([value getValue: &point2 size: sizeof(point2)]) && of_point_equal(point2, point)) EXPECT_EXCEPTION(@"-[pointValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" @@ -124,12 +120,11 @@ objCType: @encode(of_dimension_t)]) && of_dimension_equal(value.dimensionValue, dimension)) TEST(@"-[getValue:size:] for OFDimensionValue", (value = [OFValue valueWithDimension: dimension]) && - R([value getValue: &dimension2 - size: sizeof(dimension2)]) && + R([value getValue: &dimension2 size: sizeof(dimension2)]) && of_dimension_equal(dimension2, dimension)) EXPECT_EXCEPTION(@"-[dimensionValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" @@ -144,12 +139,11 @@ objCType: @encode(of_rectangle_t)]) && of_rectangle_equal(value.rectangleValue, rectangle)) TEST(@"-[getValue:size:] for OFRectangleValue", (value = [OFValue valueWithRectangle: rectangle]) && - R([value getValue: &rectangle2 - size: sizeof(rectangle2)]) && + R([value getValue: &rectangle2 size: sizeof(rectangle2)]) && of_rectangle_equal(rectangle2, rectangle)) EXPECT_EXCEPTION(@"-[rectangleValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" @@ -157,17 +151,14 @@ TEST(@"-[isEqual:]", [[OFValue valueWithRectangle: rectangle] isEqual: [OFValue valueWithBytes: &rectangle objCType: @encode(of_rectangle_t)]] && - ![[OFValue valueWithBytes: "a" - objCType: @encode(signed char)] + ![[OFValue valueWithBytes: "a" objCType: @encode(signed char)] isEqual: [OFValue valueWithBytes: "a" objCType: @encode(unsigned char)]] && - ![[OFValue valueWithBytes: "a" - objCType: @encode(char)] - isEqual: [OFValue valueWithBytes: "b" - objCType: @encode(char)]]) + ![[OFValue valueWithBytes: "a" objCType: @encode(char)] + isEqual: [OFValue valueWithBytes: "b" objCType: @encode(char)]]) objc_autoreleasePoolPop(pool); } @end Index: tests/OFWindowsRegistryKeyTests.m ================================================================== --- tests/OFWindowsRegistryKeyTests.m +++ tests/OFWindowsRegistryKeyTests.m @@ -21,12 +21,11 @@ @implementation TestsAppDelegate (OFWindowsRegistryKeyTests) - (void)windowsRegistryKeyTests { void *pool = objc_autoreleasePoolPush(); - OFData *data = [OFData dataWithItems: "abcdef" - count: 6]; + OFData *data = [OFData dataWithItems: "abcdef" count: 6]; OFWindowsRegistryKey *softwareKey, *ObjFWKey; DWORD type; TEST(@"+[OFWindowsRegistryKey classesRootKey]", [OFWindowsRegistryKey classesRootKey]) @@ -54,30 +53,26 @@ TEST(@"-[createSubkeyAtPath:securityAndAccessRights:]", (ObjFWKey = [softwareKey createSubkeyAtPath: @"ObjFW" securityAndAccessRights: KEY_ALL_ACCESS])) TEST(@"-[setData:forValueNamed:type:]", - R([ObjFWKey setData: data - forValueNamed: @"data" - type: REG_BINARY])) + R([ObjFWKey setData: data forValueNamed: @"data" type: REG_BINARY])) TEST(@"-[dataForValueNamed:subkeyPath:flags:type:]", - [[ObjFWKey dataForValueNamed: @"data" - type: &type] isEqual: data] && + [[ObjFWKey dataForValueNamed: @"data" type: &type] isEqual: data] && type == REG_BINARY) TEST(@"-[setString:forValueNamed:type:]", - R([ObjFWKey setString: @"foobar" - forValueNamed: @"string"]) && + R([ObjFWKey setString: @"foobar" forValueNamed: @"string"]) && R([ObjFWKey setString: @"%PATH%;foo" forValueNamed: @"expand" type: REG_EXPAND_SZ])) TEST(@"-[stringForValue:subkeyPath:]", [[ObjFWKey stringForValueNamed: @"string"] isEqual: @"foobar"] && - [[ObjFWKey stringForValueNamed: @"expand" - type: &type] isEqual: @"%PATH%;foo"] && + [[ObjFWKey stringForValueNamed: @"expand" type: &type] + isEqual: @"%PATH%;foo"] && type == REG_EXPAND_SZ) TEST(@"-[deleteValueNamed:]", R([ObjFWKey deleteValueNamed: @"data"])) TEST(@"-[deleteSubkeyAtPath:]", Index: tests/OFXMLNodeTests.m ================================================================== --- tests/OFXMLNodeTests.m +++ tests/OFXMLNodeTests.m @@ -36,19 +36,17 @@ [[nodes[1] XMLString] isEqual: @"b&ar"]) TEST(@"+[elementWithName:namespace:]", (nodes[2] = [OFXMLElement elementWithName: @"foo" namespace: @"urn:objfw:test"]) && - R([nodes[2] addAttributeWithName: @"test" - stringValue: @"test"]) && + R([nodes[2] addAttributeWithName: @"test" stringValue: @"test"]) && R([nodes[2] setPrefix: @"objfw-test" forNamespace: @"urn:objfw:test"]) && [[nodes[2] XMLString] isEqual: @""] && (nodes[3] = [OFXMLElement elementWithName: @"foo" namespace: @"urn:objfw:test"]) && - R([nodes[3] addAttributeWithName: @"test" - stringValue: @"test"]) && + R([nodes[3] addAttributeWithName: @"test" stringValue: @"test"]) && [[nodes[3] XMLString] isEqual: @""]) TEST(@"+[elementWithName:namespace:stringValue:]", (nodes[3] = [OFXMLElement elementWithName: @"foo" @@ -72,15 +70,13 @@ [[nodes[3] XMLString] isEqual: @""]) module = @"OFXMLElement"; TEST(@"-[addAttributeWithName:stringValue:]", - R([nodes[0] addAttributeWithName: @"foo" - stringValue: @"b&ar"]) && + R([nodes[0] addAttributeWithName: @"foo" stringValue: @"b&ar"]) && [[nodes[0] XMLString] isEqual: @""] && - R([nodes[1] addAttributeWithName: @"foo" - stringValue: @"b&ar"]) && + R([nodes[1] addAttributeWithName: @"foo" stringValue: @"b&ar"]) && [[nodes[1] XMLString] isEqual: @"b&ar"]) TEST(@"-[setPrefix:forNamespace:]", R([nodes[1] setPrefix: @"objfw-test" Index: tests/OFXMLParserTests.m ================================================================== --- tests/OFXMLParserTests.m +++ tests/OFXMLParserTests.m @@ -271,12 +271,11 @@ namespace: ns attributes: nil string: nil]; } -- (void)parser: (OFXMLParser *)parser - foundCharacters: (OFString *)string +- (void)parser: (OFXMLParser *)parser foundCharacters: (OFString *)string { [self parser: parser didCreateEvent: STRING name: nil prefix: nil @@ -283,12 +282,11 @@ namespace: nil attributes: nil string: string]; } -- (void)parser: (OFXMLParser *)parser - foundCDATA: (OFString *)cdata +- (void)parser: (OFXMLParser *)parser foundCDATA: (OFString *)cdata { [self parser: parser didCreateEvent: CDATA name: nil prefix: nil @@ -295,12 +293,11 @@ namespace: nil attributes: nil string: cdata]; } -- (void)parser: (OFXMLParser *)parser - foundComment: (OFString *)comment +- (void)parser: (OFXMLParser *)parser foundComment: (OFString *)comment { [self parser: parser didCreateEvent: COMMENT name: nil prefix: nil @@ -349,15 +346,13 @@ for (j = 0; j < len; j+= 2) { if (parser.hasFinishedParsing) abort(); if (j + 2 > len) - [parser parseBuffer: str + j - length: 1]; + [parser parseBuffer: str + j length: 1]; else - [parser parseBuffer: str + j - length: 2]; + [parser parseBuffer: str + j length: 2]; } TEST(@"Checking if everything was parsed", i == 32 && parser.lineNumber == 18) Index: tests/TestsAppDelegate.h ================================================================== --- tests/TestsAppDelegate.h +++ tests/TestsAppDelegate.h @@ -13,45 +13,39 @@ * file. */ #import "ObjFW.h" -#define TEST(test, ...) \ - { \ - [self outputTesting: test \ - inModule: module]; \ - \ - if (__VA_ARGS__) \ - [self outputSuccess: test \ - inModule: module]; \ - else { \ - [self outputFailure: test \ - inModule: module]; \ - _fails++; \ - } \ - } -#define EXPECT_EXCEPTION(test, exception, code) \ - { \ - bool caught = false; \ - \ - [self outputTesting: test \ - inModule: module]; \ - \ - @try { \ - code; \ - } @catch (exception *e) { \ - caught = true; \ - } \ - \ - if (caught) \ - [self outputSuccess: test \ - inModule: module]; \ - else { \ - [self outputFailure: test \ - inModule: module]; \ - _fails++; \ - } \ +#define TEST(test, ...) \ + { \ + [self outputTesting: test inModule: module]; \ + \ + if (__VA_ARGS__) \ + [self outputSuccess: test inModule: module]; \ + else { \ + [self outputFailure: test inModule: module]; \ + _fails++; \ + } \ + } +#define EXPECT_EXCEPTION(test, exception, code) \ + { \ + bool caught = false; \ + \ + [self outputTesting: test inModule: module]; \ + \ + @try { \ + code; \ + } @catch (exception *e) { \ + caught = true; \ + } \ + \ + if (caught) \ + [self outputSuccess: test inModule: module]; \ + else { \ + [self outputFailure: test inModule: module]; \ + _fails++; \ + } \ } #define R(...) (__VA_ARGS__, 1) @class OFString; @@ -58,16 +52,13 @@ @interface TestsAppDelegate: OFObject { int _fails; } -- (void)outputTesting: (OFString *)test - inModule: (OFString *)module; -- (void)outputSuccess: (OFString *)test - inModule: (OFString *)module; -- (void)outputFailure: (OFString *)test - inModule: (OFString *)module; +- (void)outputTesting: (OFString *)test inModule: (OFString *)module; +- (void)outputSuccess: (OFString *)test inModule: (OFString *)module; +- (void)outputFailure: (OFString *)test inModule: (OFString *)module; @end @interface TestsAppDelegate (OFASN1DERParsingTests) - (void)ASN1DERParsingTests; @end Index: utils/ofarc/GZIPArchive.m ================================================================== --- utils/ofarc/GZIPArchive.m +++ utils/ofarc/GZIPArchive.m @@ -124,16 +124,14 @@ if (app->_outputLevel >= 0) [of_stdout writeString: OF_LOCALIZED(@"extracting_file", @"Extracting %[file]...", @"file", fileName)]; - if (![app shouldExtractFile: fileName - outFileName: fileName]) + if (![app shouldExtractFile: fileName outFileName: fileName]) return; - output = [OFFile fileWithPath: fileName - mode: @"w"]; + output = [OFFile fileWithPath: fileName mode: @"w"]; setPermissions(fileName, app->_archivePath); while (!_stream.atEndOfStream) { ssize_t length = [app copyBlockFromStream: _stream toStream: output Index: utils/ofarc/LHAArchive.m ================================================================== --- utils/ofarc/LHAArchive.m +++ utils/ofarc/LHAArchive.m @@ -326,17 +326,15 @@ directory = outFileName.stringByDeletingLastPathComponent; if (![fileManager directoryExistsAtPath: directory]) [fileManager createDirectoryAtPath: directory createParents: true]; - if (![app shouldExtractFile: fileName - outFileName: outFileName]) + if (![app shouldExtractFile: fileName outFileName: outFileName]) goto outer_loop_end; stream = [_archive streamForReadingCurrentEntry]; - output = [OFFile fileWithPath: outFileName - mode: @"w"]; + output = [OFFile fileWithPath: outFileName mode: @"w"]; setPermissions(outFileName, entry); while (!stream.atEndOfStream) { ssize_t length = [app copyBlockFromStream: stream toStream: output Index: utils/ofarc/OFArc.m ================================================================== --- utils/ofarc/OFArc.m +++ utils/ofarc/OFArc.m @@ -322,12 +322,11 @@ if (![remainingArguments.firstObject isEqual: @"-"]) [sandbox unveilPath: remainingArguments.firstObject permissions: (mode == 'a' ? @"rwc" : @"wc")]; for (OFString *path in files) - [sandbox unveilPath: path - permissions: @"r"]; + [sandbox unveilPath: path permissions: @"r"]; sandbox.allowsUnveil = false; [OFApplication activateSandbox: sandbox]; #endif @@ -396,18 +395,16 @@ [sandbox unveilPath: remainingArguments.firstObject permissions: @"r"]; if (files.count > 0) for (OFString *path in files) - [sandbox unveilPath: path - permissions: @"wc"]; + [sandbox unveilPath: path permissions: @"wc"]; else { OFString *path = (outputDir != nil ? outputDir : OF_PATH_CURRENT_DIRECTORY); /* We need 'r' to change the directory to it. */ - [sandbox unveilPath: path - permissions: @"rwc"]; + [sandbox unveilPath: path permissions: @"rwc"]; } sandbox.allowsUnveil = false; [OFApplication activateSandbox: sandbox]; #endif @@ -510,12 +507,11 @@ default: @throw [OFInvalidArgumentException exception]; } } else { @try { - file = [OFFile fileWithPath: path - mode: fileModeString]; + file = [OFFile fileWithPath: path mode: fileModeString]; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stderr writeString: @"\r"]; @@ -689,12 +685,11 @@ { char buffer[BUFFER_SIZE]; size_t length; @try { - length = [input readIntoBuffer: buffer - length: BUFFER_SIZE]; + length = [input readIntoBuffer: buffer length: BUFFER_SIZE]; } @catch (OFReadFailedException *e) { OFString *error = [OFString stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stdout writeString: @"\r"]; @@ -704,12 +699,11 @@ @"error", error)]; return -1; } @try { - [output writeBuffer: buffer - length: length]; + [output writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFString *error = [OFString stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; [of_stdout writeString: @"\r"]; Index: utils/ofarc/TarArchive.m ================================================================== --- utils/ofarc/TarArchive.m +++ utils/ofarc/TarArchive.m @@ -337,17 +337,15 @@ directory = outFileName.stringByDeletingLastPathComponent; if (![fileManager directoryExistsAtPath: directory]) [fileManager createDirectoryAtPath: directory createParents: true]; - if (![app shouldExtractFile: fileName - outFileName: outFileName]) + if (![app shouldExtractFile: fileName outFileName: outFileName]) goto outer_loop_end; stream = [_archive streamForReadingCurrentEntry]; - output = [OFFile fileWithPath: outFileName - mode: @"w"]; + output = [OFFile fileWithPath: outFileName mode: @"w"]; setPermissions(outFileName, entry); while (!stream.atEndOfStream) { ssize_t length = [app copyBlockFromStream: stream toStream: output Index: utils/ofarc/ZIPArchive.m ================================================================== --- utils/ofarc/ZIPArchive.m +++ utils/ofarc/ZIPArchive.m @@ -44,13 +44,12 @@ OF_ZIP_ARCHIVE_ENTRY_ATTR_COMPAT_UNIX) { OFNumber *mode = [OFNumber numberWithUnsignedShort: (entry.versionSpecificAttributes >> 16) & 0777]; of_file_attribute_key_t key = of_file_attribute_key_posix_permissions; - of_file_attributes_t attributes = [OFDictionary - dictionaryWithObject: mode - forKey: key]; + of_file_attributes_t attributes = + [OFDictionary dictionaryWithObject: mode forKey: key]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; } #endif @@ -293,17 +292,15 @@ directory = outFileName.stringByDeletingLastPathComponent; if (![fileManager directoryExistsAtPath: directory]) [fileManager createDirectoryAtPath: directory createParents: true]; - if (![app shouldExtractFile: fileName - outFileName: outFileName]) + if (![app shouldExtractFile: fileName outFileName: outFileName]) goto outer_loop_end; stream = [_archive streamForReadingFile: fileName]; - output = [OFFile fileWithPath: outFileName - mode: @"w"]; + output = [OFFile fileWithPath: outFileName mode: @"w"]; setPermissions(outFileName, entry); while (!stream.atEndOfStream) { ssize_t length = [app copyBlockFromStream: stream toStream: output Index: utils/ofdns/OFDNS.m ================================================================== --- utils/ofdns/OFDNS.m +++ utils/ofdns/OFDNS.m @@ -199,11 +199,10 @@ [OFDNSQuery queryWithDomainName: domainName DNSClass: DNSClass recordType: recordType]; _inFlight++; - [resolver asyncPerformQuery: query - delegate: self]; + [resolver asyncPerformQuery: query delegate: self]; } } } @end Index: utils/ofhash/OFHash.m ================================================================== --- utils/ofhash/OFHash.m +++ utils/ofhash/OFHash.m @@ -127,15 +127,13 @@ sandbox.allowsStdIO = true; sandbox.allowsReadingFiles = true; sandbox.allowsUserDatabaseReading = true; for (OFString *path in optionsParser.remainingArguments) - [sandbox unveilPath: path - permissions: @"r"]; + [sandbox unveilPath: path permissions: @"r"]; - [sandbox unveilPath: @LANGUAGE_DIR - permissions: @"r"]; + [sandbox unveilPath: @LANGUAGE_DIR permissions: @"r"]; [OFApplication activateSandbox: sandbox]; } @finally { [sandbox release]; } @@ -176,12 +174,11 @@ if ([path isEqual: @"-"]) file = of_stdin; else { @try { - file = [OFFile fileWithPath: path - mode: @"r"]; + file = [OFFile fileWithPath: path mode: @"r"]; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString stringWithCString: strerror(e.errNo) encoding: [OFLocale encoding]]; Index: utils/ofhttp/OFHTTP.m ================================================================== --- utils/ofhttp/OFHTTP.m +++ utils/ofhttp/OFHTTP.m @@ -328,12 +328,11 @@ .stringByDeletingEnclosingWhitespaces; value = [header substringFromIndex: pos + 1] .stringByDeletingEnclosingWhitespaces; - [_clientHeaders setObject: value - forKey: name]; + [_clientHeaders setObject: value forKey: name]; } - (void)setBody: (OFString *)path { OFString *contentLength = nil; @@ -342,12 +341,11 @@ _body = nil; if ([path isEqual: @"-"]) _body = [of_stdin copy]; else { - _body = [[OFFile alloc] initWithPath: path - mode: @"r"]; + _body = [[OFFile alloc] initWithPath: path mode: @"r"]; @try { unsigned long long fileSize = [[OFFileManager defaultManager] attributesOfItemAtPath: path].fileSize; @@ -532,12 +530,11 @@ #ifdef OF_HAVE_SANDBOX [sandbox unveilPath: (outputPath != nil ? outputPath : OF_PATH_CURRENT_DIRECTORY) permissions: (_continue ? @"rwc" : @"wc")]; /* In case we use ObjOpenSSL for https later */ - [sandbox unveilPath: @"/etc/ssl" - permissions: @"r"]; + [sandbox unveilPath: @"/etc/ssl" permissions: @"r"]; sandbox.allowsUnveil = false; [OFApplication activateSandbox: sandbox]; #endif @@ -576,12 +573,11 @@ if (_insecure) _HTTPClient.allowsInsecureRedirects = true; _useUnicode = ([OFLocale encoding] == OF_STRING_ENCODING_UTF_8); - [self performSelector: @selector(downloadNextURL) - afterDelay: 0]; + [self performSelector: @selector(downloadNextURL) afterDelay: 0]; } - (void)client: (OFHTTPClient *)client didCreateSocket: (OFTCPSocket *)sock request: (OFHTTPRequest *)request @@ -596,16 +592,12 @@ request: (OFHTTPRequest *)request { /* TODO: Do asynchronously and print status */ while (!_body.atEndOfStream) { char buffer[4096]; - size_t length; - - length = [_body readIntoBuffer: buffer - length: 4096]; - [body writeBuffer: buffer - length: length]; + size_t length = [_body readIntoBuffer: buffer length: 4096]; + [body writeBuffer: buffer length: length]; } } - (bool)client: (OFHTTPClient *)client shouldFollowRedirect: (OFURL *)URL @@ -621,12 +613,11 @@ OFEnumerator *objectEnumerator = [headers objectEnumerator]; OFString *key, *object; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) - [of_stdout writeFormat: @" %@: %@\n", - key, object]; + [of_stdout writeFormat: @" %@: %@\n", key, object]; objc_autoreleasePoolPop(pool); } if (!_quiet) { @@ -673,15 +664,13 @@ [self performSelector: @selector(downloadNextURL) afterDelay: 0]; return false; } - _received += length; + [_output writeBuffer: buffer length: length]; - [_output writeBuffer: buffer - length: length]; - + _received += length; [_progressBar setReceived: _received]; if (response.atEndOfStream) { [_progressBar stop]; [_progressBar draw]; @@ -979,20 +968,18 @@ [_currentFileName release]; _currentFileName = nil; response.delegate = self; - [response asyncReadIntoBuffer: _buffer - length: [OFSystemInfo pageSize]]; + [response asyncReadIntoBuffer: _buffer length: [OFSystemInfo pageSize]]; return; next: [_currentFileName release]; _currentFileName = nil; - [self performSelector: @selector(downloadNextURL) - afterDelay: 0]; + [self performSelector: @selector(downloadNextURL) afterDelay: 0]; } - (void)downloadNextURL { OFString *URLString = nil; @@ -1075,12 +1062,11 @@ _resumedFrom = (unsigned long long)size; range = [OFString stringWithFormat: @"bytes=%jd-", _resumedFrom]; - [clientHeaders setObject: range - forKey: @"Range"]; + [clientHeaders setObject: range forKey: @"Range"]; } @catch (OFRetrieveItemAttributesFailedException *e) { } } if (!_quiet) { @@ -1097,9 +1083,8 @@ _detectFileNameRequest = false; [_HTTPClient asyncPerformRequest: request]; return; next: - [self performSelector: @selector(downloadNextURL) - afterDelay: 0]; + [self performSelector: @selector(downloadNextURL) afterDelay: 0]; } @end Index: utils/ofsock/OFSock.m ================================================================== --- utils/ofsock/OFSock.m +++ utils/ofsock/OFSock.m @@ -57,15 +57,12 @@ if (URL.port == nil) { [of_stderr writeLine: @"Need a port!"]; [OFApplication terminateWithStatus: 1]; } - [sock connectToHost: URL.host - port: URL.port.shortValue]; - - return [OFPair pairWithFirstObject: sock - secondObject: sock]; + [sock connectToHost: URL.host port: URL.port.shortValue]; + return [OFPair pairWithFirstObject: sock secondObject: sock]; } [of_stderr writeFormat: @"Invalid protocol: %@\n", scheme]; [OFApplication terminateWithStatus: 1]; abort(); @@ -139,12 +136,11 @@ for (OFPair *pair in _streams) { if (pair.firstObject == stream) continue; - [pair.secondObject writeBuffer: buffer - length: length]; + [pair.secondObject writeBuffer: buffer length: length]; } return true; } @end