@@ -608,20 +608,20 @@ PRE_IVAR->lastMem = preMem; return (char*)pointer + PRE_MEM_ALIGN; } -- (void*)allocMemoryForNItems: (size_t)nItems - ofSize: (size_t)size +- (void*)allocMemoryWithItemSize: (size_t)itemSize + count: (size_t)count { - if (nItems == 0 || size == 0) + if (itemSize == 0 || count == 0) return NULL; - if (nItems > SIZE_MAX / size) + if (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exceptionWithClass: isa]; - return [self allocMemoryWithSize: nItems * size]; + return [self allocMemoryWithSize: itemSize * count]; } - (void*)resizeMemory: (void*)pointer toSize: (size_t)size { @@ -660,27 +660,27 @@ return (char*)new + PRE_MEM_ALIGN; } - (void*)resizeMemory: (void*)pointer - toNItems: (size_t)nItems - ofSize: (size_t)size + itemSize: (size_t)itemSize + count: (size_t)count { if (pointer == NULL) - return [self allocMemoryForNItems: nItems - ofSize: size]; + return [self allocMemoryWithItemSize: itemSize + count: count]; - if (nItems == 0 || size == 0) { + if (itemSize == 0 || count == 0) { [self freeMemory: pointer]; return NULL; } - if (nItems > SIZE_MAX / size) + if (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exceptionWithClass: isa]; return [self resizeMemory: pointer - toSize: nItems * size]; + toSize: itemSize * count]; } - (void)freeMemory: (void*)pointer { if (pointer == NULL) @@ -837,12 +837,12 @@ { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } -+ (void*)allocMemoryForNItems: (size_t)nItems - ofSize: (size_t)size ++ (void*)allocMemoryWithItemSize: (size_t)itemSize + count: (size_t)count { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } @@ -852,12 +852,12 @@ @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } + (void*)resizeMemory: (void*)pointer - toNItems: (size_t)nItems - ofSize: (size_t)size + itemSize: (size_t)itemSize + count: (size_t)count { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; }