@@ -87,11 +87,11 @@ return NULL; return data + (count - 1) * itemsize; } -- addItem: (void*)item +- (void)addItem: (void*)item { if (SIZE_MAX - count < 1) @throw [OFOutOfRangeException newWithClass: isa]; data = [self resizeMemory: data @@ -99,24 +99,22 @@ withSize: itemsize]; memcpy(data + count * itemsize, item, itemsize); count++; - - return self; } -- addItem: (void*)item - atIndex: (size_t)index +- (void)addItem: (void*)item + atIndex: (size_t)index { - return [self addNItems: 1 - fromCArray: item - atIndex: index]; + [self addNItems: 1 + fromCArray: item + atIndex: index]; } -- addNItems: (size_t)nitems - fromCArray: (void*)carray +- (void)addNItems: (size_t)nitems + fromCArray: (void*)carray { if (nitems > SIZE_MAX - count) @throw [OFOutOfRangeException newWithClass: isa]; data = [self resizeMemory: data @@ -123,17 +121,15 @@ toNItems: count + nitems withSize: itemsize]; memcpy(data + count * itemsize, carray, nitems * itemsize); count += nitems; - - return self; } -- addNItems: (size_t)nitems - fromCArray: (void*)carray - atIndex: (size_t)index +- (void)addNItems: (size_t)nitems + fromCArray: (void*)carray + atIndex: (size_t)index { if (nitems > SIZE_MAX - count) @throw [OFOutOfRangeException newWithClass: isa]; data = [self resizeMemory: data @@ -143,21 +139,19 @@ memmove(data + (index + nitems) * itemsize, data + index * itemsize, (count - index) * itemsize); memcpy(data + index * itemsize, carray, nitems * itemsize); count += nitems; +} - return self; +- (void)removeItemAtIndex: (size_t)index +{ + [self removeNItems: 1 + atIndex: index]; } -- removeItemAtIndex: (size_t)index -{ - return [self removeNItems: 1 - atIndex: index]; -} - -- removeNItems: (size_t)nitems +- (void)removeNItems: (size_t)nitems { if (nitems > count) @throw [OFOutOfRangeException newWithClass: isa]; @@ -168,16 +162,14 @@ withSize: itemsize]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ [e dealloc]; } - - return self; } -- removeNItems: (size_t)nitems - atIndex: (size_t)index +- (void)removeNItems: (size_t)nitems + atIndex: (size_t)index { if (nitems > count) @throw [OFOutOfRangeException newWithClass: isa]; memmove(data + index * itemsize, data + (index + nitems) * itemsize, @@ -190,12 +182,10 @@ withSize: itemsize]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ [e dealloc]; } - - return self; } - (id)copy { OFDataArray *new = [[OFDataArray alloc] initWithItemSize: itemsize]; @@ -260,11 +250,11 @@ return hash; } @end @implementation OFBigDataArray -- addItem: (void*)item +- (void)addItem: (void*)item { size_t nsize, lastpagebyte; if (SIZE_MAX - count < 1 || count + 1 > SIZE_MAX / itemsize) @throw [OFOutOfRangeException newWithClass: isa]; @@ -278,16 +268,14 @@ memcpy(data + count * itemsize, item, itemsize); count++; size = nsize; - - return self; } -- addNItems: (size_t)nitems - fromCArray: (void*)carray +- (void)addNItems: (size_t)nitems + fromCArray: (void*)carray { size_t nsize, lastpagebyte; if (nitems > SIZE_MAX - count || count + nitems > SIZE_MAX / itemsize) @throw [OFOutOfRangeException newWithClass: isa]; @@ -301,17 +289,15 @@ memcpy(data + count * itemsize, carray, nitems * itemsize); count += nitems; size = nsize; - - return self; } -- addNItems: (size_t)nitems - fromCArray: (void*)carray - atIndex: (size_t)index +- (void)addNItems: (size_t)nitems + fromCArray: (void*)carray + atIndex: (size_t)index { size_t nsize, lastpagebyte; if (nitems > SIZE_MAX - count || count + nitems > SIZE_MAX / itemsize) @throw [OFOutOfRangeException newWithClass: isa]; @@ -328,15 +314,13 @@ (count - index) * itemsize); memcpy(data + index * itemsize, carray, nitems * itemsize); count += nitems; size = nsize; - - return self; } -- removeNItems: (size_t)nitems +- (void)removeNItems: (size_t)nitems { size_t nsize, lastpagebyte; if (nitems > count) @throw [OFOutOfRangeException newWithClass: isa]; @@ -347,16 +331,14 @@ if (size != nsize) data = [self resizeMemory: data toSize: nsize]; size = nsize; - - return self; } -- removeNItems: (size_t)nitems - atIndex: (size_t)index +- (void)removeNItems: (size_t)nitems + atIndex: (size_t)index { size_t nsize, lastpagebyte; if (nitems > count) @throw [OFOutOfRangeException newWithClass: isa]; @@ -370,12 +352,10 @@ if (size != nsize) data = [self resizeMemory: data toSize: nsize]; size = nsize; - - return self; } - (id)copy { OFDataArray *new = [[OFBigDataArray alloc] initWithItemSize: itemsize];