@@ -193,12 +193,11 @@ { id ret; va_list arguments; va_start(arguments, firstObject); - ret = [self initWithObject: firstObject - arguments: arguments]; + ret = [self initWithObject: firstObject arguments: arguments]; va_end(arguments); return ret; } @@ -240,12 +239,11 @@ { size_t count = self.count; id *buffer = of_alloc(count, sizeof(id)); @try { - [self getObjects: buffer - inRange: of_range(0, count)]; + [self getObjects: buffer inRange: of_range(0, count)]; return [[OFData dataWithItemsNoCopy: buffer count: count itemSize: sizeof(id) freeWhenDone: true] items]; @@ -296,16 +294,14 @@ [ret makeImmutable]; return ret; } -- (void)setValue: (id)value - forKey: (OFString *)key +- (void)setValue: (id)value forKey: (OFString *)key { for (id object in self) - [object setValue: value - forKey: key]; + [object setValue: value forKey: key]; } - (size_t)indexOfObject: (id)object { size_t i = 0; @@ -376,20 +372,17 @@ if (range.length > SIZE_MAX - range.location || range.location + range.length < self.count) @throw [OFOutOfRangeException exception]; if (![self isKindOfClass: [OFMutableArray class]]) - return [OFSubarray arrayWithArray: self - range: range]; + return [OFSubarray arrayWithArray: self range: range]; buffer = of_alloc(range.length, sizeof(*buffer)); @try { - [self getObjects: buffer - inRange: range]; + [self getObjects: buffer inRange: range]; - ret = [OFArray arrayWithObjects: buffer - count: range.length]; + ret = [OFArray arrayWithObjects: buffer count: range.length]; } @finally { free(buffer); } return ret; @@ -538,12 +531,11 @@ pool = objc_autoreleasePoolPush(); ret = [[self componentsJoinedByString: @",\n"] mutableCopy]; @try { [ret prependString: @"(\n"]; - [ret replaceOccurrencesOfString: @"\n" - withString: @"\n\t"]; + [ret replaceOccurrencesOfString: @"\n" withString: @"\n\t"]; [ret appendString: @"\n)"]; } @catch (id e) { [ret release]; @throw e; } @@ -582,18 +574,16 @@ return [element autorelease]; } - (OFString *)JSONRepresentation { - return [self of_JSONRepresentationWithOptions: 0 - depth: 0]; + return [self of_JSONRepresentationWithOptions: 0 depth: 0]; } - (OFString *)JSONRepresentationWithOptions: (int)options { - return [self of_JSONRepresentationWithOptions: options - depth: 0]; + return [self of_JSONRepresentationWithOptions: options depth: 0]; } - (OFString *)of_JSONRepresentationWithOptions: (int)options depth: (size_t)depth { @@ -667,19 +657,17 @@ } else if (count <= UINT16_MAX) { uint8_t type = 0xDC; uint16_t tmp = OF_BSWAP16_IF_LE((uint16_t)count); [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else if (count <= UINT32_MAX) { uint8_t type = 0xDD; uint32_t tmp = OF_BSWAP32_IF_LE((uint32_t)count); [data addItem: &type]; - [data addItems: &tmp - count: sizeof(tmp)]; + [data addItems: &tmp count: sizeof(tmp)]; } else @throw [OFOutOfRangeException exception]; pool = objc_autoreleasePoolPush(); @@ -689,12 +677,11 @@ OFData *child; i++; child = [object messagePackRepresentation]; - [data addItems: child.items - count: child.count]; + [data addItems: child.items count: child.count]; objc_autoreleasePoolPop(pool2); } assert(i == count); @@ -714,61 +701,46 @@ - (void)makeObjectsPerformSelector: (SEL)selector withObject: (id)object { for (id objectIter in self) - [objectIter performSelector: selector - withObject: object]; + [objectIter performSelector: selector withObject: object]; } - (OFArray *)sortedArray { OFMutableArray *new = [[self mutableCopy] autorelease]; - [new sort]; - [new makeImmutable]; - return new; } - (OFArray *)sortedArrayUsingSelector: (SEL)selector options: (int)options { OFMutableArray *new = [[self mutableCopy] autorelease]; - - [new sortUsingSelector: selector - options: options]; - + [new sortUsingSelector: selector options: options]; [new makeImmutable]; - return new; } #ifdef OF_HAVE_BLOCKS - (OFArray *)sortedArrayUsingComparator: (of_comparator_t)comparator options: (int)options { OFMutableArray *new = [[self mutableCopy] autorelease]; - - [new sortUsingComparator: comparator - options: options]; - + [new sortUsingComparator: comparator options: options]; [new makeImmutable]; - return new; } #endif - (OFArray *)reversedArray { OFMutableArray *new = [[self mutableCopy] autorelease]; - [new reverse]; - [new makeImmutable]; - return new; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state objects: (id *)objects @@ -780,12 +752,11 @@ @throw [OFOutOfRangeException exception]; if (range.location + range.length > self.count) range.length = self.count - range.location; - [self getObjects: objects - inRange: range]; + [self getObjects: objects inRange: range]; if (range.location + range.length > ULONG_MAX) @throw [OFOutOfRangeException exception]; state->state = (unsigned long)(range.location + range.length); @@ -822,34 +793,30 @@ if (object == nil) @throw [OFInvalidArgumentException exception]; ret = [[self mutableCopy] autorelease]; - [ret addObject: object]; [ret makeImmutable]; return ret; } - (OFArray *)arrayByAddingObjectsFromArray: (OFArray *)array { OFMutableArray *ret = [[self mutableCopy] autorelease]; - [ret addObjectsFromArray: array]; [ret makeImmutable]; return ret; } - (OFArray *)arrayByRemovingObject: (id)object { OFMutableArray *ret = [[self mutableCopy] autorelease]; - [ret removeObject: object]; [ret makeImmutable]; - return ret; } #ifdef OF_HAVE_BLOCKS - (OFArray *)mappedArrayUsingBlock: (of_array_map_block_t)block @@ -862,12 +829,11 @@ [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { tmp[idx] = block(object, idx); }]; - ret = [OFArray arrayWithObjects: tmp - count: count]; + ret = [OFArray arrayWithObjects: tmp count: count]; } @finally { free(tmp); } return ret; @@ -886,12 +852,11 @@ bool *stop) { if (block(object, idx)) tmp[i++] = object; }]; - ret = [OFArray arrayWithObjects: tmp - count: i]; + ret = [OFArray arrayWithObjects: tmp count: i]; } @finally { free(tmp); } return ret;