diff --git a/src/OFApplication.m b/src/OFApplication.m index 8fb58cd7d..85f8b8903 100644 --- a/src/OFApplication.m +++ b/src/OFApplication.m @@ -267,8 +267,8 @@ - (void)dealloc @implementation OFObject (OFApplicationDelegate) - (void)applicationDidFinishLaunching { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)applicationWillTerminate diff --git a/src/OFArray.m b/src/OFArray.m index 44399c347..051554682 100644 --- a/src/OFArray.m +++ b/src/OFArray.m @@ -105,8 +105,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @@ -171,8 +171,8 @@ + (void)initialize if (isa == [OFArray class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; @@ -201,24 +201,24 @@ + (void)initialize { 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 @@ -226,22 +226,22 @@ + (void)initialize { 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 @@ -282,8 +282,8 @@ - (id*)cArray - (id)objectAtIndex: (size_t)index { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (size_t)indexOfObject: (id)object @@ -531,7 +531,7 @@ - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state size_t count = [self count]; if (count > INT_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if (state->state >= count) return 0; @@ -668,8 +668,9 @@ - (void)dealloc - (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++]; @@ -680,8 +681,9 @@ - (id)nextObject - (void)reset { if (mutationsPtr != NULL && *mutationsPtr != mutations) - @throw [OFEnumerationMutationException newWithClass: isa - object: array]; + @throw [OFEnumerationMutationException + exceptionWithClass: isa + object: array]; position = 0; } diff --git a/src/OFArray_adjacent.m b/src/OFArray_adjacent.m index 1ca308af2..4a87e20dd 100644 --- a/src/OFArray_adjacent.m +++ b/src/OFArray_adjacent.m @@ -189,8 +189,9 @@ @implementation OFArray_adjacent 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]; @@ -239,7 +240,7 @@ - (void)getObjects: (id*)buffer 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]; @@ -281,7 +282,7 @@ - (OFArray*)objectsInRange: (of_range_t)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]; diff --git a/src/OFArray_subarray.m b/src/OFArray_subarray.m index eba465a22..808ccd725 100644 --- a/src/OFArray_subarray.m +++ b/src/OFArray_subarray.m @@ -60,7 +60,7 @@ - (size_t)count - (id)objectAtIndex: (size_t)index { if (index >= range.length) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return [array objectAtIndex: index + range.start]; } @@ -69,7 +69,7 @@ - (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; @@ -110,7 +110,7 @@ - (size_t)indexOfObjectIdenticalTo: (id)object - (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; diff --git a/src/OFAutoreleasePool.m b/src/OFAutoreleasePool.m index 8da95a9b0..6e879f764 100644 --- a/src/OFAutoreleasePool.m +++ b/src/OFAutoreleasePool.m @@ -41,7 +41,8 @@ + (void)initialize return; if (!of_tlskey_new(&firstKey) || !of_tlskey_new(&lastKey)) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } #endif @@ -66,7 +67,8 @@ + (void)addObject: (id)object if (lastPool == nil) { [object release]; - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } @try { @@ -97,7 +99,7 @@ + (void)_releaseAll if (!of_tlskey_set(lastKey, self)) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; #else previousPool = lastPool; lastPool = self; @@ -108,7 +110,7 @@ + (void)_releaseAll if (!of_tlskey_set(firstKey, self)) { of_tlskey_set(lastKey, previousPool); @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; } #else firstPool = self; @@ -209,13 +211,13 @@ - (void)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 diff --git a/src/OFBlock.m b/src/OFBlock.m index c1621e2cc..c3f7261ff 100644 --- a/src/OFBlock.m +++ b/src/OFBlock.m @@ -352,19 +352,22 @@ + (void)load * 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); @@ -379,60 +382,60 @@ + (void)initialize 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 @@ -473,8 +476,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end diff --git a/src/OFConstantString.m b/src/OFConstantString.m index 0848c5be7..7ee2f2496 100644 --- a/src/OFConstantString.m +++ b/src/OFConstantString.m @@ -48,8 +48,9 @@ - (void)finishInitialization 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; @@ -62,7 +63,7 @@ - (void)finishInitialization break; case -1: free(ivars); - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; } s = ivars; @@ -75,24 +76,24 @@ - (void)finishInitialization */ + 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 @@ -100,8 +101,8 @@ - (void)finishInitialization { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithCString: (const char*)cString @@ -109,8 +110,8 @@ - (void)finishInitialization { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithCString: (const char*)cString @@ -119,24 +120,24 @@ - (void)finishInitialization { 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 @@ -144,8 +145,8 @@ - (void)finishInitialization { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUnicodeString: (of_unichar_t*)string @@ -153,8 +154,8 @@ - (void)finishInitialization { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUnicodeString: (of_unichar_t*)string @@ -163,8 +164,8 @@ - (void)finishInitialization { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUTF16String: (uint16_t*)string @@ -172,8 +173,8 @@ - (void)finishInitialization { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUTF16String: (uint16_t*)string @@ -181,8 +182,8 @@ - (void)finishInitialization { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithUTF16String: (uint16_t*)string @@ -191,16 +192,16 @@ - (void)finishInitialization { 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 @@ -208,16 +209,16 @@ - (void)finishInitialization { 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 @@ -225,16 +226,16 @@ - (void)finishInitialization { 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 @@ -242,16 +243,16 @@ - (void)finishInitialization { 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 @@ -259,8 +260,8 @@ - (void)finishInitialization { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } /* From protocol OFSerializing */ @@ -268,8 +269,8 @@ - (void)finishInitialization { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } /* @@ -278,42 +279,42 @@ - (void)finishInitialization */ - (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]; } /* @@ -341,8 +342,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } diff --git a/src/OFCountedSet.m b/src/OFCountedSet.m index c57e4fdeb..a85009578 100644 --- a/src/OFCountedSet.m +++ b/src/OFCountedSet.m @@ -87,8 +87,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @@ -113,8 +113,8 @@ + (void)initialize if (isa == [OFCountedSet class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; @@ -122,8 +122,8 @@ + (void)initialize - (size_t)countForObject: (id)object { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (OFString*)description diff --git a/src/OFCountedSet_hashtable.m b/src/OFCountedSet_hashtable.m index d0445fbbd..9d93f1852 100644 --- a/src/OFCountedSet_hashtable.m +++ b/src/OFCountedSet_hashtable.m @@ -126,8 +126,9 @@ + (void)initialize 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]; @@ -146,7 +147,7 @@ + (void)initialize if (object == nil || count == nil) @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; number = [OFNumber numberWithSize: (size_t)[[count stringValue] decimalValue]]; diff --git a/src/OFDataArray.m b/src/OFDataArray.m index 58d241d38..b4f3d68c8 100644 --- a/src/OFDataArray.m +++ b/src/OFDataArray.m @@ -86,8 +86,8 @@ @implementation OFDataArray if (itemSize_ == 0) { Class c = isa; [self release]; - @throw [OFInvalidArgumentException newWithClass: c - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: c + selector: _cmd]; } itemSize = itemSize_; @@ -152,9 +152,9 @@ @implementation OFDataArray 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]; @@ -172,7 +172,7 @@ @implementation OFDataArray [string cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII])) { Class c = isa; [self release]; - @throw [OFInvalidEncodingException newWithClass: c]; + @throw [OFInvalidEncodingException exceptionWithClass: c]; } return self; @@ -190,8 +190,9 @@ @implementation OFDataArray 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]; @@ -199,7 +200,8 @@ @implementation OFDataArray [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) { @@ -228,7 +230,7 @@ - (void*)cArray - (void*)itemAtIndex: (size_t)index { if (index >= count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return data + index * itemSize; } @@ -252,7 +254,7 @@ - (void*)lastItem - (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 @@ -275,7 +277,7 @@ - (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 @@ -290,7 +292,7 @@ - (void)addNItems: (size_t)nItems atIndex: (size_t)index { if (nItems > SIZE_MAX - count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self resizeMemory: data toNItems: count + nItems @@ -312,7 +314,7 @@ - (void)removeItemAtIndex: (size_t)index - (void)removeNItems: (size_t)nItems { if (nItems > count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; count -= nItems; @@ -322,7 +324,6 @@ - (void)removeNItems: (size_t)nItems ofSize: itemSize]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } @@ -330,7 +331,7 @@ - (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); @@ -342,7 +343,6 @@ - (void)removeNItems: (size_t)nItems ofSize: itemSize]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } @@ -355,7 +355,6 @@ - (void)removeLastItem ofSize: itemSize]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ - [e release]; } } @@ -394,13 +393,13 @@ - (of_comparison_result_t)compare: (id)object 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); @@ -457,8 +456,8 @@ - (OFXMLElement*)XMLElementBySerializing OFXMLElement *element; if (itemSize != 1) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; pool = [[OFAutoreleasePool alloc] init]; element = [OFXMLElement @@ -480,7 +479,7 @@ - (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; @@ -501,7 +500,7 @@ - (void)addNItems: (size_t)nItems 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; @@ -523,7 +522,7 @@ - (void)addNItems: (size_t)nItems 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; @@ -546,7 +545,7 @@ - (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; @@ -564,7 +563,7 @@ - (void)removeNItems: (size_t)nItems 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); diff --git a/src/OFDate.m b/src/OFDate.m index 085b83e8c..63f2db00f 100644 --- a/src/OFDate.m +++ b/src/OFDate.m @@ -48,86 +48,88 @@ #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 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 newWithClass: isa]; \ - \ - [mutex lock]; \ - \ - @try { \ - if ((tm = localtime(&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 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 @@ -229,13 +231,16 @@ + (void)initialize 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) { @@ -258,10 +263,12 @@ + (void)initialize 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; @@ -279,8 +286,9 @@ + (void)initialize 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]; @@ -339,8 +347,8 @@ - (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; @@ -456,11 +464,11 @@ - (OFString*)dateStringWithFormat: (OFConstantString*)format 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]; @@ -470,7 +478,7 @@ - (OFString*)dateStringWithFormat: (OFConstantString*)format struct tm *tmp; if ((tmp = gmtime(&seconds_)) == NULL) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; tm = *tmp; # ifdef OF_THREADS @@ -484,7 +492,7 @@ - (OFString*)dateStringWithFormat: (OFConstantString*)format @try { if (!strftime(buffer, of_pagesize, [format UTF8String], &tm)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; ret = [OFString stringWithUTF8String: buffer]; } @finally { @@ -502,11 +510,11 @@ - (OFString*)localDateStringWithFormat: (OFConstantString*)format 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]; @@ -516,7 +524,7 @@ - (OFString*)localDateStringWithFormat: (OFConstantString*)format struct tm *tmp; if ((tmp = localtime(&seconds_)) == NULL) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; tm = *tmp; # ifdef OF_THREADS @@ -530,7 +538,7 @@ - (OFString*)localDateStringWithFormat: (OFConstantString*)format @try { if (!strftime(buffer, of_pagesize, [format UTF8String], &tm)) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; ret = [OFString stringWithUTF8String: buffer]; } @finally { diff --git a/src/OFDictionary.m b/src/OFDictionary.m index 60a2dee6d..57192dfdd 100644 --- a/src/OFDictionary.m +++ b/src/OFDictionary.m @@ -99,8 +99,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @@ -162,8 +162,8 @@ + (void)initialize if (isa == [OFDictionary class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; @@ -173,8 +173,8 @@ + (void)initialize { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithObject: (id)object @@ -188,8 +188,8 @@ + (void)initialize { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithKeysAndObjects: (id)firstKey, ... @@ -210,28 +210,28 @@ + (void)initialize { 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 @@ -369,22 +369,22 @@ - (OFArray*)allObjects - (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) diff --git a/src/OFDictionary_hashtable.m b/src/OFDictionary_hashtable.m index 02881d8a7..2c1b78daa 100644 --- a/src/OFDictionary_hashtable.m +++ b/src/OFDictionary_hashtable.m @@ -67,15 +67,17 @@ @implementation OFDictionary_hashtable 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; @@ -130,12 +132,12 @@ @implementation OFDictionary_hashtable 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)]; @@ -168,7 +170,7 @@ @implementation OFDictionary_hashtable if (data[i] != NULL) @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; @@ -200,8 +202,9 @@ @implementation OFDictionary_hashtable 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)]; @@ -241,12 +244,12 @@ @implementation OFDictionary_hashtable 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)]; @@ -298,7 +301,7 @@ @implementation OFDictionary_hashtable if (j >= last) @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; @@ -345,26 +348,28 @@ @implementation OFDictionary_hashtable 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)]; @@ -393,8 +398,8 @@ @implementation OFDictionary_hashtable if (key == nil || object == nil) @throw [OFInvalidArgumentException - newWithClass: isa - selector: _cmd]; + exceptionWithClass: isa + selector: _cmd]; hash = [key hash]; last = size; @@ -431,7 +436,7 @@ @implementation OFDictionary_hashtable if (j >= last) @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; @@ -476,8 +481,9 @@ @implementation OFDictionary_hashtable 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]; @@ -487,7 +493,8 @@ @implementation OFDictionary_hashtable namespace: OF_SERIALIZATION_NS]; if ([keys count] != [objects count]) - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; keyEnumerator = [keys objectEnumerator]; objectEnumerator = [objects objectEnumerator]; @@ -504,7 +511,7 @@ @implementation OFDictionary_hashtable if (key == nil || object == nil) @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; [dictionary setObject: [object objectByDeserializing] forKey: [key objectByDeserializing]]; @@ -528,8 +535,8 @@ - (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; @@ -771,8 +778,8 @@ - (void)reset { if (mutationsPtr != NULL && *mutationsPtr != mutations) @throw [OFEnumerationMutationException - newWithClass: isa - object: dictionary]; + exceptionWithClass: isa + object: dictionary]; pos = 0; } @@ -783,8 +790,8 @@ - (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++); @@ -801,8 +808,8 @@ - (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++); diff --git a/src/OFDoubleMatrix.m b/src/OFDoubleMatrix.m index b5ae81383..34a3151b5 100644 --- a/src/OFDoubleMatrix.m +++ b/src/OFDoubleMatrix.m @@ -68,8 +68,8 @@ + (void)initialize { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithRows: (size_t)rows_ @@ -84,12 +84,13 @@ + (void)initialize 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)); @@ -139,12 +140,13 @@ + (void)initialize 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; @@ -173,7 +175,7 @@ - (void)setValue: (double)value column: (size_t)column { if (row >= rows || column >= columns) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data[row * columns + column] = value; } @@ -182,7 +184,7 @@ - (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]; } @@ -294,8 +296,8 @@ - (void)addMatrix: (OFDoubleMatrix*)matrix 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]; @@ -307,8 +309,8 @@ - (void)subtractMatrix: (OFDoubleMatrix*)matrix 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]; @@ -337,13 +339,14 @@ - (void)multiplyWithMatrix: (OFDoubleMatrix*)matrix 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; @@ -384,9 +387,9 @@ - (void)transpose 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; @@ -410,8 +413,8 @@ - (void)translateWithVector: (OFDoubleVector*)vector 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 @@ -435,8 +438,8 @@ - (void)rotateWithVector: (OFDoubleVector*)vector 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]; @@ -484,8 +487,8 @@ - (void)scaleWithVector: (OFDoubleVector*)vector 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 diff --git a/src/OFDoubleVector.m b/src/OFDoubleVector.m index b40867f7b..b2a69c399 100644 --- a/src/OFDoubleVector.m +++ b/src/OFDoubleVector.m @@ -64,8 +64,8 @@ + (void)initialize { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithDimension: (size_t)dimension_ @@ -76,12 +76,12 @@ + (void)initialize 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) { @@ -119,12 +119,12 @@ + (void)initialize 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++) @@ -148,7 +148,7 @@ - (void)setValue: (double)value atIndex: (size_t)index { if (index >= dimension) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data[index] = value; } @@ -156,7 +156,7 @@ - (void)setValue: (double)value - (double)valueAtIndex: (size_t)index { if (index >= dimension) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return data[index]; } @@ -172,9 +172,9 @@ - (void)setDimension: (size_t)dimension_ 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; @@ -297,8 +297,8 @@ - (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]; @@ -309,8 +309,8 @@ - (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]; @@ -337,8 +337,8 @@ - (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]; @@ -349,8 +349,8 @@ - (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]; @@ -362,8 +362,8 @@ - (double)dotProductWithVector: (OFDoubleVector*)vector 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; @@ -378,12 +378,12 @@ - (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]; @@ -403,13 +403,13 @@ - (void)multiplyWithMatrix: (OFDoubleMatrix*)matrix 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)); diff --git a/src/OFEnumerator.m b/src/OFEnumerator.m index 0a6a83b97..9082c03cf 100644 --- a/src/OFEnumerator.m +++ b/src/OFEnumerator.m @@ -26,8 +26,8 @@ @implementation OFEnumerator if (isa == [OFEnumerator class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; @@ -35,13 +35,13 @@ @implementation OFEnumerator - (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 diff --git a/src/OFFile.m b/src/OFFile.m index f34ca29bd..287a8f8e2 100644 --- a/src/OFFile.m +++ b/src/OFFile.m @@ -232,8 +232,9 @@ + (void)createDirectoryAtPath: (OFString*)path #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 @@ -247,8 +248,8 @@ + (OFArray*)filesInDirectoryAtPath: (OFString*)path 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 { @@ -282,9 +283,9 @@ + (OFArray*)filesInDirectoryAtPath: (OFString*)path 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]; @@ -318,8 +319,9 @@ + (OFArray*)filesInDirectoryAtPath: (OFString*)path + (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 @@ -328,16 +330,18 @@ + (void)changeModeOfFile: (OFString*)path { # 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; @@ -345,9 +349,10 @@ + (void)changeModeOfFile: (OFString*)path 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 @@ -359,9 +364,9 @@ + (OFDate*)modificationDateOfFile: (OFString*)path 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]; @@ -376,8 +381,8 @@ + (void)changeOwnerOfFile: (OFString*)path 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]; @@ -390,10 +395,10 @@ + (void)changeOwnerOfFile: (OFString*)path 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; } @@ -404,10 +409,10 @@ + (void)changeOwnerOfFile: (OFString*)path 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; } @@ -419,10 +424,11 @@ + (void)changeOwnerOfFile: (OFString*)path 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 @@ -444,8 +450,8 @@ + (void)copyFileAtPath: (OFString*)source 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 @@ -496,9 +502,10 @@ + (void)renameFileAtPath: (OFString*)source 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]; } @@ -510,15 +517,16 @@ + (void)deleteFileAtPath: (OFString*)path #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 @@ -535,9 +543,9 @@ + (void)linkFileAtPath: (OFString*)source 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]; } @@ -557,9 +565,10 @@ + (void)symlinkFileAtPath: (OFString*)source 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]; } @@ -569,8 +578,8 @@ + (void)symlinkFileAtPath: (OFString*)source { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithPath: (OFString*)path @@ -583,14 +592,16 @@ + (void)symlinkFileAtPath: (OFString*)source 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) { @@ -624,9 +635,9 @@ - (size_t)_readNBytes: (size_t)length 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; @@ -639,18 +650,18 @@ - (void)_writeNBytes: (size_t)length { 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 @@ -658,10 +669,10 @@ - (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; } @@ -671,10 +682,10 @@ - (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; } @@ -707,8 +718,8 @@ @implementation OFFileSingleton { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - autorelease @@ -732,26 +743,26 @@ - (unsigned int)retainCount - (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 diff --git a/src/OFFloatMatrix.m b/src/OFFloatMatrix.m index 47743f098..2e96abe95 100644 --- a/src/OFFloatMatrix.m +++ b/src/OFFloatMatrix.m @@ -68,8 +68,8 @@ + (void)initialize { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithRows: (size_t)rows_ @@ -83,13 +83,13 @@ + (void)initialize 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)); @@ -139,12 +139,13 @@ + (void)initialize 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; @@ -173,7 +174,7 @@ - (void)setValue: (float)value column: (size_t)column { if (row >= rows || column >= columns) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data[row * columns + column] = value; } @@ -182,7 +183,7 @@ - (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]; } @@ -294,8 +295,8 @@ - (void)addMatrix: (OFFloatMatrix*)matrix 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]; @@ -307,8 +308,8 @@ - (void)subtractMatrix: (OFFloatMatrix*)matrix 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]; @@ -337,13 +338,14 @@ - (void)multiplyWithMatrix: (OFFloatMatrix*)matrix 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; @@ -384,9 +386,9 @@ - (void)transpose 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; @@ -410,8 +412,8 @@ - (void)translateWithVector: (OFFloatVector*)vector 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 @@ -435,8 +437,8 @@ - (void)rotateWithVector: (OFFloatVector*)vector 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]; @@ -484,8 +486,8 @@ - (void)scaleWithVector: (OFFloatVector*)vector 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 diff --git a/src/OFFloatVector.m b/src/OFFloatVector.m index 8aeb56425..8859c6142 100644 --- a/src/OFFloatVector.m +++ b/src/OFFloatVector.m @@ -64,8 +64,8 @@ + (void)initialize { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithDimension: (size_t)dimension_ @@ -76,12 +76,12 @@ + (void)initialize 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) { @@ -119,12 +119,12 @@ + (void)initialize 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++) @@ -148,7 +148,7 @@ - (void)setValue: (float)value atIndex: (size_t)index { if (index >= dimension) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; data[index] = value; } @@ -156,7 +156,7 @@ - (void)setValue: (float)value - (float)valueAtIndex: (size_t)index { if (index >= dimension) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return data[index]; } @@ -172,9 +172,9 @@ - (void)setDimension: (size_t)dimension_ 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; @@ -297,8 +297,8 @@ - (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]; @@ -309,8 +309,8 @@ - (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]; @@ -337,8 +337,8 @@ - (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]; @@ -349,8 +349,8 @@ - (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]; @@ -362,8 +362,8 @@ - (float)dotProductWithVector: (OFFloatVector*)vector 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; @@ -378,12 +378,12 @@ - (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]; @@ -403,13 +403,13 @@ - (void)multiplyWithMatrix: (OFFloatMatrix*)matrix 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)); diff --git a/src/OFHTTPRequest.m b/src/OFHTTPRequest.m index e91550f58..bc819c573 100644 --- a/src/OFHTTPRequest.m +++ b/src/OFHTTPRequest.m @@ -191,16 +191,16 @@ - (OFHTTPRequestResult*)performWithRedirects: (size_t)redirects 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]; @@ -283,7 +283,7 @@ - (OFHTTPRequestResult*)performWithRedirects: (size_t)redirects 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]; @@ -299,7 +299,7 @@ - (OFHTTPRequestResult*)performWithRedirects: (size_t)redirects if ((tmp = strchr(line_c, ':')) == NULL) @throw [OFInvalidServerReplyException - newWithClass: isa]; + exceptionWithClass: isa]; key = [OFString stringWithUTF8String: line_c length: tmp - line_c]; @@ -386,7 +386,7 @@ - (OFHTTPRequestResult*)performWithRedirects: (size_t)redirects if (cl > SIZE_MAX) @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; /* * We only want to throw on these status codes as we @@ -396,7 +396,7 @@ - (OFHTTPRequestResult*)performWithRedirects: (size_t)redirects if (cl != bytesReceived && (status == 200 || status == 301 || status == 302 || status == 303)) @throw [OFTruncatedDataException - newWithClass: isa]; + exceptionWithClass: isa]; } [serverHeaders makeImmutable]; @@ -409,9 +409,9 @@ - (OFHTTPRequestResult*)performWithRedirects: (size_t)redirects 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]; } diff --git a/src/OFHash.m b/src/OFHash.m index 5a1162f4f..c35a9d87d 100644 --- a/src/OFHash.m +++ b/src/OFHash.m @@ -23,27 +23,27 @@ @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 diff --git a/src/OFList.m b/src/OFList.m index ca9919283..ddf4ed665 100644 --- a/src/OFList.m +++ b/src/OFList.m @@ -47,8 +47,9 @@ @implementation OFList 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]; @@ -443,8 +444,9 @@ - (id)nextObject id ret; if (*mutationsPtr != mutations) - @throw [OFEnumerationMutationException newWithClass: isa - object: list]; + @throw [OFEnumerationMutationException + exceptionWithClass: isa + object: list]; if (current == NULL) return nil; @@ -458,7 +460,9 @@ - (id)nextObject - (void)reset { if (*mutationsPtr != mutations) - @throw [OFEnumerationMutationException newWithClass: isa]; + @throw [OFEnumerationMutationException + exceptionWithClass: isa + object: list]; current = [list firstListObject]; } diff --git a/src/OFMD5Hash.m b/src/OFMD5Hash.m index a81f7deab..613992b9c 100644 --- a/src/OFMD5Hash.m +++ b/src/OFMD5Hash.m @@ -155,8 +155,9 @@ - (void)updateWithBuffer: (const char*)buffer_ return; if (calculated) - @throw [OFHashAlreadyCalculatedException newWithClass: isa - hash: self]; + @throw [OFHashAlreadyCalculatedException + exceptionWithClass: isa + hash: self]; /* Update bitcount */ t = bits[0]; diff --git a/src/OFMutableArray.m b/src/OFMutableArray.m index 9bb82b2d2..66b269379 100644 --- a/src/OFMutableArray.m +++ b/src/OFMutableArray.m @@ -103,8 +103,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @@ -129,8 +129,8 @@ + (void)initialize if (isa == [OFMutableArray class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; @@ -150,15 +150,15 @@ - (void)addObject: (id)object - (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 @@ -192,8 +192,8 @@ - (void)replaceObjectIdenticalTo: (id)oldObject - (void)removeObjectAtIndex: (size_t)index { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (void)removeObject: (id)object diff --git a/src/OFMutableArray_adjacent.m b/src/OFMutableArray_adjacent.m index 4f500c851..a1fc04c10 100644 --- a/src/OFMutableArray_adjacent.m +++ b/src/OFMutableArray_adjacent.m @@ -76,7 +76,7 @@ - (void)replaceObjectAtIndex: (size_t)index id oldObject; if (index >= [array count]) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; oldObject = cArray[index]; cArray[index] = [object retain]; @@ -151,7 +151,7 @@ - (void)removeNObjects: (size_t)nObjects size_t i, count = [array count]; if (nObjects > count) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; copy = [self allocMemoryForNItems: nObjects ofSize: sizeof(id)]; @@ -174,7 +174,7 @@ - (void)removeObjectsInRange: (of_range_t)range 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)]; @@ -237,8 +237,8 @@ - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block 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); } @@ -256,14 +256,15 @@ - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block 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]; diff --git a/src/OFMutableDictionary.m b/src/OFMutableDictionary.m index d1313c0d0..7dc9de5e0 100644 --- a/src/OFMutableDictionary.m +++ b/src/OFMutableDictionary.m @@ -96,8 +96,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @@ -122,8 +122,8 @@ + (void)initialize if (isa == [OFMutableDictionary class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; @@ -132,14 +132,14 @@ + (void)initialize - (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 diff --git a/src/OFMutableDictionary_hashtable.m b/src/OFMutableDictionary_hashtable.m index 1e8856fa9..0cd545abe 100644 --- a/src/OFMutableDictionary_hashtable.m +++ b/src/OFMutableDictionary_hashtable.m @@ -48,7 +48,7 @@ - (void)_resizeForCount: (size_t)newCount uint32_t i, newSize; if (newCount > UINT32_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; if (fullness >= 3) newSize = size << 1; @@ -58,7 +58,7 @@ - (void)_resizeForCount: (size_t)newCount return; if (newSize == 0) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; newData = [self allocMemoryForNItems: newSize ofSize: sizeof(*newData)]; @@ -86,7 +86,7 @@ - (void)_resizeForCount: (size_t)newCount if (j >= last) { [self freeMemory: newData]; @throw [OFOutOfRangeException - newWithClass: isa]; + exceptionWithClass: isa]; } newData[j] = data[i]; @@ -106,8 +106,8 @@ - (void)_setObject: (id)object id old; if (key == nil || object == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; hash = [key hash]; last = size; @@ -155,7 +155,7 @@ - (void)_setObject: (id)object } if (i >= last) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; @@ -196,8 +196,8 @@ - (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; @@ -291,8 +291,8 @@ - (void)enumerateKeysAndObjectsUsingBlock: 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); @@ -308,16 +308,16 @@ - (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block 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]; diff --git a/src/OFMutableSet.m b/src/OFMutableSet.m index 9eac06a34..8fa162840 100644 --- a/src/OFMutableSet.m +++ b/src/OFMutableSet.m @@ -86,8 +86,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @@ -112,8 +112,8 @@ + (void)initialize if (isa == [OFMutableSet class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; @@ -121,14 +121,14 @@ + (void)initialize - (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 diff --git a/src/OFMutableString.m b/src/OFMutableString.m index 6135864d0..daa9f223c 100644 --- a/src/OFMutableString.m +++ b/src/OFMutableString.m @@ -78,7 +78,8 @@ - (void)_applyTable: (const of_unichar_t* const[])table if (cLen == 0 || c > 0x10FFFF) { [self freeMemory: unicodeString]; - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } if (c >> 8 < tableSize) { @@ -99,7 +100,8 @@ - (void)_applyTable: (const of_unichar_t* const[])table newCStringLength += 4; else { [self freeMemory: unicodeString]; - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } i += cLen; @@ -119,7 +121,8 @@ - (void)_applyTable: (const of_unichar_t* const[])table newCString + j)) == 0) { [self freeMemory: unicodeString]; [self freeMemory: newCString]; - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } j += d; } @@ -153,7 +156,7 @@ - (void)appendUTF8String: (const char*)UTF8String s->UTF8 = YES; break; case -1: - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; } s->cString = [self resizeMemory: s->cString @@ -180,7 +183,7 @@ - (void)appendUTF8String: (const char*)UTF8String s->UTF8 = YES; break; case -1: - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; } s->cString = [self resizeMemory: s->cString @@ -224,8 +227,8 @@ - (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]; @@ -261,12 +264,12 @@ - (void)appendFormat: (OFConstantString*)format 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 @@ -309,14 +312,16 @@ - (void)reverse /* 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 */ @@ -333,7 +338,8 @@ - (void)reverse 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 */ @@ -350,7 +356,8 @@ - (void)reverse 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 */ @@ -369,7 +376,7 @@ - (void)reverse /* 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); @@ -393,7 +400,7 @@ - (void)insertString: (OFString*)string 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, @@ -419,11 +426,11 @@ - (void)deleteCharactersInRange: (of_range_t)range 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; @@ -443,7 +450,6 @@ - (void)deleteCharactersInRange: (of_range_t)range toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } @@ -455,11 +461,11 @@ - (void)replaceCharactersInRange: (of_range_t)range 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]; @@ -569,7 +575,6 @@ - (void)deleteLeadingWhitespaces toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } @@ -596,7 +601,6 @@ - (void)deleteTrailingWhitespaces toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } @@ -635,7 +639,6 @@ - (void)deleteEnclosingWhitespaces toSize: s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ - [e release]; } } diff --git a/src/OFNull.m b/src/OFNull.m index 8cbea6530..71a59fd66 100644 --- a/src/OFNull.m +++ b/src/OFNull.m @@ -47,8 +47,8 @@ @implementation OFNull 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]; @@ -101,8 +101,8 @@ - (unsigned int)retainCount - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end diff --git a/src/OFNumber.m b/src/OFNumber.m index f6c6f5c04..a62b0db1f 100644 --- a/src/OFNumber.m +++ b/src/OFNumber.m @@ -84,7 +84,8 @@ case OF_NUMBER_DOUBLE: \ return (t)value.double_; \ default: \ - @throw [OFInvalidFormatException newWithClass: isa]; \ + @throw [OFInvalidFormatException \ + exceptionWithClass: isa]; \ } #define CALCULATE(o, n) \ switch (type) { \ @@ -167,7 +168,8 @@ return [OFNumber numberWithDouble: \ value.double_ o [n doubleValue]]; \ default: \ - @throw [OFInvalidFormatException newWithClass: isa]; \ + @throw [OFInvalidFormatException \ + exceptionWithClass: isa]; \ } #define CALCULATE2(o, n) \ switch (type) { \ @@ -245,10 +247,12 @@ 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) { \ @@ -308,7 +312,8 @@ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: value.double_ o]; \ default: \ - @throw [OFInvalidFormatException newWithClass: isa]; \ + @throw [OFInvalidFormatException \ + exceptionWithClass: isa]; \ } @implementation OFNumber @@ -444,8 +449,8 @@ @implementation OFNumber - init { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - initWithBool: (BOOL)bool_ @@ -718,8 +723,9 @@ @implementation OFNumber 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]; @@ -732,8 +738,8 @@ @implementation OFNumber 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 @@ -751,8 +757,9 @@ @implementation OFNumber 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) { @@ -1118,7 +1125,7 @@ - (OFNumber*)remainderOfDivisionWithNumber: (OFNumber*)number return [OFNumber numberWithDouble: fmod(value.double_, [number doubleValue])]; default: - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException exceptionWithClass: isa]; } } @@ -1162,7 +1169,7 @@ - (OFString*)description case OF_NUMBER_DOUBLE: return [OFString stringWithFormat: @"%lg", value.double_]; default: - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException exceptionWithClass: isa]; } } @@ -1224,7 +1231,7 @@ - (OFXMLElement*)XMLElementBySerializing break; default: - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException exceptionWithClass: isa]; } [element retain]; diff --git a/src/OFObject+Serialization.m b/src/OFObject+Serialization.m index 65d345553..b7e31db10 100644 --- a/src/OFObject+Serialization.m +++ b/src/OFObject+Serialization.m @@ -37,8 +37,8 @@ - (OFString*)stringBySerializing 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]; diff --git a/src/OFObject.m b/src/OFObject.m index eb404ac91..2b4080fa9 100644 --- a/src/OFObject.m +++ b/src/OFObject.m @@ -101,8 +101,9 @@ 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 @@ -197,7 +198,8 @@ + (void)initialize if (!of_spinlock_new( &((struct pre_ivar*)instance)->retainCountSpinlock)) { free(instance); - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } #endif @@ -304,8 +306,8 @@ + (const char*)typeEncodingForInstanceSelector: (SEL)selector 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) @@ -313,8 +315,8 @@ + (const char*)typeEncodingForInstanceSelector: (SEL)selector 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 @@ -323,8 +325,8 @@ + (const char*)typeEncodingForInstanceSelector: (SEL)selector 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 @@ -340,8 +342,8 @@ + (IMP)setImplementation: (IMP)newImp { #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) @@ -351,8 +353,8 @@ + (IMP)setImplementation: (IMP)newImp 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) { @@ -383,8 +385,8 @@ + (IMP)setImplementation: (IMP)newImp 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 @@ -401,8 +403,8 @@ + (IMP)replaceClassMethod: (SEL)selector IMP newImp; if (![class isSubclassOfClass: self]) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; newImp = [class methodForSelector: selector]; @@ -415,8 +417,8 @@ + (IMP)setImplementation: (IMP)newImp { #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) @@ -426,8 +428,8 @@ + (IMP)setImplementation: (IMP)newImp 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) { @@ -457,8 +459,8 @@ + (IMP)setImplementation: (IMP)newImp 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)); @@ -471,8 +473,8 @@ + (IMP)replaceInstanceMethod: (SEL)selector IMP newImp; if (![class isSubclassOfClass: self]) - @throw [OFInvalidArgumentException newWithClass: self - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: self + selector: _cmd]; newImp = [class instanceMethodForSelector: selector]; @@ -501,8 +503,8 @@ + (BOOL)addInstanceMethod: (SEL)selector 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; @@ -517,8 +519,8 @@ + (BOOL)addInstanceMethod: (SEL)selector return YES; #else - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; #endif } @@ -544,8 +546,8 @@ + (BOOL)addClassMethod: (SEL)selector 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; @@ -560,8 +562,8 @@ + (BOOL)addClassMethod: (SEL)selector return YES; #else - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; #endif } @@ -700,8 +702,8 @@ + (void)inheritMethodsFromClass: (Class)class } } #else - @throw [OFNotImplementedException newWithClass: self - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: self + selector: _cmd]; #endif [self inheritMethodsFromClass: [class superclass]]; @@ -792,8 +794,8 @@ - (const char*)typeEncodingForSelector: (SEL)selector 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) @@ -801,8 +803,8 @@ - (const char*)typeEncodingForSelector: (SEL)selector 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 @@ -811,8 +813,8 @@ - (const char*)typeEncodingForSelector: (SEL)selector 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 @@ -845,12 +847,13 @@ - (void)addMemoryToPool: (void*)pointer 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; @@ -869,17 +872,18 @@ - (void*)allocMemoryWithSize: (size_t)size 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; @@ -896,7 +900,7 @@ - (void*)allocMemoryForNItems: (size_t)nItems return NULL; if (nItems > SIZE_MAX / size) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return [self allocMemoryWithSize: nItems * size]; } @@ -921,16 +925,16 @@ - (void*)resizeMemory: (void*)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 @@ -947,7 +951,7 @@ - (void*)resizeMemory: (void*)pointer } if (nItems > SIZE_MAX / size) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; return [self resizeMemory: pointer toSize: nItems * size]; @@ -999,8 +1003,8 @@ - (void)freeMemory: (void*)pointer } } - @throw [OFMemoryNotPartOfObjectException newWithClass: isa - pointer: pointer]; + @throw [OFMemoryNotPartOfObjectException exceptionWithClass: isa + pointer: pointer]; } - retain @@ -1091,8 +1095,8 @@ - (void)dealloc - copyWithZone: (void*)zone { if (zone != NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; return [(id)self copy]; } @@ -1100,8 +1104,8 @@ - (void)dealloc - mutableCopyWithZone: (void*)zone { if (zone != NULL) - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; return [(id)self mutableCopy]; } @@ -1112,42 +1116,42 @@ - (void)dealloc */ + (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 @@ -1171,19 +1175,19 @@ + (void)release + (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 diff --git a/src/OFPlugin.m b/src/OFPlugin.m index 501e84b7f..5d7505485 100644 --- a/src/OFPlugin.m +++ b/src/OFPlugin.m @@ -51,14 +51,16 @@ @implementation OFPlugin 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; @@ -70,8 +72,8 @@ @implementation OFPlugin if (isa == [OFPlugin class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; diff --git a/src/OFSHA1Hash.m b/src/OFSHA1Hash.m index 15ba5b111..b28c014fd 100644 --- a/src/OFSHA1Hash.m +++ b/src/OFSHA1Hash.m @@ -164,8 +164,9 @@ - (void)updateWithBuffer: (const char*)buffer_ return; if (calculated) - @throw [OFHashAlreadyCalculatedException newWithClass: isa - hash: self]; + @throw [OFHashAlreadyCalculatedException + exceptionWithClass: isa + hash: self]; sha1_update(state, &count, buffer, buffer_, length); } diff --git a/src/OFSOCKS5Socket.m b/src/OFSOCKS5Socket.m index b902adc05..89d489a4a 100644 --- a/src/OFSOCKS5Socket.m +++ b/src/OFSOCKS5Socket.m @@ -33,8 +33,8 @@ @implementation OFSOCKS5Socket { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithProxyHost: (OFString*)host @@ -79,10 +79,11 @@ - (void)connectToHost: (OFString*)host 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]; @@ -107,10 +108,10 @@ - (void)connectToHost: (OFString*)host 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 */ @@ -129,10 +130,10 @@ - (void)connectToHost: (OFString*)host 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]; diff --git a/src/OFSeekableStream.m b/src/OFSeekableStream.m index 4ece4971f..350b671b5 100644 --- a/src/OFSeekableStream.m +++ b/src/OFSeekableStream.m @@ -21,20 +21,20 @@ @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 diff --git a/src/OFSet.m b/src/OFSet.m index e6c831e0e..8c58d9b9b 100644 --- a/src/OFSet.m +++ b/src/OFSet.m @@ -85,8 +85,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @@ -139,8 +139,8 @@ + (void)initialize if (isa == [OFSet class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } return [super init]; @@ -150,16 +150,16 @@ + (void)initialize { 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, ... @@ -180,42 +180,42 @@ - (id)initWithObjects:(id)firstObject, ... { 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 diff --git a/src/OFSet_hashtable.m b/src/OFSet_hashtable.m index 84e8e6dfb..e9014e147 100644 --- a/src/OFSet_hashtable.m +++ b/src/OFSet_hashtable.m @@ -140,8 +140,9 @@ @implementation OFSet_hashtable 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]; diff --git a/src/OFStream.m b/src/OFStream.m index 3350bc9f3..182e70fa5 100644 --- a/src/OFStream.m +++ b/src/OFStream.m @@ -57,8 +57,8 @@ + (void)initialize if (isa == [OFStream class]) { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } self = [super init]; @@ -72,22 +72,22 @@ + (void)initialize - (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 @@ -693,8 +693,8 @@ - (OFString*)tryReadTillDelimiter: (OFString*)delimiter 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) { @@ -1332,12 +1332,12 @@ - (size_t)writeFormat: (OFConstantString*)format 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 @@ -1367,8 +1367,8 @@ - (void)setBlocking: (BOOL)enable 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; @@ -1376,24 +1376,24 @@ - (void)setBlocking: (BOOL)enable 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 diff --git a/src/OFStreamObserver.m b/src/OFStreamObserver.m index f11ae6c87..c0661141c 100644 --- a/src/OFStreamObserver.m +++ b/src/OFStreamObserver.m @@ -108,7 +108,7 @@ @implementation OFStreamObserver #ifndef _WIN32 if (pipe(cancelFD)) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; #else /* Make sure WSAStartup has been called */ [OFTCPSocket class]; @@ -119,7 +119,7 @@ @implementation OFStreamObserver if (cancelFD[0] == INVALID_SOCKET || cancelFD[1] == INVALID_SOCKET) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; cancelAddr.sin_family = AF_INET; cancelAddr.sin_port = 0; @@ -130,14 +130,14 @@ @implementation OFStreamObserver 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]; @@ -274,26 +274,26 @@ - (void)removeStreamForWriting: (OFStream*)stream - (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 @@ -372,8 +372,8 @@ - (void)observe - (BOOL)observeWithTimeout: (int)timeout { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; } - (BOOL)_processCache diff --git a/src/OFStreamObserver_kqueue.m b/src/OFStreamObserver_kqueue.m index d3d535ff2..4f6483dd8 100644 --- a/src/OFStreamObserver_kqueue.m +++ b/src/OFStreamObserver_kqueue.m @@ -41,7 +41,7 @@ @implementation OFStreamObserver_kqueue @try { if ((kernelQueue = kqueue()) == -1) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; changeList = [[OFDataArray alloc] initWithItemSize: sizeof(struct kevent)]; @@ -115,7 +115,7 @@ - (BOOL)observeWithTimeout: (int)timeout case EINTR: return NO; case ENOMEM: - @throw [OFOutOfMemoryException newWithClass: isa]; + @throw [OFOutOfMemoryException exceptionWithClass: isa]; default: assert(0); } diff --git a/src/OFStreamObserver_poll.m b/src/OFStreamObserver_poll.m index 90dd5c3ca..8c2171b1b 100644 --- a/src/OFStreamObserver_poll.m +++ b/src/OFStreamObserver_poll.m @@ -135,7 +135,7 @@ - (BOOL)observeWithTimeout: (int)timeout #ifdef OPEN_MAX if (nFDs > OPEN_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: isa]; #endif if (poll(FDsCArray, (nfds_t)nFDs, timeout) < 1) diff --git a/src/OFStreamSocket.m b/src/OFStreamSocket.m index 321217c23..ba276c397 100644 --- a/src/OFStreamSocket.m +++ b/src/OFStreamSocket.m @@ -55,7 +55,8 @@ + (void)initialize return; if (WSAStartup(MAKEWORD(2, 0), &wsa)) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } #endif @@ -75,15 +76,15 @@ - (size_t)_readNBytes: (size_t)length 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 @@ -94,9 +95,9 @@ - (size_t)_readNBytes: (size_t)length } 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; @@ -108,15 +109,15 @@ - (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 @@ -127,9 +128,9 @@ - (void)_writeNBytes: (size_t)length } 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 @@ -139,8 +140,8 @@ - (void)setBlocking: (BOOL)enable blocking = enable; if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) - @throw [OFSetOptionFailedException newWithClass: isa - stream: self]; + @throw [OFSetOptionFailedException exceptionWithClass: isa + stream: self]; } #endif @@ -152,8 +153,8 @@ - (int)fileDescriptor - (void)close { if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException newWithClass: isa - socket: self]; + @throw [OFNotConnectedException exceptionWithClass: isa + socket: self]; close(sock); diff --git a/src/OFString+Serialization.m b/src/OFString+Serialization.m index 6882bffa1..77b3aaff9 100644 --- a/src/OFString+Serialization.m +++ b/src/OFString+Serialization.m @@ -40,20 +40,18 @@ - (id)objectByDeserializing @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]; diff --git a/src/OFString+URLEncoding.m b/src/OFString+URLEncoding.m index f51916e18..81205d93c 100644 --- a/src/OFString+URLEncoding.m +++ b/src/OFString+URLEncoding.m @@ -43,8 +43,8 @@ - (OFString*)stringByURLEncoding */ 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 == '_' || @@ -85,8 +85,8 @@ - (OFString*)stringByURLDecoding 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) { @@ -111,7 +111,7 @@ - (OFString*)stringByURLDecoding else { free(retCString); @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; } if (++state == 3) { @@ -127,7 +127,7 @@ - (OFString*)stringByURLDecoding if (state != 0) { free(retCString); - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; } @try { diff --git a/src/OFString+XMLEscaping.m b/src/OFString+XMLEscaping.m index 2b437ffe4..b198403dc 100644 --- a/src/OFString+XMLEscaping.m +++ b/src/OFString+XMLEscaping.m @@ -45,8 +45,8 @@ - (OFString*)stringByXMLEscaping * 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]) { @@ -86,8 +86,8 @@ - (OFString*)stringByXMLEscaping retLength + appendLen)) == NULL) { free(retCString); @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: retLength + appendLen]; + exceptionWithClass: isa + requestedSize: retLength + appendLen]; } retCString = newRetCString; retLength += appendLen - 1; diff --git a/src/OFString+XMLUnescaping.m b/src/OFString+XMLUnescaping.m index 08b5f7b23..082fef231 100644 --- a/src/OFString+XMLUnescaping.m +++ b/src/OFString+XMLUnescaping.m @@ -140,7 +140,7 @@ - (OFString*)stringByXMLUnescapingWithDelegate: if (tmp == nil) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; @@ -158,13 +158,13 @@ - (OFString*)stringByXMLUnescapingWithDelegate: 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; @@ -172,7 +172,7 @@ - (OFString*)stringByXMLUnescapingWithDelegate: } if (inEntity) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendUTF8String: string + last withLength: i - last]; @@ -242,7 +242,7 @@ - (OFString*)stringByXMLUnescapingWithBlock: if (tmp == nil) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; @@ -259,7 +259,7 @@ - (OFString*)stringByXMLUnescapingWithBlock: if (tmp == nil) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; @@ -271,7 +271,7 @@ - (OFString*)stringByXMLUnescapingWithBlock: } if (inEntity) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendUTF8String: string + last withLength: i - last]; diff --git a/src/OFString.m b/src/OFString.m index ad52c8b8b..e2a6c1405 100644 --- a/src/OFString.m +++ b/src/OFString.m @@ -498,13 +498,13 @@ @implementation OFString 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); @@ -532,7 +532,7 @@ @implementation OFString if (bytes == 0) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; s->cStringLength += bytes - 1; s->cString = [self @@ -556,7 +556,8 @@ @implementation OFString table = of_windows_1252; break; default: - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; } for (i = j = 0; i < cStringLength; i++) { @@ -573,7 +574,7 @@ @implementation OFString if (character == 0xFFFD) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; s->UTF8 = YES; characterBytes = of_string_unicode_to_utf8(character, @@ -581,7 +582,7 @@ @implementation OFString if (characterBytes == 0) @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; s->cStringLength += characterBytes - 1; s->cString = [self resizeMemory: s->cString @@ -712,7 +713,7 @@ @implementation OFString break; default: @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; } } @@ -723,7 +724,6 @@ @implementation OFString 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]; @@ -792,14 +792,14 @@ @implementation OFString /* 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]) @@ -845,7 +845,7 @@ @implementation OFString break; default: @throw [OFInvalidEncodingException - newWithClass: isa]; + exceptionWithClass: isa]; } } @@ -856,7 +856,6 @@ @implementation OFString 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]; @@ -888,15 +887,17 @@ @implementation OFString 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; @@ -908,12 +909,13 @@ @implementation OFString 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]; @@ -1015,12 +1017,13 @@ @implementation OFString 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"]; @@ -1081,9 +1084,9 @@ @implementation OFString 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"])) { @@ -1118,8 +1121,9 @@ @implementation OFString 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]]; @@ -1144,12 +1148,13 @@ - (const char*)cStringWithEncoding: (of_string_encoding_t)encoding 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]; } } @@ -1170,12 +1175,13 @@ - (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding 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]; } } @@ -1215,8 +1221,8 @@ - (of_comparison_result_t)compare: (id)object int compare; if (![object isKindOfClass: [OFString class]]) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; otherString = object; otherCStringLength = [otherString UTF8StringLength]; @@ -1245,8 +1251,8 @@ - (of_comparison_result_t)caseInsensitiveCompare: (OFString*)otherString 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]; @@ -1282,7 +1288,8 @@ - (of_comparison_result_t)caseInsensitiveCompare: (OFString*)otherString 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 = @@ -1362,7 +1369,7 @@ - (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]; @@ -1372,7 +1379,7 @@ - (of_unichar_t)characterAtIndex: (size_t)index if (!of_string_utf8_to_unicode(s->cString + index, s->cStringLength - index, &character)) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException exceptionWithClass: isa]; return character; } @@ -1441,7 +1448,7 @@ - (OFString*)substringWithRange: (of_range_t)range 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, @@ -1747,7 +1754,7 @@ - (intmax_t)decimalValue cString[i] != '\n' && cString[i] != '\r' && cString[i] != '\f') @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; continue; } @@ -1755,7 +1762,7 @@ - (intmax_t)decimalValue 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' || @@ -1763,7 +1770,8 @@ - (intmax_t)decimalValue cString[i] == '\f') expectWhitespace = YES; else - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; } if (cString[0] == '-') @@ -1802,7 +1810,7 @@ - (uintmax_t)hexadecimalValue cString[i] != '\n' && cString[i] != '\r' && cString[i] != '\f') @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; continue; } @@ -1821,16 +1829,17 @@ - (uintmax_t)hexadecimalValue 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; } @@ -1854,7 +1863,7 @@ - (float)floatValue *endPointer != '\n' && *endPointer != '\r' && *endPointer != '\f') @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; return value; } @@ -1878,7 +1887,7 @@ - (double)doubleValue *endPointer != '\n' && *endPointer != '\r' && *endPointer != '\f') @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; return value; } @@ -1905,7 +1914,8 @@ - (of_unichar_t*)unicodeString s->cStringLength - i, &c); if (cLen == 0 || c > 0x10FFFF) - @throw [OFInvalidEncodingException newWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: isa]; ret[j++] = c; i += cLen; diff --git a/src/OFTCPSocket.m b/src/OFTCPSocket.m index 7f0be4627..bb7ffbf5b 100644 --- a/src/OFTCPSocket.m +++ b/src/OFTCPSocket.m @@ -85,8 +85,8 @@ - (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; @@ -99,9 +99,10 @@ - (void)connectToHost: (OFString*)host 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, @@ -136,9 +137,10 @@ - (void)connectToHost: (OFString*)host [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)); @@ -151,10 +153,10 @@ - (void)connectToHost: (OFString*)host [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 @@ -195,10 +197,10 @@ - (void)connectToHost: (OFString*)host #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 @@ -212,8 +214,8 @@ - (uint16_t)bindToHost: (OFString*)host 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; @@ -226,24 +228,25 @@ - (uint16_t)bindToHost: (OFString*)host 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); @@ -259,9 +262,10 @@ - (uint16_t)bindToHost: (OFString*)host # 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)); @@ -272,9 +276,10 @@ - (uint16_t)bindToHost: (OFString*)host # 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); @@ -283,18 +288,18 @@ - (uint16_t)bindToHost: (OFString*)host [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 @@ -305,10 +310,10 @@ - (uint16_t)bindToHost: (OFString*)host 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) @@ -318,22 +323,22 @@ - (uint16_t)bindToHost: (OFString*)host 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; } @@ -341,13 +346,13 @@ - (void)listenWithBackLog: (int)backLog - (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; } @@ -372,8 +377,8 @@ - (OFTCPSocket*)accept 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; @@ -388,8 +393,8 @@ - (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 @@ -397,8 +402,8 @@ - (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]; @@ -407,7 +412,7 @@ - (OFString*)remoteAddress 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]; @@ -424,7 +429,7 @@ - (OFString*)remoteAddress if (host == NULL) @throw [OFAddressTranslationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; return [OFString stringWithCString: host encoding: OF_STRING_ENCODING_NATIVE]; diff --git a/src/OFThread.m b/src/OFThread.m index 6e70e01fe..7aad646bf 100644 --- a/src/OFThread.m +++ b/src/OFThread.m @@ -67,7 +67,7 @@ if (!of_tlskey_set(threadSelf, thread)) @throw [OFInitializationFailedException - newWithClass: [thread class]]; + exceptionWithClass: [thread class]]; /* * Nasty workaround for thread implementations which can't return a @@ -109,7 +109,8 @@ + (void)initialize return; if (!of_tlskey_new(&threadSelf)) - @throw [OFInitializationFailedException newWithClass: self]; + @throw [OFInitializationFailedException + exceptionWithClass: self]; } + thread @@ -142,8 +143,8 @@ + (void)setObject: (id)object 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]; } @@ -161,17 +162,17 @@ + (OFThread*)currentThread + (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 @@ -183,13 +184,13 @@ + (void)sleepUntilDate: (OFDate*)date #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 @@ -263,8 +264,8 @@ + (void)terminateWithObject: (id)object - (id)main { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; return nil; } @@ -276,8 +277,8 @@ - (void)handleTermination - (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); @@ -288,8 +289,8 @@ - (void)start 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; @@ -298,8 +299,8 @@ - (void)start - (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; @@ -309,8 +310,8 @@ - (id)join - (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 @@ -365,7 +366,7 @@ + (void)callAllDestructors @try { if (!of_tlskey_new(&key)) @throw [OFInitializationFailedException - newWithClass: isa]; + exceptionWithClass: isa]; initialized = YES; @@ -421,7 +422,7 @@ @implementation OFMutex if (!of_mutex_new(&mutex)) { Class c = isa; [self release]; - @throw [OFInitializationFailedException newWithClass: c]; + @throw [OFInitializationFailedException exceptionWithClass: c]; } initialized = YES; @@ -432,8 +433,8 @@ @implementation OFMutex - (void)lock { if (!of_mutex_lock(&mutex)) - @throw [OFMutexLockFailedException newWithClass: isa - mutex: self]; + @throw [OFMutexLockFailedException exceptionWithClass: isa + mutex: self]; } - (BOOL)tryLock @@ -444,16 +445,17 @@ - (BOOL)tryLock - (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]; } @@ -472,7 +474,7 @@ @implementation OFCondition if (!of_condition_new(&condition)) { Class c = isa; [self release]; - @throw [OFInitializationFailedException newWithClass: c]; + @throw [OFInitializationFailedException exceptionWithClass: c]; } conditionInitialized = YES; @@ -483,22 +485,25 @@ @implementation OFCondition - (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 @@ -506,8 +511,8 @@ - (void)dealloc if (conditionInitialized) if (!of_condition_free(&condition)) @throw [OFConditionStillWaitingException - newWithClass: isa - condition: self]; + exceptionWithClass: isa + condition: self]; [super dealloc]; } diff --git a/src/OFURL.m b/src/OFURL.m index 776c87333..d651eb0ff 100644 --- a/src/OFURL.m +++ b/src/OFURL.m @@ -101,8 +101,8 @@ @implementation OFURL if ((UTF8String2 = strdup([string UTF8String])) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: [string UTF8StringLength]]; + exceptionWithClass: isa + requestedSize: [string UTF8StringLength]]; UTF8String = UTF8String2; @@ -118,7 +118,8 @@ @implementation OFURL scheme = @"https"; UTF8String += 8; } else - @throw [OFInvalidFormatException newWithClass: isa]; + @throw [OFInvalidFormatException + exceptionWithClass: isa]; if ((tmp = strchr(UTF8String, '/')) != NULL) { *tmp = '\0'; @@ -161,7 +162,7 @@ @implementation OFURL if ([portString decimalValue] > 65535) @throw [OFInvalidFormatException - newWithClass: isa]; + exceptionWithClass: isa]; port = [portString decimalValue]; @@ -235,8 +236,8 @@ @implementation OFURL if ((UTF8String2 = strdup([string UTF8String])) == NULL) @throw [OFOutOfMemoryException - newWithClass: isa - requestedSize: [string UTF8StringLength]]; + exceptionWithClass: isa + requestedSize: [string UTF8StringLength]]; UTF8String = UTF8String2; @@ -296,8 +297,9 @@ @implementation OFURL 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]]; @@ -411,8 +413,8 @@ - (OFString*)scheme - (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) } @@ -466,8 +468,8 @@ - (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) } diff --git a/src/OFXMLAttribute.m b/src/OFXMLAttribute.m index df2e0ab3b..a4ed59c5d 100644 --- a/src/OFXMLAttribute.m +++ b/src/OFXMLAttribute.m @@ -63,8 +63,9 @@ @implementation OFXMLAttribute 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]; diff --git a/src/OFXMLElement+Serialization.m b/src/OFXMLElement+Serialization.m index 1815d886e..2ab020783 100644 --- a/src/OFXMLElement+Serialization.m +++ b/src/OFXMLElement+Serialization.m @@ -40,12 +40,12 @@ - (id)objectByDeserializing 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]; diff --git a/src/OFXMLElement.m b/src/OFXMLElement.m index b8269cd9d..a21556500 100644 --- a/src/OFXMLElement.m +++ b/src/OFXMLElement.m @@ -135,8 +135,8 @@ @implementation OFXMLElement { Class c = isa; [self release]; - @throw [OFNotImplementedException newWithClass: c - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: c + selector: _cmd]; } - initWithName: (OFString*)name_ @@ -170,8 +170,9 @@ @implementation OFXMLElement @try { if (name_ == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; name = [name_ copy]; ns = [ns_ copy]; @@ -197,8 +198,9 @@ @implementation OFXMLElement @try { if (characters_ == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; characters = [characters_ copy]; } @catch (id e) { @@ -215,8 +217,9 @@ @implementation OFXMLElement @try { if (CDATA_ == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; CDATA = [CDATA_ copy]; } @catch (id e) { @@ -233,8 +236,9 @@ @implementation OFXMLElement @try { if (comment_ == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; comment = [comment_ copy]; } @catch (id e) { @@ -251,8 +255,9 @@ @implementation OFXMLElement @try { if (element == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: isa + selector: _cmd]; name = [element->name copy]; ns = [element->ns copy]; @@ -283,8 +288,8 @@ @implementation OFXMLElement [self release]; if (string == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; pool = [[OFAutoreleasePool alloc] init]; @@ -299,8 +304,8 @@ @implementation OFXMLElement [parser parseString: string]; if (![parser finishedParsing]) - @throw [OFMalformedXMLException newWithClass: c - parser: parser]; + @throw [OFMalformedXMLException exceptionWithClass: c + parser: parser]; self = [delegate->element retain]; @@ -333,8 +338,8 @@ @implementation OFXMLElement [parser parseFile: path]; if (![parser finishedParsing]) - @throw [OFMalformedXMLException newWithClass: c - parser: parser]; + @throw [OFMalformedXMLException exceptionWithClass: c + parser: parser]; self = [delegate->element retain]; @@ -354,8 +359,9 @@ @implementation OFXMLElement 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] @@ -393,8 +399,9 @@ @implementation OFXMLElement [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) { @@ -408,8 +415,8 @@ @implementation OFXMLElement - (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) } @@ -422,8 +429,8 @@ - (OFString*)name - (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) } @@ -648,8 +655,9 @@ - (OFString*)_XMLStringWithParent: (OFXMLElement*)parent (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 ? @@ -881,8 +889,8 @@ - (OFXMLElement*)XMLElementBySerializing - (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]; @@ -907,8 +915,8 @@ - (void)addAttributeWithName: (OFString*)name_ 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_ @@ -990,8 +998,8 @@ - (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_ = @""; @@ -1012,8 +1020,8 @@ - (void)bindPrefix: (OFString*)prefix - (OFString*)defaultNamespace { if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; return [[defaultNamespace retain] autorelease]; } @@ -1021,8 +1029,8 @@ - (OFString*)defaultNamespace - (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]; @@ -1032,8 +1040,8 @@ - (void)setDefaultNamespace: (OFString*)ns_ - (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]; @@ -1044,8 +1052,8 @@ - (void)addChild: (OFXMLElement*)child - (void)removeChild: (OFXMLElement*)child { if (name == nil) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException exceptionWithClass: isa + selector: _cmd]; [children removeObject: child]; } diff --git a/src/OFXMLElementBuilder.m b/src/OFXMLElementBuilder.m index 73bc7d5e7..436c87840 100644 --- a/src/OFXMLElementBuilder.m +++ b/src/OFXMLElementBuilder.m @@ -194,8 +194,8 @@ - (void)elementBuilder: (OFXMLElementBuilder*)builder withPrefix: (OFString*)prefix namespace: (OFString*)ns { - @throw [OFMalformedXMLException newWithClass: [builder class] - parser: nil]; + @throw [OFMalformedXMLException exceptionWithClass: [builder class] + parser: nil]; } - (OFString*)elementBuilder: (OFXMLElementBuilder*)builder diff --git a/src/OFXMLParser.m b/src/OFXMLParser.m index ecfcaf44d..b63a9c996 100644 --- a/src/OFXMLParser.m +++ b/src/OFXMLParser.m @@ -120,8 +120,8 @@ if ((attributePrefix != nil && attributeNS == nil)) @throw [OFUnboundNamespaceException - newWithClass: isa - prefix: attributePrefix]; + exceptionWithClass: isa + prefix: attributePrefix]; [attribute->ns release]; attribute->ns = [attributeNS retain]; @@ -158,7 +158,7 @@ + (void)initialize 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]]; @@ -304,8 +304,8 @@ - (void)_parseOutsideTagWithBuffer: (const char*)buffer 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; @@ -338,8 +338,8 @@ - (void)_parseTagOpenedWithBuffer: (const char*)buffer 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 '?': @@ -481,8 +481,8 @@ - (void)_parseInProcessingInstructionsWithBuffer: (const char*)buffer [pi hasPrefix: @"xml\n"]) if (![self _parseXMLProcessingInstructions: pi]) @throw [OFMalformedXMLException - newWithClass: isa - parser: self]; + exceptionWithClass: isa + parser: self]; [delegate parser: self foundProcessingInstructions: pi]; @@ -541,9 +541,9 @@ - (void)_parseInTagNameWithBuffer: (const char*)buffer 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]; @@ -626,8 +626,8 @@ - (void)_parseInCloseTagNameWithBuffer: (const char*)buffer } if (![[previous lastObject] isEqual: cacheString]) - @throw [OFMalformedXMLException newWithClass: isa - parser: self]; + @throw [OFMalformedXMLException exceptionWithClass: isa + parser: self]; [previous removeLastObject]; @@ -635,8 +635,8 @@ - (void)_parseInCloseTagNameWithBuffer: (const char*)buffer 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 @@ -687,8 +687,8 @@ - (void)_parseInTagWithBuffer: (const char*)buffer 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, @@ -792,8 +792,8 @@ - (void)_parseExpectDelimiterWithBuffer: (const char*)buffer 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; @@ -852,8 +852,8 @@ - (void)_parseExpectCloseWithBuffer: (const char*)buffer *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 */ @@ -866,8 +866,8 @@ - (void)_parseExpectSpaceOrCloseWithBuffer: (const char*)buffer 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]; @@ -1016,8 +1016,8 @@ - (void)_parseInDoctypeWithBuffer: (const char*)buffer 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++; diff --git a/src/exceptions/OFAcceptFailedException.h b/src/exceptions/OFAcceptFailedException.h index 2ca8523ae..12caf657c 100644 --- a/src/exceptions/OFAcceptFailedException.h +++ b/src/exceptions/OFAcceptFailedException.h @@ -37,8 +37,8 @@ * \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. diff --git a/src/exceptions/OFAcceptFailedException.m b/src/exceptions/OFAcceptFailedException.m index 262b2eb14..08b7f9c05 100644 --- a/src/exceptions/OFAcceptFailedException.m +++ b/src/exceptions/OFAcceptFailedException.m @@ -25,19 +25,19 @@ #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_ diff --git a/src/exceptions/OFAddressTranslationFailedException.h b/src/exceptions/OFAddressTranslationFailedException.h index e3cbbc2c4..c1315e12e 100644 --- a/src/exceptions/OFAddressTranslationFailedException.h +++ b/src/exceptions/OFAddressTranslationFailedException.h @@ -40,9 +40,9 @@ * \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. diff --git a/src/exceptions/OFAddressTranslationFailedException.m b/src/exceptions/OFAddressTranslationFailedException.m index d2ed4fccd..cc60fbddd 100644 --- a/src/exceptions/OFAddressTranslationFailedException.m +++ b/src/exceptions/OFAddressTranslationFailedException.m @@ -23,13 +23,13 @@ #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_ diff --git a/src/exceptions/OFAllocFailedException.m b/src/exceptions/OFAllocFailedException.m index 113894809..e8d04d0a8 100644 --- a/src/exceptions/OFAllocFailedException.m +++ b/src/exceptions/OFAllocFailedException.m @@ -24,54 +24,54 @@ @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 @@ -95,8 +95,8 @@ - (void)release - (void)dealloc { - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; + @throw [OFNotImplementedException exceptionWithClass: isa + selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } diff --git a/src/exceptions/OFAlreadyConnectedException.h b/src/exceptions/OFAlreadyConnectedException.h index acdff9393..6e48c93fe 100644 --- a/src/exceptions/OFAlreadyConnectedException.h +++ b/src/exceptions/OFAlreadyConnectedException.h @@ -36,8 +36,8 @@ * \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. diff --git a/src/exceptions/OFAlreadyConnectedException.m b/src/exceptions/OFAlreadyConnectedException.m index 66e077ca8..8dcdbe19f 100644 --- a/src/exceptions/OFAlreadyConnectedException.m +++ b/src/exceptions/OFAlreadyConnectedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFBindFailedException.h b/src/exceptions/OFBindFailedException.h index 649bf4235..e82f3011c 100644 --- a/src/exceptions/OFBindFailedException.h +++ b/src/exceptions/OFBindFailedException.h @@ -43,10 +43,10 @@ * \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. diff --git a/src/exceptions/OFBindFailedException.m b/src/exceptions/OFBindFailedException.m index 7e5f4d7d8..1655076da 100644 --- a/src/exceptions/OFBindFailedException.m +++ b/src/exceptions/OFBindFailedException.m @@ -25,23 +25,23 @@ #import "common.h" @implementation OFBindFailedException -+ 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 { - return [[self alloc] initWithClass: class_ - socket: socket - host: host - port: 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_ diff --git a/src/exceptions/OFChangeDirectoryFailedException.h b/src/exceptions/OFChangeDirectoryFailedException.h index b315f0176..2ff7696c8 100644 --- a/src/exceptions/OFChangeDirectoryFailedException.h +++ b/src/exceptions/OFChangeDirectoryFailedException.h @@ -36,8 +36,8 @@ * 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. diff --git a/src/exceptions/OFChangeDirectoryFailedException.m b/src/exceptions/OFChangeDirectoryFailedException.m index 596e26708..10cb7d1c1 100644 --- a/src/exceptions/OFChangeDirectoryFailedException.m +++ b/src/exceptions/OFChangeDirectoryFailedException.m @@ -24,19 +24,19 @@ #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_ diff --git a/src/exceptions/OFChangeFileModeFailedException.h b/src/exceptions/OFChangeFileModeFailedException.h index e058a3528..03125e17c 100644 --- a/src/exceptions/OFChangeFileModeFailedException.h +++ b/src/exceptions/OFChangeFileModeFailedException.h @@ -40,9 +40,9 @@ * \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. diff --git a/src/exceptions/OFChangeFileModeFailedException.m b/src/exceptions/OFChangeFileModeFailedException.m index d87eb98d1..6ff0a4398 100644 --- a/src/exceptions/OFChangeFileModeFailedException.m +++ b/src/exceptions/OFChangeFileModeFailedException.m @@ -24,22 +24,22 @@ #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_ diff --git a/src/exceptions/OFChangeFileOwnerFailedException.h b/src/exceptions/OFChangeFileOwnerFailedException.h index 0cdbeae83..2cb0fdbd7 100644 --- a/src/exceptions/OFChangeFileOwnerFailedException.h +++ b/src/exceptions/OFChangeFileOwnerFailedException.h @@ -42,10 +42,10 @@ * \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. diff --git a/src/exceptions/OFChangeFileOwnerFailedException.m b/src/exceptions/OFChangeFileOwnerFailedException.m index 9423ea481..d69639500 100644 --- a/src/exceptions/OFChangeFileOwnerFailedException.m +++ b/src/exceptions/OFChangeFileOwnerFailedException.m @@ -25,23 +25,23 @@ #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_ diff --git a/src/exceptions/OFConditionBroadcastFailedException.h b/src/exceptions/OFConditionBroadcastFailedException.h index c1af412ee..4abd013f5 100644 --- a/src/exceptions/OFConditionBroadcastFailedException.h +++ b/src/exceptions/OFConditionBroadcastFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFConditionBroadcastFailedException.m b/src/exceptions/OFConditionBroadcastFailedException.m index 5c2f355af..d797eb69b 100644 --- a/src/exceptions/OFConditionBroadcastFailedException.m +++ b/src/exceptions/OFConditionBroadcastFailedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFConditionSignalFailedException.h b/src/exceptions/OFConditionSignalFailedException.h index a981747d9..19c7a7dd0 100644 --- a/src/exceptions/OFConditionSignalFailedException.h +++ b/src/exceptions/OFConditionSignalFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFConditionSignalFailedException.m b/src/exceptions/OFConditionSignalFailedException.m index 927c5e34a..3dc52f944 100644 --- a/src/exceptions/OFConditionSignalFailedException.m +++ b/src/exceptions/OFConditionSignalFailedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFConditionStillWaitingException.h b/src/exceptions/OFConditionStillWaitingException.h index 02e7de8ba..4ea6a18d3 100644 --- a/src/exceptions/OFConditionStillWaitingException.h +++ b/src/exceptions/OFConditionStillWaitingException.h @@ -36,8 +36,8 @@ * \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. diff --git a/src/exceptions/OFConditionStillWaitingException.m b/src/exceptions/OFConditionStillWaitingException.m index 6cd527859..38750c276 100644 --- a/src/exceptions/OFConditionStillWaitingException.m +++ b/src/exceptions/OFConditionStillWaitingException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFConditionWaitFailedException.h b/src/exceptions/OFConditionWaitFailedException.h index 9cc870f41..19ee71ab3 100644 --- a/src/exceptions/OFConditionWaitFailedException.h +++ b/src/exceptions/OFConditionWaitFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFConditionWaitFailedException.m b/src/exceptions/OFConditionWaitFailedException.m index 681185284..bde252776 100644 --- a/src/exceptions/OFConditionWaitFailedException.m +++ b/src/exceptions/OFConditionWaitFailedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFConnectionFailedException.h b/src/exceptions/OFConnectionFailedException.h index 4e4363e46..0c90d53d3 100644 --- a/src/exceptions/OFConnectionFailedException.h +++ b/src/exceptions/OFConnectionFailedException.h @@ -43,10 +43,10 @@ * \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. diff --git a/src/exceptions/OFConnectionFailedException.m b/src/exceptions/OFConnectionFailedException.m index 2a1ba1b32..3ea2b096f 100644 --- a/src/exceptions/OFConnectionFailedException.m +++ b/src/exceptions/OFConnectionFailedException.m @@ -25,23 +25,23 @@ #import "common.h" @implementation OFConnectionFailedException -+ 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 { - return [[self alloc] initWithClass: class_ - socket: socket - host: host - port: 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_ diff --git a/src/exceptions/OFCopyFileFailedException.h b/src/exceptions/OFCopyFileFailedException.h index 0382d338a..390dc32fb 100644 --- a/src/exceptions/OFCopyFileFailedException.h +++ b/src/exceptions/OFCopyFileFailedException.h @@ -38,9 +38,9 @@ * \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. diff --git a/src/exceptions/OFCopyFileFailedException.m b/src/exceptions/OFCopyFileFailedException.m index 54732fe09..49ae03c79 100644 --- a/src/exceptions/OFCopyFileFailedException.m +++ b/src/exceptions/OFCopyFileFailedException.m @@ -24,21 +24,21 @@ #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_ diff --git a/src/exceptions/OFCreateDirectoryFailedException.h b/src/exceptions/OFCreateDirectoryFailedException.h index f40b9a73e..e90fb6ab9 100644 --- a/src/exceptions/OFCreateDirectoryFailedException.h +++ b/src/exceptions/OFCreateDirectoryFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFCreateDirectoryFailedException.m b/src/exceptions/OFCreateDirectoryFailedException.m index ba5dc09d2..1f1b794cf 100644 --- a/src/exceptions/OFCreateDirectoryFailedException.m +++ b/src/exceptions/OFCreateDirectoryFailedException.m @@ -24,19 +24,19 @@ #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_ diff --git a/src/exceptions/OFDeleteDirectoryFailedException.h b/src/exceptions/OFDeleteDirectoryFailedException.h index 231883abd..8308d79ac 100644 --- a/src/exceptions/OFDeleteDirectoryFailedException.h +++ b/src/exceptions/OFDeleteDirectoryFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFDeleteDirectoryFailedException.m b/src/exceptions/OFDeleteDirectoryFailedException.m index ccbfd58e4..2cfef0596 100644 --- a/src/exceptions/OFDeleteDirectoryFailedException.m +++ b/src/exceptions/OFDeleteDirectoryFailedException.m @@ -24,19 +24,19 @@ #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_ diff --git a/src/exceptions/OFDeleteFileFailedException.h b/src/exceptions/OFDeleteFileFailedException.h index 2973a8f26..61beb0172 100644 --- a/src/exceptions/OFDeleteFileFailedException.h +++ b/src/exceptions/OFDeleteFileFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFDeleteFileFailedException.m b/src/exceptions/OFDeleteFileFailedException.m index aa05dbdbc..80526c15a 100644 --- a/src/exceptions/OFDeleteFileFailedException.m +++ b/src/exceptions/OFDeleteFileFailedException.m @@ -24,19 +24,19 @@ #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_ diff --git a/src/exceptions/OFEnumerationMutationException.h b/src/exceptions/OFEnumerationMutationException.h index b301653e8..ec1fa531a 100644 --- a/src/exceptions/OFEnumerationMutationException.h +++ b/src/exceptions/OFEnumerationMutationException.h @@ -30,8 +30,8 @@ * \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. diff --git a/src/exceptions/OFEnumerationMutationException.m b/src/exceptions/OFEnumerationMutationException.m index 580990b79..a5abcf4a1 100644 --- a/src/exceptions/OFEnumerationMutationException.m +++ b/src/exceptions/OFEnumerationMutationException.m @@ -22,19 +22,19 @@ #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_ diff --git a/src/exceptions/OFException.h b/src/exceptions/OFException.h index cc74c3b81..b81fcc6e8 100644 --- a/src/exceptions/OFException.h +++ b/src/exceptions/OFException.h @@ -23,9 +23,6 @@ * * 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 { @@ -43,7 +40,7 @@ * \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. diff --git a/src/exceptions/OFException.m b/src/exceptions/OFException.m index c4f9fef6b..d9c0c49b3 100644 --- a/src/exceptions/OFException.m +++ b/src/exceptions/OFException.m @@ -22,17 +22,17 @@ #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_ @@ -60,10 +60,4 @@ - (OFString*)description { return @"An exception occurred"; } - -- autorelease -{ - @throw [OFNotImplementedException newWithClass: isa - selector: _cmd]; -} @end diff --git a/src/exceptions/OFHTTPRequestFailedException.h b/src/exceptions/OFHTTPRequestFailedException.h index 5fcf3a55a..f68fb96a8 100644 --- a/src/exceptions/OFHTTPRequestFailedException.h +++ b/src/exceptions/OFHTTPRequestFailedException.h @@ -39,9 +39,9 @@ * \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 diff --git a/src/exceptions/OFHTTPRequestFailedException.m b/src/exceptions/OFHTTPRequestFailedException.m index 08ba9f43e..6a8f5adc8 100644 --- a/src/exceptions/OFHTTPRequestFailedException.m +++ b/src/exceptions/OFHTTPRequestFailedException.m @@ -24,21 +24,21 @@ #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_ diff --git a/src/exceptions/OFHashAlreadyCalculatedException.h b/src/exceptions/OFHashAlreadyCalculatedException.h index 6b237d084..29f0d4ffd 100644 --- a/src/exceptions/OFHashAlreadyCalculatedException.h +++ b/src/exceptions/OFHashAlreadyCalculatedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFHashAlreadyCalculatedException.m b/src/exceptions/OFHashAlreadyCalculatedException.m index ff0ddcdb4..0e998b03d 100644 --- a/src/exceptions/OFHashAlreadyCalculatedException.m +++ b/src/exceptions/OFHashAlreadyCalculatedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFInvalidArgumentException.h b/src/exceptions/OFInvalidArgumentException.h index 24fcfc59b..be3208c25 100644 --- a/src/exceptions/OFInvalidArgumentException.h +++ b/src/exceptions/OFInvalidArgumentException.h @@ -33,8 +33,8 @@ * \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 diff --git a/src/exceptions/OFInvalidArgumentException.m b/src/exceptions/OFInvalidArgumentException.m index 501fc7ab9..46aa48fb3 100644 --- a/src/exceptions/OFInvalidArgumentException.m +++ b/src/exceptions/OFInvalidArgumentException.m @@ -24,19 +24,19 @@ #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_ diff --git a/src/exceptions/OFLinkFailedException.h b/src/exceptions/OFLinkFailedException.h index 8bbfaf19e..5da19c95b 100644 --- a/src/exceptions/OFLinkFailedException.h +++ b/src/exceptions/OFLinkFailedException.h @@ -39,9 +39,9 @@ * \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. diff --git a/src/exceptions/OFLinkFailedException.m b/src/exceptions/OFLinkFailedException.m index 6ac95f33a..17bea58a1 100644 --- a/src/exceptions/OFLinkFailedException.m +++ b/src/exceptions/OFLinkFailedException.m @@ -25,21 +25,21 @@ #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_ diff --git a/src/exceptions/OFListenFailedException.h b/src/exceptions/OFListenFailedException.h index 00dafb69d..0338300dc 100644 --- a/src/exceptions/OFListenFailedException.h +++ b/src/exceptions/OFListenFailedException.h @@ -40,9 +40,9 @@ * \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 diff --git a/src/exceptions/OFListenFailedException.m b/src/exceptions/OFListenFailedException.m index 9aeac5157..e9666911b 100644 --- a/src/exceptions/OFListenFailedException.m +++ b/src/exceptions/OFListenFailedException.m @@ -25,21 +25,21 @@ #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_ diff --git a/src/exceptions/OFMalformedXMLException.h b/src/exceptions/OFMalformedXMLException.h index 7c9bf1a20..fabe258ea 100644 --- a/src/exceptions/OFMalformedXMLException.h +++ b/src/exceptions/OFMalformedXMLException.h @@ -34,8 +34,8 @@ * \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. diff --git a/src/exceptions/OFMalformedXMLException.m b/src/exceptions/OFMalformedXMLException.m index 613d9a459..800e1b32d 100644 --- a/src/exceptions/OFMalformedXMLException.m +++ b/src/exceptions/OFMalformedXMLException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFMemoryNotPartOfObjectException.h b/src/exceptions/OFMemoryNotPartOfObjectException.h index 63ad3b31b..2a1017627 100644 --- a/src/exceptions/OFMemoryNotPartOfObjectException.h +++ b/src/exceptions/OFMemoryNotPartOfObjectException.h @@ -33,8 +33,8 @@ * \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. diff --git a/src/exceptions/OFMemoryNotPartOfObjectException.m b/src/exceptions/OFMemoryNotPartOfObjectException.m index e7101e2f6..252ad41fc 100644 --- a/src/exceptions/OFMemoryNotPartOfObjectException.m +++ b/src/exceptions/OFMemoryNotPartOfObjectException.m @@ -22,19 +22,19 @@ #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_ diff --git a/src/exceptions/OFMutexLockFailedException.h b/src/exceptions/OFMutexLockFailedException.h index 88c127ae8..b2bb57677 100644 --- a/src/exceptions/OFMutexLockFailedException.h +++ b/src/exceptions/OFMutexLockFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFMutexLockFailedException.m b/src/exceptions/OFMutexLockFailedException.m index 36d2a1b6c..6ac910b68 100644 --- a/src/exceptions/OFMutexLockFailedException.m +++ b/src/exceptions/OFMutexLockFailedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFMutexStillLockedException.h b/src/exceptions/OFMutexStillLockedException.h index d43d5673d..9afe8bc1f 100644 --- a/src/exceptions/OFMutexStillLockedException.h +++ b/src/exceptions/OFMutexStillLockedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFMutexStillLockedException.m b/src/exceptions/OFMutexStillLockedException.m index b13b9ba6f..300ab2e80 100644 --- a/src/exceptions/OFMutexStillLockedException.m +++ b/src/exceptions/OFMutexStillLockedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFMutexUnlockFailedException.h b/src/exceptions/OFMutexUnlockFailedException.h index 1f0bce7bd..eb3123b9f 100644 --- a/src/exceptions/OFMutexUnlockFailedException.h +++ b/src/exceptions/OFMutexUnlockFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFMutexUnlockFailedException.m b/src/exceptions/OFMutexUnlockFailedException.m index be5d7c329..874420d31 100644 --- a/src/exceptions/OFMutexUnlockFailedException.m +++ b/src/exceptions/OFMutexUnlockFailedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFNotConnectedException.h b/src/exceptions/OFNotConnectedException.h index 59cb01249..eb5b97d46 100644 --- a/src/exceptions/OFNotConnectedException.h +++ b/src/exceptions/OFNotConnectedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFNotConnectedException.m b/src/exceptions/OFNotConnectedException.m index 99b4b06bb..4cd597684 100644 --- a/src/exceptions/OFNotConnectedException.m +++ b/src/exceptions/OFNotConnectedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFNotImplementedException.h b/src/exceptions/OFNotImplementedException.h index ae7486cc2..8f430dc79 100644 --- a/src/exceptions/OFNotImplementedException.h +++ b/src/exceptions/OFNotImplementedException.h @@ -34,8 +34,8 @@ * \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. diff --git a/src/exceptions/OFNotImplementedException.m b/src/exceptions/OFNotImplementedException.m index b7475dfa8..3f8776482 100644 --- a/src/exceptions/OFNotImplementedException.m +++ b/src/exceptions/OFNotImplementedException.m @@ -22,19 +22,19 @@ #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_ diff --git a/src/exceptions/OFOpenFileFailedException.h b/src/exceptions/OFOpenFileFailedException.h index 0e2eabdcf..83217f769 100644 --- a/src/exceptions/OFOpenFileFailedException.h +++ b/src/exceptions/OFOpenFileFailedException.h @@ -38,9 +38,9 @@ * \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. diff --git a/src/exceptions/OFOpenFileFailedException.m b/src/exceptions/OFOpenFileFailedException.m index 35583eda9..d9f500d17 100644 --- a/src/exceptions/OFOpenFileFailedException.m +++ b/src/exceptions/OFOpenFileFailedException.m @@ -24,21 +24,21 @@ #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_ diff --git a/src/exceptions/OFOutOfMemoryException.h b/src/exceptions/OFOutOfMemoryException.h index 1bb5457f8..7e1265418 100644 --- a/src/exceptions/OFOutOfMemoryException.h +++ b/src/exceptions/OFOutOfMemoryException.h @@ -33,8 +33,8 @@ * \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. diff --git a/src/exceptions/OFOutOfMemoryException.m b/src/exceptions/OFOutOfMemoryException.m index 9d4bee2d7..4ee9f9caf 100644 --- a/src/exceptions/OFOutOfMemoryException.m +++ b/src/exceptions/OFOutOfMemoryException.m @@ -20,11 +20,11 @@ #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_ diff --git a/src/exceptions/OFReadOrWriteFailedException.h b/src/exceptions/OFReadOrWriteFailedException.h index 0f294f169..bd3f9ad67 100644 --- a/src/exceptions/OFReadOrWriteFailedException.h +++ b/src/exceptions/OFReadOrWriteFailedException.h @@ -42,9 +42,9 @@ * 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. diff --git a/src/exceptions/OFReadOrWriteFailedException.m b/src/exceptions/OFReadOrWriteFailedException.m index c04f3b700..ef4f90fb4 100644 --- a/src/exceptions/OFReadOrWriteFailedException.m +++ b/src/exceptions/OFReadOrWriteFailedException.m @@ -25,21 +25,21 @@ #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_ diff --git a/src/exceptions/OFRenameFileFailedException.h b/src/exceptions/OFRenameFileFailedException.h index dda049063..c4463c01d 100644 --- a/src/exceptions/OFRenameFileFailedException.h +++ b/src/exceptions/OFRenameFileFailedException.h @@ -38,9 +38,9 @@ * \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. diff --git a/src/exceptions/OFRenameFileFailedException.m b/src/exceptions/OFRenameFileFailedException.m index 7d09b5449..ba98684c9 100644 --- a/src/exceptions/OFRenameFileFailedException.m +++ b/src/exceptions/OFRenameFileFailedException.m @@ -24,21 +24,21 @@ #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_ diff --git a/src/exceptions/OFSeekFailedException.h b/src/exceptions/OFSeekFailedException.h index 914d0c471..982ec2cae 100644 --- a/src/exceptions/OFSeekFailedException.h +++ b/src/exceptions/OFSeekFailedException.h @@ -46,10 +46,10 @@ * \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. diff --git a/src/exceptions/OFSeekFailedException.m b/src/exceptions/OFSeekFailedException.m index 1f353749e..d27bd1ac4 100644 --- a/src/exceptions/OFSeekFailedException.m +++ b/src/exceptions/OFSeekFailedException.m @@ -25,23 +25,23 @@ #import "common.h" @implementation OFSeekFailedException -+ 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 { - return [[self alloc] initWithClass: class_ - stream: stream - offset: offset - whence: 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_ diff --git a/src/exceptions/OFSetOptionFailedException.h b/src/exceptions/OFSetOptionFailedException.h index 93f7d08aa..27106b969 100644 --- a/src/exceptions/OFSetOptionFailedException.h +++ b/src/exceptions/OFSetOptionFailedException.h @@ -34,8 +34,8 @@ * \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. diff --git a/src/exceptions/OFSetOptionFailedException.m b/src/exceptions/OFSetOptionFailedException.m index c8553eb45..c9eecda67 100644 --- a/src/exceptions/OFSetOptionFailedException.m +++ b/src/exceptions/OFSetOptionFailedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFSymlinkFailedException.h b/src/exceptions/OFSymlinkFailedException.h index b412bc9a6..7752a0a6e 100644 --- a/src/exceptions/OFSymlinkFailedException.h +++ b/src/exceptions/OFSymlinkFailedException.h @@ -39,9 +39,9 @@ * \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. diff --git a/src/exceptions/OFSymlinkFailedException.m b/src/exceptions/OFSymlinkFailedException.m index 7490454d4..c010fa6d5 100644 --- a/src/exceptions/OFSymlinkFailedException.m +++ b/src/exceptions/OFSymlinkFailedException.m @@ -25,21 +25,21 @@ #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_ diff --git a/src/exceptions/OFThreadJoinFailedException.h b/src/exceptions/OFThreadJoinFailedException.h index 5f72356d9..07368b513 100644 --- a/src/exceptions/OFThreadJoinFailedException.h +++ b/src/exceptions/OFThreadJoinFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFThreadJoinFailedException.m b/src/exceptions/OFThreadJoinFailedException.m index 46426b02a..eafa27118 100644 --- a/src/exceptions/OFThreadJoinFailedException.m +++ b/src/exceptions/OFThreadJoinFailedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFThreadStartFailedException.h b/src/exceptions/OFThreadStartFailedException.h index 14c612d37..4886d0ffa 100644 --- a/src/exceptions/OFThreadStartFailedException.h +++ b/src/exceptions/OFThreadStartFailedException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFThreadStartFailedException.m b/src/exceptions/OFThreadStartFailedException.m index 01bc0a105..ead3d6ff6 100644 --- a/src/exceptions/OFThreadStartFailedException.m +++ b/src/exceptions/OFThreadStartFailedException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFThreadStillRunningException.h b/src/exceptions/OFThreadStillRunningException.h index 0398eda3a..d2c75619a 100644 --- a/src/exceptions/OFThreadStillRunningException.h +++ b/src/exceptions/OFThreadStillRunningException.h @@ -35,8 +35,8 @@ * \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. diff --git a/src/exceptions/OFThreadStillRunningException.m b/src/exceptions/OFThreadStillRunningException.m index 170db6575..90363d9d4 100644 --- a/src/exceptions/OFThreadStillRunningException.m +++ b/src/exceptions/OFThreadStillRunningException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/exceptions/OFUnboundNamespaceException.h b/src/exceptions/OFUnboundNamespaceException.h index b08dcc720..10b2bd6e7 100644 --- a/src/exceptions/OFUnboundNamespaceException.h +++ b/src/exceptions/OFUnboundNamespaceException.h @@ -35,16 +35,16 @@ * \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 diff --git a/src/exceptions/OFUnboundNamespaceException.m b/src/exceptions/OFUnboundNamespaceException.m index de2c2534a..931fffaa2 100644 --- a/src/exceptions/OFUnboundNamespaceException.m +++ b/src/exceptions/OFUnboundNamespaceException.m @@ -22,26 +22,26 @@ #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_ diff --git a/src/exceptions/OFUnsupportedProtocolException.h b/src/exceptions/OFUnsupportedProtocolException.h index 0d2ad0aa8..ae09fdee7 100644 --- a/src/exceptions/OFUnsupportedProtocolException.h +++ b/src/exceptions/OFUnsupportedProtocolException.h @@ -36,8 +36,8 @@ * \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 diff --git a/src/exceptions/OFUnsupportedProtocolException.m b/src/exceptions/OFUnsupportedProtocolException.m index c2802b16a..37128489b 100644 --- a/src/exceptions/OFUnsupportedProtocolException.m +++ b/src/exceptions/OFUnsupportedProtocolException.m @@ -23,19 +23,19 @@ #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_ diff --git a/src/of_asprintf.m b/src/of_asprintf.m index b36639bda..41484c54e 100644 --- a/src/of_asprintf.m +++ b/src/of_asprintf.m @@ -279,7 +279,6 @@ @try { pool = [[OFAutoreleasePool alloc] init]; } @catch (id e) { - [e release]; return false; } diff --git a/tests/OFArrayTests.m b/tests/OFArrayTests.m index afbb563c6..2e03ea9f5 100644 --- a/tests/OFArrayTests.m +++ b/tests/OFArrayTests.m @@ -212,7 +212,6 @@ - (void)arrayTests } } @catch (OFEnumerationMutationException *e) { ok = YES; - [e release]; } TEST(@"Detection of mutation during Fast Enumeration", ok) @@ -249,13 +248,11 @@ - (void)arrayTests }]; } @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", diff --git a/tests/OFDictionaryTests.m b/tests/OFDictionaryTests.m index a742b3b31..46e79d988 100644 --- a/tests/OFDictionaryTests.m +++ b/tests/OFDictionaryTests.m @@ -114,7 +114,6 @@ - (void)dictionaryTests forKey: @""]; } @catch (OFEnumerationMutationException *e) { ok = YES; - [e dealloc]; } TEST(@"Detection of mutation during Fast Enumeration", ok) @@ -147,7 +146,6 @@ - (void)dictionaryTests }]; } @catch (OFEnumerationMutationException *e) { ok = YES; - [e dealloc]; } TEST(@"Detection of mutation during enumeration using blocks", diff --git a/tests/OFListTests.m b/tests/OFListTests.m index a91881bb4..403f8b91f 100644 --- a/tests/OFListTests.m +++ b/tests/OFListTests.m @@ -147,7 +147,6 @@ - (void)listTests [list removeListObject: [list lastListObject]]; } @catch (OFEnumerationMutationException *e) { ok = YES; - [e dealloc]; } TEST(@"Detection of mutation during Fast Enumeration", ok) diff --git a/tests/OFSet.m b/tests/OFSet.m index 4989d8d14..69ee79b20 100644 --- a/tests/OFSet.m +++ b/tests/OFSet.m @@ -129,7 +129,6 @@ - (void)setTests [mutableSet removeObject: s]; } @catch (OFEnumerationMutationException *e) { ok = YES; - [e dealloc]; } TEST(@"Detection of mutation during Fast Enumeration", ok); diff --git a/tests/TestsAppDelegate.h b/tests/TestsAppDelegate.h index 9fca88746..82b971c5b 100644 --- a/tests/TestsAppDelegate.h +++ b/tests/TestsAppDelegate.h @@ -42,7 +42,6 @@ code; \ } @catch (exception *e) { \ caught = YES; \ - [e release]; \ } \ \ if (caught) \