Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -265,13 +265,13 @@ @end @implementation OFObject (OFApplicationDelegate) - (void)applicationDidFinishLaunching { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)applicationWillTerminate { } @end Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -103,12 +103,12 @@ { } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @implementation OFArray @@ -169,12 +169,12 @@ - init { if (isa == [OFArray class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; } @@ -199,51 +199,51 @@ - initWithObject: (id)firstObject arguments: (va_list)arguments { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithArray: (OFArray*)array { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithCArray: (id*)objects { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithCArray: (id*)objects length: (size_t)length { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithSerialization: (OFXMLElement*)element { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - (size_t)count { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)getObjects: (id*)buffer inRange: (of_range_t)range { @@ -280,12 +280,12 @@ return [[OFMutableArray alloc] initWithArray: self]; } - (id)objectAtIndex: (size_t)index { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (size_t)indexOfObject: (id)object { size_t i, count = [self count]; @@ -529,11 +529,11 @@ { /* FIXME: Use -[getObjects:inRange:] on the passed objects */ size_t count = [self count]; if (count > INT_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if (state->state >= count) return 0; state->state = count; @@ -666,12 +666,13 @@ } - (id)nextObject { if (mutationsPtr != NULL && *mutationsPtr != mutations) - @throw [OFEnumerationMutationException newWithClass: isa - object: array]; + @throw [OFEnumerationMutationException + exceptionWithClass: isa + object: array]; if (position < count) return [array objectAtIndex: position++]; return nil; @@ -678,11 +679,12 @@ } - (void)reset { if (mutationsPtr != NULL && *mutationsPtr != mutations) - @throw [OFEnumerationMutationException newWithClass: isa - object: array]; + @throw [OFEnumerationMutationException + exceptionWithClass: isa + object: array]; position = 0; } @end Index: src/OFArray_adjacent.m ================================================================== --- src/OFArray_adjacent.m +++ src/OFArray_adjacent.m @@ -187,12 +187,13 @@ pool = [[OFAutoreleasePool alloc] init]; if ((![[element name] isEqual: @"OFArray"] && ![[element name] isEqual: @"OFMutableArray"]) || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; enumerator = [[element children] objectEnumerator]; pool2 = [[OFAutoreleasePool alloc] init]; while ((child = [enumerator nextObject]) != nil) { @@ -237,11 +238,11 @@ { id *cArray = [array cArray]; size_t i, count = [array count]; if (range.start + range.length > count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; for (i = 0; i < range.length; i++) buffer[i] = cArray[range.start + i]; } @@ -279,11 +280,11 @@ range: range]; count = [array count]; if (range.start + range.length > count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return [OFArray arrayWithCArray: (id*)[array cArray] + range.start length: range.length]; } Index: src/OFArray_subarray.m ================================================================== --- src/OFArray_subarray.m +++ src/OFArray_subarray.m @@ -58,20 +58,20 @@ } - (id)objectAtIndex: (size_t)index { if (index >= range.length) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return [array objectAtIndex: index + range.start]; } - (void)getObjects: (id*)buffer inRange: (of_range_t)range_ { if (range_.start + range_.length > range.length) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; range_.start += range.start; return [array getObjects: buffer inRange: range_]; @@ -108,12 +108,12 @@ } - (OFArray*)objectsInRange: (of_range_t)range_ { if (range_.start + range_.length > range.length) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; range_.start += range.start; return [array objectsInRange: range_]; } @end Index: src/OFAutoreleasePool.m ================================================================== --- src/OFAutoreleasePool.m +++ src/OFAutoreleasePool.m @@ -39,11 +39,12 @@ { if (self != [OFAutoreleasePool class]) return; if (!of_tlskey_new(&firstKey) || !of_tlskey_new(&lastKey)) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } #endif + (void)addObject: (id)object { @@ -64,11 +65,12 @@ #endif } if (lastPool == nil) { [object release]; - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } @try { [lastPool _addObject: object]; } @catch (id e) { @@ -95,11 +97,11 @@ id firstPool = of_tlskey_get(firstKey); previousPool = of_tlskey_get(lastKey); if (!of_tlskey_set(lastKey, self)) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; #else previousPool = lastPool; lastPool = self; #endif @@ -106,11 +108,11 @@ if (firstPool == nil) { #ifdef OF_THREADS if (!of_tlskey_set(firstKey, self)) { of_tlskey_set(lastKey, previousPool); @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; } #else firstPool = self; #endif } @@ -207,15 +209,15 @@ [super dealloc]; } - retain { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - autorelease { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } @end Index: src/OFBlock.m ================================================================== --- src/OFBlock.m +++ src/OFBlock.m @@ -350,23 +350,26 @@ * However, objc_allocateClassPair does not register the new class with * the subclass in the ObjC1 runtime like the ObjC2 runtime does, so * this workaround should be fine. */ if ((tmp = objc_allocateClassPair(self, "OFStackBlock", 0)) == NULL) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; memcpy(&_NSConcreteStackBlock, tmp, sizeof(_NSConcreteStackBlock)); free(tmp); objc_registerClassPair((Class)&_NSConcreteStackBlock); if ((tmp = objc_allocateClassPair(self, "OFGlobalBlock", 0)) == NULL) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; memcpy(&_NSConcreteGlobalBlock, tmp, sizeof(_NSConcreteGlobalBlock)); free(tmp); objc_registerClassPair((Class)&_NSConcreteGlobalBlock); if ((tmp = objc_allocateClassPair(self, "OFMallocBlock", 0)) == NULL) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; memcpy(&_NSConcreteMallocBlock, tmp, sizeof(_NSConcreteMallocBlock)); free(tmp); objc_registerClassPair((Class)&_NSConcreteMallocBlock); } #endif @@ -377,64 +380,64 @@ size_t i; for (i = 0; i < NUM_SPINLOCKS; i++) if (!of_spinlock_new(&spinlocks[i])) @throw [OFInitializationFailedException - newWithClass: self]; + exceptionWithClass: self]; } #endif + alloc { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } - init { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)addMemoryToPool: (void*)ptr { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)allocMemoryWithSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)allocMemoryForNItems: (size_t)nitems withSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)resizeMemory: (void*)ptr toSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)resizeMemory: (void*)ptr toNItems: (size_t)nitems withSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)freeMemory: (void*)ptr { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - retain { if (isa == (Class)&_NSConcreteMallocBlock) @@ -471,12 +474,12 @@ Block_release(self); } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end #if defined(OF_APPLE_RUNTIME) && defined(__OBJC2__) Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -46,12 +46,13 @@ if (initialized == SIZE_MAX) return; if ((ivars = malloc(sizeof(*ivars))) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: sizeof(*ivars)]; + @throw [OFOutOfMemoryException + exceptionWithClass: isa + requestedSize: sizeof(*ivars)]; memset(ivars, 0, sizeof(*ivars)); ivars->cString = (char*)s; ivars->cStringLength = initialized; @@ -60,11 +61,11 @@ case 1: ivars->UTF8 = YES; break; case -1: free(ivars); - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; } s = ivars; initialized = SIZE_MAX; } @@ -73,249 +74,249 @@ * The following methods are not available since it's a constant string, which * can't be allocated or initialized at runtime. */ + alloc { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } - init { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUTF8String: (const char*)UTF8String { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUTF8String: (const char*)UTF8String length: (size_t)UTF8StringLength { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithCString: (const char*)cString encoding: (of_string_encoding_t)encoding { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithCString: (const char*)cString encoding: (of_string_encoding_t)encoding length: (size_t)cStringLength { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithString: (OFString*)string { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUnicodeString: (of_unichar_t*)string { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUnicodeString: (of_unichar_t*)string byteOrder: (of_endianess_t)byteOrder { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUnicodeString: (of_unichar_t*)string length: (size_t)length { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUnicodeString: (of_unichar_t*)string byteOrder: (of_endianess_t)byteOrder length: (size_t)length { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUTF16String: (uint16_t*)string byteOrder: (of_endianess_t)byteOrder { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUTF16String: (uint16_t*)string length: (size_t)length { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUTF16String: (uint16_t*)string byteOrder: (of_endianess_t)byteOrder length: (size_t)length { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithFormat: (OFConstantString*)format, ... { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithFormat: (OFConstantString*)format arguments: (va_list)args { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithPath: (OFString*)firstComponent, ... { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithPath: (OFString*)firstComponent arguments: (va_list)arguments { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithContentsOfFile: (OFString*)path { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithContentsOfFile: (OFString*)path encoding: (of_string_encoding_t)encoding { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithContentsOfURL: (OFURL*)URL { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } /* From protocol OFSerializing */ - initWithSerialization: (OFXMLElement*)element { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } /* * The following methods are not available because constant strings are * preallocated by the compiler and thus don't have a memory pool. */ - (void)addMemoryToPool: (void*)ptr { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)allocMemoryWithSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)allocMemoryForNItems: (size_t)nitems withSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)resizeMemory: (void*)ptr toSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)resizeMemory: (void*)ptr toNItems: (size_t)nitems withSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)freeMemory: (void*)ptr { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } /* * The following methods are unnecessary because constant strings are * singletons. @@ -339,12 +340,12 @@ { } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } /* * In all following methods, it is checked whether the constant string has been Index: src/OFCountedSet.m ================================================================== --- src/OFCountedSet.m +++ src/OFCountedSet.m @@ -85,12 +85,12 @@ { } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @implementation OFCountedSet @@ -111,21 +111,21 @@ - init { if (isa == [OFCountedSet class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; } - (size_t)countForObject: (id)object { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (OFString*)description { OFMutableString *ret; Index: src/OFCountedSet_hashtable.m ================================================================== --- src/OFCountedSet_hashtable.m +++ src/OFCountedSet_hashtable.m @@ -124,12 +124,13 @@ OFEnumerator *enumerator; OFXMLElement *objectElement; if (![[element name] isEqual: @"OFCountedSet"] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; objects = [element elementsForName: @"object" namespace: OF_SERIALIZATION_NS]; enumerator = [objects objectEnumerator]; @@ -144,11 +145,11 @@ OF_SERIALIZATION_NS] firstObject]; count = [objectElement attributeForName: @"count"]; if (object == nil || count == nil) @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; number = [OFNumber numberWithSize: (size_t)[[count stringValue] decimalValue]]; [dictionary _setObject: number Index: src/OFDataArray.m ================================================================== --- src/OFDataArray.m +++ src/OFDataArray.m @@ -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; Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -46,90 +46,92 @@ defined(OF_THREADS) static OFMutex *mutex; #endif #ifdef HAVE_GMTIME_R -# define GMTIME_RET(field) \ - time_t seconds_ = (time_t)seconds; \ - struct tm tm; \ - \ - if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ - if (gmtime_r(&seconds_, &tm) == NULL) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ +# define GMTIME_RET(field) \ + time_t seconds_ = (time_t)seconds; \ + struct tm tm; \ + \ + if (seconds_ != floor(seconds)) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ + if (gmtime_r(&seconds_, &tm) == NULL) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ return tm.field; -# define LOCALTIME_RET(field) \ - time_t seconds_ = (time_t)seconds; \ - struct tm tm; \ - \ - if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ - if (localtime_r(&seconds_, &tm) == NULL) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ +# define LOCALTIME_RET(field) \ + time_t seconds_ = (time_t)seconds; \ + struct tm tm; \ + \ + if (seconds_ != floor(seconds)) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ + if (localtime_r(&seconds_, &tm) == NULL) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ return tm.field; #else # ifdef OF_THREADS -# define GMTIME_RET(field) \ - time_t seconds_ = (time_t)seconds; \ - struct tm *tm; \ - \ - if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ - [mutex lock]; \ - \ - @try { \ - if ((tm = gmtime(&seconds_)) == NULL) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ - return tm->field; \ - } @finally { \ - [mutex unlock]; \ - } -# define LOCALTIME_RET(field) \ - time_t seconds_ = (time_t)seconds; \ - struct tm *tm; \ - \ - if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ - [mutex lock]; \ - \ - @try { \ - if ((tm = localtime(&seconds_)) == NULL) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ - return tm->field; \ - } @finally { \ - [mutex unlock]; \ +# define GMTIME_RET(field) \ + time_t seconds_ = (time_t)seconds; \ + struct tm *tm; \ + \ + if (seconds_ != floor(seconds)) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ + [mutex lock]; \ + \ + @try { \ + if ((tm = gmtime(&seconds_)) == NULL) \ + @throw [OFOutOfRangeException \ + exceptionWithClass: isa]; \ + \ + return tm->field; \ + } @finally { \ + [mutex unlock]; \ + } +# define LOCALTIME_RET(field) \ + time_t seconds_ = (time_t)seconds; \ + struct tm *tm; \ + \ + if (seconds_ != floor(seconds)) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ + [mutex lock]; \ + \ + @try { \ + if ((tm = localtime(&seconds_)) == NULL) \ + @throw [OFOutOfRangeException \ + exceptionWithClass: isa]; \ + \ + return tm->field; \ + } @finally { \ + [mutex unlock]; \ } # else -# define GMTIME_RET(field) \ - time_t seconds_ = (time_t)seconds; \ - struct tm *tm; \ - \ - if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ - if ((tm = gmtime(&seconds_)) == NULL) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ +# define GMTIME_RET(field) \ + time_t seconds_ = (time_t)seconds; \ + struct tm *tm; \ + \ + if (seconds_ != floor(seconds)) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ + if ((tm = gmtime(&seconds_)) == NULL) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ return tm->field; -# define LOCALTIME_RET(field) \ - time_t seconds_ = (time_t)seconds; \ - struct tm *tm; \ - \ - if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ - if ((tm = localtime(&seconds_)) == NULL) \ - @throw [OFOutOfRangeException newWithClass: isa]; \ - \ +# define LOCALTIME_RET(field) \ + time_t seconds_ = (time_t)seconds; \ + struct tm *tm; \ + \ + if (seconds_ != floor(seconds)) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ + if ((tm = localtime(&seconds_)) == NULL) \ + @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + \ return tm->field; # endif #endif @implementation OFDate @@ -227,17 +229,20 @@ tm.tm_isdst = -1; if (strptime([string UTF8String], [format UTF8String], &tm) == NULL) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; if (tm.tm_gmtoff) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; if ((seconds = mktime(&tm)) == -1) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; seconds += tm.tm_gmtoff; } @catch (id e) { [self release]; @throw e; @@ -256,14 +261,16 @@ tm.tm_isdst = -1; if (strptime([string UTF8String], [format UTF8String], &tm) == NULL) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; if ((seconds = mktime(&tm)) == -1) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; } @catch (id e) { [self release]; @throw e; } @@ -277,12 +284,13 @@ @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; seconds = [element doubleValue]; [pool release]; } @catch (id e) { @@ -337,12 +345,12 @@ - (of_comparison_result_t)compare: (id)object { OFDate *otherDate; if (![object isKindOfClass: [OFDate class]]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; otherDate = object; if (seconds < otherDate->seconds) return OF_ORDERED_ASCENDING; @@ -454,25 +462,25 @@ time_t seconds_ = (time_t)seconds; struct tm tm; char *buffer; if (seconds_ != floor(seconds)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; #ifdef HAVE_GMTIME_R if (gmtime_r(&seconds_, &tm) == NULL) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; #else # ifdef OF_THREADS [mutex lock]; @try { # endif struct tm *tmp; if ((tmp = gmtime(&seconds_)) == NULL) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; tm = *tmp; # ifdef OF_THREADS } @finally { [mutex unlock]; @@ -482,11 +490,11 @@ buffer = [self allocMemoryWithSize: of_pagesize]; @try { if (!strftime(buffer, of_pagesize, [format UTF8String], &tm)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; ret = [OFString stringWithUTF8String: buffer]; } @finally { [self freeMemory: buffer]; } @@ -500,25 +508,25 @@ time_t seconds_ = (time_t)seconds; struct tm tm; char *buffer; if (seconds_ != floor(seconds)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; #ifdef HAVE_LOCALTIME_R if (localtime_r(&seconds_, &tm) == NULL) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; #else # ifdef OF_THREADS [mutex lock]; @try { # endif struct tm *tmp; if ((tmp = localtime(&seconds_)) == NULL) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; tm = *tmp; # ifdef OF_THREADS } @finally { [mutex unlock]; @@ -528,11 +536,11 @@ buffer = [self allocMemoryWithSize: of_pagesize]; @try { if (!strftime(buffer, of_pagesize, [format UTF8String], &tm)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; ret = [OFString stringWithUTF8String: buffer]; } @finally { [self freeMemory: buffer]; } Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -97,12 +97,12 @@ { } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @implementation OFDictionary @@ -160,23 +160,23 @@ - init { if (isa == [OFDictionary class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; } - initWithDictionary: (OFDictionary*)dictionary { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithObject: (id)object forKey: (id)key { @@ -186,12 +186,12 @@ - initWithObjects: (OFArray*)objects forKeys: (OFArray*)keys { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithKeysAndObjects: (id)firstKey, ... { id ret; @@ -208,32 +208,32 @@ - initWithKey: (id)firstKey arguments: (va_list)arguments { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithSerialization: (OFXMLElement*)element { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - (id)objectForKey: (id)key { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (size_t)count { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - copy { return [self retain]; @@ -367,26 +367,26 @@ return ret; } - (OFEnumerator*)objectEnumerator { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (OFEnumerator*)keyEnumerator { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count_ { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } #if defined(OF_HAVE_BLOCKS) && defined(OF_HAVE_FAST_ENUMERATION) - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block Index: src/OFDictionary_hashtable.m ================================================================== --- src/OFDictionary_hashtable.m +++ src/OFDictionary_hashtable.m @@ -65,19 +65,21 @@ @try { uint32_t i; OFDictionary_hashtable *hashtable; if (dictionary == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; if (![dictionary isKindOfClass: [OFDictionary_hashtable class]] && ![dictionary isKindOfClass: [OFMutableDictionary_hashtable class]]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; hashtable = (OFDictionary_hashtable*)dictionary; data = [self allocMemoryForNItems: hashtable->size ofSize: sizeof(*data)]; @@ -128,16 +130,16 @@ uint32_t i, newSize; count = [dictionary count]; if (count > UINT32_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; for (newSize = 1; newSize < count; newSize <<= 1); if (newSize == 0) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self allocMemoryForNItems: newSize ofSize: sizeof(*data)]; for (i = 0; i < newSize; i++) @@ -166,11 +168,11 @@ for (i = 0; i < last && data[i] != NULL; i++); } if (data[i] != NULL) @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; object = [dictionary objectForKey: key]; @@ -198,12 +200,13 @@ @try { uint32_t i; struct of_dictionary_hashtable_bucket *bucket; if (key == nil || object == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; data = [self allocMemoryForNItems: 2 ofSize: sizeof(*data)]; size = 2; @@ -239,16 +242,16 @@ keysCArray = [keys cArray]; objectsCArray = [objects cArray]; count = [keys count]; if (count > UINT32_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; for (newSize = 1; newSize < count; newSize <<= 1); if (newSize == 0) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self allocMemoryForNItems: newSize ofSize: sizeof(*data)]; for (j = 0; j < newSize; j++) @@ -296,11 +299,11 @@ j++); } if (j >= last) @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; key = [keysCArray[i] copy]; @@ -343,30 +346,32 @@ struct of_dictionary_hashtable_bucket *bucket; va_copy(argumentsCopy, arguments); if (firstKey == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; key = firstKey; if ((object = va_arg(arguments, id)) == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; count = 1; for (; va_arg(argumentsCopy, id) != nil; count++); count >>= 1; if (count > UINT32_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; for (newSize = 1; newSize < count; newSize <<= 1); if (newSize == 0) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self allocMemoryForNItems: newSize ofSize: sizeof(*data)]; for (j = 0; j < newSize; j++) @@ -391,12 +396,12 @@ key = va_arg(arguments, id); object = va_arg(arguments, id); if (key == nil || object == nil) @throw [OFInvalidArgumentException - newWithClass: isa - selector: _cmd]; + exceptionWithClass: isa + selector: _cmd]; hash = [key hash]; last = size; for (j = hash & (size - 1); j < last && data[j] != NULL; @@ -429,11 +434,11 @@ j++); } if (j >= last) @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; bucket->key = [key copy]; bucket->object = [object retain]; @@ -474,22 +479,24 @@ OFXMLElement *keyElement, *objectElement; if ((![[element name] isEqual: @"OFDictionary"] && ![[element name] isEqual: @"OFMutableDictionary"]) || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; dictionary = [OFMutableDictionary dictionary]; keys = [element elementsForName: @"key" namespace: OF_SERIALIZATION_NS]; objects = [element elementsForName: @"object" namespace: OF_SERIALIZATION_NS]; if ([keys count] != [objects count]) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; keyEnumerator = [keys objectEnumerator]; objectEnumerator = [objects objectEnumerator]; pool2 = [[OFAutoreleasePool alloc] init]; @@ -502,11 +509,11 @@ object = [[objectElement elementsForNamespace: OF_SERIALIZATION_NS] firstObject]; if (key == nil || object == nil) @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; [dictionary setObject: [object objectByDeserializing] forKey: [key objectByDeserializing]]; [pool2 releaseObjects]; @@ -526,12 +533,12 @@ - (id)objectForKey: (id)key { uint32_t i, hash, last; if (key == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; hash = [key hash]; last = size; for (i = hash & (size - 1); i < last && data[i] != NULL; i++) { @@ -769,12 +776,12 @@ - (void)reset { if (mutationsPtr != NULL && *mutationsPtr != mutations) @throw [OFEnumerationMutationException - newWithClass: isa - object: dictionary]; + exceptionWithClass: isa + object: dictionary]; pos = 0; } @end @@ -781,12 +788,12 @@ @implementation OFDictionaryObjectEnumerator_hashtable - (id)nextObject { if (mutationsPtr != NULL && *mutationsPtr != mutations) @throw [OFEnumerationMutationException - newWithClass: isa - object: dictionary]; + exceptionWithClass: isa + object: dictionary]; for (; pos < size && (data[pos] == NULL || data[pos] == DELETED); pos++); if (pos < size) @@ -799,12 +806,12 @@ @implementation OFDictionaryKeyEnumerator_hashtable - (id)nextObject { if (mutationsPtr != NULL && *mutationsPtr != mutations) @throw [OFEnumerationMutationException - newWithClass: isa - object: dictionary]; + exceptionWithClass: isa + object: dictionary]; for (; pos < size && (data[pos] == NULL || data[pos] == DELETED); pos++); if (pos < size) Index: src/OFDoubleMatrix.m ================================================================== --- src/OFDoubleMatrix.m +++ src/OFDoubleMatrix.m @@ -66,12 +66,12 @@ - init { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithRows: (size_t)rows_ columns: (size_t)columns_ { @@ -82,16 +82,17 @@ columns = columns_; if (SIZE_MAX / rows < columns || SIZE_MAX / rows * columns < sizeof(double)) @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; if ((data = malloc(rows * columns * sizeof(double))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: rows * columns * sizeof(double)]; + exceptionWithClass: isa + requestedSize: rows * columns * + sizeof(double)]; memset(data, 0, rows * columns * sizeof(double)); if (rows == columns) { size_t i; @@ -137,16 +138,17 @@ rows = rows_; columns = columns_; if (SIZE_MAX / rows < columns || SIZE_MAX / rows * columns < sizeof(double)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((data = malloc(rows * columns * sizeof(double))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: rows * columns * sizeof(double)]; + exceptionWithClass: isa + requestedSize: rows * columns * + sizeof(double)]; for (i = 0; i < rows; i++) { size_t j; for (j = i; j < rows * columns; j += rows) @@ -171,20 +173,20 @@ - (void)setValue: (double)value forRow: (size_t)row column: (size_t)column { if (row >= rows || column >= columns) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data[row * columns + column] = value; } - (double)valueForRow: (size_t)row column: (size_t)column { if (row >= rows || column >= columns) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return data[row * columns + column]; } - (size_t)rows @@ -292,12 +294,12 @@ { size_t i; if (matrix->isa != isa || matrix->rows != rows || matrix->columns != columns) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < rows * columns; i++) data[i] += matrix->data[i]; } @@ -305,12 +307,12 @@ { size_t i; if (matrix->isa != isa || matrix->rows != rows || matrix->columns != columns) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < rows * columns; i++) data[i] -= matrix->data[i]; } @@ -335,17 +337,18 @@ { double *newData; size_t i, base1, base2; if (rows != matrix->columns) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if ((newData = malloc(matrix->rows * columns * sizeof(double))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: matrix->rows * columns * sizeof(double)]; + exceptionWithClass: isa + requestedSize: matrix->rows * columns * + sizeof(double)]; base1 = 0; base2 = 0; for (i = 0; i < columns; i++) { @@ -382,13 +385,13 @@ { double *newData; size_t i, k; if ((newData = malloc(rows * columns * sizeof(double))) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: rows * columns * - sizeof(double)]; + @throw [OFOutOfMemoryException + exceptionWithClass: isa + requestedSize: rows * columns * sizeof(double)]; rows ^= columns; columns ^= rows; rows ^= columns; @@ -408,12 +411,12 @@ OFDoubleMatrix *translation; double *cArray; if (rows != columns || vector->isa != doubleVector || vector->dimension != rows - 1) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; cArray = [vector cArray]; translation = [[OFDoubleMatrix alloc] initWithRows: rows columns: columns]; @@ -433,12 +436,12 @@ OFDoubleMatrix *rotation; double n[3], m, angleCos, angleSin; if (rows != 4 || columns != 4 || vector->isa != doubleVector || vector->dimension != 3) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; n[0] = vector->data[0]; n[1] = vector->data[1]; n[2] = vector->data[2]; @@ -482,12 +485,12 @@ double *cArray; size_t i, j; if (rows != columns || vector->isa != doubleVector || vector->dimension != rows - 1) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; cArray = [vector cArray]; scale = [[OFDoubleMatrix alloc] initWithRows: rows columns: columns]; Index: src/OFDoubleVector.m ================================================================== --- src/OFDoubleVector.m +++ src/OFDoubleVector.m @@ -62,12 +62,12 @@ - init { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithDimension: (size_t)dimension_ { self = [super init]; @@ -74,16 +74,16 @@ @try { dimension = dimension_; if (SIZE_MAX / dimension < sizeof(double)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((data = malloc(dimension * sizeof(double))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: dimension * sizeof(double)]; + exceptionWithClass: isa + requestedSize: dimension * sizeof(double)]; memset(data, 0, dimension * sizeof(double)); } @catch (id e) { [self release]; @throw e; @@ -117,16 +117,16 @@ size_t i; dimension = dimension_; if (SIZE_MAX / dimension < sizeof(double)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((data = malloc(dimension * sizeof(double))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: dimension * sizeof(double)]; + exceptionWithClass: isa + requestedSize: dimension * sizeof(double)]; data[0] = data_; for (i = 1; i < dimension; i++) data[i] = va_arg(arguments, double); } @catch (id e) { @@ -146,19 +146,19 @@ - (void)setValue: (double)value atIndex: (size_t)index { if (index >= dimension) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data[index] = value; } - (double)valueAtIndex: (size_t)index { if (index >= dimension) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return data[index]; } - (size_t)dimension @@ -170,13 +170,13 @@ { double *newData; size_t i; if ((newData = realloc(data, dimension_ * sizeof(double))) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: dimension_ * - sizeof(double)]; + @throw [OFOutOfMemoryException + exceptionWithClass: isa + requestedSize: dimension_ * sizeof(double)]; data = newData; for (i = dimension; i < dimension_; i++) data[i] = 0; @@ -295,12 +295,12 @@ - (void)addVector: (OFDoubleVector*)vector { size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < dimension; i++) data[i] += vector->data[i]; } @@ -307,12 +307,12 @@ - (void)subtractVector: (OFDoubleVector*)vector { size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < dimension; i++) data[i] -= vector->data[i]; } @@ -335,12 +335,12 @@ - (void)multiplyWithComponentsOfVector: (OFDoubleVector*)vector { size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < dimension; i++) data[i] *= vector->data[i]; } @@ -347,12 +347,12 @@ - (void)divideByComponentsOfVector: (OFDoubleVector*)vector { size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < dimension; i++) data[i] /= vector->data[i]; } @@ -360,12 +360,12 @@ { double dotProduct; size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; dotProduct = 0.0; for (i = 0; i < dimension; i++) dotProduct += data[i] * vector->data[i]; @@ -376,16 +376,16 @@ - (OFDoubleVector*)crossProductWithVector: (OFDoubleVector*)vector { OFDoubleVector *crossProduct; if (dimension != 3) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; if (vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; crossProduct = [OFDoubleVector vectorWithDimension: 3]; crossProduct->data[0] = data[1] * vector->data[2] - data[2] * vector->data[1]; @@ -401,17 +401,17 @@ { double *newData; size_t i, j, k; if (matrix->isa != doubleMatrix || dimension != matrix->columns) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if ((newData = malloc(matrix->rows * sizeof(double))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: matrix->rows * sizeof(double)]; + exceptionWithClass: isa + requestedSize: matrix->rows * sizeof(double)]; memset(newData, 0, matrix->rows * sizeof(double)); for (i = j = k = 0; i < matrix->rows * matrix->columns; i++) { newData[j] += matrix->data[i] * data[k]; Index: src/OFEnumerator.m ================================================================== --- src/OFEnumerator.m +++ src/OFEnumerator.m @@ -24,24 +24,24 @@ - init { if (isa == [OFEnumerator class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; } - (id)nextObject { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)reset { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } @end Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -230,12 +230,13 @@ if (mkdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], DIR_MODE)) #else if (mkdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #endif - @throw [OFCreateDirectoryFailedException newWithClass: self - path: path]; + @throw [OFCreateDirectoryFailedException + exceptionWithClass: self + path: path]; } + (OFArray*)filesInDirectoryAtPath: (OFString*)path { OFAutoreleasePool *pool; @@ -245,12 +246,12 @@ DIR *dir; struct dirent *dirent; if ((dir = opendir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) - @throw [OFOpenFileFailedException newWithClass: self - path: path + @throw [OFOpenFileFailedException exceptionWithClass: self + path: path mode: @"r"]; @try { pool = [[OFAutoreleasePool alloc] init]; @@ -280,13 +281,13 @@ pool = [[OFAutoreleasePool alloc] init]; path = [path stringByAppendingString: @"\\*"]; if ((handle = FindFirstFile([path cString], &fd)) == INVALID_HANDLE_VALUE) - @throw [OFOpenFileFailedException newWithClass: self - path: path - mode: @"r"]; + @throw [OFOpenFileFailedException exceptionWithClass: self + path: path + mode: @"r"]; @try { OFAutoreleasePool *pool2 = [[OFAutoreleasePool alloc] init]; do { @@ -316,40 +317,44 @@ } + (void)changeToDirectory: (OFString*)path { if (chdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) - @throw [OFChangeDirectoryFailedException newWithClass: self - path: path]; + @throw [OFChangeDirectoryFailedException + exceptionWithClass: self + path: path]; } #ifndef _PSP + (void)changeModeOfFile: (OFString*)path toMode: (mode_t)mode { # ifndef _WIN32 if (chmod([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], mode)) - @throw [OFChangeFileModeFailedException newWithClass: self - path: path - mode: mode]; + @throw [OFChangeFileModeFailedException + exceptionWithClass: self + path: path + mode: mode]; # else DWORD attributes = GetFileAttributes([path cString]); if (attributes == INVALID_FILE_ATTRIBUTES) - @throw [OFChangeFileModeFailedException newWithClass: self - path: path - mode: mode]; + @throw [OFChangeFileModeFailedException + exceptionWithClass: self + path: path + mode: mode]; if ((mode / 100) & 2) attributes &= ~FILE_ATTRIBUTE_READONLY; else attributes |= FILE_ATTRIBUTE_READONLY; if (!SetFileAttributes([path cString], attributes)) - @throw [OFChangeFileModeFailedException newWithClass: self - path: path - mode: mode]; + @throw [OFChangeFileModeFailedException + exceptionWithClass: self + path: path + mode: mode]; # endif } #endif + (OFDate*)modificationDateOfFile: (OFString*)path @@ -357,13 +362,13 @@ struct stat s; if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) /* FIXME: Maybe use another exception? */ - @throw [OFOpenFileFailedException newWithClass: self - path: path - mode: @"r"]; + @throw [OFOpenFileFailedException exceptionWithClass: self + path: path + mode: @"r"]; /* FIXME: We could be more precise on some OSes */ return [OFDate dateWithTimeIntervalSince1970: s.st_mtime]; } @@ -374,12 +379,12 @@ { uid_t uid = -1; gid_t gid = -1; if (owner == nil && group == nil) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; # ifdef OF_THREADS [mutex lock]; @try { @@ -388,14 +393,14 @@ struct passwd *passwd; if ((passwd = getpwnam([owner cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) @throw [OFChangeFileOwnerFailedException - newWithClass: self - path: path - owner: owner - group: group]; + exceptionWithClass: self + path: path + owner: owner + group: group]; uid = passwd->pw_uid; } if (group != nil) { @@ -402,14 +407,14 @@ struct group *group_; if ((group_ = getgrnam([group cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) @throw [OFChangeFileOwnerFailedException - newWithClass: self - path: path - owner: owner - group: group]; + exceptionWithClass: self + path: path + owner: owner + group: group]; gid = group_->gr_gid; } # ifdef OF_THREADS } @finally { @@ -417,14 +422,15 @@ } # endif if (chown([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], uid, gid)) - @throw [OFChangeFileOwnerFailedException newWithClass: self - path: path - owner: owner - group: group]; + @throw [OFChangeFileOwnerFailedException + exceptionWithClass: self + path: path + owner: owner + group: group]; } #endif + (void)copyFileAtPath: (OFString*)source toPath: (OFString*)destination @@ -442,12 +448,12 @@ } override = [self fileExistsAtPath: destination]; if ((buffer = malloc(of_pagesize)) == NULL) - @throw [OFOutOfMemoryException newWithClass: self - requestedSize: of_pagesize]; + @throw [OFOutOfMemoryException exceptionWithClass: self + requestedSize: of_pagesize]; @try { sourceFile = [OFFile fileWithPath: source mode: @"rb"]; destinationFile = [OFFile fileWithPath: destination @@ -494,13 +500,14 @@ [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (!MoveFile([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #endif - @throw [OFRenameFileFailedException newWithClass: self - sourcePath: source - destinationPath: destination]; + @throw [OFRenameFileFailedException + exceptionWithClass: self + sourcePath: source + destinationPath: destination]; [pool release]; } + (void)deleteFileAtPath: (OFString*)path @@ -508,19 +515,20 @@ #ifndef _WIN32 if (unlink([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (!DeleteFile([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #endif - @throw [OFDeleteFileFailedException newWithClass: self - path: path]; + @throw [OFDeleteFileFailedException exceptionWithClass: self + path: path]; } + (void)deleteDirectoryAtPath: (OFString*)path { if (rmdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) - @throw [OFDeleteDirectoryFailedException newWithClass: self - path: path]; + @throw [OFDeleteDirectoryFailedException + exceptionWithClass: self + path: path]; } #ifndef _WIN32 + (void)linkFileAtPath: (OFString*)source toPath: (OFString*)destination @@ -533,13 +541,13 @@ nil]; } if (link([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]) != 0) - @throw [OFLinkFailedException newWithClass: self - sourcePath: source - destinationPath: destination]; + @throw [OFLinkFailedException exceptionWithClass: self + sourcePath: source + destinationPath: destination]; [pool release]; } #endif @@ -555,24 +563,25 @@ nil]; } if (symlink([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]) != 0) - @throw [OFSymlinkFailedException newWithClass: self - sourcePath: source - destinationPath: destination]; + @throw [OFSymlinkFailedException + exceptionWithClass: self + sourcePath: source + destinationPath: destination]; [pool release]; } #endif - init { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithPath: (OFString*)path mode: (OFString*)mode { @@ -581,18 +590,20 @@ @try { int flags; if ((flags = parse_mode([mode cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == -1) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; if ((fileDescriptor = open([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], flags, DEFAULT_MODE)) == -1) - @throw [OFOpenFileFailedException newWithClass: isa - path: path - mode: mode]; + @throw [OFOpenFileFailedException + exceptionWithClass: isa + path: path + mode: mode]; closable = YES; } @catch (id e) { [self release]; @throw e; @@ -622,13 +633,13 @@ intoBuffer: (void*)buffer { size_t ret; if (fileDescriptor == -1 || atEndOfStream) - @throw [OFReadFailedException newWithClass: isa - stream: self - requestedLength: length]; + @throw [OFReadFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; if ((ret = read(fileDescriptor, buffer, length)) == 0) atEndOfStream = YES; return ret; @@ -637,46 +648,46 @@ - (void)_writeNBytes: (size_t)length fromBuffer: (const void*)buffer { if (fileDescriptor == -1 || atEndOfStream || write(fileDescriptor, buffer, length) < length) - @throw [OFWriteFailedException newWithClass: isa - stream: self - requestedLength: length]; + @throw [OFWriteFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; } - (void)_seekToOffset: (off_t)offset { if (lseek(fileDescriptor, offset, SEEK_SET) == -1) - @throw [OFSeekFailedException newWithClass: isa - stream: self - offset: offset - whence: SEEK_SET]; + @throw [OFSeekFailedException exceptionWithClass: isa + stream: self + offset: offset + whence: SEEK_SET]; } - (off_t)_seekForwardWithOffset: (off_t)offset { off_t ret; if ((ret = lseek(fileDescriptor, offset, SEEK_CUR)) == -1) - @throw [OFSeekFailedException newWithClass: isa - stream: self - offset: offset - whence: SEEK_CUR]; + @throw [OFSeekFailedException exceptionWithClass: isa + stream: self + offset: offset + whence: SEEK_CUR]; return ret; } - (off_t)_seekToOffsetRelativeToEnd: (off_t)offset { off_t ret; if ((ret = lseek(fileDescriptor, offset, SEEK_END)) == -1) - @throw [OFSeekFailedException newWithClass: isa - stream: self - offset: offset - whence: SEEK_END]; + @throw [OFSeekFailedException exceptionWithClass: isa + stream: self + offset: offset + whence: SEEK_END]; return ret; } - (int)fileDescriptor @@ -705,12 +716,12 @@ - initWithPath: (OFString*)path mode: (OFString*)mode { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - autorelease { return self; @@ -730,28 +741,28 @@ return OF_RETAIN_COUNT_MAX; } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of stupid warning */ } - (void)_seekToOffset: (off_t)offset { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (off_t)_seekForwardWithOffset: (off_t)offset { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (off_t)_seekToOffsetRelativeToEnd: (off_t)offset { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } @end Index: src/OFFloatMatrix.m ================================================================== --- src/OFFloatMatrix.m +++ src/OFFloatMatrix.m @@ -66,12 +66,12 @@ - init { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithRows: (size_t)rows_ columns: (size_t)columns_ { @@ -81,17 +81,17 @@ rows = rows_; columns = columns_; if (SIZE_MAX / rows < columns || SIZE_MAX / rows * columns < sizeof(float)) - @throw [OFOutOfRangeException - newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((data = malloc(rows * columns * sizeof(float))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: rows * columns * sizeof(float)]; + exceptionWithClass: isa + requestedSize: rows * columns * + sizeof(float)]; memset(data, 0, rows * columns * sizeof(float)); if (rows == columns) { size_t i; @@ -137,16 +137,17 @@ rows = rows_; columns = columns_; if (SIZE_MAX / rows < columns || SIZE_MAX / rows * columns < sizeof(float)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((data = malloc(rows * columns * sizeof(float))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: rows * columns * sizeof(float)]; + exceptionWithClass: isa + requestedSize: rows * columns * + sizeof(float)]; for (i = 0; i < rows; i++) { size_t j; for (j = i; j < rows * columns; j += rows) @@ -171,20 +172,20 @@ - (void)setValue: (float)value forRow: (size_t)row column: (size_t)column { if (row >= rows || column >= columns) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data[row * columns + column] = value; } - (float)valueForRow: (size_t)row column: (size_t)column { if (row >= rows || column >= columns) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return data[row * columns + column]; } - (size_t)rows @@ -292,12 +293,12 @@ { size_t i; if (matrix->isa != isa || matrix->rows != rows || matrix->columns != columns) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < rows * columns; i++) data[i] += matrix->data[i]; } @@ -305,12 +306,12 @@ { size_t i; if (matrix->isa != isa || matrix->rows != rows || matrix->columns != columns) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < rows * columns; i++) data[i] -= matrix->data[i]; } @@ -335,17 +336,18 @@ { float *newData; size_t i, base1, base2; if (rows != matrix->columns) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if ((newData = malloc(matrix->rows * columns * sizeof(float))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: matrix->rows * columns * sizeof(float)]; + exceptionWithClass: isa + requestedSize: matrix->rows * columns * + sizeof(float)]; base1 = 0; base2 = 0; for (i = 0; i < columns; i++) { @@ -382,13 +384,13 @@ { float *newData; size_t i, k; if ((newData = malloc(rows * columns * sizeof(float))) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: rows * columns * - sizeof(float)]; + @throw [OFOutOfMemoryException + exceptionWithClass: isa + requestedSize: rows * columns * sizeof(float)]; rows ^= columns; columns ^= rows; rows ^= columns; @@ -408,12 +410,12 @@ OFFloatMatrix *translation; float *cArray; if (rows != columns || vector->isa != floatVector || vector->dimension != rows - 1) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; cArray = [vector cArray]; translation = [[OFFloatMatrix alloc] initWithRows: rows columns: columns]; @@ -433,12 +435,12 @@ OFFloatMatrix *rotation; float n[3], m, angleCos, angleSin; if (rows != 4 || columns != 4 || vector->isa != floatVector || vector->dimension != 3) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; n[0] = vector->data[0]; n[1] = vector->data[1]; n[2] = vector->data[2]; @@ -482,12 +484,12 @@ float *cArray; size_t i, j; if (rows != columns || vector->isa != floatVector || vector->dimension != rows - 1) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; cArray = [vector cArray]; scale = [[OFFloatMatrix alloc] initWithRows: rows columns: columns]; Index: src/OFFloatVector.m ================================================================== --- src/OFFloatVector.m +++ src/OFFloatVector.m @@ -62,12 +62,12 @@ - init { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithDimension: (size_t)dimension_ { self = [super init]; @@ -74,16 +74,16 @@ @try { dimension = dimension_; if (SIZE_MAX / dimension < sizeof(float)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((data = malloc(dimension * sizeof(float))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: dimension * sizeof(float)]; + exceptionWithClass: isa + requestedSize: dimension * sizeof(float)]; memset(data, 0, dimension * sizeof(float)); } @catch (id e) { [self release]; @throw e; @@ -117,16 +117,16 @@ size_t i; dimension = dimension_; if (SIZE_MAX / dimension < sizeof(float)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((data = malloc(dimension * sizeof(float))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: dimension * sizeof(float)]; + exceptionWithClass: isa + requestedSize: dimension * sizeof(float)]; data[0] = data_; for (i = 1; i < dimension; i++) data[i] = (float)va_arg(arguments, double); } @catch (id e) { @@ -146,19 +146,19 @@ - (void)setValue: (float)value atIndex: (size_t)index { if (index >= dimension) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data[index] = value; } - (float)valueAtIndex: (size_t)index { if (index >= dimension) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return data[index]; } - (size_t)dimension @@ -170,13 +170,13 @@ { float *newData; size_t i; if ((newData = realloc(data, dimension_ * sizeof(float))) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: dimension_ * - sizeof(float)]; + @throw [OFOutOfMemoryException + exceptionWithClass: isa + requestedSize: dimension_ * sizeof(float)]; data = newData; for (i = dimension; i < dimension_; i++) data[i] = 0; @@ -295,12 +295,12 @@ - (void)addVector: (OFFloatVector*)vector { size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < dimension; i++) data[i] += vector->data[i]; } @@ -307,12 +307,12 @@ - (void)subtractVector: (OFFloatVector*)vector { size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < dimension; i++) data[i] -= vector->data[i]; } @@ -335,12 +335,12 @@ - (void)multiplyWithComponentsOfVector: (OFFloatVector*)vector { size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < dimension; i++) data[i] *= vector->data[i]; } @@ -347,12 +347,12 @@ - (void)divideByComponentsOfVector: (OFFloatVector*)vector { size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; for (i = 0; i < dimension; i++) data[i] /= vector->data[i]; } @@ -360,12 +360,12 @@ { float dotProduct; size_t i; if (vector->isa != isa || vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; dotProduct = 0.0f; for (i = 0; i < dimension; i++) dotProduct += data[i] * vector->data[i]; @@ -376,16 +376,16 @@ - (OFFloatVector*)crossProductWithVector: (OFFloatVector*)vector { OFFloatVector *crossProduct; if (dimension != 3) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; if (vector->dimension != dimension) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; crossProduct = [OFFloatVector vectorWithDimension: 3]; crossProduct->data[0] = data[1] * vector->data[2] - data[2] * vector->data[1]; @@ -401,17 +401,17 @@ { float *newData; size_t i, j, k; if (matrix->isa != floatMatrix || dimension != matrix->columns) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if ((newData = malloc(matrix->rows * sizeof(float))) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: matrix->rows * sizeof(float)]; + exceptionWithClass: isa + requestedSize: matrix->rows * sizeof(float)]; memset(newData, 0, matrix->rows * sizeof(float)); for (i = j = k = 0; i < matrix->rows * matrix->columns; i++) { newData[j] += matrix->data[i] * data[k]; Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -189,20 +189,20 @@ OFString *scheme = [URL scheme]; OFTCPSocket *sock; OFHTTPRequestResult *result; if (![scheme isEqual: @"http"] && ![scheme isEqual: @"https"]) - @throw [OFUnsupportedProtocolException newWithClass: isa - URL: URL]; + @throw [OFUnsupportedProtocolException exceptionWithClass: isa + URL: URL]; if ([scheme isEqual: @"http"]) sock = [OFTCPSocket socket]; else { if (of_http_request_tls_socket_class == Nil) @throw [OFUnsupportedProtocolException - newWithClass: isa - URL: URL]; + exceptionWithClass: isa + URL: URL]; sock = [[[of_http_request_tls_socket_class alloc] init] autorelease]; } @@ -281,11 +281,11 @@ */ line = [sock readLine]; if (![line hasPrefix: @"HTTP/1.0 "] && ![line hasPrefix: @"HTTP/1.1 "]) @throw [OFInvalidServerReplyException - newWithClass: isa]; + exceptionWithClass: isa]; status = (int)[[line substringWithRange: of_range(9, 3)] decimalValue]; serverHeaders = [OFMutableDictionary dictionary]; @@ -297,11 +297,11 @@ if ([line isEqual: @""]) break; if ((tmp = strchr(line_c, ':')) == NULL) @throw [OFInvalidServerReplyException - newWithClass: isa]; + exceptionWithClass: isa]; key = [OFString stringWithUTF8String: line_c length: tmp - line_c]; normalize_key(key); @@ -384,21 +384,21 @@ [serverHeaders objectForKey: @"Content-Length"]) != nil) { intmax_t cl = [contentLengthHeader decimalValue]; if (cl > SIZE_MAX) @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; /* * We only want to throw on these status codes as we * will throw an OFHTTPRequestFailedException for all * other status codes later. */ if (cl != bytesReceived && (status == 200 || status == 301 || status == 302 || status == 303)) @throw [OFTruncatedDataException - newWithClass: isa]; + exceptionWithClass: isa]; } [serverHeaders makeImmutable]; result = [[OFHTTPRequestResult alloc] @@ -407,13 +407,13 @@ data: data]; if (status != 200 && status != 301 && status != 302 && status != 303) @throw [OFHTTPRequestFailedException - newWithClass: isa - HTTPRequest: self - result: result]; + exceptionWithClass: isa + HTTPRequest: self + result: result]; } @finally { [pool release]; } return [result autorelease]; Index: src/OFHash.m ================================================================== --- src/OFHash.m +++ src/OFHash.m @@ -21,33 +21,33 @@ #import "OFNotImplementedException.h" @implementation OFHash + (size_t)digestSize { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (size_t)blockSize { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } - (void)updateWithBuffer: (const char*)buffer length: (size_t)length { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (uint8_t*)digest { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (BOOL)isCalculated { return calculated; } @end Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -45,12 +45,13 @@ OFEnumerator *enumerator; OFXMLElement *child; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; enumerator = [[element children] objectEnumerator]; pool2 = [[OFAutoreleasePool alloc] init]; while ((child = [enumerator nextObject]) != nil) { @@ -441,12 +442,13 @@ - (id)nextObject { id ret; if (*mutationsPtr != mutations) - @throw [OFEnumerationMutationException newWithClass: isa - object: list]; + @throw [OFEnumerationMutationException + exceptionWithClass: isa + object: list]; if (current == NULL) return nil; ret = current->object; @@ -456,10 +458,12 @@ } - (void)reset { if (*mutationsPtr != mutations) - @throw [OFEnumerationMutationException newWithClass: isa]; + @throw [OFEnumerationMutationException + exceptionWithClass: isa + object: list]; current = [list firstListObject]; } @end Index: src/OFMD5Hash.m ================================================================== --- src/OFMD5Hash.m +++ src/OFMD5Hash.m @@ -153,12 +153,13 @@ if (length == 0) return; if (calculated) - @throw [OFHashAlreadyCalculatedException newWithClass: isa - hash: self]; + @throw [OFHashAlreadyCalculatedException + exceptionWithClass: isa + hash: self]; /* Update bitcount */ t = bits[0]; if ((bits[0] = t + ((uint32_t)length << 3)) < t) /* Carry from low to high */ Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -101,12 +101,12 @@ { } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @implementation OFMutableArray @@ -127,12 +127,12 @@ - init { if (isa == [OFMutableArray class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; } @@ -148,19 +148,19 @@ } - (void)addObject: (id)object atIndex: (size_t)index { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)replaceObjectAtIndex: (size_t)index withObject: (id)object { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)replaceObject: (id)oldObject withObject: (id)newObject { @@ -190,12 +190,12 @@ } } - (void)removeObjectAtIndex: (size_t)index { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)removeObject: (id)object { size_t i, count = [self count]; Index: src/OFMutableArray_adjacent.m ================================================================== --- src/OFMutableArray_adjacent.m +++ src/OFMutableArray_adjacent.m @@ -74,11 +74,11 @@ { id *cArray = [array cArray]; id oldObject; if (index >= [array count]) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; oldObject = cArray[index]; cArray[index] = [object retain]; [oldObject release]; } @@ -149,11 +149,11 @@ { id *cArray = [array cArray], *copy; size_t i, count = [array count]; if (nObjects > count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; copy = [self allocMemoryForNItems: nObjects ofSize: sizeof(id)]; memcpy(copy, cArray + (count - nObjects), nObjects * sizeof(id)); @@ -172,11 +172,11 @@ { id *cArray = [array cArray], *copy; size_t i, count = [array count]; if (range.length > count - range.start) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; copy = [self allocMemoryForNItems: range.length ofSize: sizeof(id)]; memcpy(copy, cArray + range.start, range.length * sizeof(id)); @@ -235,12 +235,12 @@ unsigned long mutations2 = mutations; for (i = 0; i < count && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException - newWithClass: isa - object: self]; + exceptionWithClass: isa + object: self]; block(cArray[i], i, &stop); } } @@ -254,18 +254,19 @@ for (i = 0; i < count && !stop; i++) { id newObject; if (mutations != mutations2) @throw [OFEnumerationMutationException - newWithClass: isa - object: self]; + exceptionWithClass: isa + object: self]; newObject = block(cArray[i], i, &stop); if (newObject == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; [newObject retain]; [cArray[i] release]; cArray[i] = newObject; } Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -94,12 +94,12 @@ { } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @implementation OFMutableDictionary @@ -120,28 +120,28 @@ - init { if (isa == [OFMutableDictionary class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; } - (void)setObject: (id)object forKey: (id)key { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)removeObjectForKey: (id)key { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - copy { return [[OFDictionary alloc] initWithDictionary: self]; Index: src/OFMutableDictionary_hashtable.m ================================================================== --- src/OFMutableDictionary_hashtable.m +++ src/OFMutableDictionary_hashtable.m @@ -46,21 +46,21 @@ size_t fullness = newCount * 4 / size; struct of_dictionary_hashtable_bucket **newData; uint32_t i, newSize; if (newCount > UINT32_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if (fullness >= 3) newSize = size << 1; else if (fullness <= 1) newSize = size >> 1; else return; if (newSize == 0) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; newData = [self allocMemoryForNItems: newSize ofSize: sizeof(*newData)]; for (i = 0; i < newSize; i++) @@ -84,11 +84,11 @@ } if (j >= last) { [self freeMemory: newData]; @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; } newData[j] = data[i]; } } @@ -104,12 +104,12 @@ { uint32_t i, hash, last; id old; if (key == nil || object == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; hash = [key hash]; last = size; for (i = hash & (size - 1); i < last && data[i] != NULL; i++) { @@ -153,11 +153,11 @@ for (i = 0; i < last && data[i] != NULL && data[i] != DELETED; i++); } if (i >= last) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; if (copyKey) { @try { @@ -194,12 +194,12 @@ - (void)removeObjectForKey: (id)key { uint32_t i, hash, last; if (key == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; hash = [key hash]; last = size; for (i = hash & (size - 1); i < last && data[i] != NULL; i++) { @@ -289,12 +289,12 @@ unsigned long mutations2 = mutations; for (i = 0; i < size && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException - newWithClass: isa - object: self]; + exceptionWithClass: isa + object: self]; if (data[i] != NULL && data[i] != DELETED) block(data[i]->key, data[i]->object, &stop); } } @@ -306,20 +306,20 @@ unsigned long mutations2 = mutations; for (i = 0; i < size && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException - newWithClass: isa - object: self]; + exceptionWithClass: isa + object: self]; if (data[i] != NULL && data[i] != DELETED) { id new = block(data[i]->key, data[i]->object, &stop); if (new == nil) @throw [OFInvalidArgumentException - newWithClass: isa - selector: _cmd]; + exceptionWithClass: isa + selector: _cmd]; [new retain]; [data[i]->object release]; data[i]->object = new; } Index: src/OFMutableSet.m ================================================================== --- src/OFMutableSet.m +++ src/OFMutableSet.m @@ -84,12 +84,12 @@ { } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @implementation OFMutableSet @@ -110,27 +110,27 @@ - init { if (isa == [OFMutableSet class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; } - (void)addObject: (id)object { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)removeObject: (id)object { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)minusSet: (OFSet*)set { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -76,11 +76,12 @@ cLen = of_string_utf8_to_unicode(s->cString + i, s->cStringLength - i, &c); if (cLen == 0 || c > 0x10FFFF) { [self freeMemory: unicodeString]; - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } if (c >> 8 < tableSize) { of_unichar_t tc = table[c >> 8][c & 0xFF]; @@ -97,11 +98,12 @@ newCStringLength += 3; else if (c < 0x110000) newCStringLength += 4; else { [self freeMemory: unicodeString]; - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } i += cLen; } @@ -117,11 +119,12 @@ for (i = 0; i < unicodeLen; i++) { if ((d = of_string_unicode_to_utf8(unicodeString[i], newCString + j)) == 0) { [self freeMemory: unicodeString]; [self freeMemory: newCString]; - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } j += d; } assert(j == newCStringLength); @@ -151,11 +154,11 @@ switch (of_string_check_utf8(UTF8String, UTF8StringLength, &length)) { case 1: s->UTF8 = YES; break; case -1: - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; } s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + UTF8StringLength + 1]; @@ -178,11 +181,11 @@ switch (of_string_check_utf8(UTF8String, UTF8StringLength, &length)) { case 1: s->UTF8 = YES; break; case -1: - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; } s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + UTF8StringLength + 1]; @@ -222,12 +225,12 @@ - (void)appendString: (OFString*)string { size_t UTF8StringLength; if (string == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; UTF8StringLength = [string UTF8StringLength]; s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + @@ -259,16 +262,16 @@ { char *UTF8String; int UTF8StringLength; if (format == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if ((UTF8StringLength = of_vasprintf(&UTF8String, [format UTF8String], arguments)) == -1) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException exceptionWithClass: isa]; @try { [self appendUTF8String: UTF8String withLength: UTF8StringLength]; } @finally { @@ -307,18 +310,20 @@ continue; /* A start byte can't happen first as we reversed everything */ if (OF_UNLIKELY(s->cString[i] & 0x40)) { madvise(s->cString, s->cStringLength, MADV_NORMAL); - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } /* Next byte must not be ASCII */ if (OF_UNLIKELY(s->cStringLength < i + 1 || !(s->cString[i + 1] & 0x80))) { madvise(s->cString, s->cStringLength, MADV_NORMAL); - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } /* Next byte is the start byte */ if (OF_LIKELY(s->cString[i + 1] & 0x40)) { s->cString[i] ^= s->cString[i + 1]; @@ -331,11 +336,12 @@ /* Second next byte must not be ASCII */ if (OF_UNLIKELY(s->cStringLength < i + 2 || !(s->cString[i + 2] & 0x80))) { madvise(s->cString, s->cStringLength, MADV_NORMAL); - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } /* Second next byte is the start byte */ if (OF_LIKELY(s->cString[i + 2] & 0x40)) { s->cString[i] ^= s->cString[i + 2]; @@ -348,11 +354,12 @@ /* Third next byte must not be ASCII */ if (OF_UNLIKELY(s->cStringLength < i + 3 || !(s->cString[i + 3] & 0x80))) { madvise(s->cString, s->cStringLength, MADV_NORMAL); - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } /* Third next byte is the start byte */ if (OF_LIKELY(s->cString[i + 3] & 0x40)) { s->cString[i] ^= s->cString[i + 3]; @@ -367,11 +374,11 @@ continue; } /* UTF-8 does not allow more than 4 bytes per character */ madvise(s->cString, s->cStringLength, MADV_NORMAL); - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; } madvise(s->cString, s->cStringLength, MADV_NORMAL); } @@ -391,11 +398,11 @@ atIndex: (size_t)index { size_t newCStringLength; if (index > s->length) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if (s->UTF8) index = of_string_index_to_position(s->cString, index, s->cStringLength); @@ -417,15 +424,15 @@ { size_t start = range.start; size_t end = range.start + range.length; if (start > end) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if (end > s->length) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; s->length -= end - start; if (s->UTF8) { start = of_string_index_to_position(s->cString, start, @@ -441,11 +448,10 @@ @try { s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } - (void)replaceCharactersInRange: (of_range_t)range withString: (OFString*)replacement @@ -453,15 +459,15 @@ size_t start = range.start; size_t end = range.start + range.length; size_t newCStringLength, newLength; if (start > end) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if (end > s->length) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; newLength = s->length - (end - start) + [replacement length]; if (s->UTF8) { start = of_string_index_to_position(s->cString, start, @@ -567,11 +573,10 @@ @try { s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } - (void)deleteTrailingWhitespaces { @@ -594,11 +599,10 @@ @try { s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } - (void)deleteEnclosingWhitespaces { @@ -633,11 +637,10 @@ @try { s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } - copy { Index: src/OFNull.m ================================================================== --- src/OFNull.m +++ src/OFNull.m @@ -45,12 +45,12 @@ pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; [pool release]; return [OFNull null]; } @@ -99,10 +99,10 @@ return OF_RETAIN_COUNT_MAX; } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -82,11 +82,12 @@ case OF_NUMBER_FLOAT: \ return (t)value.float_; \ case OF_NUMBER_DOUBLE: \ return (t)value.double_; \ default: \ - @throw [OFInvalidFormatException newWithClass: isa]; \ + @throw [OFInvalidFormatException \ + exceptionWithClass: isa]; \ } #define CALCULATE(o, n) \ switch (type) { \ case OF_NUMBER_BOOL: \ return [OFNumber numberWithBool: \ @@ -165,11 +166,12 @@ value.float_ o [n floatValue]]; \ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: \ value.double_ o [n doubleValue]]; \ default: \ - @throw [OFInvalidFormatException newWithClass: isa]; \ + @throw [OFInvalidFormatException \ + exceptionWithClass: isa]; \ } #define CALCULATE2(o, n) \ switch (type) { \ case OF_NUMBER_BOOL: \ return [OFNumber numberWithBool: \ @@ -243,14 +245,16 @@ case OF_NUMBER_UINTPTR: \ return [OFNumber numberWithUIntPtr: \ value.uintptr o [n uIntPtrValue]]; \ case OF_NUMBER_FLOAT: \ case OF_NUMBER_DOUBLE: \ - @throw [OFNotImplementedException newWithClass: isa \ - selector: _cmd]; \ + @throw [OFNotImplementedException \ + exceptionWithClass: isa \ + selector: _cmd]; \ default: \ - @throw [OFInvalidFormatException newWithClass: isa]; \ + @throw [OFInvalidFormatException \ + exceptionWithClass: isa]; \ } #define CALCULATE3(o) \ switch (type) { \ case OF_NUMBER_BOOL: \ return [OFNumber numberWithBool: value.bool_ o]; \ @@ -306,11 +310,12 @@ case OF_NUMBER_FLOAT: \ return [OFNumber numberWithFloat: value.float_ o]; \ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: value.double_ o]; \ default: \ - @throw [OFInvalidFormatException newWithClass: isa]; \ + @throw [OFInvalidFormatException \ + exceptionWithClass: isa]; \ } @implementation OFNumber + numberWithBool: (BOOL)bool_ { @@ -442,12 +447,12 @@ return [[[self alloc] initWithDouble: double_] autorelease]; } - init { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - initWithBool: (BOOL)bool_ { self = [super init]; @@ -716,12 +721,13 @@ OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *typeString; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; typeString = [[element attributeForName: @"type"] stringValue]; if ([typeString isEqual: @"boolean"]) { type = OF_NUMBER_BOOL; @@ -730,12 +736,12 @@ value.bool_ = YES; else if ([[element stringValue] isEqual: @"NO"]) value.bool_ = NO; else @throw [OFInvalidArgumentException - newWithClass: isa - selector: _cmd]; + exceptionWithClass: isa + selector: _cmd]; } else if ([typeString isEqual: @"unsigned"]) { /* * FIXME: This will fail if the value is bigger than * INTMAX_MAX! */ @@ -749,12 +755,13 @@ value.float_ = [element floatValue]; } else if ([typeString isEqual: @"double"]) { type = OF_NUMBER_DOUBLE; value.double_ = [element doubleValue]; } else - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; [pool release]; } @catch (id e) { [self release]; @throw e; @@ -1116,11 +1123,11 @@ numberWithFloat: fmodf(value.float_, [number floatValue])]; case OF_NUMBER_DOUBLE: return [OFNumber numberWithDouble: fmod(value.double_, [number doubleValue])]; default: - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException exceptionWithClass: isa]; } } - copy { @@ -1160,11 +1167,11 @@ case OF_NUMBER_FLOAT: return [OFString stringWithFormat: @"%g", value.float_]; case OF_NUMBER_DOUBLE: return [OFString stringWithFormat: @"%lg", value.double_]; default: - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException exceptionWithClass: isa]; } } - (OFXMLElement*)XMLElementBySerializing { @@ -1222,15 +1229,15 @@ [element setStringValue: [OFString stringWithFormat: @"%la", value.double_]]; break; default: - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException exceptionWithClass: isa]; } [element retain]; [pool release]; [element autorelease]; return element; } @end Index: src/OFObject+Serialization.m ================================================================== --- src/OFObject+Serialization.m +++ src/OFObject+Serialization.m @@ -35,12 +35,12 @@ OFXMLElement *root; OFString *ret; if (![self conformsToProtocol: @protocol(OFSerialization)]) @throw [OFNotImplementedException - newWithClass: isa - selector: @selector(stringBySerializing)]; + exceptionWithClass: isa + selector: @selector(stringBySerializing)]; pool = [[OFAutoreleasePool alloc] init]; element = [(id)self XMLElementBySerializing]; root = [OFXMLElement elementWithName: @"serialization" Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -99,12 +99,13 @@ #endif static void enumeration_mutation_handler(id object) { - @throw [OFEnumerationMutationException newWithClass: [object class] - object: object]; + @throw [OFEnumerationMutationException + exceptionWithClass: [object class] + object: object]; } #ifndef HAVE_OBJC_ENUMERATIONMUTATION void objc_enumerationMutation(id object) @@ -195,11 +196,12 @@ #if !defined(OF_ATOMIC_OPS) if (!of_spinlock_new( &((struct pre_ivar*)instance)->retainCountSpinlock)) { free(instance); - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } #endif instance = (OFObject*)((char*)instance + PRE_IVAR_ALIGN); memset(instance, 0, instanceSize); @@ -302,31 +304,31 @@ { #if defined(OF_OBJFW_RUNTIME) const char *ret; if ((ret = objc_get_type_encoding(self, selector)) == NULL) - @throw [OFNotImplementedException newWithClass: self - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: selector]; return ret; #elif defined(OF_OLD_GNU_RUNTIME) Method_t m; if ((m = class_get_instance_method(self, selector)) == NULL || m->method_types == NULL) - @throw [OFNotImplementedException newWithClass: self - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: selector]; return m->method_types; #else Method m; const char *ret; if ((m = class_getInstanceMethod(self, selector)) == NULL || (ret = method_getTypeEncoding(m)) == NULL) - @throw [OFNotImplementedException newWithClass: self - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: selector]; return ret; #endif } @@ -338,23 +340,23 @@ + (IMP)setImplementation: (IMP)newImp forClassMethod: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) if (newImp == (IMP)0 || !class_respondsToSelector(self->isa, selector)) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; return objc_replace_class_method(self, selector, newImp); #elif defined(OF_OLD_GNU_RUNTIME) Method_t method; MethodList_t iter; method = class_get_class_method(self->class_pointer, selector); if (newImp == (IMP)0 || method == METHOD_NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; for (iter = ((Class)self->class_pointer)->methods; iter != NULL; iter = iter->method_next) { int i; @@ -381,12 +383,12 @@ #else Method method; if (newImp == (IMP)0 || (method = class_getClassMethod(self, selector)) == NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; /* * Cast needed because it's isa in the Apple runtime, but class_pointer * in the GNU runtime. */ @@ -399,12 +401,12 @@ withMethodFromClass: (Class)class { IMP newImp; if (![class isSubclassOfClass: self]) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; newImp = [class methodForSelector: selector]; return [self setImplementation: newImp forClassMethod: selector]; @@ -413,23 +415,23 @@ + (IMP)setImplementation: (IMP)newImp forInstanceMethod: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) if (newImp == (IMP)0 || !class_respondsToSelector(self, selector)) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; return objc_replace_instance_method(self, selector, newImp); #elif defined(OF_OLD_GNU_RUNTIME) Method_t method; MethodList_t iter; method = class_get_instance_method(self, selector); if (newImp == (IMP)0 || method == METHOD_NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; for (iter = ((Class)self)->methods; iter != NULL; iter = iter->method_next) { int i; @@ -455,12 +457,12 @@ #else Method method; if (newImp == (IMP)0 || (method = class_getInstanceMethod(self, selector)) == NULL) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; return class_replaceMethod(self, selector, newImp, method_getTypeEncoding(method)); #endif } @@ -469,12 +471,12 @@ withMethodFromClass: (Class)class { IMP newImp; if (![class isSubclassOfClass: self]) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; newImp = [class instanceMethodForSelector: selector]; return [self setImplementation: newImp forInstanceMethod: selector]; @@ -499,12 +501,12 @@ return NO; } if ((methodList = malloc(sizeof(*methodList))) == NULL) @throw [OFOutOfMemoryException - newWithClass: self - requestedSize: sizeof(*methodList)]; + exceptionWithClass: self + requestedSize: sizeof(*methodList)]; methodList->method_next = ((Class)self)->methods; methodList->method_count = 1; methodList->method_list[0].method_name = selector; @@ -515,12 +517,12 @@ __objc_update_dispatch_table_for_class(self); return YES; #else - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; #endif } + (BOOL)addClassMethod: (SEL)selector withTypeEncoding: (const char*)typeEncoding @@ -542,12 +544,12 @@ return NO; } if ((methodList = malloc(sizeof(*methodList))) == NULL) @throw [OFOutOfMemoryException - newWithClass: self - requestedSize: sizeof(*methodList)]; + exceptionWithClass: self + requestedSize: sizeof(*methodList)]; methodList->method_next = ((Class)self->class_pointer)->methods; methodList->method_count = 1; methodList->method_list[0].method_name = selector; @@ -558,12 +560,12 @@ __objc_update_dispatch_table_for_class((Class)self->class_pointer); return YES; #else - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; #endif } + (void)inheritMethodsFromClass: (Class)class { @@ -698,12 +700,12 @@ implementation: implementation]; } } } #else - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; #endif [self inheritMethodsFromClass: [class superclass]]; } @@ -790,31 +792,31 @@ { #if defined(OF_OBJFW_RUNTIME) const char *ret; if ((ret = objc_get_type_encoding(isa, selector)) == NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: selector]; return ret; #elif defined(OF_OLD_GNU_RUNTIME) Method_t m; if ((m = class_get_instance_method(isa, selector)) == NULL || m->method_types == NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: selector]; return m->method_types; #else Method m; const char *ret; if ((m = class_getInstanceMethod(isa, selector)) == NULL || (ret = method_getTypeEncoding(m)) == NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: selector]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: selector]; return ret; #endif } @@ -843,16 +845,17 @@ memoryChunksSize = PRE_IVAR->memoryChunksSize + 1; if (UINT_MAX - PRE_IVAR->memoryChunksSize < 1 || memoryChunksSize > UINT_MAX / sizeof(void*)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((memoryChunks = realloc(PRE_IVAR->memoryChunks, memoryChunksSize * sizeof(void*))) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: memoryChunksSize]; + @throw [OFOutOfMemoryException + exceptionWithClass: isa + requestedSize: memoryChunksSize]; PRE_IVAR->memoryChunks = memoryChunks; PRE_IVAR->memoryChunks[PRE_IVAR->memoryChunksSize] = pointer; PRE_IVAR->memoryChunksSize = memoryChunksSize; } @@ -867,21 +870,22 @@ memoryChunksSize = PRE_IVAR->memoryChunksSize + 1; if (UINT_MAX - PRE_IVAR->memoryChunksSize == 0 || memoryChunksSize > UINT_MAX / sizeof(void*)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if ((pointer = malloc(size)) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: size]; + @throw [OFOutOfMemoryException exceptionWithClass: isa + requestedSize: size]; if ((memoryChunks = realloc(PRE_IVAR->memoryChunks, memoryChunksSize * sizeof(void*))) == NULL) { free(pointer); - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: memoryChunksSize]; + @throw [OFOutOfMemoryException + exceptionWithClass: isa + requestedSize: memoryChunksSize]; } PRE_IVAR->memoryChunks = memoryChunks; PRE_IVAR->memoryChunks[PRE_IVAR->memoryChunksSize] = pointer; PRE_IVAR->memoryChunksSize = memoryChunksSize; @@ -894,11 +898,11 @@ { if (nItems == 0 || size == 0) return NULL; if (nItems > SIZE_MAX / size) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return [self allocMemoryWithSize: nItems * size]; } - (void*)resizeMemory: (void*)pointer @@ -919,20 +923,20 @@ while (iter-- > PRE_IVAR->memoryChunks) { if (OF_UNLIKELY(*iter == pointer)) { if (OF_UNLIKELY((pointer = realloc(pointer, size)) == NULL)) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: size]; + exceptionWithClass: isa + requestedSize: size]; *iter = pointer; return pointer; } } - @throw [OFMemoryNotPartOfObjectException newWithClass: isa - pointer: pointer]; + @throw [OFMemoryNotPartOfObjectException exceptionWithClass: isa + pointer: pointer]; } - (void*)resizeMemory: (void*)pointer toNItems: (size_t)nItems ofSize: (size_t)size @@ -945,11 +949,11 @@ [self freeMemory: pointer]; return NULL; } if (nItems > SIZE_MAX / size) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return [self resizeMemory: pointer toSize: nItems * size]; } @@ -997,12 +1001,12 @@ return; } } - @throw [OFMemoryNotPartOfObjectException newWithClass: isa - pointer: pointer]; + @throw [OFMemoryNotPartOfObjectException exceptionWithClass: isa + pointer: pointer]; } - retain { #if defined(OF_ATOMIC_OPS) @@ -1089,21 +1093,21 @@ /* Required to use properties with the Apple runtime */ - copyWithZone: (void*)zone { if (zone != NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; return [(id)self copy]; } - mutableCopyWithZone: (void*)zone { if (zone != NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; return [(id)self mutableCopy]; } /* @@ -1110,46 +1114,46 @@ * Those are needed as the root class is the superclass of the root class's * metaclass and thus instance methods can be sent to class objects as well. */ + (void)addMemoryToPool: (void*)pointer { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void*)allocMemoryWithSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void*)allocMemoryForNItems: (size_t)nItems ofSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void*)resizeMemory: (void*)pointer toSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void*)resizeMemory: (void*)pointer toNItems: (size_t)nItems ofSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + (void)freeMemory: (void*)pointer { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + retain { return self; @@ -1169,21 +1173,21 @@ { } + (void)dealloc { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + copyWithZone: (void*)zone { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } + mutableCopyWithZone: (void*)zone { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } @end Index: src/OFPlugin.m ================================================================== --- src/OFPlugin.m +++ src/OFPlugin.m @@ -49,18 +49,20 @@ file = [OFMutableString stringWithString: path]; [file appendString: @PLUGIN_SUFFIX]; if ((handle = dlopen([file cStringWithEncoding: OF_STRING_ENCODING_NATIVE], RTLD_LAZY)) == NULL) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; [pool release]; initPlugin = (OFPlugin*(*)())dlsym(handle, "init_plugin"); if (initPlugin == NULL || (plugin = initPlugin()) == nil) { dlclose(handle); - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } plugin->handle = handle; return plugin; } @@ -68,12 +70,12 @@ - init { if (isa == [OFPlugin class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; } Index: src/OFSHA1Hash.m ================================================================== --- src/OFSHA1Hash.m +++ src/OFSHA1Hash.m @@ -162,12 +162,13 @@ { if (length == 0) return; if (calculated) - @throw [OFHashAlreadyCalculatedException newWithClass: isa - hash: self]; + @throw [OFHashAlreadyCalculatedException + exceptionWithClass: isa + hash: self]; sha1_update(state, &count, buffer, buffer_, length); } - (uint8_t*)digest Index: src/OFSOCKS5Socket.m ================================================================== --- src/OFSOCKS5Socket.m +++ src/OFSOCKS5Socket.m @@ -31,12 +31,12 @@ - init { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithProxyHost: (OFString*)host port: (uint16_t)port { @@ -77,14 +77,15 @@ [self readExactlyNBytes: 2 intoBuffer: reply]; if (reply[0] != 5 || reply[1] != 0) { [self close]; - @throw [OFConnectionFailedException newWithClass: isa - socket: self - host: proxyHost - port: proxyPort]; + @throw [OFConnectionFailedException + exceptionWithClass: isa + socket: self + host: proxyHost + port: proxyPort]; } oldBuffersWrites = [self buffersWrites]; [self setBuffersWrites: YES]; @@ -105,14 +106,14 @@ [self readExactlyNBytes: 4 intoBuffer: reply]; if (reply[0] != 5 || reply[1] != 0 || reply[2] != 0) { [self close]; - @throw [OFConnectionFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFConnectionFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; } /* Skip the rest of the reply */ switch (reply[3]) { case 1: /* IPv4 */ @@ -127,14 +128,14 @@ [self readExactlyNBytes: 16 intoBuffer: reply]; break; default: [self close]; - @throw [OFConnectionFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFConnectionFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; } [self readBigEndianInt16]; } @end Index: src/OFSeekableStream.m ================================================================== --- src/OFSeekableStream.m +++ src/OFSeekableStream.m @@ -19,24 +19,24 @@ #import "OFNotImplementedException.h" @implementation OFSeekableStream - (void)_seekToOffset: (off_t)offset { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (off_t)_seekForwardWithOffset: (off_t)offset { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (off_t)_seekToOffsetRelativeToEnd: (off_t)offset { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)seekToOffset: (off_t)offset { [self _seekToOffset: offset]; Index: src/OFSet.m ================================================================== --- src/OFSet.m +++ src/OFSet.m @@ -83,12 +83,12 @@ { } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @implementation OFSet @@ -137,31 +137,31 @@ - init { if (isa == [OFSet class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; } - initWithSet: (OFSet*)set { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithArray: (OFArray*)array { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - (id)initWithObjects:(id)firstObject, ... { id ret; @@ -178,46 +178,46 @@ - initWithObject: (id)firstObject arguments: (va_list)arguments { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithSerialization: (OFXMLElement*)element { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - (size_t)count { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (BOOL)containsObject: (id)object { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (OFEnumerator*)objectEnumerator { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (BOOL)isEqual: (id)object { OFSet *otherSet; Index: src/OFSet_hashtable.m ================================================================== --- src/OFSet_hashtable.m +++ src/OFSet_hashtable.m @@ -138,12 +138,13 @@ pool = [[OFAutoreleasePool alloc] init]; if ((![[element name] isEqual: @"OFSet"] && ![[element name] isEqual: @"OFMutableSet"]) || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; one = [OFNumber numberWithSize: 1]; enumerator = [[element children] objectEnumerator]; pool2 = [[OFAutoreleasePool alloc] init]; Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -55,12 +55,12 @@ - init { if (isa == [OFStream class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } self = [super init]; cache = NULL; @@ -70,26 +70,26 @@ return self; } - (BOOL)_isAtEndOfStream { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (size_t)_readNBytes: (size_t)length intoBuffer: (void*)buffer { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)_writeNBytes: (size_t)length fromBuffer: (const void*)buffer { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - copy { return [self retain]; @@ -691,12 +691,12 @@ delimiterUTF8String = [delimiter UTF8String]; delimiterLength = [delimiter UTF8StringLength]; j = 0; if (delimiterLength == 0) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; /* Look if there's something in our cache */ if (!waitingForDelimiter && cache != NULL) { for (i = 0; i < cacheLength; i++) { if (cache[i] != delimiterUTF8String[j++]) @@ -1330,16 +1330,16 @@ { char *UTF8String; int length; if (format == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if ((length = of_vasprintf(&UTF8String, [format UTF8String], arguments)) == -1) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException exceptionWithClass: isa]; @try { [self writeNBytes: length fromBuffer: UTF8String]; } @finally { @@ -1365,39 +1365,39 @@ int flags; blocking = enable; if ((flags = fcntl([self fileDescriptor], F_GETFL)) == -1) - @throw [OFSetOptionFailedException newWithClass: isa - stream: self]; + @throw [OFSetOptionFailedException exceptionWithClass: isa + stream: self]; if (enable) flags &= ~O_NONBLOCK; else flags |= O_NONBLOCK; if (fcntl([self fileDescriptor], F_SETFL, flags) == -1) - @throw [OFSetOptionFailedException newWithClass: isa - stream: self]; + @throw [OFSetOptionFailedException exceptionWithClass: isa + stream: self]; #else - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; #endif } - (int)fileDescriptor { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)close { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (BOOL)_isWaitingForDelimiter { return waitingForDelimiter; } @end Index: src/OFStreamObserver.m ================================================================== --- src/OFStreamObserver.m +++ src/OFStreamObserver.m @@ -106,11 +106,11 @@ queueFDs = [[OFDataArray alloc] initWithItemSize: sizeof(int)]; #ifndef _WIN32 if (pipe(cancelFD)) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; #else /* Make sure WSAStartup has been called */ [OFTCPSocket class]; cancelFD[0] = socket(AF_INET, SOCK_DGRAM, 0); @@ -117,11 +117,11 @@ cancelFD[1] = socket(AF_INET, SOCK_DGRAM, 0); if (cancelFD[0] == INVALID_SOCKET || cancelFD[1] == INVALID_SOCKET) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; cancelAddr.sin_family = AF_INET; cancelAddr.sin_port = 0; cancelAddr.sin_addr.s_addr = inet_addr("127.0.0.1"); cancelAddr2 = cancelAddr; @@ -128,18 +128,18 @@ if (bind(cancelFD[0], (struct sockaddr*)&cancelAddr, sizeof(cancelAddr)) || bind(cancelFD[1], (struct sockaddr*)&cancelAddr2, sizeof(cancelAddr2))) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; cancelAddrLen = sizeof(cancelAddr); if (getsockname(cancelFD[0], (struct sockaddr*)&cancelAddr, &cancelAddrLen)) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; #endif maxFD = cancelFD[0]; FDToStream = [self allocMemoryForNItems: maxFD + 1 ofSize: sizeof(OFStream*)]; @@ -272,30 +272,30 @@ #endif } - (void)_addFileDescriptorForReading: (int)fd { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)_addFileDescriptorForWriting: (int)fd { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)_removeFileDescriptorForReading: (int)fd { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)_removeFileDescriptorForWriting: (int)fd { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)_processQueue { [mutex lock]; @@ -370,12 +370,12 @@ [self observeWithTimeout: -1]; } - (BOOL)observeWithTimeout: (int)timeout { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (BOOL)_processCache { OFAutoreleasePool *pool; Index: src/OFStreamObserver_kqueue.m ================================================================== --- src/OFStreamObserver_kqueue.m +++ src/OFStreamObserver_kqueue.m @@ -39,11 +39,11 @@ self = [super init]; @try { if ((kernelQueue = kqueue()) == -1) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; changeList = [[OFDataArray alloc] initWithItemSize: sizeof(struct kevent)]; [self _addFileDescriptorForReading: cancelFD[0]]; @@ -113,11 +113,11 @@ if (events == -1) { switch (errno) { case EINTR: return NO; case ENOMEM: - @throw [OFOutOfMemoryException newWithClass: isa]; + @throw [OFOutOfMemoryException exceptionWithClass: isa]; default: assert(0); } } Index: src/OFStreamObserver_poll.m ================================================================== --- src/OFStreamObserver_poll.m +++ src/OFStreamObserver_poll.m @@ -133,11 +133,11 @@ FDsCArray = [FDs cArray]; nFDs = [FDs count]; #ifdef OPEN_MAX if (nFDs > OPEN_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; #endif if (poll(FDsCArray, (nfds_t)nFDs, timeout) < 1) return NO; Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -53,11 +53,12 @@ if (self != [OFStreamSocket class]) return; if (WSAStartup(MAKEWORD(2, 0), &wsa)) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } #endif + socket { @@ -73,19 +74,19 @@ intoBuffer: (void*)buffer { ssize_t ret; if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa - socket: self]; + @throw [OFNotConnectedException exceptionWithClass: isa + socket: self]; if (atEndOfStream) { OFReadFailedException *e; - e = [OFReadFailedException newWithClass: isa - stream: self - requestedLength: length]; + e = [OFReadFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; #ifndef _WIN32 e->errNo = ENOTCONN; #else e->errNo = WSAENOTCONN; #endif @@ -92,13 +93,13 @@ @throw e; } if ((ret = recv(sock, buffer, length, 0)) < 0) - @throw [OFReadFailedException newWithClass: isa - stream: self - requestedLength: length]; + @throw [OFReadFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; if (ret == 0) atEndOfStream = YES; return ret; @@ -106,19 +107,19 @@ - (void)_writeNBytes: (size_t)length fromBuffer: (const void*)buffer { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa - socket: self]; + @throw [OFNotConnectedException exceptionWithClass: isa + socket: self]; if (atEndOfStream) { OFWriteFailedException *e; - e = [OFWriteFailedException newWithClass: isa - stream: self - requestedLength: length]; + e = [OFWriteFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; #ifndef _WIN32 e->errNo = ENOTCONN; #else e->errNo = WSAENOTCONN; #endif @@ -125,24 +126,24 @@ @throw e; } if (send(sock, buffer, length, 0) < length) - @throw [OFWriteFailedException newWithClass: isa - stream: self - requestedLength: length]; + @throw [OFWriteFailedException exceptionWithClass: isa + stream: self + requestedLength: length]; } #ifdef _WIN32 - (void)setBlocking: (BOOL)enable { u_long v = enable; blocking = enable; if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) - @throw [OFSetOptionFailedException newWithClass: isa - stream: self]; + @throw [OFSetOptionFailedException exceptionWithClass: isa + stream: self]; } #endif - (int)fileDescriptor { @@ -150,12 +151,12 @@ } - (void)close { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa - socket: self]; + @throw [OFNotConnectedException exceptionWithClass: isa + socket: self]; close(sock); sock = INVALID_SOCKET; atEndOfStream = NO; Index: src/OFString+Serialization.m ================================================================== --- src/OFString+Serialization.m +++ src/OFString+Serialization.m @@ -38,24 +38,22 @@ id object; @try { root = [OFXMLElement elementWithXMLString: self]; } @catch (OFMalformedXMLException *e) { - [e release]; - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; } @catch (OFUnboundNamespaceException *e) { - [e release]; - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; } elements = [root elementsForNamespace: OF_SERIALIZATION_NS]; if ([elements count] != 1) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; object = [[elements firstObject] objectByDeserializing]; [object retain]; [pool release]; Index: src/OFString+URLEncoding.m ================================================================== --- src/OFString+URLEncoding.m +++ src/OFString+URLEncoding.m @@ -41,12 +41,12 @@ * Oh, and we can't use [self allocWithSize:] here as self might be a * @"" literal. */ if ((retCString = malloc(([self UTF8StringLength] * 3) + 1)) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: ([self UTF8StringLength] * 3) + 1]; + exceptionWithClass: isa + requestedSize: ([self UTF8StringLength] * 3) + 1]; for (i = 0; *string != '\0'; string++) { if (isalnum((int)*string) || *string == '-' || *string == '_' || *string == '.' || *string == '~') retCString[i++] = *string; @@ -83,12 +83,12 @@ int state = 0; size_t i; if ((retCString = malloc([self UTF8StringLength] + 1)) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: [self UTF8StringLength] + 1]; + exceptionWithClass: isa + requestedSize: [self UTF8StringLength] + 1]; for (i = 0; *string; string++) { switch (state) { case 0: if (*string == '%') @@ -109,11 +109,11 @@ else if (*string >= 'a' && *string <= 'f') byte += (*string - 'a' + 10) << shift; else { free(retCString); @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; } if (++state == 3) { retCString[i++] = byte; state = 0; @@ -125,11 +125,11 @@ } retCString[i] = '\0'; if (state != 0) { free(retCString); - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; } @try { ret = [OFString stringWithUTF8String: retCString length: i]; Index: src/OFString+XMLEscaping.m ================================================================== --- src/OFString+XMLEscaping.m +++ src/OFString+XMLEscaping.m @@ -43,12 +43,12 @@ /* * We can't use allocMemoryWithSize: here as it might be a @"" literal */ if ((retCString = malloc(retLength)) == NULL) - @throw [OFOutOfMemoryException newWithClass: isa - requestedSize: retLength]; + @throw [OFOutOfMemoryException exceptionWithClass: isa + requestedSize: retLength]; for (i = 0; i < length; i++) { switch (string[i]) { case '<': append = "<"; @@ -84,12 +84,12 @@ if ((newRetCString = realloc(retCString, retLength + appendLen)) == NULL) { free(retCString); @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: retLength + appendLen]; + exceptionWithClass: isa + requestedSize: retLength + appendLen]; } retCString = newRetCString; retLength += appendLen - 1; memcpy(retCString + j, append, appendLen); Index: src/OFString+XMLUnescaping.m ================================================================== --- src/OFString+XMLUnescaping.m +++ src/OFString+XMLUnescaping.m @@ -138,11 +138,11 @@ tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; } else if (delegate != nil) { OFAutoreleasePool *pool; @@ -156,25 +156,25 @@ tmp = [delegate string: self containsUnknownEntityNamed: n]; if (tmp == nil) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; } else @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; last = i + 1; inEntity = NO; } } if (inEntity) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendUTF8String: string + last withLength: i - last]; [ret makeImmutable]; @@ -240,11 +240,11 @@ tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; } else { OFAutoreleasePool *pool; @@ -257,11 +257,11 @@ length: entityLength]; tmp = block(self, entityString); if (tmp == nil) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; } @@ -269,11 +269,11 @@ inEntity = NO; } } if (inEntity) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendUTF8String: string + last withLength: i - last]; [ret makeImmutable]; Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -496,17 +496,17 @@ switch (of_string_check_utf8(cString, cStringLength, &s->length)) { case 1: if (encoding == OF_STRING_ENCODING_ASCII) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; s->UTF8 = YES; break; case -1: @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; } memcpy(s->cString, cString, cStringLength); s->cString[cStringLength] = 0; @@ -530,11 +530,11 @@ bytes = of_string_unicode_to_utf8( (uint8_t)cString[i], buffer); if (bytes == 0) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; s->cStringLength += bytes - 1; s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + 1]; @@ -554,11 +554,12 @@ break; case OF_STRING_ENCODING_WINDOWS_1252: table = of_windows_1252; break; default: - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } for (i = j = 0; i < cStringLength; i++) { char buffer[4]; of_unichar_t character; @@ -571,19 +572,19 @@ character = table[(uint8_t)cString[i]]; if (character == 0xFFFD) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; s->UTF8 = YES; characterBytes = of_string_unicode_to_utf8(character, buffer); if (characterBytes == 0) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; s->cStringLength += characterBytes - 1; s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + 1]; @@ -710,11 +711,11 @@ j += 4; break; default: @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; } } s->cString[j] = '\0'; @@ -721,11 +722,10 @@ @try { s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ - [e release]; } } @catch (id e) { [self release]; @throw e; } @@ -790,18 +790,18 @@ size_t characterLen; /* Missing high surrogate */ if ((character & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; if ((character & 0xFC00) == 0xD800) { uint16_t nextCharacter; if (length <= i + 1) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; nextCharacter = (swap ? of_bswap16(string[i + 1]) : string[i + 1]); character = (((character & 0x3FF) << 10) | @@ -843,11 +843,11 @@ j += 4; break; default: @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; } } s->cString[j] = '\0'; @@ -854,11 +854,10 @@ @try { s->cString = [self resizeMemory: s->cString toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ - [e release]; } } @catch (id e) { [self release]; @throw e; } @@ -886,19 +885,21 @@ @try { int cStringLength; if (format == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; s = [self allocMemoryWithSize: sizeof(*s)]; memset(s, 0, sizeof(*s)); if ((cStringLength = of_vasprintf(&s->cString, [format UTF8String], arguments)) == -1) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; s->cStringLength = cStringLength; @try { switch (of_string_check_utf8(s->cString, @@ -906,16 +907,17 @@ case 1: s->UTF8 = YES; break; case -1: @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; } [self addMemoryToPool: s->cString]; } @catch (id e) { free(s->cString); + @throw e; } } @catch (id e) { [self release]; @throw e; } @@ -1013,16 +1015,17 @@ @try { OFFile *file; if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &st) == -1) - @throw [OFOpenFileFailedException newWithClass: isa - path: path - mode: @"rb"]; + @throw [OFOpenFileFailedException + exceptionWithClass: isa + path: path + mode: @"rb"]; if (st.st_size > SIZE_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; file = [[OFFile alloc] initWithPath: path mode: @"rb"]; @try { @@ -1079,13 +1082,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]; if (encoding == OF_STRING_ENCODING_AUTODETECT && (contentType = [[result headers] objectForKey: @"Content-Type"])) { contentType = [[contentType mutableCopy] autorelease]; [contentType lower]; @@ -1116,12 +1119,13 @@ @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; self = [self initWithString: [element stringValue]]; [pool release]; } @catch (id e) { @@ -1142,16 +1146,17 @@ switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cString; case OF_STRING_ENCODING_ASCII: if (s->UTF8) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; return s->cString; default: - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } } - (size_t)length { @@ -1168,16 +1173,17 @@ switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cStringLength; case OF_STRING_ENCODING_ASCII: if (s->UTF8) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; return s->cStringLength; default: - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } } - (BOOL)isEqual: (id)object { @@ -1213,12 +1219,12 @@ OFString *otherString; size_t otherCStringLength, minimumCStringLength; int compare; if (![object isKindOfClass: [OFString class]]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; otherString = object; otherCStringLength = [otherString UTF8StringLength]; minimumCStringLength = (s->cStringLength > otherCStringLength ? otherCStringLength : s->cStringLength); @@ -1243,12 +1249,12 @@ const char *otherCString; size_t i, j, otherCStringLength, minimumCStringLength; int compare; if (![otherString isKindOfClass: [OFString class]]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; otherCString = [otherString UTF8String]; otherCStringLength = [otherString UTF8StringLength]; if (!s->UTF8) { @@ -1280,11 +1286,12 @@ s->cStringLength - i, &c1); l2 = of_string_utf8_to_unicode(otherCString + j, otherCStringLength - j, &c2); if (l1 == 0 || l2 == 0 || c1 > 0x10FFFF || c2 > 0x10FFFF) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; if (c1 >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { of_unichar_t tc = of_unicode_casefolding_table[c1 >> 8][c1 & 0xFF]; @@ -1360,21 +1367,21 @@ - (of_unichar_t)characterAtIndex: (size_t)index { of_unichar_t character; if (index >= s->length) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if (!s->UTF8) return s->cString[index]; index = of_string_index_to_position(s->cString, index, s->cStringLength); if (!of_string_utf8_to_unicode(s->cString + index, s->cStringLength - index, &character)) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; return character; } - (size_t)indexOfFirstOccurrenceOfString: (OFString*)string @@ -1439,11 +1446,11 @@ { size_t start = range.start; size_t end = range.start + range.length; if (end > s->length) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if (s->UTF8) { start = of_string_index_to_position(s->cString, start, s->cStringLength); end = of_string_index_to_position(s->cString, end, @@ -1745,27 +1752,28 @@ if (expectWhitespace) { if (cString[i] != ' ' && cString[i] != '\t' && cString[i] != '\n' && cString[i] != '\r' && cString[i] != '\f') @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; continue; } if (cString[i] >= '0' && cString[i] <= '9') { if (INTMAX_MAX / 10 < value || INTMAX_MAX - value * 10 < cString[i] - '0') @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; value = (value * 10) + (cString[i] - '0'); } else if (cString[i] == ' ' || cString[i] == '\t' || cString[i] == '\n' || cString[i] == '\r' || cString[i] == '\f') expectWhitespace = YES; else - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; } if (cString[0] == '-') value *= -1; @@ -1800,11 +1808,11 @@ if (expectWhitespace) { if (cString[i] != ' ' && cString[i] != '\t' && cString[i] != '\n' && cString[i] != '\r' && cString[i] != '\f') @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; continue; } if (cString[i] >= '0' && cString[i] <= '9') { newValue = (value << 4) | (cString[i] - '0'); @@ -1819,20 +1827,21 @@ cString[i] == '\t' || cString[i] == '\n' || cString[i] == '\r' || cString[i] == '\f') { expectWhitespace = YES; continue; } else - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; if (newValue < value) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; value = newValue; } if (!foundValue) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException exceptionWithClass: isa]; return value; } - (float)floatValue @@ -1852,11 +1861,11 @@ for (; *endPointer != '\0'; endPointer++) if (*endPointer != ' ' && *endPointer != '\t' && *endPointer != '\n' && *endPointer != '\r' && *endPointer != '\f') @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; return value; } - (double)doubleValue @@ -1876,11 +1885,11 @@ for (; *endPointer != '\0'; endPointer++) if (*endPointer != ' ' && *endPointer != '\t' && *endPointer != '\n' && *endPointer != '\r' && *endPointer != '\f') @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; return value; } - (of_unichar_t*)unicodeString @@ -1903,11 +1912,12 @@ cLen = of_string_utf8_to_unicode(s->cString + i, s->cStringLength - i, &c); if (cLen == 0 || c > 0x10FFFF) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; ret[j++] = c; i += cLen; } Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -83,12 +83,12 @@ - (void)connectToHost: (OFString*)host port: (uint16_t)port { if (sock != INVALID_SOCKET) - @throw [OFAlreadyConnectedException newWithClass: isa - socket: self]; + @throw [OFAlreadyConnectedException exceptionWithClass: isa + socket: self]; #ifdef HAVE_THREADSAFE_GETADDRINFO struct addrinfo hints, *res, *res0; char portCString[7]; @@ -97,13 +97,14 @@ hints.ai_socktype = SOCK_STREAM; snprintf(portCString, 7, "%" PRIu16, port); if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], portCString, &hints, &res0)) - @throw [OFAddressTranslationFailedException newWithClass: isa - socket: self - host: host]; + @throw [OFAddressTranslationFailedException + exceptionWithClass: isa + socket: self + host: host]; for (res = res0; res != NULL; res = res->ai_next) { if ((sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == INVALID_SOCKET) continue; @@ -134,13 +135,14 @@ OF_STRING_ENCODING_NATIVE])) == NULL) { # ifdef OF_THREADS [addrlist release]; [mutex unlock]; # endif - @throw [OFAddressTranslationFailedException newWithClass: isa - socket: self - host: host]; + @throw [OFAddressTranslationFailedException + exceptionWithClass: isa + socket: self + host: host]; } memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = of_bswap16_if_le(port); @@ -149,14 +151,14 @@ (sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { # ifdef OF_THREADS [addrlist release]; [mutex unlock]; # endif - @throw [OFConnectionFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFConnectionFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; } # ifdef OF_THREADS @try { for (ip = he->h_addr_list; *ip != NULL; ip++) @@ -193,14 +195,14 @@ sock = INVALID_SOCKET; } #endif if (sock == INVALID_SOCKET) - @throw [OFConnectionFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFConnectionFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; } - (uint16_t)bindToHost: (OFString*)host port: (uint16_t)port { @@ -210,12 +212,12 @@ struct sockaddr_in6 in6; } addr; socklen_t addrLen; if (sock != INVALID_SOCKET) - @throw [OFAlreadyConnectedException newWithClass: isa - socket: self]; + @throw [OFAlreadyConnectedException exceptionWithClass: isa + socket: self]; #ifdef HAVE_THREADSAFE_GETADDRINFO struct addrinfo hints, *res; char portCString[7]; @@ -224,28 +226,29 @@ hints.ai_socktype = SOCK_STREAM; snprintf(portCString, 7, "%" PRIu16, port); if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], portCString, &hints, &res)) - @throw [OFAddressTranslationFailedException newWithClass: isa - socket: self - host: host]; + @throw [OFAddressTranslationFailedException + exceptionWithClass: isa + socket: self + host: host]; if ((sock = socket(res->ai_family, SOCK_STREAM, 0)) == INVALID_SOCKET) - @throw [OFBindFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFBindFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; if (bind(sock, res->ai_addr, res->ai_addrlen) == -1) { freeaddrinfo(res); close(sock); sock = INVALID_SOCKET; - @throw [OFBindFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFBindFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; } freeaddrinfo(res); #else struct hostent *he; @@ -257,13 +260,14 @@ if ((he = gethostbyname([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) { # ifdef OF_THREADS [mutex unlock]; # endif - @throw [OFAddressTranslationFailedException newWithClass: isa - socket: self - host: host]; + @throw [OFAddressTranslationFailedException + exceptionWithClass: isa + socket: self + host: host]; } memset(&addr, 0, sizeof(addr)); addr.in.sin_family = AF_INET; addr.in.sin_port = of_bswap16_if_le(port); @@ -270,33 +274,34 @@ if (he->h_addrtype != AF_INET || he->h_addr_list[0] == NULL) { # ifdef OF_THREADS [mutex unlock]; # endif - @throw [OFAddressTranslationFailedException newWithClass: isa - socket: self - host: host]; + @throw [OFAddressTranslationFailedException + exceptionWithClass: isa + socket: self + host: host]; } memcpy(&addr.in.sin_addr.s_addr, he->h_addr_list[0], he->h_length); # ifdef OF_THREADS [mutex unlock]; # endif if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) - @throw [OFBindFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFBindFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; if (bind(sock, (struct sockaddr*)&addr.in, sizeof(addr.in)) == -1) { close(sock); sock = INVALID_SOCKET; - @throw [OFBindFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFBindFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; } #endif if (port > 0) return port; @@ -303,53 +308,53 @@ addrLen = sizeof(addr.storage); if (getsockname(sock, (struct sockaddr*)&addr, &addrLen)) { close(sock); sock = INVALID_SOCKET; - @throw [OFBindFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFBindFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; } if (addr.storage.ss_family == AF_INET) return of_bswap16_if_le(addr.in.sin_port); if (addr.storage.ss_family == AF_INET6) return of_bswap16_if_le(addr.in6.sin6_port); close(sock); sock = INVALID_SOCKET; - @throw [OFBindFailedException newWithClass: isa - socket: self - host: host - port: port]; + @throw [OFBindFailedException exceptionWithClass: isa + socket: self + host: host + port: port]; } - (void)listenWithBackLog: (int)backLog { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa - socket: self]; + @throw [OFNotConnectedException exceptionWithClass: isa + socket: self]; if (listen(sock, backLog) == -1) - @throw [OFListenFailedException newWithClass: isa - socket: self - backLog: backLog]; + @throw [OFListenFailedException exceptionWithClass: isa + socket: self + backLog: backLog]; listening = YES; } - (void)listen { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa - socket: self]; + @throw [OFNotConnectedException exceptionWithClass: isa + socket: self]; if (listen(sock, 5) == -1) - @throw [OFListenFailedException newWithClass: isa - socket: self - backLog: 5]; + @throw [OFListenFailedException exceptionWithClass: isa + socket: self + backLog: 5]; listening = YES; } - (OFTCPSocket*)accept @@ -370,12 +375,12 @@ } if ((newSock = accept(sock, (struct sockaddr*)addr, &addrLen)) == INVALID_SOCKET) { [newSocket release]; - @throw [OFAcceptFailedException newWithClass: isa - socket: self]; + @throw [OFAcceptFailedException exceptionWithClass: isa + socket: self]; } newSocket->sock = newSock; newSocket->sockAddr = addr; newSocket->sockAddrLen = addrLen; @@ -386,30 +391,30 @@ - (void)setKeepAlivesEnabled: (BOOL)enable { int v = enable; if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, sizeof(v))) - @throw [OFSetOptionFailedException newWithClass: isa - stream: self]; + @throw [OFSetOptionFailedException exceptionWithClass: isa + stream: self]; } - (OFString*)remoteAddress { char *host; if (sockAddr == NULL || sockAddrLen == 0) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; #ifdef HAVE_THREADSAFE_GETADDRINFO host = [self allocMemoryWithSize: NI_MAXHOST]; @try { if (getnameinfo((struct sockaddr*)sockAddr, sockAddrLen, host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST)) @throw [OFAddressTranslationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; return [OFString stringWithCString: host encoding: OF_STRING_ENCODING_NATIVE]; } @finally { [self freeMemory: host]; @@ -422,11 +427,11 @@ # endif host = inet_ntoa(((struct sockaddr_in*)sockAddr)->sin_addr); if (host == NULL) @throw [OFAddressTranslationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; return [OFString stringWithCString: host encoding: OF_STRING_ENCODING_NATIVE]; # ifdef OF_THREADS } @finally { Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -65,11 +65,11 @@ objc_thread_add(); #endif if (!of_tlskey_set(threadSelf, thread)) @throw [OFInitializationFailedException - newWithClass: [thread class]]; + exceptionWithClass: [thread class]]; /* * Nasty workaround for thread implementations which can't return a * value on join. */ @@ -107,11 +107,12 @@ { if (self != [OFThread class]) return; if (!of_tlskey_new(&threadSelf)) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } + thread { return [[[self alloc] init] autorelease]; @@ -140,12 +141,12 @@ forTLSKey: (OFTLSKey*)key { id oldObject = of_tlskey_get(key->key); if (!of_tlskey_set(key->key, [object retain])) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; [oldObject release]; } + (id)objectForTLSKey: (OFTLSKey*)key @@ -159,21 +160,21 @@ } + (void)sleepForTimeInterval: (double)seconds { if (seconds < 0) - @throw [OFOutOfRangeException newWithClass: self]; + @throw [OFOutOfRangeException exceptionWithClass: self]; #ifndef _WIN32 if (seconds > UINT_MAX) - @throw [OFOutOfRangeException newWithClass: self]; + @throw [OFOutOfRangeException exceptionWithClass: self]; sleep((unsigned int)seconds); usleep((useconds_t)rint((seconds - floor(seconds)) * 1000000)); #else if (seconds * 1000 > UINT_MAX) - @throw [OFOutOfRangeException newWithClass: self]; + @throw [OFOutOfRangeException exceptionWithClass: self]; Sleep((unsigned int)(seconds * 1000)); #endif } @@ -181,17 +182,17 @@ { double seconds = [date timeIntervalSinceNow]; #ifndef _WIN32 if (seconds > UINT_MAX) - @throw [OFOutOfRangeException newWithClass: self]; + @throw [OFOutOfRangeException exceptionWithClass: self]; sleep((unsigned int)seconds); usleep((useconds_t)rint((seconds - floor(seconds)) * 1000000)); #else if (seconds * 1000 > UINT_MAX) - @throw [OFOutOfRangeException newWithClass: self]; + @throw [OFOutOfRangeException exceptionWithClass: self]; Sleep((unsigned int)(seconds * 1000)); #endif } @@ -261,12 +262,12 @@ } #endif - (id)main { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; return nil; } - (void)handleTermination @@ -274,12 +275,12 @@ } - (void)start { if (running == OF_THREAD_RUNNING) - @throw [OFThreadStillRunningException newWithClass: isa - thread: self]; + @throw [OFThreadStillRunningException exceptionWithClass: isa + thread: self]; if (running == OF_THREAD_WAITING_FOR_JOIN) { of_thread_detach(thread); [returnValue release]; } @@ -286,33 +287,33 @@ [self retain]; if (!of_thread_new(&thread, call_main, self)) { [self release]; - @throw [OFThreadStartFailedException newWithClass: isa - thread: self]; + @throw [OFThreadStartFailedException exceptionWithClass: isa + thread: self]; } running = OF_THREAD_RUNNING; } - (id)join { if (running == OF_THREAD_NOT_RUNNING || !of_thread_join(thread)) - @throw [OFThreadJoinFailedException newWithClass: isa - thread: self]; + @throw [OFThreadJoinFailedException exceptionWithClass: isa + thread: self]; running = OF_THREAD_NOT_RUNNING; return returnValue; } - (void)dealloc { if (running == OF_THREAD_RUNNING) - @throw [OFThreadStillRunningException newWithClass: isa - thread: self]; + @throw [OFThreadStillRunningException exceptionWithClass: isa + thread: self]; /* * We should not be running anymore, but call detach in order to free * the resources. */ @@ -363,11 +364,11 @@ self = [super init]; @try { if (!of_tlskey_new(&key)) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; initialized = YES; @synchronized (TLSKeys) { listObject = [TLSKeys appendObject: self]; @@ -419,11 +420,11 @@ self = [super init]; if (!of_mutex_new(&mutex)) { Class c = isa; [self release]; - @throw [OFInitializationFailedException newWithClass: c]; + @throw [OFInitializationFailedException exceptionWithClass: c]; } initialized = YES; return self; @@ -430,12 +431,12 @@ } - (void)lock { if (!of_mutex_lock(&mutex)) - @throw [OFMutexLockFailedException newWithClass: isa - mutex: self]; + @throw [OFMutexLockFailedException exceptionWithClass: isa + mutex: self]; } - (BOOL)tryLock { return of_mutex_trylock(&mutex); @@ -442,20 +443,21 @@ } - (void)unlock { if (!of_mutex_unlock(&mutex)) - @throw [OFMutexUnlockFailedException newWithClass: isa - mutex: self]; + @throw [OFMutexUnlockFailedException exceptionWithClass: isa + mutex: self]; } - (void)dealloc { if (initialized) if (!of_mutex_free(&mutex)) - @throw [OFMutexStillLockedException newWithClass: isa - mutex: self]; + @throw [OFMutexStillLockedException + exceptionWithClass: isa + mutex: self]; [super dealloc]; } @end @@ -470,11 +472,11 @@ self = [super init]; if (!of_condition_new(&condition)) { Class c = isa; [self release]; - @throw [OFInitializationFailedException newWithClass: c]; + @throw [OFInitializationFailedException exceptionWithClass: c]; } conditionInitialized = YES; return self; @@ -481,34 +483,37 @@ } - (void)wait { if (!of_condition_wait(&condition, &mutex)) - @throw [OFConditionWaitFailedException newWithClass: isa - condition: self]; + @throw [OFConditionWaitFailedException + exceptionWithClass: isa + condition: self]; } - (void)signal { if (!of_condition_signal(&condition)) - @throw [OFConditionSignalFailedException newWithClass: isa - condition: self]; + @throw [OFConditionSignalFailedException + exceptionWithClass: isa + condition: self]; } - (void)broadcast { if (!of_condition_broadcast(&condition)) - @throw [OFConditionBroadcastFailedException newWithClass: isa - condition: self]; + @throw [OFConditionBroadcastFailedException + exceptionWithClass: isa + condition: self]; } - (void)dealloc { if (conditionInitialized) if (!of_condition_free(&condition)) @throw [OFConditionStillWaitingException - newWithClass: isa - condition: self]; + exceptionWithClass: isa + condition: self]; [super dealloc]; } @end Index: src/OFURL.m ================================================================== --- src/OFURL.m +++ src/OFURL.m @@ -99,12 +99,12 @@ @try { char *tmp, *tmp2; if ((UTF8String2 = strdup([string UTF8String])) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: [string UTF8StringLength]]; + exceptionWithClass: isa + requestedSize: [string UTF8StringLength]]; UTF8String = UTF8String2; if (!strncmp(UTF8String, "file://", 7)) { scheme = @"file"; @@ -116,11 +116,12 @@ UTF8String += 7; } else if (!strncmp(UTF8String, "https://", 8)) { scheme = @"https"; UTF8String += 8; } else - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; if ((tmp = strchr(UTF8String, '/')) != NULL) { *tmp = '\0'; tmp++; } @@ -159,11 +160,11 @@ pool = [[OFAutoreleasePool alloc] init]; portString = [OFString stringWithUTF8String: tmp2]; if ([portString decimalValue] > 65535) @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; port = [portString decimalValue]; [pool release]; } else { @@ -233,12 +234,12 @@ user = [URL->user copy]; password = [URL->password copy]; if ((UTF8String2 = strdup([string UTF8String])) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: [string UTF8StringLength]]; + exceptionWithClass: isa + requestedSize: [string UTF8StringLength]]; UTF8String = UTF8String2; if ((tmp = strchr(UTF8String, '#')) != NULL) { *tmp = '\0'; @@ -294,12 +295,13 @@ @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; self = [self initWithString: [element stringValue]]; [pool release]; } @catch (id e) { @@ -409,12 +411,12 @@ } - (void)setScheme: (OFString*)scheme_ { if (![scheme_ isEqual: @"http"] && ![scheme_ isEqual: @"https"]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; OF_SETTER(scheme, scheme_, YES, YES) } - (OFString*)host @@ -464,12 +466,12 @@ - (void)setPath: (OFString*)path_ { if (([scheme isEqual: @"http"] || [scheme isEqual: @"https"]) && ![path_ hasPrefix: @"/"]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; OF_SETTER(path, path_, YES, YES) } - (OFString*)parameters Index: src/OFXMLAttribute.m ================================================================== --- src/OFXMLAttribute.m +++ src/OFXMLAttribute.m @@ -61,12 +61,13 @@ @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; name = [[[element attributeForName: @"name"] stringValue] copy]; ns = [[[element attributeForName: @"namespace"] stringValue] copy]; Index: src/OFXMLElement+Serialization.m ================================================================== --- src/OFXMLElement+Serialization.m +++ src/OFXMLElement+Serialization.m @@ -38,19 +38,19 @@ pool = [[OFAutoreleasePool alloc] init]; if ((class = objc_lookUpClass([name cStringWithEncoding: OF_STRING_ENCODING_ASCII])) == Nil) - @throw [OFNotImplementedException newWithClass: Nil]; + @throw [OFNotImplementedException exceptionWithClass: Nil]; if (![class conformsToProtocol: @protocol(OFSerialization)]) @throw [OFNotImplementedException - newWithClass: class - selector: @selector(initWithSerialization:)]; + exceptionWithClass: class + selector: @selector(initWithSerialization:)]; object = [[class alloc] initWithSerialization: self]; [pool release]; return [object autorelease]; } @end Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -133,12 +133,12 @@ - init { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithName: (OFString*)name_ { return [self initWithName: name_ @@ -168,12 +168,13 @@ { self = [super init]; @try { if (name_ == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; name = [name_ copy]; ns = [ns_ copy]; namespaces = [[OFMutableDictionary alloc] @@ -195,12 +196,13 @@ { self = [super init]; @try { if (characters_ == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; characters = [characters_ copy]; } @catch (id e) { [self release]; @throw e; @@ -213,12 +215,13 @@ { self = [super init]; @try { if (CDATA_ == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; CDATA = [CDATA_ copy]; } @catch (id e) { [self release]; @throw e; @@ -231,12 +234,13 @@ { self = [super init]; @try { if (comment_ == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; comment = [comment_ copy]; } @catch (id e) { [self release]; @throw e; @@ -249,12 +253,13 @@ { self = [super init]; @try { if (element == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; name = [element->name copy]; ns = [element->ns copy]; defaultNamespace = [element->defaultNamespace copy]; attributes = [element->attributes mutableCopy]; @@ -281,12 +286,12 @@ c = isa; [self release]; if (string == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; pool = [[OFAutoreleasePool alloc] init]; parser = [OFXMLParser parser]; builder = [OFXMLElementBuilder elementBuilder]; @@ -297,12 +302,12 @@ [builder setDelegate: delegate]; [parser parseString: string]; if (![parser finishedParsing]) - @throw [OFMalformedXMLException newWithClass: c - parser: parser]; + @throw [OFMalformedXMLException exceptionWithClass: c + parser: parser]; self = [delegate->element retain]; [pool release]; @@ -331,12 +336,12 @@ [builder setDelegate: delegate]; [parser parseFile: path]; if (![parser finishedParsing]) - @throw [OFMalformedXMLException newWithClass: c - parser: parser]; + @throw [OFMalformedXMLException exceptionWithClass: c + parser: parser]; self = [delegate->element retain]; [pool release]; @@ -352,12 +357,13 @@ OFXMLElement *attributesElement, *namespacesElement; OFXMLElement *childrenElement; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; name = [[[element attributeForName: @"name"] stringValue] copy]; ns = [[[element attributeForName: @"namespace"] stringValue] copy]; defaultNamespace = [[[element attributeForName: @@ -391,12 +397,13 @@ if (!((name != nil || ns != nil || defaultNamespace != nil || [attributes count] > 0 || [namespaces count] > 0 || [children count] > 0) ^ (characters != nil) ^ (CDATA != nil) ^ (comment != nil))) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; [pool release]; } @catch (id e) { [self release]; @throw e; @@ -406,12 +413,12 @@ } - (void)setName: (OFString*)name_ { if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; OF_SETTER(name, name_, YES, YES) } - (OFString*)name @@ -420,12 +427,12 @@ } - (void)setNamespace: (OFString*)ns_ { if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; OF_SETTER(ns, ns_, YES, YES) } - (OFString*)namespace @@ -646,12 +653,13 @@ if ([attributesCArray[j] namespace] != nil && (attributePrefix = [allNamespaces objectForKey: [attributesCArray[j] namespace]]) == nil) @throw [OFUnboundNamespaceException - newWithClass: isa - namespace: [attributesCArray[j] namespace]]; + exceptionWithClass: isa + namespace: [attributesCArray[j] + namespace]]; length += [attributeName UTF8StringLength] + (attributePrefix != nil ? [attributePrefix UTF8StringLength] + 1 : 0) + [tmp UTF8StringLength] + 4; @@ -879,12 +887,12 @@ } - (void)addAttribute: (OFXMLAttribute*)attribute { if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if (attributes == nil) attributes = [[OFMutableArray alloc] init]; if ([self attributeForName: attribute->name @@ -905,12 +913,12 @@ stringValue: (OFString*)stringValue { OFAutoreleasePool *pool; if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; pool = [[OFAutoreleasePool alloc] init]; [self addAttribute: [OFXMLAttribute attributeWithName: name_ namespace: ns_ stringValue: stringValue]]; @@ -988,12 +996,12 @@ - (void)setPrefix: (OFString*)prefix forNamespace: (OFString*)ns_ { if (name == nil || prefix == nil || [prefix isEqual: @""]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if (ns_ == nil) ns_ = @""; [namespaces setObject: prefix forKey: ns_]; @@ -1010,32 +1018,32 @@ } - (OFString*)defaultNamespace { if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; return [[defaultNamespace retain] autorelease]; } - (void)setDefaultNamespace: (OFString*)ns_ { if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; OFString *old = defaultNamespace; defaultNamespace = [ns_ copy]; [old release]; } - (void)addChild: (OFXMLElement*)child { if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; if (children == nil) children = [[OFMutableArray alloc] init]; [children addObject: child]; @@ -1042,12 +1050,12 @@ } - (void)removeChild: (OFXMLElement*)child { if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; [children removeObject: child]; } - (OFXMLElement*)elementForName: (OFString*)elementName Index: src/OFXMLElementBuilder.m ================================================================== --- src/OFXMLElementBuilder.m +++ src/OFXMLElementBuilder.m @@ -192,15 +192,15 @@ - (void)elementBuilder: (OFXMLElementBuilder*)builder didNotExpectCloseTag: (OFString*)name withPrefix: (OFString*)prefix namespace: (OFString*)ns { - @throw [OFMalformedXMLException newWithClass: [builder class] - parser: nil]; + @throw [OFMalformedXMLException exceptionWithClass: [builder class] + parser: nil]; } - (OFString*)elementBuilder: (OFXMLElementBuilder*)builder foundUnknownEntityNamed: (OFString*)entity { return nil; } @end Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -118,12 +118,12 @@ attributeNS = namespace_for_prefix(attributePrefix, namespaces); if ((attributePrefix != nil && attributeNS == nil)) @throw [OFUnboundNamespaceException - newWithClass: isa - prefix: attributePrefix]; + exceptionWithClass: isa + prefix: attributePrefix]; [attribute->ns release]; attribute->ns = [attributeNS retain]; } @@ -156,11 +156,11 @@ memcpy(selectors, selectors_, sizeof(selectors_)); for (i = 0; i < OF_XMLPARSER_NUM_STATES; i++) { if (![self instancesRespondToSelector: selectors[i]]) @throw [OFInitializationFailedException - newWithClass: self]; + exceptionWithClass: self]; lookupTable[i] = (state_function) [self instanceMethodForSelector: selectors[i]]; } } @@ -302,12 +302,12 @@ size_t length; if ((finishedParsing || [previous count] < 1) && buffer[*i] != ' ' && buffer[*i] != '\t' && buffer[*i] != '\n' && buffer[*i] != '\r' && buffer[*i] != '\f' && buffer[*i] != '<') - @throw [OFMalformedXMLException newWithClass: isa - parser: self]; + @throw [OFMalformedXMLException exceptionWithClass: isa + parser: self]; if (buffer[*i] != '<') return; if ((length = *i - *last) > 0) @@ -336,12 +336,12 @@ - (void)_parseTagOpenedWithBuffer: (const char*)buffer i: (size_t*)i last: (size_t*)last { if (finishedParsing && buffer[*i] != '!' && buffer[*i] != '?') - @throw [OFMalformedXMLException newWithClass: isa - parser: self]; + @throw [OFMalformedXMLException exceptionWithClass: isa + parser: self]; switch (buffer[*i]) { case '?': *last = *i + 1; state = OF_XMLPARSER_IN_PROCESSING_INSTRUCTIONS; @@ -479,12 +479,12 @@ if ([pi isEqual: @"xml"] || [pi hasPrefix: @"xml "] || [pi hasPrefix: @"xml\t"] || [pi hasPrefix: @"xml\r"] || [pi hasPrefix: @"xml\n"]) if (![self _parseXMLProcessingInstructions: pi]) @throw [OFMalformedXMLException - newWithClass: isa - parser: self]; + exceptionWithClass: isa + parser: self]; [delegate parser: self foundProcessingInstructions: pi]; [pool release]; @@ -539,13 +539,13 @@ OFString *ns; ns = namespace_for_prefix(prefix, namespaces); if (prefix != nil && ns == nil) - @throw - [OFUnboundNamespaceException newWithClass: isa - prefix: prefix]; + @throw [OFUnboundNamespaceException + exceptionWithClass: isa + prefix: prefix]; pool2 = [[OFAutoreleasePool alloc] init]; [delegate parser: self didStartElement: name @@ -624,21 +624,21 @@ name = [cacheString copy]; prefix = nil; } if (![[previous lastObject] isEqual: cacheString]) - @throw [OFMalformedXMLException newWithClass: isa - parser: self]; + @throw [OFMalformedXMLException exceptionWithClass: isa + parser: self]; [previous removeLastObject]; [cache removeNItems: [cache count]]; ns = namespace_for_prefix(prefix, namespaces); if (prefix != nil && ns == nil) - @throw [OFUnboundNamespaceException newWithClass: isa - prefix: prefix]; + @throw [OFUnboundNamespaceException exceptionWithClass: isa + prefix: prefix]; [delegate parser: self didEndElement: name withPrefix: prefix namespace: ns]; @@ -685,12 +685,12 @@ attributesCount = [attributes count]; ns = namespace_for_prefix(prefix, namespaces); if (prefix != nil && ns == nil) - @throw [OFUnboundNamespaceException newWithClass: isa - prefix: prefix]; + @throw [OFUnboundNamespaceException exceptionWithClass: isa + prefix: prefix]; for (j = 0; j < attributesCount; j++) resolve_attribute_namespace(attributesCArray[j], namespaces, isa); @@ -790,12 +790,12 @@ if (buffer[*i] == ' ' || buffer[*i] == '\t' || buffer[*i] == '\n' || buffer[*i] == '\r' || buffer[*i] == '\f') return; if (buffer[*i] != '\'' && buffer[*i] != '"') - @throw [OFMalformedXMLException newWithClass: isa - parser: self]; + @throw [OFMalformedXMLException exceptionWithClass: isa + parser: self]; delimiter = buffer[*i]; state = OF_XMLPARSER_IN_ATTR_VALUE; } @@ -850,12 +850,12 @@ { if (buffer[*i] == '>') { *last = *i + 1; state = OF_XMLPARSER_OUTSIDE_TAG; } else - @throw [OFMalformedXMLException newWithClass: isa - parser: self]; + @throw [OFMalformedXMLException exceptionWithClass: isa + parser: self]; } /* Expecting closing '>' or space */ - (void)_parseExpectSpaceOrCloseWithBuffer: (const char*)buffer i: (size_t*)i @@ -864,22 +864,22 @@ if (buffer[*i] == '>') { *last = *i + 1; state = OF_XMLPARSER_OUTSIDE_TAG; } else if (buffer[*i] != ' ' && buffer[*i] != '\t' && buffer[*i] != '\n' && buffer[*i] != '\r' && buffer[*i] != '\f') - @throw [OFMalformedXMLException newWithClass: isa - parser: self]; + @throw [OFMalformedXMLException exceptionWithClass: isa + parser: self]; } /* In ') - @throw [OFMalformedXMLException newWithClass: isa - parser: self]; + @throw [OFMalformedXMLException exceptionWithClass: isa + parser: self]; pool = [[OFAutoreleasePool alloc] init]; cache_append(cache, buffer + *last, encoding, *i - *last); comment = transform_string(cache, 2, NO, nil); @@ -1014,12 +1014,12 @@ last: (size_t*)last { if ((level < 6 && buffer[*i] != "OCTYPE"[level]) || (level == 6 && buffer[*i] != ' ' && buffer[*i] != '\t' && buffer[*i] != '\n' && buffer[*i] != '\r' && buffer[*i] != '\f')) - @throw [OFMalformedXMLException newWithClass: isa - parser: self]; + @throw [OFMalformedXMLException exceptionWithClass: isa + parser: self]; if (level < 7 || buffer[*i] == '<') level++; if (buffer[*i] == '>') { Index: src/exceptions/OFAcceptFailedException.h ================================================================== --- src/exceptions/OFAcceptFailedException.h +++ src/exceptions/OFAcceptFailedException.h @@ -35,12 +35,12 @@ /** * \param class_ The class of the object which caused the exception * \param socket The socket which could not accept a connection * \return A new accept failed exception */ -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket; ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket; /** * Initializes an already allocated accept failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFAcceptFailedException.m ================================================================== --- src/exceptions/OFAcceptFailedException.m +++ src/exceptions/OFAcceptFailedException.m @@ -23,23 +23,23 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFAcceptFailedException -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket { - return [[self alloc] initWithClass: class_ - socket: socket]; + return [[[self alloc] initWithClass: class_ + socket: socket] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ socket: (OFTCPSocket*)socket_ { Index: src/exceptions/OFAddressTranslationFailedException.h ================================================================== --- src/exceptions/OFAddressTranslationFailedException.h +++ src/exceptions/OFAddressTranslationFailedException.h @@ -38,13 +38,13 @@ * \param class_ The class of the object which caused the exception * \param socket The socket which could not translate the address * \param host The host for which translation was requested * \return A new address translation failed exception */ -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket - host: (OFString*)host; ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket + host: (OFString*)host; /** * Initializes an already allocated address translation failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFAddressTranslationFailedException.m ================================================================== --- src/exceptions/OFAddressTranslationFailedException.m +++ src/exceptions/OFAddressTranslationFailedException.m @@ -21,17 +21,17 @@ #import "OFTCPSocket.h" #import "common.h" @implementation OFAddressTranslationFailedException -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket - host: (OFString*)host ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket + host: (OFString*)host { - return [[self alloc] initWithClass: class_ - socket: socket - host: host]; + return [[[self alloc] initWithClass: class_ + socket: socket + host: host] autorelease]; } - initWithClass: (Class)class_ { self = [super initWithClass: class_]; Index: src/exceptions/OFAllocFailedException.m ================================================================== --- src/exceptions/OFAllocFailedException.m +++ src/exceptions/OFAllocFailedException.m @@ -22,58 +22,58 @@ #import "OFNotImplementedException.h" @implementation OFAllocFailedException + alloc { - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; } - init { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)addMemoryToPool: (void*)ptr { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)allocMemoryWithSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)allocMemoryForNItems: (size_t)nitems withSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)resizeMemory: (void*)ptr toSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void*)resizeMemory: (void*)ptr toNItems: (size_t)nitems withSize: (size_t)size { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)freeMemory: (void*)ptr { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - retain { return self; @@ -93,15 +93,15 @@ { } - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } - (OFString*)description { return @"Allocating an object failed!"; } @end Index: src/exceptions/OFAlreadyConnectedException.h ================================================================== --- src/exceptions/OFAlreadyConnectedException.h +++ src/exceptions/OFAlreadyConnectedException.h @@ -34,12 +34,12 @@ /** * \param class_ The class of the object which caused the exception * \param socket The socket which is already connected * \return A new already connected exception */ -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket; ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket; /** * Initializes an already allocated already connected exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFAlreadyConnectedException.m ================================================================== --- src/exceptions/OFAlreadyConnectedException.m +++ src/exceptions/OFAlreadyConnectedException.m @@ -21,23 +21,23 @@ #import "OFTCPSocket.h" #import "OFNotImplementedException.h" @implementation OFAlreadyConnectedException -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket { - return [[self alloc] initWithClass: class_ - socket: socket]; + return [[[self alloc] initWithClass: class_ + socket: socket] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ socket: (OFTCPSocket*)socket_ { Index: src/exceptions/OFBindFailedException.h ================================================================== --- src/exceptions/OFBindFailedException.h +++ src/exceptions/OFBindFailedException.h @@ -41,14 +41,14 @@ * \param socket The socket which could not be bound * \param host The host on which binding failed * \param port The port on which binding failed * \return A new bind failed exception */ -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket - host: (OFString*)host - port: (uint16_t)port; ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket + host: (OFString*)host + port: (uint16_t)port; /** * Initializes an already allocated bind failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFBindFailedException.m ================================================================== --- src/exceptions/OFBindFailedException.m +++ src/exceptions/OFBindFailedException.m @@ -23,27 +23,27 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFBindFailedException -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket - host: (OFString*)host - port: (uint16_t)port -{ - return [[self alloc] initWithClass: class_ - socket: socket - host: host - port: port]; ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket + host: (OFString*)host + port: (uint16_t)port +{ + return [[[self alloc] initWithClass: class_ + socket: socket + host: host + port: port] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ socket: (OFTCPSocket*)socket_ host: (OFString*)host_ Index: src/exceptions/OFChangeDirectoryFailedException.h ================================================================== --- src/exceptions/OFChangeDirectoryFailedException.h +++ src/exceptions/OFChangeDirectoryFailedException.h @@ -34,12 +34,12 @@ * \param class_ The class of the object which caused the exception * \param path A string with the path of the directory to which couldn't be * changed * \return A new change directory failed exception */ -+ newWithClass: (Class)class_ - path: (OFString*)path; ++ exceptionWithClass: (Class)class_ + path: (OFString*)path; /** * Initializes an already allocated change directory failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFChangeDirectoryFailedException.m ================================================================== --- src/exceptions/OFChangeDirectoryFailedException.m +++ src/exceptions/OFChangeDirectoryFailedException.m @@ -22,23 +22,23 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFChangeDirectoryFailedException -+ newWithClass: (Class)class_ - path: (OFString*)path_ ++ exceptionWithClass: (Class)class_ + path: (OFString*)path_ { - return [[self alloc] initWithClass: class_ - path: path_]; + return [[[self alloc] initWithClass: class_ + path: path_] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ path: (OFString*)path_ { Index: src/exceptions/OFChangeFileModeFailedException.h ================================================================== --- src/exceptions/OFChangeFileModeFailedException.h +++ src/exceptions/OFChangeFileModeFailedException.h @@ -38,13 +38,13 @@ * \param class_ The class of the object which caused the exception * \param path The path of the file * \param mode The new mode for the file * \return An initialized change file mode failed exception */ -+ newWithClass: (Class)class_ - path: (OFString*)path - mode: (mode_t)mode; ++ exceptionWithClass: (Class)class_ + path: (OFString*)path + mode: (mode_t)mode; /** * Initializes an already allocated change file mode failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFChangeFileModeFailedException.m ================================================================== --- src/exceptions/OFChangeFileModeFailedException.m +++ src/exceptions/OFChangeFileModeFailedException.m @@ -22,26 +22,26 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFChangeFileModeFailedException -+ newWithClass: (Class)class_ - path: (OFString*)path - mode: (mode_t)mode ++ exceptionWithClass: (Class)class_ + path: (OFString*)path + mode: (mode_t)mode { - return [(OFChangeFileModeFailedException*)[self alloc] + return [(OFChangeFileModeFailedException*)[[self alloc] initWithClass: class_ path: path - mode: mode]; + mode: mode] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ path: (OFString*)path_ mode: (mode_t)mode_ Index: src/exceptions/OFChangeFileOwnerFailedException.h ================================================================== --- src/exceptions/OFChangeFileOwnerFailedException.h +++ src/exceptions/OFChangeFileOwnerFailedException.h @@ -40,14 +40,14 @@ * \param path The path of the file * \param owner The new owner for the file * \param group The new group for the file * \return An initialized change file owner failed exception */ -+ newWithClass: (Class)class_ - path: (OFString*)path - owner: (OFString*)owner - group: (OFString*)group; ++ exceptionWithClass: (Class)class_ + path: (OFString*)path + owner: (OFString*)owner + group: (OFString*)group; /** * Initializes an already allocated change file owner failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFChangeFileOwnerFailedException.m ================================================================== --- src/exceptions/OFChangeFileOwnerFailedException.m +++ src/exceptions/OFChangeFileOwnerFailedException.m @@ -23,27 +23,27 @@ #import "common.h" #ifndef _WIN32 @implementation OFChangeFileOwnerFailedException -+ newWithClass: (Class)class_ - path: (OFString*)path ++ exceptionWithClass: (Class)class_ + path: (OFString*)path owner: (OFString*)owner group: (OFString*)group { - return [[self alloc] initWithClass: class_ - path: path - owner: owner - group: group]; + return [[[self alloc] initWithClass: class_ + path: path + owner: owner + group: group] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ path: (OFString*)path_ owner: (OFString*)owner_ Index: src/exceptions/OFConditionBroadcastFailedException.h ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.h +++ src/exceptions/OFConditionBroadcastFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param condition The condition which could not be broadcasted * \return A new condition broadcast failed exception */ -+ newWithClass: (Class)class_ - condition: (OFCondition*)condition; ++ exceptionWithClass: (Class)class_ + condition: (OFCondition*)condition; /** * Initializes an already allocated condition broadcast failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFConditionBroadcastFailedException.m ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.m +++ src/exceptions/OFConditionBroadcastFailedException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFConditionBroadcastFailedException -+ newWithClass: (Class)class_ - condition: (OFCondition*)condition ++ exceptionWithClass: (Class)class_ + condition: (OFCondition*)condition { - return [[self alloc] initWithClass: class_ - condition: condition]; + return [[[self alloc] initWithClass: class_ + condition: condition] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ condition: (OFCondition*)condition_ { Index: src/exceptions/OFConditionSignalFailedException.h ================================================================== --- src/exceptions/OFConditionSignalFailedException.h +++ src/exceptions/OFConditionSignalFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param condition The condition which could not be signaled * \return A new condition signal failed exception */ -+ newWithClass: (Class)class_ - condition: (OFCondition*)condition; ++ exceptionWithClass: (Class)class_ + condition: (OFCondition*)condition; /** * Initializes an already allocated condition signal failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFConditionSignalFailedException.m ================================================================== --- src/exceptions/OFConditionSignalFailedException.m +++ src/exceptions/OFConditionSignalFailedException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFConditionSignalFailedException -+ newWithClass: (Class)class_ - condition: (OFCondition*)condition ++ exceptionWithClass: (Class)class_ + condition: (OFCondition*)condition { - return [[self alloc] initWithClass: class_ - condition: condition]; + return [[[self alloc] initWithClass: class_ + condition: condition] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ condition: (OFCondition*)condition_ { Index: src/exceptions/OFConditionStillWaitingException.h ================================================================== --- src/exceptions/OFConditionStillWaitingException.h +++ src/exceptions/OFConditionStillWaitingException.h @@ -34,12 +34,12 @@ /** * \param class_ The class of the object which caused the exception * \param condition The condition for which is still being waited * \return A new condition still waiting exception */ -+ newWithClass: (Class)class_ - condition: (OFCondition*)condition; ++ exceptionWithClass: (Class)class_ + condition: (OFCondition*)condition; /** * Initializes an already allocated condition still waiting exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFConditionStillWaitingException.m ================================================================== --- src/exceptions/OFConditionStillWaitingException.m +++ src/exceptions/OFConditionStillWaitingException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFConditionStillWaitingException -+ newWithClass: (Class)class_ - condition: (OFCondition*)condition ++ exceptionWithClass: (Class)class_ + condition: (OFCondition*)condition { - return [[self alloc] initWithClass: class_ - condition: condition]; + return [[[self alloc] initWithClass: class_ + condition: condition] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ condition: (OFCondition*)condition_ { Index: src/exceptions/OFConditionWaitFailedException.h ================================================================== --- src/exceptions/OFConditionWaitFailedException.h +++ src/exceptions/OFConditionWaitFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param condition The condition for which could not be waited * \return A new condition wait failed exception */ -+ newWithClass: (Class)class_ - condition: (OFCondition*)condition; ++ exceptionWithClass: (Class)class_ + condition: (OFCondition*)condition; /** * Initializes an already allocated condition wait failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFConditionWaitFailedException.m ================================================================== --- src/exceptions/OFConditionWaitFailedException.m +++ src/exceptions/OFConditionWaitFailedException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFConditionWaitFailedException -+ newWithClass: (Class)class_ - condition: (OFCondition*)condition ++ exceptionWithClass: (Class)class_ + condition: (OFCondition*)condition { - return [[self alloc] initWithClass: class_ - condition: condition]; + return [[[self alloc] initWithClass: class_ + condition: condition] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ condition: (OFCondition*)condition_ { Index: src/exceptions/OFConnectionFailedException.h ================================================================== --- src/exceptions/OFConnectionFailedException.h +++ src/exceptions/OFConnectionFailedException.h @@ -41,14 +41,14 @@ * \param socket The socket which could not connect * \param host The host to which the connection failed * \param port The port on the host to which the connection failed * \return A new connection failed exception */ -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket - host: (OFString*)host - port: (uint16_t)port; ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket + host: (OFString*)host + port: (uint16_t)port; /** * Initializes an already allocated connection failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFConnectionFailedException.m ================================================================== --- src/exceptions/OFConnectionFailedException.m +++ src/exceptions/OFConnectionFailedException.m @@ -23,27 +23,27 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFConnectionFailedException -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket - host: (OFString*)host - port: (uint16_t)port -{ - return [[self alloc] initWithClass: class_ - socket: socket - host: host - port: port]; ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket + host: (OFString*)host + port: (uint16_t)port +{ + return [[[self alloc] initWithClass: class_ + socket: socket + host: host + port: port] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ socket: (OFTCPSocket*)socket_ host: (OFString*)host_ Index: src/exceptions/OFCopyFileFailedException.h ================================================================== --- src/exceptions/OFCopyFileFailedException.h +++ src/exceptions/OFCopyFileFailedException.h @@ -36,13 +36,13 @@ * \param class_ The class of the object which caused the exception * \param src The original path * \param dst The new path * \return A new copy file failed exception */ -+ newWithClass: (Class)class_ - sourcePath: (OFString*)src - destinationPath: (OFString*)dst; ++ exceptionWithClass: (Class)class_ + sourcePath: (OFString*)src + destinationPath: (OFString*)dst; /** * Initializes an already allocated copy file failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFCopyFileFailedException.m ================================================================== --- src/exceptions/OFCopyFileFailedException.m +++ src/exceptions/OFCopyFileFailedException.m @@ -22,25 +22,25 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFCopyFileFailedException -+ newWithClass: (Class)class_ - sourcePath: (OFString*)src - destinationPath: (OFString*)dst ++ exceptionWithClass: (Class)class_ + sourcePath: (OFString*)src + destinationPath: (OFString*)dst { - return [[self alloc] initWithClass: class_ - sourcePath: src - destinationPath: dst]; + return [[[self alloc] initWithClass: class_ + sourcePath: src + destinationPath: dst] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ sourcePath: (OFString*)src destinationPath: (OFString*)dst Index: src/exceptions/OFCreateDirectoryFailedException.h ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.h +++ src/exceptions/OFCreateDirectoryFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param path A string with the path of the directory which couldn't be created * \return A new create directory failed exception */ -+ newWithClass: (Class)class_ - path: (OFString*)path; ++ exceptionWithClass: (Class)class_ + path: (OFString*)path; /** * Initializes an already allocated create directory failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFCreateDirectoryFailedException.m ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.m +++ src/exceptions/OFCreateDirectoryFailedException.m @@ -22,23 +22,23 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFCreateDirectoryFailedException -+ newWithClass: (Class)class_ - path: (OFString*)path_ ++ exceptionWithClass: (Class)class_ + path: (OFString*)path_ { - return [[self alloc] initWithClass: class_ - path: path_]; + return [[[self alloc] initWithClass: class_ + path: path_] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ path: (OFString*)path_ { Index: src/exceptions/OFDeleteDirectoryFailedException.h ================================================================== --- src/exceptions/OFDeleteDirectoryFailedException.h +++ src/exceptions/OFDeleteDirectoryFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param path The path of the directory * \return A new delete directory failed exception */ -+ newWithClass: (Class)class_ - path: (OFString*)path; ++ exceptionWithClass: (Class)class_ + path: (OFString*)path; /** * Initializes an already allocated delete directory failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFDeleteDirectoryFailedException.m ================================================================== --- src/exceptions/OFDeleteDirectoryFailedException.m +++ src/exceptions/OFDeleteDirectoryFailedException.m @@ -22,23 +22,23 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFDeleteDirectoryFailedException -+ newWithClass: (Class)class_ - path: (OFString*)path_ ++ exceptionWithClass: (Class)class_ + path: (OFString*)path_ { - return [[self alloc] initWithClass: class_ - path: path_]; + return [[[self alloc] initWithClass: class_ + path: path_] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ path: (OFString*)path_ { Index: src/exceptions/OFDeleteFileFailedException.h ================================================================== --- src/exceptions/OFDeleteFileFailedException.h +++ src/exceptions/OFDeleteFileFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param path The path of the file * \return A new delete file failed exception */ -+ newWithClass: (Class)class_ - path: (OFString*)path; ++ exceptionWithClass: (Class)class_ + path: (OFString*)path; /** * Initializes an already allocated delete file failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFDeleteFileFailedException.m ================================================================== --- src/exceptions/OFDeleteFileFailedException.m +++ src/exceptions/OFDeleteFileFailedException.m @@ -22,23 +22,23 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFDeleteFileFailedException -+ newWithClass: (Class)class_ - path: (OFString*)path_ ++ exceptionWithClass: (Class)class_ + path: (OFString*)path_ { - return [[self alloc] initWithClass: class_ - path: path_]; + return [[[self alloc] initWithClass: class_ + path: path_] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ path: (OFString*)path_ { Index: src/exceptions/OFEnumerationMutationException.h ================================================================== --- src/exceptions/OFEnumerationMutationException.h +++ src/exceptions/OFEnumerationMutationException.h @@ -28,12 +28,12 @@ /** * \param class_ The class of the object which caused the exception * \param object The object which was mutated during enumeration * \return A new enumeration mutation exception */ -+ newWithClass: (Class)class_ - object: (id)object; ++ exceptionWithClass: (Class)class_ + object: (id)object; /** * Initializes an already allocated enumeration mutation exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFEnumerationMutationException.m ================================================================== --- src/exceptions/OFEnumerationMutationException.m +++ src/exceptions/OFEnumerationMutationException.m @@ -20,23 +20,23 @@ #import "OFString.h" #import "OFNotImplementedException.h" @implementation OFEnumerationMutationException -+ newWithClass: (Class)class_ - object: (id)object ++ exceptionWithClass: (Class)class_ + object: (id)object { - return [[self alloc] initWithClass: class_ - object: object]; + return [[[self alloc] initWithClass: class_ + object: object] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ object: (id)object_ { Index: src/exceptions/OFException.h ================================================================== --- src/exceptions/OFException.h +++ src/exceptions/OFException.h @@ -21,13 +21,10 @@ /** * \brief The base class for all exceptions in ObjFW * * The OFException class is the base class for all exceptions in ObjFW, except * the OFAllocFailedException. - * - * IMPORTANT: Exceptions do NOT use OFAutoreleasePools and can't be autoreleased - * either! You have to make sure to dealloc the exception in your \@catch block! */ @interface OFException: OFObject { Class inClass; OFString *description; @@ -41,11 +38,11 @@ * Creates a new exception. * * \param class_ The class of the object which caused the exception * \return A new exception */ -+ newWithClass: (Class)class_; ++ exceptionWithClass: (Class)class_; /** * Initializes an already allocated OFException. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFException.m ================================================================== --- src/exceptions/OFException.m +++ src/exceptions/OFException.m @@ -20,21 +20,21 @@ #import "OFString.h" #import "OFNotImplementedException.h" @implementation OFException -+ newWithClass: (Class)class_ ++ exceptionWithClass: (Class)class_ { - return [[self alloc] initWithClass: class_]; + return [[[self alloc] initWithClass: class_] autorelease]; } - init { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ { self = [super init]; @@ -58,12 +58,6 @@ - (OFString*)description { return @"An exception occurred"; } - -- autorelease -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} @end Index: src/exceptions/OFHTTPRequestFailedException.h ================================================================== --- src/exceptions/OFHTTPRequestFailedException.h +++ src/exceptions/OFHTTPRequestFailedException.h @@ -37,13 +37,13 @@ * \param class_ The class of the object which caused the exception * \param request The HTTP request which failed * \param result The result of the failed HTTP request * \return A new HTTP request failed exception */ -+ newWithClass: (Class)class_ - HTTPRequest: (OFHTTPRequest*)request - result: (OFHTTPRequestResult*)result; ++ exceptionWithClass: (Class)class_ + HTTPRequest: (OFHTTPRequest*)request + result: (OFHTTPRequestResult*)result; /** * Initializes an already allocated HTTP request failed exception * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFHTTPRequestFailedException.m ================================================================== --- src/exceptions/OFHTTPRequestFailedException.m +++ src/exceptions/OFHTTPRequestFailedException.m @@ -22,25 +22,25 @@ #import "OFAutoreleasePool.h" #import "OFNotImplementedException.h" @implementation OFHTTPRequestFailedException -+ newWithClass: (Class)class_ - HTTPRequest: (OFHTTPRequest*)request - result: (OFHTTPRequestResult*)result ++ exceptionWithClass: (Class)class_ + HTTPRequest: (OFHTTPRequest*)request + result: (OFHTTPRequestResult*)result { - return [[self alloc] initWithClass: class_ - HTTPRequest: request - result: result]; + return [[[self alloc] initWithClass: class_ + HTTPRequest: request + result: result] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ HTTPRequest: (OFHTTPRequest*)request result: (OFHTTPRequestResult*)result_ Index: src/exceptions/OFHashAlreadyCalculatedException.h ================================================================== --- src/exceptions/OFHashAlreadyCalculatedException.h +++ src/exceptions/OFHashAlreadyCalculatedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param hash The hash which has already been calculated * \return A new hash already calculated exception */ -+ newWithClass: (Class)class_ - hash: (OFHash*)hash; ++ exceptionWithClass: (Class)class_ + hash: (OFHash*)hash; /** * Initializes an already allocated hash already calculated exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFHashAlreadyCalculatedException.m ================================================================== --- src/exceptions/OFHashAlreadyCalculatedException.m +++ src/exceptions/OFHashAlreadyCalculatedException.m @@ -21,23 +21,23 @@ #import "OFHash.h" #import "OFNotImplementedException.h" @implementation OFHashAlreadyCalculatedException -+ newWithClass: (Class)class_ - hash: (OFHash*)hash ++ exceptionWithClass: (Class)class_ + hash: (OFHash*)hash { - return [[self alloc] initWithClass: class_ - hash: hash]; + return [[[self alloc] initWithClass: class_ + hash: hash] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ hash: (OFHash*)hash { Index: src/exceptions/OFInvalidArgumentException.h ================================================================== --- src/exceptions/OFInvalidArgumentException.h +++ src/exceptions/OFInvalidArgumentException.h @@ -31,12 +31,12 @@ /** * \param class_ The class of the object which caused the exception * \param selector The selector which doesn't accept the argument * \return A new invalid argument exception */ -+ newWithClass: (Class)class_ - selector: (SEL)selector; ++ exceptionWithClass: (Class)class_ + selector: (SEL)selector; /** * Initializes an already allocated invalid argument exception * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFInvalidArgumentException.m ================================================================== --- src/exceptions/OFInvalidArgumentException.m +++ src/exceptions/OFInvalidArgumentException.m @@ -22,23 +22,23 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFInvalidArgumentException -+ newWithClass: (Class)class_ - selector: (SEL)selector_ ++ exceptionWithClass: (Class)class_ + selector: (SEL)selector_ { - return [[self alloc] initWithClass: class_ - selector: selector_]; + return [[[self alloc] initWithClass: class_ + selector: selector_] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ selector: (SEL)selector_ { Index: src/exceptions/OFLinkFailedException.h ================================================================== --- src/exceptions/OFLinkFailedException.h +++ src/exceptions/OFLinkFailedException.h @@ -37,13 +37,13 @@ * \param class_ The class of the object which caused the exception * \param src The source for the link * \param dest The destination for the link * \return A new link failed exception */ -+ newWithClass: (Class)class_ - sourcePath: (OFString*)src - destinationPath: (OFString*)dest; ++ exceptionWithClass: (Class)class_ + sourcePath: (OFString*)src + destinationPath: (OFString*)dest; /** * Initializes an already allocated link failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFLinkFailedException.m ================================================================== --- src/exceptions/OFLinkFailedException.m +++ src/exceptions/OFLinkFailedException.m @@ -23,25 +23,25 @@ #import "common.h" #ifndef _WIN32 @implementation OFLinkFailedException -+ newWithClass: (Class)class_ - sourcePath: (OFString*)src - destinationPath: (OFString*)dest ++ exceptionWithClass: (Class)class_ + sourcePath: (OFString*)src + destinationPath: (OFString*)dest { - return [[self alloc] initWithClass: class_ - sourcePath: src - destinationPath: dest]; + return [[[self alloc] initWithClass: class_ + sourcePath: src + destinationPath: dest] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ sourcePath: (OFString*)src destinationPath: (OFString*)dest Index: src/exceptions/OFListenFailedException.h ================================================================== --- src/exceptions/OFListenFailedException.h +++ src/exceptions/OFListenFailedException.h @@ -38,13 +38,13 @@ * \param class_ The class of the object which caused the exception * \param socket The socket which failed to listen * \param backlog The requested size of the back log * \return A new listen failed exception */ -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket - backLog: (int)backlog; ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket + backLog: (int)backlog; /** * Initializes an already allocated listen failed exception * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFListenFailedException.m ================================================================== --- src/exceptions/OFListenFailedException.m +++ src/exceptions/OFListenFailedException.m @@ -23,25 +23,25 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFListenFailedException -+ newWithClass: (Class)class_ - socket: (OFTCPSocket*)socket - backLog: (int)backlog ++ exceptionWithClass: (Class)class_ + socket: (OFTCPSocket*)socket + backLog: (int)backlog { - return [[self alloc] initWithClass: class_ - socket: socket - backLog: backlog]; + return [[[self alloc] initWithClass: class_ + socket: socket + backLog: backlog] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ socket: (OFTCPSocket*)socket_ backLog: (int)backlog Index: src/exceptions/OFMalformedXMLException.h ================================================================== --- src/exceptions/OFMalformedXMLException.h +++ src/exceptions/OFMalformedXMLException.h @@ -32,12 +32,12 @@ /** * \param parser The parser which encountered malformed XML * \return A new malformed XML exception */ -+ newWithClass: (Class)class_ - parser: (OFXMLParser*)parser; ++ exceptionWithClass: (Class)class_ + parser: (OFXMLParser*)parser; /** * Initializes an already allocated malformed XML exception. * * \param parser The parser which encountered malformed XML Index: src/exceptions/OFMalformedXMLException.m ================================================================== --- src/exceptions/OFMalformedXMLException.m +++ src/exceptions/OFMalformedXMLException.m @@ -21,23 +21,23 @@ #import "OFXMLParser.h" #import "OFNotImplementedException.h" @implementation OFMalformedXMLException -+ newWithClass: (Class)class_ - parser: (OFXMLParser*)parser ++ exceptionWithClass: (Class)class_ + parser: (OFXMLParser*)parser { - return [[self alloc] initWithClass: class_ - parser: parser]; + return [[[self alloc] initWithClass: class_ + parser: parser] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ parser: (OFXMLParser*)parser_ { Index: src/exceptions/OFMemoryNotPartOfObjectException.h ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.h +++ src/exceptions/OFMemoryNotPartOfObjectException.h @@ -31,12 +31,12 @@ /** * \param class_ The class of the object which caused the exception * \param ptr A pointer to the memory that is not part of the object * \return A new memory not part of object exception */ -+ newWithClass: (Class)class_ - pointer: (void*)ptr; ++ exceptionWithClass: (Class)class_ + pointer: (void*)ptr; /** * Initializes an already allocated memory not part of object exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFMemoryNotPartOfObjectException.m ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.m +++ src/exceptions/OFMemoryNotPartOfObjectException.m @@ -20,23 +20,23 @@ #import "OFString.h" #import "OFNotImplementedException.h" @implementation OFMemoryNotPartOfObjectException -+ newWithClass: (Class)class_ - pointer: (void*)ptr ++ exceptionWithClass: (Class)class_ + pointer: (void*)ptr { - return [[self alloc] initWithClass: class_ - pointer: ptr]; + return [[[self alloc] initWithClass: class_ + pointer: ptr] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ pointer: (void*)ptr { Index: src/exceptions/OFMutexLockFailedException.h ================================================================== --- src/exceptions/OFMutexLockFailedException.h +++ src/exceptions/OFMutexLockFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param mutex The mutex which is could not be locked * \return A new mutex lock failed exception */ -+ newWithClass: (Class)class_ - mutex: (OFMutex*)mutex; ++ exceptionWithClass: (Class)class_ + mutex: (OFMutex*)mutex; /** * Initializes an already allocated mutex lock failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFMutexLockFailedException.m ================================================================== --- src/exceptions/OFMutexLockFailedException.m +++ src/exceptions/OFMutexLockFailedException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFMutexLockFailedException -+ newWithClass: (Class)class_ - mutex: (OFMutex*)mutex ++ exceptionWithClass: (Class)class_ + mutex: (OFMutex*)mutex { - return [[self alloc] initWithClass: class_ - mutex: mutex]; + return [[[self alloc] initWithClass: class_ + mutex: mutex] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ mutex: (OFMutex*)mutex_ { Index: src/exceptions/OFMutexStillLockedException.h ================================================================== --- src/exceptions/OFMutexStillLockedException.h +++ src/exceptions/OFMutexStillLockedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param mutex The mutex which is still locked * \return A new mutex still locked exception */ -+ newWithClass: (Class)class_ - mutex: (OFMutex*)mutex; ++ exceptionWithClass: (Class)class_ + mutex: (OFMutex*)mutex; /** * Initializes an already allocated mutex still locked exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFMutexStillLockedException.m ================================================================== --- src/exceptions/OFMutexStillLockedException.m +++ src/exceptions/OFMutexStillLockedException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFMutexStillLockedException -+ newWithClass: (Class)class_ - mutex: (OFMutex*)mutex ++ exceptionWithClass: (Class)class_ + mutex: (OFMutex*)mutex { - return [[self alloc] initWithClass: class_ - mutex: mutex]; + return [[[self alloc] initWithClass: class_ + mutex: mutex] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ mutex: (OFMutex*)mutex_ { Index: src/exceptions/OFMutexUnlockFailedException.h ================================================================== --- src/exceptions/OFMutexUnlockFailedException.h +++ src/exceptions/OFMutexUnlockFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param mutex The mutex which could not be unlocked * \return A new mutex unlock failed exception */ -+ newWithClass: (Class)class_ - mutex: (OFMutex*)mutex; ++ exceptionWithClass: (Class)class_ + mutex: (OFMutex*)mutex; /** * Initializes an already allocated mutex unlock failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFMutexUnlockFailedException.m ================================================================== --- src/exceptions/OFMutexUnlockFailedException.m +++ src/exceptions/OFMutexUnlockFailedException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFMutexUnlockFailedException -+ newWithClass: (Class)class_ - mutex: (OFMutex*)mutex ++ exceptionWithClass: (Class)class_ + mutex: (OFMutex*)mutex { - return [[self alloc] initWithClass: class_ - mutex: mutex]; + return [[[self alloc] initWithClass: class_ + mutex: mutex] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ mutex: (OFMutex*)mutex_ { Index: src/exceptions/OFNotConnectedException.h ================================================================== --- src/exceptions/OFNotConnectedException.h +++ src/exceptions/OFNotConnectedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param socket The socket which is not connected * \return A new not connected exception */ -+ newWithClass: (Class)class_ - socket: (OFStreamSocket*)socket; ++ exceptionWithClass: (Class)class_ + socket: (OFStreamSocket*)socket; /** * Initializes an already allocated not connected exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFNotConnectedException.m ================================================================== --- src/exceptions/OFNotConnectedException.m +++ src/exceptions/OFNotConnectedException.m @@ -21,23 +21,23 @@ #import "OFTCPSocket.h" #import "OFNotImplementedException.h" @implementation OFNotConnectedException -+ newWithClass: (Class)class_ - socket: (OFStreamSocket*)socket ++ exceptionWithClass: (Class)class_ + socket: (OFStreamSocket*)socket { - return [[self alloc] initWithClass: class_ - socket: socket]; + return [[[self alloc] initWithClass: class_ + socket: socket] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ socket: (OFStreamSocket*)socket_ { Index: src/exceptions/OFNotImplementedException.h ================================================================== --- src/exceptions/OFNotImplementedException.h +++ src/exceptions/OFNotImplementedException.h @@ -32,12 +32,12 @@ /** * \param class_ The class of the object which caused the exception * \param selector The selector which is not or not fully implemented * \return A new not implemented exception */ -+ newWithClass: (Class)class_ - selector: (SEL)selector; ++ exceptionWithClass: (Class)class_ + selector: (SEL)selector; /** * Initializes an already allocated not implemented exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFNotImplementedException.m ================================================================== --- src/exceptions/OFNotImplementedException.m +++ src/exceptions/OFNotImplementedException.m @@ -20,23 +20,23 @@ #import "OFString.h" #import "common.h" @implementation OFNotImplementedException -+ newWithClass: (Class)class_ - selector: (SEL)selector ++ exceptionWithClass: (Class)class_ + selector: (SEL)selector { - return [[self alloc] initWithClass: class_ - selector: selector]; + return [[[self alloc] initWithClass: class_ + selector: selector] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ selector: (SEL)selector_ { Index: src/exceptions/OFOpenFileFailedException.h ================================================================== --- src/exceptions/OFOpenFileFailedException.h +++ src/exceptions/OFOpenFileFailedException.h @@ -36,13 +36,13 @@ * \param class_ The class of the object which caused the exception * \param path A string with the path of the file tried to open * \param mode A string with the mode in which the file should have been opened * \return A new open file failed exception */ -+ newWithClass: (Class)class_ - path: (OFString*)path - mode: (OFString*)mode; ++ exceptionWithClass: (Class)class_ + path: (OFString*)path + mode: (OFString*)mode; /** * Initializes an already allocated open file failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFOpenFileFailedException.m ================================================================== --- src/exceptions/OFOpenFileFailedException.m +++ src/exceptions/OFOpenFileFailedException.m @@ -22,25 +22,25 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFOpenFileFailedException -+ newWithClass: (Class)class_ - path: (OFString*)path ++ exceptionWithClass: (Class)class_ + path: (OFString*)path mode: (OFString*)mode { - return [[self alloc] initWithClass: class_ - path: path - mode: mode]; + return [[[self alloc] initWithClass: class_ + path: path + mode: mode] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ path: (OFString*)path_ mode: (OFString*)mode_ Index: src/exceptions/OFOutOfMemoryException.h ================================================================== --- src/exceptions/OFOutOfMemoryException.h +++ src/exceptions/OFOutOfMemoryException.h @@ -31,12 +31,12 @@ /** * \param class_ The class of the object which caused the exception * \param size The size of the memory that couldn't be allocated * \return A new no memory exception */ -+ newWithClass: (Class)class_ - requestedSize: (size_t)size; ++ exceptionWithClass: (Class)class_ + requestedSize: (size_t)size; /** * Initializes an already allocated no memory exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFOutOfMemoryException.m ================================================================== --- src/exceptions/OFOutOfMemoryException.m +++ src/exceptions/OFOutOfMemoryException.m @@ -18,15 +18,15 @@ #import "OFOutOfMemoryException.h" #import "OFString.h" @implementation OFOutOfMemoryException -+ newWithClass: (Class)class_ - requestedSize: (size_t)size ++ exceptionWithClass: (Class)class_ + requestedSize: (size_t)size { - return [[self alloc] initWithClass: class_ - requestedSize: size]; + return [[[self alloc] initWithClass: class_ + requestedSize: size] autorelease]; } - initWithClass: (Class)class_ requestedSize: (size_t)size { Index: src/exceptions/OFReadOrWriteFailedException.h ================================================================== --- src/exceptions/OFReadOrWriteFailedException.h +++ src/exceptions/OFReadOrWriteFailedException.h @@ -40,13 +40,13 @@ * \param stream The stream which caused the read or write failed exception * \param length The requested length of the data that couldn't be read / * written * \return A new open file failed exception */ -+ newWithClass: (Class)class_ - stream: (OFStream*)stream - requestedLength: (size_t)length; ++ exceptionWithClass: (Class)class_ + stream: (OFStream*)stream + requestedLength: (size_t)length; /** * Initializes an already allocated read or write failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFReadOrWriteFailedException.m ================================================================== --- src/exceptions/OFReadOrWriteFailedException.m +++ src/exceptions/OFReadOrWriteFailedException.m @@ -23,25 +23,25 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFReadOrWriteFailedException -+ newWithClass: (Class)class_ - stream: (OFStream*)stream - requestedLength: (size_t)length ++ exceptionWithClass: (Class)class_ + stream: (OFStream*)stream + requestedLength: (size_t)length { - return [[self alloc] initWithClass: class_ - stream: stream - requestedLength: length]; + return [[[self alloc] initWithClass: class_ + stream: stream + requestedLength: length] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ stream: (OFStream*)stream_ requestedLength: (size_t)length Index: src/exceptions/OFRenameFileFailedException.h ================================================================== --- src/exceptions/OFRenameFileFailedException.h +++ src/exceptions/OFRenameFileFailedException.h @@ -36,13 +36,13 @@ * \param class_ The class of the object which caused the exception * \param src The original path * \param dst The new path * \return A new rename file failed exception */ -+ newWithClass: (Class)class_ - sourcePath: (OFString*)src - destinationPath: (OFString*)dst; ++ exceptionWithClass: (Class)class_ + sourcePath: (OFString*)src + destinationPath: (OFString*)dst; /** * Initializes an already allocated rename failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFRenameFileFailedException.m ================================================================== --- src/exceptions/OFRenameFileFailedException.m +++ src/exceptions/OFRenameFileFailedException.m @@ -22,25 +22,25 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFRenameFileFailedException -+ newWithClass: (Class)class_ - sourcePath: (OFString*)src - destinationPath: (OFString*)dst ++ exceptionWithClass: (Class)class_ + sourcePath: (OFString*)src + destinationPath: (OFString*)dst { - return [[self alloc] initWithClass: class_ - sourcePath: src - destinationPath: dst]; + return [[[self alloc] initWithClass: class_ + sourcePath: src + destinationPath: dst] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ sourcePath: (OFString*)src destinationPath: (OFString*)dst Index: src/exceptions/OFSeekFailedException.h ================================================================== --- src/exceptions/OFSeekFailedException.h +++ src/exceptions/OFSeekFailedException.h @@ -44,14 +44,14 @@ * \param stream The stream for which seeking failed * \param offset The offset to which seeking failed * \param whence To what the offset is relative * \return A new seek failed exception */ -+ newWithClass: (Class)class_ - stream: (OFSeekableStream*)stream - offset: (off_t)offset - whence: (int)whence; ++ exceptionWithClass: (Class)class_ + stream: (OFSeekableStream*)stream + offset: (off_t)offset + whence: (int)whence; /** * Initializes an already allocated seek failed exception. * * \param stream The stream for which seeking failed Index: src/exceptions/OFSeekFailedException.m ================================================================== --- src/exceptions/OFSeekFailedException.m +++ src/exceptions/OFSeekFailedException.m @@ -23,27 +23,27 @@ #import "OFNotImplementedException.h" #import "common.h" @implementation OFSeekFailedException -+ newWithClass: (Class)class_ - stream: (OFSeekableStream*)stream - offset: (off_t)offset - whence: (int)whence -{ - return [[self alloc] initWithClass: class_ - stream: stream - offset: offset - whence: whence]; ++ exceptionWithClass: (Class)class_ + stream: (OFSeekableStream*)stream + offset: (off_t)offset + whence: (int)whence +{ + return [[[self alloc] initWithClass: class_ + stream: stream + offset: offset + whence: whence] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ stream: (OFSeekableStream*)stream_ offset: (off_t)offset_ Index: src/exceptions/OFSetOptionFailedException.h ================================================================== --- src/exceptions/OFSetOptionFailedException.h +++ src/exceptions/OFSetOptionFailedException.h @@ -32,12 +32,12 @@ /** * \param stream The stream for which the option could not be set * \return A new set option failed exception */ -+ newWithClass: (Class)class_ - stream: (OFStream*)stream; ++ exceptionWithClass: (Class)class_ + stream: (OFStream*)stream; /** * Initializes an already allocated set option failed exception. * * \param stream The stream for which the option could not be set Index: src/exceptions/OFSetOptionFailedException.m ================================================================== --- src/exceptions/OFSetOptionFailedException.m +++ src/exceptions/OFSetOptionFailedException.m @@ -21,23 +21,23 @@ #import "OFStream.h" #import "OFNotImplementedException.h" @implementation OFSetOptionFailedException -+ newWithClass: (Class)class_ - stream: (OFStream*)stream ++ exceptionWithClass: (Class)class_ + stream: (OFStream*)stream { - return [[self alloc] initWithClass: class_ - stream: stream]; + return [[[self alloc] initWithClass: class_ + stream: stream] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ stream: (OFStream*)stream_ { Index: src/exceptions/OFSymlinkFailedException.h ================================================================== --- src/exceptions/OFSymlinkFailedException.h +++ src/exceptions/OFSymlinkFailedException.h @@ -37,13 +37,13 @@ * \param class_ The class of the object which caused the exception * \param src The source for the symlink * \param dest The destination for the symlink * \return A new symlink failed exception */ -+ newWithClass: (Class)class_ - sourcePath: (OFString*)src - destinationPath: (OFString*)dest; ++ exceptionWithClass: (Class)class_ + sourcePath: (OFString*)src + destinationPath: (OFString*)dest; /** * Initializes an already allocated symlink failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFSymlinkFailedException.m ================================================================== --- src/exceptions/OFSymlinkFailedException.m +++ src/exceptions/OFSymlinkFailedException.m @@ -23,25 +23,25 @@ #import "common.h" #ifndef _WIN32 @implementation OFSymlinkFailedException -+ newWithClass: (Class)class_ - sourcePath: (OFString*)src - destinationPath: (OFString*)dest ++ exceptionWithClass: (Class)class_ + sourcePath: (OFString*)src + destinationPath: (OFString*)dest { - return [[self alloc] initWithClass: class_ - sourcePath: src - destinationPath: dest]; + return [[[self alloc] initWithClass: class_ + sourcePath: src + destinationPath: dest] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ sourcePath: (OFString*)src destinationPath: (OFString*)dest Index: src/exceptions/OFThreadJoinFailedException.h ================================================================== --- src/exceptions/OFThreadJoinFailedException.h +++ src/exceptions/OFThreadJoinFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param thread The thread which could not be joined * \return A new thread join failed exception */ -+ newWithClass: (Class)class_ - thread: (OFThread*)thread; ++ exceptionWithClass: (Class)class_ + thread: (OFThread*)thread; /** * Initializes an already allocated thread join failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFThreadJoinFailedException.m ================================================================== --- src/exceptions/OFThreadJoinFailedException.m +++ src/exceptions/OFThreadJoinFailedException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFThreadJoinFailedException -+ newWithClass: (Class)class_ - thread: (OFThread*)thread ++ exceptionWithClass: (Class)class_ + thread: (OFThread*)thread { - return [[self alloc] initWithClass: class_ - thread: thread]; + return [[[self alloc] initWithClass: class_ + thread: thread] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ thread: (OFThread*)thread_ { Index: src/exceptions/OFThreadStartFailedException.h ================================================================== --- src/exceptions/OFThreadStartFailedException.h +++ src/exceptions/OFThreadStartFailedException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param thread The thread which could not be started * \return An initialized thread start failed exception */ -+ newWithClass: (Class)class_ - thread: (OFThread*)thread; ++ exceptionWithClass: (Class)class_ + thread: (OFThread*)thread; /** * Initializes an already allocated thread start failed exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFThreadStartFailedException.m ================================================================== --- src/exceptions/OFThreadStartFailedException.m +++ src/exceptions/OFThreadStartFailedException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFThreadStartFailedException -+ newWithClass: (Class)class_ - thread: (OFThread*)thread ++ exceptionWithClass: (Class)class_ + thread: (OFThread*)thread { - return [[self alloc] initWithClass: class_ - thread: thread]; + return [[[self alloc] initWithClass: class_ + thread: thread] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ thread: (OFThread*)thread_ { Index: src/exceptions/OFThreadStillRunningException.h ================================================================== --- src/exceptions/OFThreadStillRunningException.h +++ src/exceptions/OFThreadStillRunningException.h @@ -33,12 +33,12 @@ /** * \param class_ The class of the object which caused the exception * \param thread The thread which is still running * \return A new thread still running exception */ -+ newWithClass: (Class)class_ - thread: (OFThread*)thread; ++ exceptionWithClass: (Class)class_ + thread: (OFThread*)thread; /** * Initializes an already allocated thread still running exception. * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFThreadStillRunningException.m ================================================================== --- src/exceptions/OFThreadStillRunningException.m +++ src/exceptions/OFThreadStillRunningException.m @@ -21,23 +21,23 @@ #import "OFThread.h" #import "OFNotImplementedException.h" @implementation OFThreadStillRunningException -+ newWithClass: (Class)class_ - thread: (OFThread*)thread ++ exceptionWithClass: (Class)class_ + thread: (OFThread*)thread { - return [[self alloc] initWithClass: class_ - thread: thread]; + return [[[self alloc] initWithClass: class_ + thread: thread] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ thread: (OFThread*)thread_ { Index: src/exceptions/OFUnboundNamespaceException.h ================================================================== --- src/exceptions/OFUnboundNamespaceException.h +++ src/exceptions/OFUnboundNamespaceException.h @@ -33,20 +33,20 @@ /** * \param class_ The class of the object which caused the exception * \param ns The namespace which is unbound * \return A new unbound namespace exception */ -+ newWithClass: (Class)class_ - namespace: (OFString*)ns; ++ exceptionWithClass: (Class)class_ + namespace: (OFString*)ns; /** * \param class_ The class of the object which caused the exception * \param prefix The prefix which is unbound * \return A new unbound namespace exception */ -+ newWithClass: (Class)class_ - prefix: (OFString*)prefix; ++ exceptionWithClass: (Class)class_ + prefix: (OFString*)prefix; /** * Initializes an already allocated unbound namespace exception * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFUnboundNamespaceException.m ================================================================== --- src/exceptions/OFUnboundNamespaceException.m +++ src/exceptions/OFUnboundNamespaceException.m @@ -20,30 +20,30 @@ #import "OFString.h" #import "OFNotImplementedException.h" @implementation OFUnboundNamespaceException -+ newWithClass: (Class)class_ - namespace: (OFString*)ns ++ exceptionWithClass: (Class)class_ + namespace: (OFString*)ns { - return [[self alloc] initWithClass: class_ - namespace: ns]; + return [[[self alloc] initWithClass: class_ + namespace: ns] autorelease]; } -+ newWithClass: (Class)class_ - prefix: (OFString*)prefix ++ exceptionWithClass: (Class)class_ + prefix: (OFString*)prefix { - return [[self alloc] initWithClass: class_ - prefix: prefix]; + return [[[self alloc] initWithClass: class_ + prefix: prefix] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ namespace: (OFString*)ns_ { Index: src/exceptions/OFUnsupportedProtocolException.h ================================================================== --- src/exceptions/OFUnsupportedProtocolException.h +++ src/exceptions/OFUnsupportedProtocolException.h @@ -34,12 +34,12 @@ /** * \param class_ The class of the object which caused the exception * \param url The URL whose protocol is unsupported * \return A new unsupported protocol exception */ -+ newWithClass: (Class)class_ - URL: (OFURL*)url; ++ exceptionWithClass: (Class)class_ + URL: (OFURL*)url; /** * Initializes an already allocated unsupported protocol exception * * \param class_ The class of the object which caused the exception Index: src/exceptions/OFUnsupportedProtocolException.m ================================================================== --- src/exceptions/OFUnsupportedProtocolException.m +++ src/exceptions/OFUnsupportedProtocolException.m @@ -21,23 +21,23 @@ #import "OFURL.h" #import "OFNotImplementedException.h" @implementation OFUnsupportedProtocolException -+ newWithClass: (Class)class_ - URL: (OFURL*)url ++ exceptionWithClass: (Class)class_ + URL: (OFURL*)url { - return [[self alloc] initWithClass: class_ - URL: url]; + return [[[self alloc] initWithClass: class_ + URL: url] autorelease]; } - initWithClass: (Class)class_ { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithClass: (Class)class_ URL: (OFURL*)url { Index: src/of_asprintf.m ================================================================== --- src/of_asprintf.m +++ src/of_asprintf.m @@ -277,11 +277,10 @@ ctx->subformat[ctx->subformatLen - 1] = 's'; @try { pool = [[OFAutoreleasePool alloc] init]; } @catch (id e) { - [e release]; return false; } @try { id object; Index: tests/OFArrayTests.m ================================================================== --- tests/OFArrayTests.m +++ tests/OFArrayTests.m @@ -210,11 +210,10 @@ [m[0] addObject: @""]; i++; } } @catch (OFEnumerationMutationException *e) { ok = YES; - [e release]; } TEST(@"Detection of mutation during Fast Enumeration", ok) [m[0] removeNObjects: 1]; @@ -247,17 +246,15 @@ ^ (id obj, size_t idx, BOOL *stop) { [a2 removeObjectAtIndex: idx]; }]; } @catch (OFEnumerationMutationException *e) { ok = YES; - [e release]; } @catch (OFOutOfRangeException *e) { /* * Out of bounds access due to enumeration not being * detected. */ - [e release]; } TEST(@"Detection of mutation during enumeration using blocks", ok) } Index: tests/OFDictionaryTests.m ================================================================== --- tests/OFDictionaryTests.m +++ tests/OFDictionaryTests.m @@ -112,11 +112,10 @@ for (OFString *key in dict) [dict setObject: @"" forKey: @""]; } @catch (OFEnumerationMutationException *e) { ok = YES; - [e dealloc]; } TEST(@"Detection of mutation during Fast Enumeration", ok) [dict removeObjectForKey: @""]; @@ -145,11 +144,10 @@ [dict setObject: @"" forKey: @""]; }]; } @catch (OFEnumerationMutationException *e) { ok = YES; - [e dealloc]; } TEST(@"Detection of mutation during enumeration using blocks", ok) Index: tests/OFListTests.m ================================================================== --- tests/OFListTests.m +++ tests/OFListTests.m @@ -145,14 +145,13 @@ @try { for (OFString *obj in list) [list removeListObject: [list lastListObject]]; } @catch (OFEnumerationMutationException *e) { ok = YES; - [e dealloc]; } TEST(@"Detection of mutation during Fast Enumeration", ok) #endif [pool drain]; } @end Index: tests/OFSet.m ================================================================== --- tests/OFSet.m +++ tests/OFSet.m @@ -127,14 +127,13 @@ @try { for (OFString *s in mutableSet) [mutableSet removeObject: s]; } @catch (OFEnumerationMutationException *e) { ok = YES; - [e dealloc]; } TEST(@"Detection of mutation during Fast Enumeration", ok); #endif [pool drain]; } @end Index: tests/TestsAppDelegate.h ================================================================== --- tests/TestsAppDelegate.h +++ tests/TestsAppDelegate.h @@ -40,11 +40,10 @@ \ @try { \ code; \ } @catch (exception *e) { \ caught = YES; \ - [e release]; \ } \ \ if (caught) \ [self outputSuccess: test \ inModule: module]; \