@@ -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]; @@ -164,15 +160,15 @@ @try { void *pool = objc_autoreleasePoolPush(); if ((![element.name isEqual: @"OFArray"] && ![element.name isEqual: @"OFMutableArray"]) || - ![element.namespace isEqual: OF_SERIALIZATION_NS]) + ![element.namespace isEqual: OFSerializationNS]) @throw [OFInvalidArgumentException exception]; for (OFXMLElement *child in - [element elementsForNamespace: OF_SERIALIZATION_NS]) { + [element elementsForNamespace: OFSerializationNS]) { void *pool2 = objc_autoreleasePoolPush(); id object; object = child.objectByDeserializing; [_array addItem: &object]; @@ -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: (OFRange)range { id const *objects = _array.items; size_t count = _array.count; if (range.length > SIZE_MAX - range.location || @@ -228,42 +223,42 @@ { id const *objects; size_t count; if (object == nil) - return OF_NOT_FOUND; + return OFNotFound; objects = _array.items; count = _array.count; for (size_t i = 0; i < count; i++) if ([objects[i] isEqual: object]) return i; - return OF_NOT_FOUND; + return OFNotFound; } - (size_t)indexOfObjectIdenticalTo: (id)object { id const *objects; size_t count; if (object == nil) - return OF_NOT_FOUND; + return OFNotFound; objects = _array.items; count = _array.count; for (size_t i = 0; i < count; i++) if (objects[i] == object) return i; - return OF_NOT_FOUND; + return OFNotFound; } -- (OFArray *)objectsInRange: (of_range_t)range +- (OFArray *)objectsInRange: (OFRange)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _array.count) @throw [OFOutOfRangeException exception]; @@ -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; @@ -308,23 +302,23 @@ - (unsigned long)hash { id const *objects = _array.items; size_t count = _array.count; - uint32_t hash; + unsigned long hash; - OF_HASH_INIT(hash); + OFHashInit(&hash); for (size_t i = 0; i < count; i++) - OF_HASH_ADD_HASH(hash, [objects[i] hash]); + OFHashAddHash(&hash, [objects[i] hash]); - OF_HASH_FINALIZE(hash); + OFHashFinalize(&hash); return hash; } -- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state +- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state objects: (id *)objects count: (int)count_ { size_t count = _array.count; @@ -346,11 +340,11 @@ return (int)count; } #ifdef OF_HAVE_BLOCKS -- (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block +- (void)enumerateObjectsUsingBlock: (OFArrayEnumerationBlock)block { id const *objects = _array.items; size_t count = _array.count; bool stop = false;