@@ -84,12 +84,12 @@ self = [super init]; if (itemSize_ == 0) { Class c = isa; [self release]; - @throw [OFInvalidArgumentException newWithClass: c - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: c + selector: _cmd]; } itemSize = itemSize_; return self; @@ -150,13 +150,13 @@ request = [OFHTTPRequest requestWithURL: URL]; result = [request perform]; if ([result statusCode] != 200) @throw [OFHTTPRequestFailedException - newWithClass: [request class] - HTTPRequest: request - result: result]; + exceptionWithClass: [request class] + HTTPRequest: request + result: result]; self = [[result data] retain]; [pool release]; return self; } @@ -170,11 +170,11 @@ if (!of_base64_decode(self, [string cStringWithEncoding: OF_STRING_ENCODING_ASCII], [string cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII])) { Class c = isa; [self release]; - @throw [OFInvalidEncodingException newWithClass: c]; + @throw [OFInvalidEncodingException exceptionWithClass: c]; } return self; } @@ -188,20 +188,22 @@ OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *stringValue; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; stringValue = [element stringValue]; if (!of_base64_decode(self, [stringValue cStringWithEncoding: OF_STRING_ENCODING_ASCII], [stringValue cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII])) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; [pool release]; } @catch (id e) { [self release]; @throw e; @@ -226,11 +228,11 @@ } - (void*)itemAtIndex: (size_t)index { if (index >= count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return data + index * itemSize; } - (void*)firstItem @@ -250,11 +252,11 @@ } - (void)addItem: (const void*)item { if (SIZE_MAX - count < 1) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self resizeMemory: data toNItems: count + 1 ofSize: itemSize]; @@ -273,11 +275,11 @@ - (void)addNItems: (size_t)nItems fromCArray: (const void*)cArray { if (nItems > SIZE_MAX - count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self resizeMemory: data toNItems: count + nItems ofSize: itemSize]; @@ -288,11 +290,11 @@ - (void)addNItems: (size_t)nItems fromCArray: (const void*)cArray atIndex: (size_t)index { if (nItems > SIZE_MAX - count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self resizeMemory: data toNItems: count + nItems ofSize: itemSize]; @@ -310,29 +312,28 @@ } - (void)removeNItems: (size_t)nItems { if (nItems > count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; count -= nItems; @try { data = [self resizeMemory: data toNItems: count ofSize: itemSize]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } - (void)removeNItems: (size_t)nItems atIndex: (size_t)index { if (nItems > count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; memmove(data + index * itemSize, data + (index + nItems) * itemSize, (count - index - nItems) * itemSize); count -= nItems; @@ -340,11 +341,10 @@ data = [self resizeMemory: data toNItems: count ofSize: itemSize]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } - (void)removeLastItem { @@ -353,11 +353,10 @@ data = [self resizeMemory: data toNItems: count ofSize: itemSize]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ - [e release]; } } - copy { @@ -392,17 +391,17 @@ OFDataArray *otherDataArray; int comparison; size_t otherCount, minimumCount; if (![object isKindOfClass: [OFDataArray class]]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; otherDataArray = object; if ([otherDataArray itemSize] != itemSize) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; otherCount = [otherDataArray count]; minimumCount = (count > otherCount ? otherCount : count); if ((comparison = memcmp(data, [otherDataArray cArray], @@ -455,12 +454,12 @@ { OFAutoreleasePool *pool; OFXMLElement *element; if (itemSize != 1) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; pool = [[OFAutoreleasePool alloc] init]; element = [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS @@ -478,11 +477,11 @@ - (void)addItem: (const void*)item { size_t newSize, lastPageByte; if (SIZE_MAX - count < 1 || count + 1 > SIZE_MAX / itemSize) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; lastPageByte = of_pagesize - 1; newSize = ((count + 1) * itemSize + lastPageByte) & ~lastPageByte; if (size != newSize) @@ -499,11 +498,11 @@ fromCArray: (const void*)cArray { size_t newSize, lastPageByte; if (nItems > SIZE_MAX - count || count + nItems > SIZE_MAX / itemSize) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; lastPageByte = of_pagesize - 1; newSize = ((count + nItems) * itemSize + lastPageByte) & ~lastPageByte; if (size != newSize) @@ -521,11 +520,11 @@ atIndex: (size_t)index { size_t newSize, lastPageByte; if (nItems > SIZE_MAX - count || count + nItems > SIZE_MAX / itemSize) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; lastPageByte = of_pagesize - 1; newSize = ((count + nItems) * itemSize + lastPageByte) & ~lastPageByte; if (size != newSize) @@ -544,11 +543,11 @@ - (void)removeNItems: (size_t)nItems { size_t newSize, lastPageByte; if (nItems > count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; count -= nItems; lastPageByte = of_pagesize - 1; newSize = (count * itemSize + lastPageByte) & ~lastPageByte; @@ -562,11 +561,11 @@ atIndex: (size_t)index { size_t newSize, lastPageByte; if (nItems > count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; memmove(data + index * itemSize, data + (index + nItems) * itemSize, (count - index - nItems) * itemSize); count -= nItems;