Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -185,10 +185,12 @@ [OBJCFLAGS="$OBJCFLAGS -Wundeclared-selector"]) AX_CHECK_COMPILER_FLAGS([-Wsemicolon-before-method-body -Werror], [OBJCFLAGS="$OBJCFLAGS -Wsemicolon-before-method-body"]) AX_CHECK_COMPILER_FLAGS([-Wobjc-missing-property-synthesis -Werror], [OBJCFLAGS="$OBJCFLAGS -Wobjc-missing-property-synthesis"]) +AX_CHECK_COMPILER_FLAGS([-Wmissing-method-return-type -Werror], + [OBJCFLAGS="$OBJCFLAGS -Wmissing-method-return-type"]) AC_MSG_CHECKING(whether Objective C compiler supports properties) AC_TRY_COMPILE([ #ifdef __has_attribute # if __has_attribute(objc_root_class) Index: src/OFApplication.h ================================================================== --- src/OFApplication.h +++ src/OFApplication.h @@ -202,11 +202,11 @@ * @param sandbox The sandbox to activate */ + (void)activateSandbox: (OFSandbox *)sandbox; #endif -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Gets argc and argv. * * @param argc A pointer where a pointer to argc should be stored Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -203,16 +203,16 @@ { [app activateSandbox: sandbox]; } #endif -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- of_init +- (instancetype)of_init { self = [super init]; @try { _environment = [[OFMutableDictionary alloc] init]; Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -139,48 +139,48 @@ * @brief Initializes an OFArray with the specified object. * * @param object An object * @return An initialized OFArray */ -- initWithObject: (ObjectType)object; +- (instancetype)initWithObject: (ObjectType)object; /*! * @brief Initializes an OFArray with the specified objects. * * @param firstObject The first object * @return An initialized OFArray */ -- initWithObjects: (ObjectType)firstObject, ... OF_SENTINEL; +- (instancetype)initWithObjects: (ObjectType)firstObject, ... OF_SENTINEL; /*! * @brief Initializes an OFArray with the specified object and a va_list. * * @param firstObject The first object * @param arguments A va_list * @return An initialized OFArray */ -- initWithObject: (ObjectType)firstObject - arguments: (va_list)arguments; +- (instancetype)initWithObject: (ObjectType)firstObject + arguments: (va_list)arguments; /*! * @brief Initializes an OFArray with the objects from the specified array. * * @param array An array * @return An initialized OFArray */ -- initWithArray: (OFArray OF_GENERIC(ObjectType) *)array; +- (instancetype)initWithArray: (OFArray OF_GENERIC(ObjectType) *)array; /*! * @brief Initializes an OFArray with the objects from the specified C array of * the specified length. * * @param objects A C array of objects * @param count The length of the C array * @return An initialized OFArray */ -- initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects - count: (size_t)count; +- (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects + count: (size_t)count; /*! * @brief Returns the object at the specified index in the array. * * @warning The returned object is *not* retained and autoreleased for @@ -512,12 +512,12 @@ unsigned long _mutations; unsigned long *_Nullable _mutationsPtr; size_t _position; } -- initWithArray: (OFArray *)data - mutationsPtr: (nullable unsigned long *)mutationsPtr; +- (instancetype)initWithArray: (OFArray *)data + mutationsPtr: (nullable unsigned long *)mutationsPtr; @end OF_ASSUME_NONNULL_END #import "OFMutableArray.h" Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -44,21 +44,21 @@ @interface OFArray_placeholder: OFArray @end @implementation OFArray_placeholder -- init +- (instancetype)init { return (id)[[OFArray_adjacent alloc] init]; } -- initWithObject: (id)object +- (instancetype)initWithObject: (id)object { return (id)[[OFArray_adjacent alloc] initWithObject: object]; } -- initWithObjects: (id)firstObject, ... +- (instancetype)initWithObjects: (id)firstObject, ... { id ret; va_list arguments; va_start(arguments, firstObject); @@ -67,40 +67,40 @@ va_end(arguments); return ret; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments { return (id)[[OFArray_adjacent alloc] initWithObject: firstObject arguments: arguments]; } -- initWithArray: (OFArray *)array +- (instancetype)initWithArray: (OFArray *)array { return (id)[[OFArray_adjacent alloc] initWithArray: array]; } -- initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { return (id)[[OFArray_adjacent alloc] initWithObjects: objects count: count]; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFArray_adjacent alloc] initWithSerialization: element]; } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (void)release @@ -118,11 +118,11 @@ { if (self == [OFArray class]) placeholder.isa = [OFArray_placeholder class]; } -+ alloc ++ (instancetype)alloc { if (self == [OFArray class]) return (id)&placeholder; return [super alloc]; @@ -161,11 +161,11 @@ { return [[[self alloc] initWithObjects: objects count: count] autorelease]; } -- init +- (instancetype)init { if (object_getClass(self) == [OFArray class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { @@ -177,21 +177,21 @@ } return [super init]; } -- initWithObject: (id)object +- (instancetype)initWithObject: (id)object { if (object == nil) { [self release]; @throw [OFInvalidArgumentException exception]; } return [self initWithObjects: object, nil]; } -- initWithObjects: (id)firstObject, ... +- (instancetype)initWithObjects: (id)firstObject, ... { id ret; va_list arguments; va_start(arguments, firstObject); @@ -200,28 +200,28 @@ va_end(arguments); return ret; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments +{ + OF_INVALID_INIT_METHOD +} + +- (instancetype)initWithArray: (OFArray *)array { OF_INVALID_INIT_METHOD } -- initWithArray: (OFArray *)array +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { OF_INVALID_INIT_METHOD } -- initWithObjects: (id const *)objects - count: (size_t)count -{ - OF_INVALID_INIT_METHOD -} - -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { OF_INVALID_INIT_METHOD } - (size_t)count @@ -251,16 +251,16 @@ inRange: of_range(0, count)]; return buffer; } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { return [[OFMutableArray alloc] initWithArray: self]; } - (id)objectAtIndex: (size_t)index @@ -946,12 +946,12 @@ } #endif @end @implementation OFArrayEnumerator -- initWithArray: (OFArray *)array - mutationsPtr: (unsigned long *)mutationsPtr +- (instancetype)initWithArray: (OFArray *)array + mutationsPtr: (unsigned long *)mutationsPtr { self = [super init]; _array = [array retain]; _count = [array count]; Index: src/OFArray_adjacent.m ================================================================== --- src/OFArray_adjacent.m +++ src/OFArray_adjacent.m @@ -28,11 +28,11 @@ #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" @implementation OFArray_adjacent -- init +- (instancetype)init { self = [super init]; @try { _array = [[OFMutableData alloc] initWithItemSize: sizeof(id)]; @@ -42,11 +42,11 @@ } return self; } -- initWithObject: (id)object +- (instancetype)initWithObject: (id)object { self = [self init]; @try { if (object == nil) @@ -60,12 +60,12 @@ } return self; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments { self = [self init]; @try { id object; @@ -83,11 +83,11 @@ } return self; } -- initWithArray: (OFArray *)array +- (instancetype)initWithArray: (OFArray *)array { id const *objects; size_t count; self = [super init]; @@ -125,12 +125,12 @@ } return self; } -- initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { self = [self init]; @try { bool ok = true; @@ -156,11 +156,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [self init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFArray_subarray.h ================================================================== --- src/OFArray_subarray.h +++ src/OFArray_subarray.h @@ -24,10 +24,10 @@ of_range_t _range; } + (instancetype)arrayWithArray: (OFArray *)array range: (of_range_t)range; -- initWithArray: (OFArray *)array - range: (of_range_t)range; +- (instancetype)initWithArray: (OFArray *)array + range: (of_range_t)range; @end OF_ASSUME_NONNULL_END Index: src/OFArray_subarray.m ================================================================== --- src/OFArray_subarray.m +++ src/OFArray_subarray.m @@ -26,12 +26,12 @@ { return [[[self alloc] initWithArray: array range: range] autorelease]; } -- initWithArray: (OFArray *)array - range: (of_range_t)range +- (instancetype)initWithArray: (OFArray *)array + range: (of_range_t)range { self = [super init]; @try { /* Should usually be retain, as it's useless with a copy */ Index: src/OFAutoreleasePool.m ================================================================== --- src/OFAutoreleasePool.m +++ src/OFAutoreleasePool.m @@ -46,11 +46,11 @@ @throw [OFInitializationFailedException exceptionWithClass: self]; } #endif -+ alloc ++ (instancetype)alloc { #if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) OFAutoreleasePool **cache = of_tlskey_get(cacheKey); #endif @@ -85,11 +85,11 @@ free(cache); cache = NULL; } } -- init +- (instancetype)init { self = [super init]; @try { _pool = objc_autoreleasePoolPush(); @@ -168,15 +168,15 @@ } [super dealloc]; } -- retain +- (instancetype)retain { OF_UNRECOGNIZED_SELECTOR } -- autorelease +- (instancetype)autorelease { OF_UNRECOGNIZED_SELECTOR } @end Index: src/OFBlock.h ================================================================== --- src/OFBlock.h +++ src/OFBlock.h @@ -24,12 +24,12 @@ * @class OFBlock OFBlock.h ObjFW/OFBlock.h * * @brief The class for all blocks, since all blocks are also objects. */ @interface OFBlock: OFObject -+ alloc OF_UNAVAILABLE; -- init OF_UNAVAILABLE; ++ (instancetype)alloc OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; @end @interface OFStackBlock: OFBlock @end Index: src/OFBlock.m ================================================================== --- src/OFBlock.m +++ src/OFBlock.m @@ -62,11 +62,11 @@ OF_BLOCK_FIELD_IS_WEAK = 16, OF_BLOCK_BYREF_CALLER = 128 }; @protocol RetainRelease -- retain; +- (instancetype)retain; - (void)release; @end #ifdef OF_OBJFW_RUNTIME /* Begin of ObjC module */ @@ -423,16 +423,16 @@ objc_registerClassPair((Class)&_NSConcreteMallocBlock); # endif #endif } -+ alloc ++ (instancetype)alloc { OF_UNRECOGNIZED_SELECTOR } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } - (void *)allocMemoryWithSize: (size_t)size @@ -462,24 +462,24 @@ - (void)freeMemory: (void *)ptr { OF_UNRECOGNIZED_SELECTOR } -- retain +- (instancetype)retain { if (object_getClass(self) == (Class)&_NSConcreteMallocBlock) return Block_copy(self); return self; } -- copy +- (id)copy { return Block_copy(self); } -- autorelease +- (instancetype)autorelease { if (object_getClass(self) == (Class)&_NSConcreteMallocBlock) return [super autorelease]; return self; Index: src/OFCondition.m ================================================================== --- src/OFCondition.m +++ src/OFCondition.m @@ -29,11 +29,11 @@ + (instancetype)condition { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; if (!of_condition_new(&_condition)) { Class c = [self class]; Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -46,15 +46,14 @@ @interface OFString_const: OFString_UTF8 @end @implementation OFString_const -+ alloc ++ (instancetype)alloc { OF_UNRECOGNIZED_SELECTOR } - - (void *)allocMemoryWithSize: (size_t)size { OF_UNRECOGNIZED_SELECTOR } @@ -81,16 +80,16 @@ - (void)freeMemory: (void *)pointer { OF_UNRECOGNIZED_SELECTOR } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (unsigned int)retainCount @@ -163,11 +162,11 @@ _cString = (char *)ivars; object_setClass(self, [OFString_const class]); } } -+ alloc ++ (instancetype)alloc { OF_UNRECOGNIZED_SELECTOR } - (void *)allocMemoryWithSize: (size_t)size @@ -197,16 +196,16 @@ - (void)freeMemory: (void *)pointer { OF_UNRECOGNIZED_SELECTOR } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (unsigned int)retainCount @@ -227,19 +226,19 @@ * In all following methods, the constant string is converted to an * OFString_UTF8 and the message sent again. */ /* From protocol OFCopying */ -- copy +- (id)copy { [self finishInitialization]; return [self copy]; } /* From protocol OFMutableCopying */ -- mutableCopy +- (id)mutableCopy { [self finishInitialization]; return [self mutableCopy]; } Index: src/OFCountedSet.m ================================================================== --- src/OFCountedSet.m +++ src/OFCountedSet.m @@ -30,26 +30,26 @@ @interface OFCountedSet_placeholder: OFCountedSet @end @implementation OFCountedSet_placeholder -- init +- (instancetype)init { return (id)[[OFCountedSet_hashtable alloc] init]; } -- initWithSet: (OFSet *)set +- (instancetype)initWithSet: (OFSet *)set { return (id)[[OFCountedSet_hashtable alloc] initWithSet: set]; } -- initWithArray: (OFArray *)array +- (instancetype)initWithArray: (OFArray *)array { return (id)[[OFCountedSet_hashtable alloc] initWithArray: array]; } -- initWithObjects: (id)firstObject, ... +- (instancetype)initWithObjects: (id)firstObject, ... { id ret; va_list arguments; va_start(arguments, firstObject); @@ -58,36 +58,36 @@ va_end(arguments); return ret; } -- initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { return (id)[[OFCountedSet_hashtable alloc] initWithObjects: objects count: count]; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments { return (id)[[OFCountedSet_hashtable alloc] initWithObject: firstObject arguments: arguments]; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFCountedSet_hashtable alloc] initWithSerialization: element]; } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (void)release @@ -105,19 +105,19 @@ { if (self == [OFCountedSet class]) placeholder.isa = [OFCountedSet_placeholder class]; } -+ alloc ++ (instancetype)alloc { if (self == [OFCountedSet class]) return (id)&placeholder; return [super alloc]; } -- init +- (instancetype)init { if (object_getClass(self) == [OFCountedSet class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { @@ -170,16 +170,16 @@ objc_autoreleasePoolPop(pool); return ret; } -- copy +- (id)copy { return [[OFCountedSet alloc] initWithSet: self]; } -- mutableCopy +- (id)mutableCopy { return [[OFCountedSet alloc] initWithSet: self]; } - (OFXMLElement *)XMLElementBySerializing Index: src/OFCountedSet_hashtable.m ================================================================== --- src/OFCountedSet_hashtable.m +++ src/OFCountedSet_hashtable.m @@ -34,11 +34,11 @@ { if (self == [OFCountedSet_hashtable class]) [self inheritMethodsFromClass: [OFMutableSet_hashtable class]]; } -- initWithSet: (OFSet *)set +- (instancetype)initWithSet: (OFSet *)set { self = [self init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -64,11 +64,11 @@ } return self; } -- initWithArray: (OFArray *)array +- (instancetype)initWithArray: (OFArray *)array { self = [self init]; @try { id const *objects = [array objects]; @@ -82,12 +82,12 @@ } return self; } -- initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { self = [self init]; @try { for (size_t i = 0; i < count; i++) @@ -98,12 +98,12 @@ } return self; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments { self = [self init]; @try { id object; @@ -118,11 +118,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [self init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFData.h ================================================================== --- src/OFData.h +++ src/OFData.h @@ -135,22 +135,22 @@ * @param string The string with the Base64-encoded data * @return A new autoreleased OFData */ + (instancetype)dataWithBase64EncodedString: (OFString *)string; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initialized an already allocated OFData with the specified `count` * items of size 1. * * @param items The items to store in the OFData * @param count The number of items * @return An initialized OFData */ -- initWithItems: (const void *)items - count: (size_t)count; +- (instancetype)initWithItems: (const void *)items + count: (size_t)count; /*! * @brief Initialized an already allocated OFData with the specified `count` * items of the specified size. * @@ -157,13 +157,13 @@ * @param items The items to store in the OFData * @param itemSize The item size of a single item in bytes * @param count The number of items * @return An initialized OFData */ -- initWithItems: (const void *)items - itemSize: (size_t)itemSize - count: (size_t)count; +- (instancetype)initWithItems: (const void *)items + itemSize: (size_t)itemSize + count: (size_t)count; /*! * @brief Initializes an already allocated OFData with the specified `count` * items of size 1 by taking over ownership of the specified items * pointer. @@ -172,13 +172,13 @@ * @param count The number of items * @param freeWhenDone Whether to free the pointer when it is no longer needed * by the OFData * @return An initialized OFData */ -- initWithItemsNoCopy: (const void *)items - count: (size_t)count - freeWhenDone: (bool)freeWhenDone; +- (instancetype)initWithItemsNoCopy: (const void *)items + count: (size_t)count + freeWhenDone: (bool)freeWhenDone; /*! * @brief Initializes an already allocated OFData with the specified `count` * items of the specified size by taking ownership of the specified * items pointer. @@ -188,24 +188,24 @@ * @param count The number of items * @param freeWhenDone Whether to free the pointer when it is no longer needed * by the OFData * @return An initialized OFData */ -- initWithItemsNoCopy: (const void *)items - itemSize: (size_t)itemSize - count: (size_t)count - freeWhenDone: (bool)freeWhenDone; +- (instancetype)initWithItemsNoCopy: (const void *)items + itemSize: (size_t)itemSize + count: (size_t)count + freeWhenDone: (bool)freeWhenDone; #ifdef OF_HAVE_FILES /*! * @brief Initializes an already allocated OFData with an item size of 1, * containing the data of the specified file. * * @param path The path of the file * @return An initialized OFData */ -- initWithContentsOfFile: (OFString *)path; +- (instancetype)initWithContentsOfFile: (OFString *)path; #endif #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) /*! * @brief Initializes an already allocated OFData with an item size of 1, @@ -212,30 +212,30 @@ * containing the data of the specified URL. * * @param URL The URL to the contents for the OFData * @return A new autoreleased OFData */ -- initWithContentsOfURL: (OFURL *)URL; +- (instancetype)initWithContentsOfURL: (OFURL *)URL; #endif /*! * @brief Initializes an already allocated OFData with an item size of 1, * containing the data of the string representation. * * @param string The string representation of the data * @return A new autoreleased OFData */ -- initWithStringRepresentation: (OFString *)string; +- (instancetype)initWithStringRepresentation: (OFString *)string; /*! * @brief Initializes an already allocated OFData with an item size of 1, * containing the data of the Base64-encoded string. * * @param string The string with the Base64-encoded data * @return An initialized OFData */ -- initWithBase64EncodedString: (OFString *)string; +- (instancetype)initWithBase64EncodedString: (OFString *)string; /*! * @brief Returns the number of items in the OFData. * * @return The number of items in the OFData Index: src/OFData.m ================================================================== --- src/OFData.m +++ src/OFData.m @@ -112,31 +112,31 @@ + (instancetype)dataWithBase64EncodedString: (OFString *)string { return [[[self alloc] initWithBase64EncodedString: string] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_init { return [super init]; } -- initWithItems: (const void *)items - count: (size_t)count +- (instancetype)initWithItems: (const void *)items + count: (size_t)count { return [self initWithItems: items itemSize: 1 count: count]; } -- initWithItems: (const void *)items - itemSize: (size_t)itemSize - count: (size_t)count +- (instancetype)initWithItems: (const void *)items + itemSize: (size_t)itemSize + count: (size_t)count { self = [super init]; @try { if (itemSize == 0) @@ -154,24 +154,24 @@ } return self; } -- initWithItemsNoCopy: (const void *)items - count: (size_t)count - freeWhenDone: (bool)freeWhenDone +- (instancetype)initWithItemsNoCopy: (const void *)items + count: (size_t)count + freeWhenDone: (bool)freeWhenDone { return [self initWithItemsNoCopy: items itemSize: 1 count: count freeWhenDone: freeWhenDone]; } -- initWithItemsNoCopy: (const void *)items - itemSize: (size_t)itemSize - count: (size_t)count - freeWhenDone: (bool)freeWhenDone +- (instancetype)initWithItemsNoCopy: (const void *)items + itemSize: (size_t)itemSize + count: (size_t)count + freeWhenDone: (bool)freeWhenDone { self = [super init]; @try { if (itemSize == 0) @@ -188,11 +188,11 @@ return self; } #ifdef OF_HAVE_FILES -- initWithContentsOfFile: (OFString *)path +- (instancetype)initWithContentsOfFile: (OFString *)path { @try { of_offset_t size = [[OFFileManager defaultManager] sizeOfFileAtPath: path]; char *buffer; @@ -231,11 +231,11 @@ return self; } #endif #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) -- initWithContentsOfURL: (OFURL *)URL +- (instancetype)initWithContentsOfURL: (OFURL *)URL { void *pool; OFString *scheme; pool = objc_autoreleasePoolPush(); @@ -253,11 +253,11 @@ return self; } #endif -- initWithStringRepresentation: (OFString *)string +- (instancetype)initWithStringRepresentation: (OFString *)string { self = [super init]; @try { size_t count = [string @@ -307,11 +307,11 @@ } return self; } -- initWithBase64EncodedString: (OFString *)string +- (instancetype)initWithBase64EncodedString: (OFString *)string { bool mutable = [self isKindOfClass: [OFMutableData class]]; if (!mutable) { [self release]; @@ -335,11 +335,11 @@ [(OFMutableData *)self makeImmutable]; return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { @try { void *pool = objc_autoreleasePoolPush(); OFString *stringValue; @@ -400,16 +400,16 @@ return NULL; return _items + (_count - 1) * _itemSize; } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { return [[OFMutableData alloc] initWithItems: _items itemSize: _itemSize count: _count]; } Index: src/OFDate.h ================================================================== --- src/OFDate.h +++ src/OFDate.h @@ -116,20 +116,20 @@ * time since 1970-01-01T00:00:00Z. * * @param seconds The seconds since 1970-01-01T00:00:00Z * @return An initialized OFDate with the specified date and time */ -- initWithTimeIntervalSince1970: (of_time_interval_t)seconds; +- (instancetype)initWithTimeIntervalSince1970: (of_time_interval_t)seconds; /*! * @brief Initializes an already allocated OFDate with the specified date and * time since now. * * @param seconds The seconds since now * @return An initialized OFDate with the specified date and time */ -- initWithTimeIntervalSinceNow: (of_time_interval_t)seconds; +- (instancetype)initWithTimeIntervalSinceNow: (of_time_interval_t)seconds; /*! * @brief Initializes an already allocated OFDate with the specified string in * the specified format. * @@ -144,12 +144,12 @@ * * @param string The string describing the date * @param format The format of the string describing the date * @return An initialized OFDate with the specified date and time */ -- initWithDateString: (OFString *)string - format: (OFString *)format; +- (instancetype)initWithDateString: (OFString *)string + format: (OFString *)format; /*! * @brief Initializes an already allocated OFDate with the specified string in * the specified format. * @@ -162,12 +162,12 @@ * * @param string The string describing the date * @param format The format of the string describing the date * @return An initialized OFDate with the specified date and time */ -- initWithLocalDateString: (OFString *)string - format: (OFString *)format; +- (instancetype)initWithLocalDateString: (OFString *)string + format: (OFString *)format; /*! * @brief Returns the microsecond of the date. * * @return The microsecond of the date Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -229,11 +229,11 @@ { return [[[self alloc] initWithTimeIntervalSince1970: -62167219200.0] autorelease]; } -- init +- (instancetype)init { struct timeval t; self = [super init]; @@ -243,30 +243,30 @@ _seconds += (of_time_interval_t)t.tv_usec / 1000000; return self; } -- initWithTimeIntervalSince1970: (of_time_interval_t)seconds +- (instancetype)initWithTimeIntervalSince1970: (of_time_interval_t)seconds { self = [super init]; _seconds = seconds; return self; } -- initWithTimeIntervalSinceNow: (of_time_interval_t)seconds +- (instancetype)initWithTimeIntervalSinceNow: (of_time_interval_t)seconds { self = [self init]; _seconds += seconds; return self; } -- initWithDateString: (OFString *)string - format: (OFString *)format +- (instancetype)initWithDateString: (OFString *)string + format: (OFString *)format { self = [super init]; @try { const char *UTF8String = [string UTF8String]; @@ -286,12 +286,12 @@ } return self; } -- initWithLocalDateString: (OFString *)string - format: (OFString *)format +- (instancetype)initWithLocalDateString: (OFString *)string + format: (OFString *)format { self = [super init]; @try { const char *UTF8String = [string UTF8String]; @@ -325,11 +325,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -387,11 +387,11 @@ OF_HASH_FINALIZE(hash); return hash; } -- copy +- (id)copy { return [self retain]; } - (of_comparison_result_t)compare: (id )object Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -122,11 +122,11 @@ * OFDictionary. * * @param dictionary An OFDictionary * @return An initialized OFDictionary */ -- initWithDictionary: +- (instancetype)initWithDictionary: (OFDictionary OF_GENERIC(KeyType, ObjectType) *)dictionary; /*! * @brief Initializes an already allocated OFDictionary with the specified key * and object. @@ -133,23 +133,23 @@ * * @param key The key * @param object The object * @return An initialized OFDictionary */ -- initWithObject: (ObjectType)object - forKey: (KeyType)key; +- (instancetype)initWithObject: (ObjectType)object + forKey: (KeyType)key; /*! * @brief Initializes an already allocated OFDictionary with the specified keys * and objects. * * @param keys An array of keys * @param objects An array of objects * @return An initialized OFDictionary */ -- initWithObjects: (OFArray OF_GENERIC(ObjectType) *)objects - forKeys: (OFArray OF_GENERIC(KeyType) *)keys; +- (instancetype)initWithObjects: (OFArray OF_GENERIC(ObjectType) *)objects + forKeys: (OFArray OF_GENERIC(KeyType) *)keys; /*! * @brief Initializes an already allocated OFDictionary with the specified keys * and objects. * @@ -156,33 +156,33 @@ * @param keys An array of keys * @param objects An array of objects * @param count The number of objects in the arrays * @return An initialized OFDictionary */ -- initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects - forKeys: (KeyType const _Nonnull *_Nonnull)keys - count: (size_t)count; +- (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects + forKeys: (KeyType const _Nonnull *_Nonnull)keys + count: (size_t)count; /*! * @brief Initializes an already allocated OFDictionary with the specified keys * and objects. * * @param firstKey The first key * @return An initialized OFDictionary */ -- initWithKeysAndObjects: (KeyType)firstKey, ... OF_SENTINEL; +- (instancetype)initWithKeysAndObjects: (KeyType)firstKey, ... OF_SENTINEL; /*! * @brief Initializes an already allocated OFDictionary with the specified key * and va_list. * * @param firstKey The first key * @param arguments A va_list of the other arguments * @return An initialized OFDictionary */ -- initWithKey: (KeyType)firstKey - arguments: (va_list)arguments; +- (instancetype)initWithKey: (KeyType)firstKey + arguments: (va_list)arguments; /*! * @brief Returns the object for the given key or `nil` if the key was not * found. * Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -42,45 +42,45 @@ @interface OFDictionary_placeholder: OFDictionary @end @implementation OFDictionary_placeholder -- init +- (instancetype)init { return (id)[[OFDictionary_hashtable alloc] init]; } -- initWithDictionary: (OFDictionary *)dictionary +- (instancetype)initWithDictionary: (OFDictionary *)dictionary { return (id)[[OFDictionary_hashtable alloc] initWithDictionary: dictionary]; } -- initWithObject: (id)object - forKey: (id)key +- (instancetype)initWithObject: (id)object + forKey: (id)key { return (id)[[OFDictionary_hashtable alloc] initWithObject: object forKey: key]; } -- initWithObjects: (OFArray *)objects - forKeys: (OFArray *)keys +- (instancetype)initWithObjects: (OFArray *)objects + forKeys: (OFArray *)keys { return (id)[[OFDictionary_hashtable alloc] initWithObjects: objects forKeys: keys]; } -- initWithObjects: (id const *)objects - forKeys: (id const *)keys - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + forKeys: (id const *)keys + count: (size_t)count { return (id)[[OFDictionary_hashtable alloc] initWithObjects: objects forKeys: keys count: count]; } -- initWithKeysAndObjects: (id )firstKey, ... +- (instancetype)initWithKeysAndObjects: (id )firstKey, ... { id ret; va_list arguments; va_start(arguments, firstKey); @@ -89,29 +89,29 @@ va_end(arguments); return ret; } -- initWithKey: (id )firstKey - arguments: (va_list)arguments +- (instancetype)initWithKey: (id )firstKey + arguments: (va_list)arguments { return (id)[[OFDictionary_hashtable alloc] initWithKey: firstKey arguments: arguments]; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFDictionary_hashtable alloc] initWithSerialization: element]; } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (void)release @@ -129,11 +129,11 @@ { if (self == [OFDictionary class]) placeholder.isa = [OFDictionary_placeholder class]; } -+ alloc ++ (instancetype)alloc { if (self == [OFDictionary class]) return (id)&placeholder; return [super alloc]; @@ -183,11 +183,11 @@ va_end(arguments); return ret; } -- init +- (instancetype)init { if (object_getClass(self) == [OFDictionary class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { @@ -199,26 +199,26 @@ } return [super init]; } -- initWithDictionary: (OFDictionary *)dictionary +- (instancetype)initWithDictionary: (OFDictionary *)dictionary { OF_INVALID_INIT_METHOD } -- initWithObject: (id)object - forKey: (id)key +- (instancetype)initWithObject: (id)object + forKey: (id)key { if (key == nil || object == nil) @throw [OFInvalidArgumentException exception]; return [self initWithKeysAndObjects: key, object, nil]; } -- initWithObjects: (OFArray *)objects_ - forKeys: (OFArray *)keys_ +- (instancetype)initWithObjects: (OFArray *)objects_ + forKeys: (OFArray *)keys_ { id const *objects, *keys; size_t count; @try { @@ -237,18 +237,18 @@ return [self initWithObjects: objects forKeys: keys count: count]; } -- initWithObjects: (id const *)objects - forKeys: (id const *)keys - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + forKeys: (id const *)keys + count: (size_t)count { OF_INVALID_INIT_METHOD } -- initWithKeysAndObjects: (id)firstKey, ... +- (instancetype)initWithKeysAndObjects: (id)firstKey, ... { id ret; va_list arguments; va_start(arguments, firstKey); @@ -257,17 +257,17 @@ va_end(arguments); return ret; } -- initWithKey: (id)firstKey - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)firstKey + arguments: (va_list)arguments { OF_INVALID_INIT_METHOD } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { OF_INVALID_INIT_METHOD } - (id)objectForKey: (id)key @@ -323,16 +323,16 @@ - (size_t)count { OF_UNRECOGNIZED_SELECTOR } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { return [[OFMutableDictionary alloc] initWithDictionary: self]; } - (bool)isEqual: (id)object Index: src/OFDictionary_hashtable.h ================================================================== --- src/OFDictionary_hashtable.h +++ src/OFDictionary_hashtable.h @@ -24,9 +24,9 @@ @interface OFDictionary_hashtable: OFDictionary { OFMapTable *_mapTable; } -- initWithCapacity: (size_t)capacity; +- (instancetype)initWithCapacity: (size_t)capacity; @end OF_ASSUME_NONNULL_END Index: src/OFDictionary_hashtable.m ================================================================== --- src/OFDictionary_hashtable.m +++ src/OFDictionary_hashtable.m @@ -72,16 +72,16 @@ .hash = hash, .equal = equal }; @implementation OFDictionary_hashtable -- init +- (instancetype)init { return [self initWithCapacity: 0]; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { self = [super init]; @try { _mapTable = [[OFMapTable alloc] @@ -94,11 +94,11 @@ } return self; } -- initWithDictionary: (OFDictionary *)dictionary +- (instancetype)initWithDictionary: (OFDictionary *)dictionary { size_t count; if (dictionary == nil) return [self init]; @@ -148,12 +148,12 @@ } return self; } -- initWithObject: (id)object - forKey: (id)key +- (instancetype)initWithObject: (id)object + forKey: (id)key { self = [self initWithCapacity: 1]; @try { [_mapTable setObject: object @@ -164,13 +164,13 @@ } return self; } -- initWithObjects: (id const *)objects - forKeys: (id const *)keys - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + forKeys: (id const *)keys + count: (size_t)count { self = [self initWithCapacity: count]; @try { size_t i; @@ -184,12 +184,12 @@ } return self; } -- initWithKey: (id)firstKey - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)firstKey + arguments: (va_list)arguments { self = [super init]; @try { va_list argumentsCopy; @@ -238,11 +238,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFEnumerator.m ================================================================== --- src/OFEnumerator.m +++ src/OFEnumerator.m @@ -20,11 +20,11 @@ #import "OFEnumerator.h" #import "OFArray.h" @implementation OFEnumerator -- init +- (instancetype)init { if (object_getClass(self) == [OFEnumerator class]) { @try { [self doesNotRecognizeSelector: _cmd]; abort(); Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -70,11 +70,11 @@ * object is deallocated! * @return A new autoreleased OFFile */ + (instancetype)fileWithHandle: (of_file_handle_t)handle; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFFile. * * @param path The path to the file to open as a string @@ -94,20 +94,21 @@ * `ab` | write-only, create, append, binary * `a+` | read-write, create, append * `ab+` or `a+b` | read-write, create, append, binary * @return An initialized OFFile */ -- initWithPath: (OFString *)path - mode: (OFString *)mode; +- (instancetype)initWithPath: (OFString *)path + mode: (OFString *)mode; /*! * @brief Initializes an already allocated OFFile. * * @param handle A native file handle. If OF_FILE_HANDLE_IS_FD is defined, this * is a file descriptor. The handle is closed when the OFFile * object is deallocated! * @return An initialized OFFile */ -- initWithHandle: (of_file_handle_t)handle OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithHandle: (of_file_handle_t)handle + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -186,17 +186,17 @@ + (instancetype)fileWithHandle: (of_file_handle_t)handle { return [[[self alloc] initWithHandle: handle] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPath: (OFString *)path - mode: (OFString *)mode +- (instancetype)initWithPath: (OFString *)path + mode: (OFString *)mode { of_file_handle_t handle; @try { void *pool = objc_autoreleasePoolPush(); @@ -300,11 +300,11 @@ } return self; } -- initWithHandle: (of_file_handle_t)handle +- (instancetype)initWithHandle: (of_file_handle_t)handle { self = [super init]; _handle = handle; Index: src/OFGZIPStream.h ================================================================== --- src/OFGZIPStream.h +++ src/OFGZIPStream.h @@ -89,11 +89,11 @@ * @return A new, autoreleased OFGZIPStream */ + (instancetype)streamWithStream: (OFStream *)stream mode: (OFString *)mode; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFGZIPStream with the specified * underlying stream. * @@ -100,10 +100,10 @@ * @param stream The underlying stream for the OFGZIPStream * @param mode The mode for the OFGZIPStream. Valid modes are "r" for reading * and "w" for writing. * @return An initialized OFGZIPStream */ -- initWithStream: (OFStream *)stream - mode: (OFString *)mode OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithStream: (OFStream *)stream + mode: (OFString *)mode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/OFGZIPStream.m ================================================================== --- src/OFGZIPStream.m +++ src/OFGZIPStream.m @@ -34,17 +34,17 @@ { return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithStream: (OFStream *)stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OFStream *)stream + mode: (OFString *)mode { self = [super init]; @try { if (![mode isEqual: @"r"]) Index: src/OFHMAC.h ================================================================== --- src/OFHMAC.h +++ src/OFHMAC.h @@ -41,20 +41,21 @@ * @param hashClass The class of the hashing algorithm * @return A new, autoreleased OFHMAC */ + (instancetype)HMACWithHashClass: (Class )hashClass; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initialized an already allocated OFHMAC with the specified hashing * algorithm. * * @param hashClass The class of the hashing algorithm * @return An initialized OFHMAC */ -- initWithHashClass: (Class )hashClass OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithHashClass: (Class )hashClass + OF_DESIGNATED_INITIALIZER; /*! * @brief Sets the key for the HMAC. * * @note This resets the HMAC! Index: src/OFHMAC.m ================================================================== --- src/OFHMAC.m +++ src/OFHMAC.m @@ -27,16 +27,16 @@ + (instancetype)HMACWithHashClass: (Class )class { return [[[self alloc] initWithHashClass: class] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithHashClass: (Class )class +- (instancetype)initWithHashClass: (Class )class { self = [super init]; _hashClass = class; Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -54,14 +54,14 @@ OFString *_version; int _status; OFMutableDictionary OF_GENERIC(OFString *, OFString *) *_serverHeaders; } -- initWithClient: (OFHTTPClient *)client - request: (OFHTTPRequest *)request - redirects: (unsigned int)redirects - context: (id)context; +- (instancetype)initWithClient: (OFHTTPClient *)client + request: (OFHTTPRequest *)request + redirects: (unsigned int)redirects + context: (id)context; - (void)start; - (void)closeAndReconnect; @end @interface OFHTTPClientResponse: OFHTTPResponse @@ -71,11 +71,11 @@ size_t _toRead; } @property (nonatomic, setter=of_setKeepAlive:) bool of_keepAlive; -- initWithSocket: (OFTCPSocket *)socket; +- (instancetype)initWithSocket: (OFTCPSocket *)socket; @end static OFString * constructRequestString(OFHTTPRequest *request) { @@ -203,14 +203,14 @@ str++; } } @implementation OFHTTPClientRequestHandler -- initWithClient: (OFHTTPClient *)client - request: (OFHTTPRequest *)request - redirects: (unsigned int)redirects - context: (id)context +- (instancetype)initWithClient: (OFHTTPClient *)client + request: (OFHTTPRequest *)request + redirects: (unsigned int)redirects + context: (id)context { self = [super init]; @try { _client = [client retain]; @@ -728,11 +728,11 @@ @end @implementation OFHTTPClientResponse @synthesize of_keepAlive = _keepAlive; -- initWithSocket: (OFTCPSocket *)socket +- (instancetype)initWithSocket: (OFTCPSocket *)socket { self = [super init]; _socket = [socket retain]; Index: src/OFHTTPCookie.h ================================================================== --- src/OFHTTPCookie.h +++ src/OFHTTPCookie.h @@ -110,11 +110,11 @@ */ + (instancetype)cookieWithName: (OFString *)name value: (OFString *)value domain: (OFString *)domain; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated new cookie with the specified name * and value. * @@ -121,11 +121,11 @@ * @param name The name of the cookie * @param value The value of the cookie * @param domain The domain for the cookie * @return An initialized OFHTTPCookie */ -- initWithName: (OFString *)name - value: (OFString *)value - domain: (OFString *)domain OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithName: (OFString *)name + value: (OFString *)value + domain: (OFString *)domain OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/OFHTTPCookie.m ================================================================== --- src/OFHTTPCookie.m +++ src/OFHTTPCookie.m @@ -289,18 +289,18 @@ return [[[self alloc] initWithName: name value: value domain: domain] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithName: (OFString *)name - value: (OFString *)value - domain: (OFString *)domain +- (instancetype)initWithName: (OFString *)name + value: (OFString *)value + domain: (OFString *)domain { self = [super init]; @try { _name = [name copy]; @@ -374,11 +374,11 @@ OF_HASH_FINALIZE(hash); return hash; } -- copy +- (id)copy { OFHTTPCookie *copy = [[OFHTTPCookie alloc] initWithName: _name value: _value domain: _domain]; Index: src/OFHTTPCookieManager.m ================================================================== --- src/OFHTTPCookieManager.m +++ src/OFHTTPCookieManager.m @@ -26,11 +26,11 @@ + (instancetype)manager { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; @try { _cookies = [[OFMutableArray alloc] init]; Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -121,11 +121,11 @@ * @brief Initializes an already allocated OFHTTPRequest with the specified URL. * * @param URL The URL for the request * @return An initialized OFHTTPRequest */ -- initWithURL: (OFURL *)URL; +- (instancetype)initWithURL: (OFURL *)URL; /*! * @brief Sets the protocol version of the HTTP request. * * @param protocolVersion The protocol version of the HTTP request Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -89,11 +89,11 @@ + (instancetype)requestWithURL: (OFURL *)URL { return [[[self alloc] initWithURL: URL] autorelease]; } -- init +- (instancetype)init { self = [super init]; _method = OF_HTTP_REQUEST_METHOD_GET; _protocolVersion.major = 1; @@ -100,11 +100,11 @@ _protocolVersion.minor = 1; return self; } -- initWithURL: (OFURL *)URL +- (instancetype)initWithURL: (OFURL *)URL { self = [self init]; @try { _URL = [URL copy]; @@ -124,11 +124,11 @@ [_remoteAddress release]; [super dealloc]; } -- copy +- (id)copy { OFHTTPRequest *copy = [[OFHTTPRequest alloc] init]; @try { copy->_method = _method; Index: src/OFHTTPResponse.m ================================================================== --- src/OFHTTPResponse.m +++ src/OFHTTPResponse.m @@ -136,11 +136,11 @@ } @implementation OFHTTPResponse @synthesize statusCode = _statusCode, headers = _headers; -- init +- (instancetype)init { self = [super init]; @try { _protocolVersion.major = 1; Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -178,19 +178,19 @@ OFHTTPServer *_server; OFHTTPRequest *_request; bool _chunked, _headersSent; } -- initWithSocket: (OFTCPSocket *)socket - server: (OFHTTPServer *)server - request: (OFHTTPRequest *)request; +- (instancetype)initWithSocket: (OFTCPSocket *)socket + server: (OFHTTPServer *)server + request: (OFHTTPRequest *)request; @end @implementation OFHTTPServerResponse -- initWithSocket: (OFTCPSocket *)socket - server: (OFHTTPServer *)server - request: (OFHTTPRequest *)request +- (instancetype)initWithSocket: (OFTCPSocket *)socket + server: (OFHTTPServer *)server + request: (OFHTTPRequest *)request { self = [super init]; _statusCode = 500; _socket = [socket retain]; @@ -339,12 +339,12 @@ OFMutableDictionary *_headers; size_t _contentLength; OFMutableData *_body; } -- initWithSocket: (OFTCPSocket *)socket - server: (OFHTTPServer *)server; +- (instancetype)initWithSocket: (OFTCPSocket *)socket + server: (OFHTTPServer *)server; - (bool)socket: (OFTCPSocket *)socket didReadLine: (OFString *)line context: (id)context exception: (id)exception; - (bool)parseProlog: (OFString *)line; @@ -357,12 +357,12 @@ - (bool)sendErrorAndClose: (short)statusCode; - (void)createResponse; @end @implementation OFHTTPServer_Connection -- initWithSocket: (OFTCPSocket *)socket - server: (OFHTTPServer *)server +- (instancetype)initWithSocket: (OFTCPSocket *)socket + server: (OFHTTPServer *)server { self = [super init]; @try { _socket = [socket retain]; @@ -695,11 +695,11 @@ + (instancetype)server { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; _name = @"OFHTTPServer (ObjFW's HTTP server class " @")"; Index: src/OFINICategory.h ================================================================== --- src/OFINICategory.h +++ src/OFINICategory.h @@ -36,11 +36,11 @@ /*! * The name of the INI category */ @property (copy, nonatomic) OFString *name; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Returns the string value for the specified key, or `nil` if it does * not exist. * Index: src/OFINICategory.m ================================================================== --- src/OFINICategory.m +++ src/OFINICategory.m @@ -134,11 +134,11 @@ } return self; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } - (void)dealloc Index: src/OFINIFile.h ================================================================== --- src/OFINIFile.h +++ src/OFINIFile.h @@ -51,21 +51,21 @@ * @return A new, autoreleased OFINIFile with the contents of the specified file */ + (instancetype)fileWithPath: (OFString *)path encoding: (of_string_encoding_t)encoding; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFINIFile with the contents of the * specified file. * * @param path The path to the file whose contents the OFINIFile should contain * * @return An initialized OFINIFile with the contents of the specified file */ -- initWithPath: (OFString *)path; +- (instancetype)initWithPath: (OFString *)path; /*! * @brief Initializes an already allocated OFINIFile with the contents of the * specified file in the specified encoding. * @@ -72,12 +72,13 @@ * @param path The path to the file whose contents the OFINIFile should contain * @param encoding The encoding of the specified file * * @return An initialized OFINIFile with the contents of the specified file */ -- initWithPath: (OFString *)path - encoding: (of_string_encoding_t)encoding OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPath: (OFString *)path + encoding: (of_string_encoding_t)encoding + OF_DESIGNATED_INITIALIZER; /*! * @brief Returns an @ref OFINICategory for the category with the specified * name. * Index: src/OFINIFile.m ================================================================== --- src/OFINIFile.m +++ src/OFINIFile.m @@ -57,23 +57,23 @@ { return [[[self alloc] initWithPath: path encoding: encoding] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPath: (OFString *)path +- (instancetype)initWithPath: (OFString *)path { return [self initWithPath: path encoding: OF_STRING_ENCODING_UTF_8]; } -- initWithPath: (OFString *)path - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithPath: (OFString *)path + encoding: (of_string_encoding_t)encoding { self = [super init]; @try { _categories = [[OFMutableArray alloc] init]; Index: src/OFInflateStream.h ================================================================== --- src/OFInflateStream.h +++ src/OFInflateStream.h @@ -76,19 +76,19 @@ * from which compressed data is read * @return A new, autoreleased OFInflateStream */ + (instancetype)streamWithStream: (OFStream *)stream; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFInflateStream with the specified * underlying stream. * * @param stream The underlying stream to which compressed data is written or * from which compressed data is read * @return A initialized OFInflateStream */ -- initWithStream: (OFStream *)stream OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithStream: (OFStream *)stream OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/OFInflateStream.m ================================================================== --- src/OFInflateStream.m +++ src/OFInflateStream.m @@ -279,16 +279,16 @@ + (instancetype)streamWithStream: (OFStream *)stream { return [[[self alloc] initWithStream: stream] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithStream: (OFStream *)stream +- (instancetype)initWithStream: (OFStream *)stream { self = [super init]; _stream = [stream retain]; Index: src/OFIntrospection.h ================================================================== --- src/OFIntrospection.h +++ src/OFIntrospection.h @@ -60,11 +60,11 @@ /*! * The type encoding for the method. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) const char *typeEncoding; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; @end /*! * @class OFProperty OFIntrospection.h ObjFW/OFIntrospection.h * @@ -109,11 +109,11 @@ /*! * @return The name of the setter. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *setter; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; @end /*! * @class OFInstanceVariable OFIntrospection.h ObjFW/OFIntrospection.h * @@ -139,11 +139,11 @@ /*! * The type encoding for the instance variable. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) const char *typeEncoding; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; @end /*! * @class OFIntrospection OFIntrospection.h ObjFW/OFIntrospection.h * @@ -202,17 +202,17 @@ * * @return A new, autoreleased introspection for the specified class */ + (instancetype)introspectionWithClass: (Class)class_; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFIntrospection with the specified * class. * * @return An initialized OFIntrospection */ -- initWithClass: (Class)class_ OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithClass: (Class)class_ OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/OFIntrospection.m ================================================================== --- src/OFIntrospection.m +++ src/OFIntrospection.m @@ -25,11 +25,11 @@ #import "OFInitializationFailedException.h" @implementation OFMethod @synthesize selector = _selector, name = _name, typeEncoding = _typeEncoding; -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } #if defined(OF_OBJFW_RUNTIME) @@ -132,11 +132,11 @@ @implementation OFProperty @synthesize name = _name, attributes = _attributes; @synthesize getter = _getter, setter = _setter; -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } #if defined(OF_OBJFW_RUNTIME) @@ -358,11 +358,11 @@ @end @implementation OFInstanceVariable @synthesize name = _name, offset = _offset, typeEncoding = _typeEncoding; -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } #if defined(OF_OBJFW_RUNTIME) @@ -430,16 +430,16 @@ + (instancetype)introspectionWithClass: (Class)class { return [[[self alloc] initWithClass: class] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithClass: (Class)class +- (instancetype)initWithClass: (Class)class { self = [super init]; @try { #if defined(OF_OBJFW_RUNTIME) Index: src/OFInvocation.h ================================================================== --- src/OFInvocation.h +++ src/OFInvocation.h @@ -64,11 +64,11 @@ * signature. * * @param signature The method signature for the invocation * @return An initialized OFInvocation */ -- initWithMethodSignature: (OFMethodSignature *)signature; +- (instancetype)initWithMethodSignature: (OFMethodSignature *)signature; /*! * @brief Sets the argument for the specified index. * * @param buffer The buffer in which the argument is stored Index: src/OFInvocation.m ================================================================== --- src/OFInvocation.m +++ src/OFInvocation.m @@ -33,11 +33,11 @@ + (instancetype)invocationWithMethodSignature: (OFMethodSignature *)signature { return [[[self alloc] initWithMethodSignature: signature] autorelease]; } -- initWithMethodSignature: (OFMethodSignature *)signature +- (instancetype)initWithMethodSignature: (OFMethodSignature *)signature { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFKernelEventObserver.m ================================================================== --- src/OFKernelEventObserver.m +++ src/OFKernelEventObserver.m @@ -78,11 +78,11 @@ + (instancetype)observer { return [[[self alloc] init] autorelease]; } -+ alloc ++ (instancetype)alloc { if (self == [OFKernelEventObserver class]) #if defined(HAVE_KQUEUE) return [OFKernelEventObserver_kqueue alloc]; #elif defined(HAVE_EPOLL) @@ -96,11 +96,11 @@ #endif return [super alloc]; } -- init +- (instancetype)init { self = [super init]; @try { #if !defined(OF_HAVE_PIPE) && !defined(OF_WII) && !defined(OF_NINTENDO_3DS) Index: src/OFKernelEventObserver_epoll.m ================================================================== --- src/OFKernelEventObserver_epoll.m +++ src/OFKernelEventObserver_epoll.m @@ -42,11 +42,11 @@ #define EVENTLIST_SIZE 64 static const of_map_table_functions_t mapFunctions = { NULL }; @implementation OFKernelEventObserver_epoll -- init +- (instancetype)init { self = [super init]; @try { struct epoll_event event; Index: src/OFKernelEventObserver_kqueue.m ================================================================== --- src/OFKernelEventObserver_kqueue.m +++ src/OFKernelEventObserver_kqueue.m @@ -42,11 +42,11 @@ #import "OFOutOfRangeException.h" #define EVENTLIST_SIZE 64 @implementation OFKernelEventObserver_kqueue -- init +- (instancetype)init { self = [super init]; @try { struct kevent event; Index: src/OFKernelEventObserver_poll.m ================================================================== --- src/OFKernelEventObserver_poll.m +++ src/OFKernelEventObserver_poll.m @@ -39,11 +39,11 @@ # define pollfd pollsd # define fd socket #endif @implementation OFKernelEventObserver_poll -- init +- (instancetype)init { self = [super init]; @try { struct pollfd p = { _cancelFD[0], POLLIN, 0 }; Index: src/OFKernelEventObserver_select.m ================================================================== --- src/OFKernelEventObserver_select.m +++ src/OFKernelEventObserver_select.m @@ -41,11 +41,11 @@ #import "OFOutOfRangeException.h" #import "socket_helpers.h" @implementation OFKernelEventObserver_select -- init +- (instancetype)init { self = [super init]; #ifndef OF_WINDOWS if (_cancelFD[0] >= (int)FD_SETSIZE) Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -188,10 +188,10 @@ of_list_object_t *_Nullable _current; unsigned long _mutations; unsigned long *_Nullable _mutationsPtr; } -- initWithList: (OFList *)list - mutationsPointer: (unsigned long *)mutationsPtr; +- (instancetype)initWithList: (OFList *)list + mutationsPointer: (unsigned long *)mutationsPtr; @end OF_ASSUME_NONNULL_END Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -34,11 +34,11 @@ + (instancetype)list { return [[[self alloc] init] autorelease]; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [self init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -266,11 +266,11 @@ } _firstListObject = _lastListObject = NULL; } -- copy +- (id)copy { OFList *copy = [[[self class] alloc] init]; of_list_object_t *listObject, *previous; listObject = NULL; @@ -402,12 +402,12 @@ mutationsPointer: &_mutations] autorelease]; } @end @implementation OFListEnumerator -- initWithList: (OFList *)list - mutationsPointer: (unsigned long *)mutationsPtr +- (instancetype)initWithList: (OFList *)list + mutationsPointer: (unsigned long *)mutationsPtr { self = [super init]; _list = [list retain]; _current = [list firstListObject]; Index: src/OFLocalization.h ================================================================== --- src/OFLocalization.h +++ src/OFLocalization.h @@ -137,11 +137,11 @@ * @warning You should never call this yourself, except if you do not use * @ref OFApplication. In this case, you need to allocate exactly one * instance of OFLocalization, which will be come the singleton, and * call this method. */ -- init; +- (instancetype)init; #ifdef OF_HAVE_FILES /*! * @brief Adds a directory to scan for language files. * Index: src/OFLocalization.m ================================================================== --- src/OFLocalization.m +++ src/OFLocalization.m @@ -116,11 +116,11 @@ { [sharedLocalization addLanguageDirectory: path]; } #endif -- init +- (instancetype)init { self = [super init]; @try { #ifndef OF_MORPHOS Index: src/OFMD5Hash.m ================================================================== --- src/OFMD5Hash.m +++ src/OFMD5Hash.m @@ -132,11 +132,11 @@ + (instancetype)cryptoHash { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; [self of_resetState]; @@ -148,11 +148,11 @@ [self reset]; [super dealloc]; } -- copy +- (id)copy { OFMD5Hash *copy = [[OFMD5Hash alloc] init]; memcpy(copy->_state, _state, sizeof(_state)); copy->_bits = _bits; Index: src/OFMapTable+Private.h ================================================================== --- src/OFMapTable+Private.h +++ src/OFMapTable+Private.h @@ -22,10 +22,10 @@ { OFMapTableEnumerator *_enumerator; id _object; } -- initWithEnumerator: (OFMapTableEnumerator *)enumerator - object: (id)object; +- (instancetype)initWithEnumerator: (OFMapTableEnumerator *)enumerator + object: (id)object; @end OF_ASSUME_NONNULL_END Index: src/OFMapTable.h ================================================================== --- src/OFMapTable.h +++ src/OFMapTable.h @@ -112,22 +112,22 @@ + (instancetype)mapTableWithKeyFunctions: (of_map_table_functions_t)keyFunctions objectFunctions: (of_map_table_functions_t) objectFunctions capacity: (size_t)capacity; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFMapTable with the specified key * and object functions. * * @param keyFunctions A structure of functions for handling keys * @param objectFunctions A structure of functions for handling objects * @return An initialized OFMapTable */ -- initWithKeyFunctions: (of_map_table_functions_t)keyFunctions - objectFunctions: (of_map_table_functions_t)objectFunctions; +- (instancetype)initWithKeyFunctions: (of_map_table_functions_t)keyFunctions + objectFunctions: (of_map_table_functions_t)objectFunctions; /*! * @brief Initializes an already allocated OFMapTable with the specified key * functions, object functions and capacity. * @@ -135,13 +135,14 @@ * @param objectFunctions A structure of functions for handling objects * @param capacity A hint about the count of elements expected to be in the map * table * @return An initialized OFMapTable */ -- initWithKeyFunctions: (of_map_table_functions_t)keyFunctions - objectFunctions: (of_map_table_functions_t)objectFunctions - capacity: (size_t)capacity OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithKeyFunctions: (of_map_table_functions_t)keyFunctions + objectFunctions: (of_map_table_functions_t)objectFunctions + capacity: (size_t)capacity + OF_DESIGNATED_INITIALIZER; /*! * @brief Returns the number of objects in the map table. * * @return The number of objects in the map table @@ -244,11 +245,11 @@ unsigned long _mutations; unsigned long *_Nullable _mutationsPtr; uint32_t _position; } -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Returns a pointer to the next object, or NULL if the enumeration * finished. * Index: src/OFMapTable.m ================================================================== --- src/OFMapTable.m +++ src/OFMapTable.m @@ -101,26 +101,26 @@ initWithKeyFunctions: keyFunctions objectFunctions: objectFunctions capacity: capacity] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithKeyFunctions: (of_map_table_functions_t)keyFunctions - objectFunctions: (of_map_table_functions_t)objectFunctions +- (instancetype)initWithKeyFunctions: (of_map_table_functions_t)keyFunctions + objectFunctions: (of_map_table_functions_t)objectFunctions { return [self initWithKeyFunctions: keyFunctions objectFunctions: objectFunctions capacity: 0]; } -- initWithKeyFunctions: (of_map_table_functions_t)keyFunctions - objectFunctions: (of_map_table_functions_t)objectFunctions - capacity: (size_t)capacity +- (instancetype)initWithKeyFunctions: (of_map_table_functions_t)keyFunctions + objectFunctions: (of_map_table_functions_t)objectFunctions + capacity: (size_t)capacity { self = [super init]; @try { _keyFunctions = keyFunctions; @@ -233,11 +233,11 @@ } return hash; } -- copy +- (id)copy { OFMapTable *copy = [[OFMapTable alloc] initWithKeyFunctions: _keyFunctions objectFunctions: _objectFunctions capacity: _capacity]; @@ -659,11 +659,11 @@ } #endif @end @implementation OFMapTableEnumerator -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithMapTable: (OFMapTable *)mapTable @@ -737,12 +737,12 @@ return NULL; } @end @implementation OFMapTable_EnumeratorWrapper -- initWithEnumerator: (OFMapTableEnumerator *)enumerator - object: (id)object +- (instancetype)initWithEnumerator: (OFMapTableEnumerator *)enumerator + object: (id)object { self = [super init]; _enumerator = [enumerator retain]; _object = [object retain]; Index: src/OFMessagePackExtension.h ================================================================== --- src/OFMessagePackExtension.h +++ src/OFMessagePackExtension.h @@ -53,20 +53,20 @@ * @return A new, autoreleased OFMessagePackRepresentation */ + (instancetype)extensionWithType: (int8_t)type data: (OFData *)data; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFMessagePackRepresentation with the * specified type and data. * * @param type The MessagePack extension type * @param data The data for the extension * @return An initialized OFMessagePackRepresentation */ -- initWithType: (int8_t)type - data: (OFData *)data OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithType: (int8_t)type + data: (OFData *)data OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/OFMessagePackExtension.m ================================================================== --- src/OFMessagePackExtension.m +++ src/OFMessagePackExtension.m @@ -30,17 +30,17 @@ { return [[[self alloc] initWithType: type data: data] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithType: (int8_t)type - data: (OFData *)data +- (instancetype)initWithType: (int8_t)type + data: (OFData *)data { self = [super init]; @try { if (data == nil || [data itemSize] != 1) @@ -185,10 +185,10 @@ OF_HASH_FINALIZE(hash); return hash; } -- copy +- (id)copy { return [self retain]; } @end Index: src/OFMethodSignature.h ================================================================== --- src/OFMethodSignature.h +++ src/OFMethodSignature.h @@ -61,11 +61,11 @@ * ObjC types. * * @param types The ObjC types of the method * @return An Initialized OFMethodSignature */ -- initWithObjCTypes: (const char *)types; +- (instancetype)initWithObjCTypes: (const char *)types; /*! * @brief Returns the ObjC type for the argument at the specified index. * * @param index The index of the argument for which to return the ObjC type Index: src/OFMethodSignature.m ================================================================== --- src/OFMethodSignature.m +++ src/OFMethodSignature.m @@ -524,11 +524,11 @@ + (instancetype)signatureWithObjCTypes: (const char*)types { return [[[self alloc] initWithObjCTypes: types] autorelease]; } -- initWithObjCTypes: (const char *)types +- (instancetype)initWithObjCTypes: (const char *)types { self = [super init]; @try { size_t length; Index: src/OFMutableArray.h ================================================================== --- src/OFMutableArray.h +++ src/OFMutableArray.h @@ -55,11 +55,11 @@ * hold the specified number of objects. * * @param capacity The initial capacity for the OFMutableArray * @return An initialized OFMutableArray */ -- initWithCapacity: (size_t)capacity; +- (instancetype)initWithCapacity: (size_t)capacity; /*! * @brief Adds an object to the end of the array. * * @param object An object to add Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -136,26 +136,26 @@ } } #endif @implementation OFMutableArray_placeholder -- init +- (instancetype)init { return (id)[[OFMutableArray_adjacent alloc] init]; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { return (id)[[OFMutableArray_adjacent alloc] initWithCapacity: capacity]; } -- initWithObject: (id)object +- (instancetype)initWithObject: (id)object { return (id)[[OFMutableArray_adjacent alloc] initWithObject: object]; } -- initWithObjects: (id)firstObject, ... +- (instancetype)initWithObjects: (id)firstObject, ... { id ret; va_list arguments; va_start(arguments, firstObject); @@ -164,41 +164,41 @@ va_end(arguments); return ret; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments { return (id)[[OFMutableArray_adjacent alloc] initWithObject: firstObject arguments: arguments]; } -- initWithArray: (OFArray *)array +- (instancetype)initWithArray: (OFArray *)array { return (id)[[OFMutableArray_adjacent alloc] initWithArray: array]; } -- initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { return (id)[[OFMutableArray_adjacent alloc] initWithObjects: objects count: count]; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFMutableArray_adjacent alloc] initWithSerialization: element]; } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (void)release @@ -216,11 +216,11 @@ { if (self == [OFMutableArray class]) placeholder.isa = [OFMutableArray_placeholder class]; } -+ alloc ++ (instancetype)alloc { if (self == [OFMutableArray class]) return (id)&placeholder; return [super alloc]; @@ -229,11 +229,11 @@ + (instancetype)arrayWithCapacity: (size_t)capacity { return [[[self alloc] initWithCapacity: capacity] autorelease]; } -- init +- (instancetype)init { if (object_getClass(self) == [OFMutableArray class]) { @try { [self doesNotRecognizeSelector: _cmd]; abort(); @@ -244,16 +244,16 @@ } return [super init]; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { OF_INVALID_INIT_METHOD } -- copy +- (id)copy { return [[OFArray alloc] initWithArray: self]; } - (void)addObject: (id)object Index: src/OFMutableArray_adjacent.m ================================================================== --- src/OFMutableArray_adjacent.m +++ src/OFMutableArray_adjacent.m @@ -31,11 +31,11 @@ { if (self == [OFMutableArray_adjacent class]) [self inheritMethodsFromClass: [OFArray_adjacent class]]; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { self = [super init]; @try { _array = [[OFMutableData alloc] initWithItemSize: sizeof(id) Index: src/OFMutableData.h ================================================================== --- src/OFMutableData.h +++ src/OFMutableData.h @@ -78,30 +78,30 @@ /*! * @brief Initializes an already allocated OFMutableData with an item size of 1. * * @return An initialized OFMutableData */ -- init; +- (instancetype)init; /*! * @brief Initializes an already allocated OFMutableData whose items all have * the same size. * * @param itemSize The size of a single element in the OFMutableData * @return An initialized OFMutableData */ -- initWithItemSize: (size_t)itemSize; +- (instancetype)initWithItemSize: (size_t)itemSize; /*! * @brief Initializes an already allocated OFMutableData with enough memory to * hold the the specified number of items which all have an item size of * 1. * * @param capacity The initial capacity for the OFMutableData * @return An initialized OFMutableData */ -- initWithCapacity: (size_t)capacity; +- (instancetype)initWithCapacity: (size_t)capacity; /*! * @brief Initializes an already allocated OFMutableData with enough memory to * hold the the specified number of items which all have the same * specified size. @@ -108,20 +108,20 @@ * * @param itemSize The size of a single element in the OFMutableData * @param capacity The initial capacity for the OFMutableData * @return An initialized OFMutableData */ -- initWithItemSize: (size_t)itemSize - capacity: (size_t)capacity; - -- initWithItemsNoCopy: (const void *)items - count: (size_t)count - freeWhenDone: (bool)freeWhenDone OF_UNAVAILABLE; -- initWithItemsNoCopy: (const void *)items - itemSize: (size_t)itemSize - count: (size_t)count - freeWhenDone: (bool)freeWhenDone OF_UNAVAILABLE; +- (instancetype)initWithItemSize: (size_t)itemSize + capacity: (size_t)capacity; + +- (instancetype)initWithItemsNoCopy: (const void *)items + count: (size_t)count + freeWhenDone: (bool)freeWhenDone OF_UNAVAILABLE; +- (instancetype)initWithItemsNoCopy: (const void *)items + itemSize: (size_t)itemSize + count: (size_t)count + freeWhenDone: (bool)freeWhenDone OF_UNAVAILABLE; /*! * @brief Adds an item to the OFMutableData. * * @param item A pointer to an arbitrary item Index: src/OFMutableData.m ================================================================== --- src/OFMutableData.m +++ src/OFMutableData.m @@ -64,20 +64,20 @@ freeWhenDone: (bool)freeWhenDone { OF_UNRECOGNIZED_SELECTOR } -- init +- (instancetype)init { self = [super of_init]; _itemSize = 1; return self; } -- initWithItemSize: (size_t)itemSize +- (instancetype)initWithItemSize: (size_t)itemSize { self = [super of_init]; @try { if (itemSize == 0) @@ -90,18 +90,18 @@ } return self; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { return [self initWithItemSize: 1 capacity: capacity]; } -- initWithItemSize: (size_t)itemSize - capacity: (size_t)capacity +- (instancetype)initWithItemSize: (size_t)itemSize + capacity: (size_t)capacity { self = [super of_init]; @try { if (itemSize == 0) @@ -118,13 +118,13 @@ } return self; } -- initWithItems: (const void *)items - itemSize: (size_t)itemSize - count: (size_t)count +- (instancetype)initWithItems: (const void *)items + itemSize: (size_t)itemSize + count: (size_t)count { self = [super initWithItems: items itemSize: itemSize count: count]; @@ -131,26 +131,26 @@ _capacity = _count; return self; } -- initWithItemsNoCopy: (const void *)items - count: (size_t)count - freeWhenDone: (bool)freeWhenDone +- (instancetype)initWithItemsNoCopy: (const void *)items + count: (size_t)count + freeWhenDone: (bool)freeWhenDone { OF_INVALID_INIT_METHOD } -- initWithItemsNoCopy: (const void *)items - itemSize: (size_t)itemSize - count: (size_t)count - freeWhenDone: (bool)freeWhenDone +- (instancetype)initWithItemsNoCopy: (const void *)items + itemSize: (size_t)itemSize + count: (size_t)count + freeWhenDone: (bool)freeWhenDone { OF_INVALID_INIT_METHOD } -- initWithStringRepresentation: (OFString *)string +- (instancetype)initWithStringRepresentation: (OFString *)string { self = [super initWithStringRepresentation: string]; _capacity = _count; @@ -285,11 +285,11 @@ _items = NULL; _count = 0; _capacity = 0; } -- copy +- (id)copy { return [[OFData alloc] initWithItems: _items itemSize: _itemSize count: _count]; } Index: src/OFMutableDictionary.h ================================================================== --- src/OFMutableDictionary.h +++ src/OFMutableDictionary.h @@ -56,11 +56,11 @@ * memory to hold the specified number of objects. * * @param capacity The initial capacity for the OFMutableDictionary * @return An initialized OFMutableDictionary */ -- initWithCapacity: (size_t)capacity; +- (instancetype)initWithCapacity: (size_t)capacity; /*! * @brief Sets an object for a key. * * A key can be any object that conforms to the OFCopying protocol. Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -28,47 +28,47 @@ @interface OFMutableDictionary_placeholder: OFDictionary @end @implementation OFMutableDictionary_placeholder -- init +- (instancetype)init { return (id)[[OFMutableDictionary_hashtable alloc] init]; } -- initWithDictionary: (OFDictionary *)dictionary +- (instancetype)initWithDictionary: (OFDictionary *)dictionary { return (id)[[OFMutableDictionary_hashtable alloc] initWithDictionary: dictionary]; } -- initWithObject: (id)object - forKey: (id)key +- (instancetype)initWithObject: (id)object + forKey: (id)key { return (id)[[OFMutableDictionary_hashtable alloc] initWithObject: object forKey: key]; } -- initWithObjects: (OFArray *)objects - forKeys: (OFArray *)keys +- (instancetype)initWithObjects: (OFArray *)objects + forKeys: (OFArray *)keys { return (id)[[OFMutableDictionary_hashtable alloc] initWithObjects: objects forKeys: keys]; } -- initWithObjects: (id const *)objects - forKeys: (id const *)keys - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + forKeys: (id const *)keys + count: (size_t)count { return (id)[[OFMutableDictionary_hashtable alloc] initWithObjects: objects forKeys: keys count: count]; } -- initWithKeysAndObjects: (id)firstKey, ... +- (instancetype)initWithKeysAndObjects: (id)firstKey, ... { id ret; va_list arguments; va_start(arguments, firstKey); @@ -78,36 +78,36 @@ va_end(arguments); return ret; } -- initWithKey: (id)firstKey - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)firstKey + arguments: (va_list)arguments { return (id)[[OFMutableDictionary_hashtable alloc] initWithKey: firstKey arguments: arguments]; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFMutableDictionary_hashtable alloc] initWithSerialization: element]; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { return (id)[[OFMutableDictionary_hashtable alloc] initWithCapacity: capacity]; } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (void)release @@ -125,11 +125,11 @@ { if (self == [OFMutableDictionary class]) placeholder.isa = [OFMutableDictionary_placeholder class]; } -+ alloc ++ (instancetype)alloc { if (self == [OFMutableDictionary class]) return (id)&placeholder; return [super alloc]; @@ -138,11 +138,11 @@ + (instancetype)dictionaryWithCapacity: (size_t)capacity { return [[[self alloc] initWithCapacity: capacity] autorelease]; } -- init +- (instancetype)init { if (object_getClass(self) == [OFMutableDictionary class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { @@ -154,11 +154,11 @@ } return [super init]; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { OF_INVALID_INIT_METHOD } - (void)setObject: (id)object @@ -187,11 +187,11 @@ [self removeObjectForKey: key]; objc_autoreleasePoolPop(pool); } -- copy +- (id)copy { return [[OFDictionary alloc] initWithDictionary: self]; } - (void)addEntriesFromDictionary: (OFDictionary *)dictionary Index: src/OFMutablePair.m ================================================================== --- src/OFMutablePair.m +++ src/OFMutablePair.m @@ -33,11 +33,11 @@ id old = _secondObject; _secondObject = [secondObject retain]; [old release]; } -- copy +- (id)copy { OFMutablePair *copy = [self mutableCopy]; [copy makeImmutable]; Index: src/OFMutableSet.h ================================================================== --- src/OFMutableSet.h +++ src/OFMutableSet.h @@ -41,11 +41,11 @@ * hold the specified number of objects. * * @param capacity The initial capacity for the OFMutableSet * @return An initialized OFMutableSet */ -- initWithCapacity: (size_t)capacity; +- (instancetype)initWithCapacity: (size_t)capacity; /*! * @brief Adds the specified object to the set. * * @param object The object to add to the set Index: src/OFMutableSet.m ================================================================== --- src/OFMutableSet.m +++ src/OFMutableSet.m @@ -29,26 +29,26 @@ @interface OFMutableSet_placeholder: OFMutableSet @end @implementation OFMutableSet_placeholder -- init +- (instancetype)init { return (id)[[OFMutableSet_hashtable alloc] init]; } -- initWithSet: (OFSet *)set +- (instancetype)initWithSet: (OFSet *)set { return (id)[[OFMutableSet_hashtable alloc] initWithSet: set]; } -- initWithArray: (OFArray *)array +- (instancetype)initWithArray: (OFArray *)array { return (id)[[OFMutableSet_hashtable alloc] initWithArray: array]; } -- initWithObjects: (id)firstObject, ... +- (instancetype)initWithObjects: (id)firstObject, ... { id ret; va_list arguments; va_start(arguments, firstObject); @@ -57,41 +57,41 @@ va_end(arguments); return ret; } -- initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { return (id)[[OFMutableSet_hashtable alloc] initWithObjects: objects count: count]; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments { return (id)[[OFMutableSet_hashtable alloc] initWithObject: firstObject arguments: arguments]; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFMutableSet_hashtable alloc] initWithSerialization: element]; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { return (id)[[OFMutableSet_hashtable alloc] initWithCapacity: capacity]; } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (void)release @@ -109,11 +109,11 @@ { if (self == [OFMutableSet class]) placeholder.isa = [OFMutableSet_placeholder class]; } -+ alloc ++ (instancetype)alloc { if (self == [OFMutableSet class]) return (id)&placeholder; return [super alloc]; @@ -122,11 +122,11 @@ + (instancetype)setWithCapacity: (size_t)capacity { return [[[self alloc] initWithCapacity: capacity] autorelease]; } -- init +- (instancetype)init { if (object_getClass(self) == [OFMutableSet class]) { @try { [self doesNotRecognizeSelector: _cmd]; abort(); @@ -137,11 +137,11 @@ } return [super init]; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { OF_INVALID_INIT_METHOD } - (void)addObject: (id)object Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -36,119 +36,119 @@ @interface OFMutableString_placeholder: OFMutableString @end @implementation OFMutableString_placeholder -- init +- (instancetype)init { return (id)[[OFMutableString_UTF8 alloc] init]; } -- initWithUTF8String: (const char *)UTF8String +- (instancetype)initWithUTF8String: (const char *)UTF8String { return (id)[[OFMutableString_UTF8 alloc] initWithUTF8String: UTF8String]; } -- initWithUTF8String: (const char *)UTF8String - length: (size_t)UTF8StringLength +- (instancetype)initWithUTF8String: (const char *)UTF8String + length: (size_t)UTF8StringLength { return (id)[[OFMutableString_UTF8 alloc] initWithUTF8String: UTF8String length: UTF8StringLength]; } -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding { return (id)[[OFMutableString_UTF8 alloc] initWithCString: cString encoding: encoding]; } -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding - length: (size_t)cStringLength +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding + length: (size_t)cStringLength { return (id)[[OFMutableString_UTF8 alloc] initWithCString: cString encoding: encoding length: cStringLength]; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { return (id)[[OFMutableString_UTF8 alloc] initWithString: string]; } -- initWithCharacters: (const of_unichar_t *)characters - length: (size_t)length +- (instancetype)initWithCharacters: (const of_unichar_t *)characters + length: (size_t)length { return (id)[[OFMutableString_UTF8 alloc] initWithCharacters: characters length: length]; } -- initWithUTF16String: (const char16_t *)string +- (instancetype)initWithUTF16String: (const char16_t *)string { return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string]; } -- initWithUTF16String: (const char16_t *)string - length: (size_t)length +- (instancetype)initWithUTF16String: (const char16_t *)string + length: (size_t)length { return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string length: length]; } -- initWithUTF16String: (const char16_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const char16_t *)string + byteOrder: (of_byte_order_t)byteOrder { return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string byteOrder: byteOrder]; } -- initWithUTF16String: (const char16_t *)string - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const char16_t *)string + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string length: length byteOrder: byteOrder]; } -- initWithUTF32String: (const char32_t *)string +- (instancetype)initWithUTF32String: (const char32_t *)string { return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string]; } -- initWithUTF32String: (const char32_t *)string - length: (size_t)length +- (instancetype)initWithUTF32String: (const char32_t *)string + length: (size_t)length { return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string length: length]; } -- initWithUTF32String: (const char32_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const char32_t *)string + byteOrder: (of_byte_order_t)byteOrder { return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string byteOrder: byteOrder]; } -- initWithUTF32String: (const char32_t *)string - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const char32_t *)string + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string length: length byteOrder: byteOrder]; } -- initWithFormat: (OFConstantString *)format, ... +- (instancetype)initWithFormat: (OFConstantString *)format, ... { id ret; va_list arguments; va_start(arguments, format); @@ -157,59 +157,59 @@ va_end(arguments); return ret; } -- initWithFormat: (OFConstantString *)format - arguments: (va_list)arguments +- (instancetype)initWithFormat: (OFConstantString *)format + arguments: (va_list)arguments { return (id)[[OFMutableString_UTF8 alloc] initWithFormat: format arguments: arguments]; } #ifdef OF_HAVE_FILES -- initWithContentsOfFile: (OFString *)path +- (instancetype)initWithContentsOfFile: (OFString *)path { return (id)[[OFMutableString_UTF8 alloc] initWithContentsOfFile: path]; } -- initWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithContentsOfFile: (OFString *)path + encoding: (of_string_encoding_t)encoding { return (id)[[OFMutableString_UTF8 alloc] initWithContentsOfFile: path encoding: encoding]; } #endif #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) -- initWithContentsOfURL: (OFURL *)URL +- (instancetype)initWithContentsOfURL: (OFURL *)URL { return (id)[[OFMutableString_UTF8 alloc] initWithContentsOfURL: URL]; } -- initWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithContentsOfURL: (OFURL *)URL + encoding: (of_string_encoding_t)encoding { return (id)[[OFMutableString_UTF8 alloc] initWithContentsOfURL: URL encoding: encoding]; } #endif -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFMutableString_UTF8 alloc] initWithSerialization: element]; } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (void)release @@ -227,11 +227,11 @@ { if (self == [OFMutableString class]) placeholder.isa = [OFMutableString_placeholder class]; } -+ alloc ++ (instancetype)alloc { if (self == [OFMutableString class]) return (id)&placeholder; return [super alloc]; @@ -590,14 +590,14 @@ { [self deleteLeadingWhitespaces]; [self deleteTrailingWhitespaces]; } -- copy +- (id)copy { return [[OFString alloc] initWithString: self]; } - (void)makeImmutable { } @end Index: src/OFMutableString_UTF8.m ================================================================== --- src/OFMutableString_UTF8.m +++ src/OFMutableString_UTF8.m @@ -39,12 +39,12 @@ { if (self == [OFMutableString_UTF8 class]) [self inheritMethodsFromClass: [OFString_UTF8 class]]; } -- initWithUTF8StringNoCopy: (char *)UTF8String - freeWhenDone: (bool)freeWhenDone +- (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String + freeWhenDone: (bool)freeWhenDone { @try { self = [self initWithUTF8String: UTF8String]; } @finally { if (freeWhenDone) Index: src/OFMutableTarArchiveEntry.m ================================================================== --- src/OFMutableTarArchiveEntry.m +++ src/OFMutableTarArchiveEntry.m @@ -22,11 +22,11 @@ @implementation OFMutableTarArchiveEntry @dynamic fileName, mode, UID, GID, size, modificationDate, type, targetFileName; @dynamic owner, group, deviceMajor, deviceMinor; -- copy +- (id)copy { OFMutableTarArchiveEntry *copy = [self mutableCopy]; [copy makeImmutable]; Index: src/OFMutableTriple.m ================================================================== --- src/OFMutableTriple.m +++ src/OFMutableTriple.m @@ -40,11 +40,11 @@ id old = _thirdObject; _thirdObject = [thirdObject retain]; [old release]; } -- copy +- (id)copy { OFMutableTriple *copy = [self mutableCopy]; [copy makeImmutable]; Index: src/OFMutableURL.h ================================================================== --- src/OFMutableURL.h +++ src/OFMutableURL.h @@ -80,11 +80,11 @@ /*! * @brief Initializes an already allocated OFMutableURL. * * @return An initialized OFMutableURL */ -- init; +- (instancetype)init; /*! * @brief Converts the mutable URL to an immutable URL. */ - (void)makeImmutable; Index: src/OFMutableURL.m ================================================================== --- src/OFMutableURL.m +++ src/OFMutableURL.m @@ -26,11 +26,11 @@ + (instancetype)URL { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { return [super of_init]; } - (void)setScheme: (OFString *)scheme @@ -92,11 +92,11 @@ OFString *old = _fragment; _fragment = [fragment copy]; [old release]; } -- copy +- (id)copy { OFMutableURL *copy = [self mutableCopy]; [copy makeImmutable]; Index: src/OFMutableZIPArchiveEntry.m ================================================================== --- src/OFMutableZIPArchiveEntry.m +++ src/OFMutableZIPArchiveEntry.m @@ -29,11 +29,11 @@ @dynamic fileName, fileComment, extraField, versionMadeBy, minVersionNeeded; @dynamic modificationDate, compressionMethod, compressedSize, uncompressedSize; @dynamic CRC32, versionSpecificAttributes, generalPurposeBitFlag; @dynamic of_localFileHeaderOffset; -- copy +- (id)copy { OFMutableZIPArchiveEntry *copy = [self mutableCopy]; [copy makeImmutable]; Index: src/OFMutex.m ================================================================== --- src/OFMutex.m +++ src/OFMutex.m @@ -30,11 +30,11 @@ + (instancetype)mutex { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; if (!of_mutex_new(&_mutex)) { Class c = [self class]; Index: src/OFNull.m ================================================================== --- src/OFNull.m +++ src/OFNull.m @@ -39,11 +39,11 @@ + (OFNull *)null { return null; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { void *pool; [self release]; @@ -61,11 +61,11 @@ - (OFString *)description { return @""; } -- copy +- (id)copy { return self; } - (OFXMLElement *)XMLElementBySerializing @@ -107,16 +107,16 @@ return [OFData dataWithItems: &type count: 1]; } -- autorelease +- (instancetype)autorelease { return self; } -- retain +- (instancetype)retain { return self; } - (void)release Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -378,248 +378,248 @@ * @param double_ A double which the OFNumber should contain * @return A new autoreleased OFNumber */ + (instancetype)numberWithDouble: (double)double_; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFNumber with the specified bool. * * @param bool_ A bool which the OFNumber should contain * @return An initialized OFNumber */ -- initWithBool: (bool)bool_; +- (instancetype)initWithBool: (bool)bool_; /*! * @brief Initializes an already allocated OFNumber with the specified signed * char. * * @param schar A signed char which the OFNumber should contain * @return An initialized OFNumber */ -- initWithChar: (signed char)schar; +- (instancetype)initWithChar: (signed char)schar; /*! * @brief Initializes an already allocated OFNumber with the specified signed * short. * * @param sshort A signed short which the OFNumber should contain * @return An initialized OFNumber */ -- initWithShort: (signed short)sshort; +- (instancetype)initWithShort: (signed short)sshort; /*! * @brief Initializes an already allocated OFNumber with the specified signed * int. * * @param sint A signed int which the OFNumber should contain * @return An initialized OFNumber */ -- initWithInt: (signed int)sint; +- (instancetype)initWithInt: (signed int)sint; /*! * @brief Initializes an already allocated OFNumber with the specified signed * long. * * @param slong A signed long which the OFNumber should contain * @return An initialized OFNumber */ -- initWithLong: (signed long)slong; +- (instancetype)initWithLong: (signed long)slong; /*! * @brief Initializes an already allocated OFNumber with the specified signed * long long. * * @param slonglong A signed long long which the OFNumber should contain * @return An initialized OFNumber */ -- initWithLongLong: (signed long long)slonglong; +- (instancetype)initWithLongLong: (signed long long)slonglong; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * char. * * @param uchar An unsigned char which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUnsignedChar: (unsigned char)uchar; +- (instancetype)initWithUnsignedChar: (unsigned char)uchar; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * short. * * @param ushort An unsigned short which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUnsignedShort: (unsigned short)ushort; +- (instancetype)initWithUnsignedShort: (unsigned short)ushort; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * int. * * @param uint An unsigned int which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUnsignedInt: (unsigned int)uint; +- (instancetype)initWithUnsignedInt: (unsigned int)uint; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * long. * * @param ulong An unsigned long which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUnsignedLong: (unsigned long)ulong; +- (instancetype)initWithUnsignedLong: (unsigned long)ulong; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * long long. * * @param ulonglong An unsigned long long which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUnsignedLongLong: (unsigned long long)ulonglong; +- (instancetype)initWithUnsignedLongLong: (unsigned long long)ulonglong; /*! * @brief Initializes an already allocated OFNumber with the specified int8_t. * * @param int8 An int8_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithInt8: (int8_t)int8; +- (instancetype)initWithInt8: (int8_t)int8; /*! * @brief Initializes an already allocated OFNumber with the specified int16_t. * * @param int16 An int16_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithInt16: (int16_t)int16; +- (instancetype)initWithInt16: (int16_t)int16; /*! * @brief Initializes an already allocated OFNumber with the specified int32_t. * * @param int32 An int32_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithInt32: (int32_t)int32; +- (instancetype)initWithInt32: (int32_t)int32; /*! * @brief Initializes an already allocated OFNumber with the specified int64_t. * * @param int64 An int64_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithInt64: (int64_t)int64; +- (instancetype)initWithInt64: (int64_t)int64; /*! * @brief Initializes an already allocated OFNumber with the specified uint8_t. * * @param uint8 A uint8_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUInt8: (uint8_t)uint8; +- (instancetype)initWithUInt8: (uint8_t)uint8; /*! * @brief Initializes an already allocated OFNumber with the specified uint16_t. * * @param uint16 A uint16_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUInt16: (uint16_t)uint16; +- (instancetype)initWithUInt16: (uint16_t)uint16; /*! * @brief Initializes an already allocated OFNumber with the specified uint32_t. * * @param uint32 A uint32_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUInt32: (uint32_t)uint32; +- (instancetype)initWithUInt32: (uint32_t)uint32; /*! * @brief Initializes an already allocated OFNumber with the specified uint64_t. * * @param uint64 A uint64_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUInt64: (uint64_t)uint64; +- (instancetype)initWithUInt64: (uint64_t)uint64; /*! * @brief Initializes an already allocated OFNumber with the specified size_t. * * @param size A size_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithSize: (size_t)size; +- (instancetype)initWithSize: (size_t)size; /*! * @brief Initializes an already allocated OFNumber with the specified ssize_t. * * @param ssize An ssize_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithSSize: (ssize_t)ssize; +- (instancetype)initWithSSize: (ssize_t)ssize; /*! * @brief Initializes an already allocated OFNumber with the specified intmax_t. * * @param intmax An intmax_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithIntMax: (intmax_t)intmax; +- (instancetype)initWithIntMax: (intmax_t)intmax; /*! * @brief Initializes an already allocated OFNumber with the specified * uintmax_t. * * @param uintmax A uintmax_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUIntMax: (uintmax_t)uintmax; +- (instancetype)initWithUIntMax: (uintmax_t)uintmax; /*! * @brief Initializes an already allocated OFNumber with the specified * ptrdiff_t. * * @param ptrdiff A ptrdiff_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithPtrDiff: (ptrdiff_t)ptrdiff; +- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrdiff; /*! * @brief Initializes an already allocated OFNumber with the specified intptr_t. * * @param intptr An intptr_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithIntPtr: (intptr_t)intptr; +- (instancetype)initWithIntPtr: (intptr_t)intptr; /*! * @brief Initializes an already allocated OFNumber with the specified * uintptr_t. * * @param uintptr A uintptr_t which the OFNumber should contain * @return An initialized OFNumber */ -- initWithUIntPtr: (uintptr_t)uintptr; +- (instancetype)initWithUIntPtr: (uintptr_t)uintptr; /*! * @brief Initializes an already allocated OFNumber with the specified float. * * @param float_ A float which the OFNumber should contain * @return An initialized OFNumber */ -- initWithFloat: (float)float_; +- (instancetype)initWithFloat: (float)float_; /*! * @brief Initializes an already allocated OFNumber with the specified double. * * @param double_ A double which the OFNumber should contain * @return An initialized OFNumber */ -- initWithDouble: (double)double_; +- (instancetype)initWithDouble: (double)double_; /*! * @brief Returns the OFNumber as a bool. * * @return The OFNumber as a bool Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -237,296 +237,296 @@ + (instancetype)numberWithDouble: (double)double_ { return [[[self alloc] initWithDouble: double_] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithBool: (bool)bool_ +- (instancetype)initWithBool: (bool)bool_ { self = [super init]; _value.bool_ = bool_; _type = OF_NUMBER_TYPE_BOOL; return self; } -- initWithChar: (signed char)schar +- (instancetype)initWithChar: (signed char)schar { self = [super init]; _value.schar = schar; _type = OF_NUMBER_TYPE_CHAR; return self; } -- initWithShort: (signed short)sshort +- (instancetype)initWithShort: (signed short)sshort { self = [super init]; _value.sshort = sshort; _type = OF_NUMBER_TYPE_SHORT; return self; } -- initWithInt: (signed int)sint +- (instancetype)initWithInt: (signed int)sint { self = [super init]; _value.sint = sint; _type = OF_NUMBER_TYPE_INT; return self; } -- initWithLong: (signed long)slong +- (instancetype)initWithLong: (signed long)slong { self = [super init]; _value.slong = slong; _type = OF_NUMBER_TYPE_LONG; return self; } -- initWithLongLong: (signed long long)slonglong +- (instancetype)initWithLongLong: (signed long long)slonglong { self = [super init]; _value.slonglong = slonglong; _type = OF_NUMBER_TYPE_LONGLONG; return self; } -- initWithUnsignedChar: (unsigned char)uchar +- (instancetype)initWithUnsignedChar: (unsigned char)uchar { self = [super init]; _value.uchar = uchar; _type = OF_NUMBER_TYPE_UCHAR; return self; } -- initWithUnsignedShort: (unsigned short)ushort +- (instancetype)initWithUnsignedShort: (unsigned short)ushort { self = [super init]; _value.ushort = ushort; _type = OF_NUMBER_TYPE_USHORT; return self; } -- initWithUnsignedInt: (unsigned int)uint +- (instancetype)initWithUnsignedInt: (unsigned int)uint { self = [super init]; _value.uint = uint; _type = OF_NUMBER_TYPE_UINT; return self; } -- initWithUnsignedLong: (unsigned long)ulong +- (instancetype)initWithUnsignedLong: (unsigned long)ulong { self = [super init]; _value.ulong = ulong; _type = OF_NUMBER_TYPE_ULONG; return self; } -- initWithUnsignedLongLong: (unsigned long long)ulonglong +- (instancetype)initWithUnsignedLongLong: (unsigned long long)ulonglong { self = [super init]; _value.ulonglong = ulonglong; _type = OF_NUMBER_TYPE_ULONGLONG; return self; } -- initWithInt8: (int8_t)int8 +- (instancetype)initWithInt8: (int8_t)int8 { self = [super init]; _value.int8 = int8; _type = OF_NUMBER_TYPE_INT8; return self; } -- initWithInt16: (int16_t)int16 +- (instancetype)initWithInt16: (int16_t)int16 { self = [super init]; _value.int16 = int16; _type = OF_NUMBER_TYPE_INT16; return self; } -- initWithInt32: (int32_t)int32 +- (instancetype)initWithInt32: (int32_t)int32 { self = [super init]; _value.int32 = int32; _type = OF_NUMBER_TYPE_INT32; return self; } -- initWithInt64: (int64_t)int64 +- (instancetype)initWithInt64: (int64_t)int64 { self = [super init]; _value.int64 = int64; _type = OF_NUMBER_TYPE_INT64; return self; } -- initWithUInt8: (uint8_t)uint8 +- (instancetype)initWithUInt8: (uint8_t)uint8 { self = [super init]; _value.uint8 = uint8; _type = OF_NUMBER_TYPE_UINT8; return self; } -- initWithUInt16: (uint16_t)uint16 +- (instancetype)initWithUInt16: (uint16_t)uint16 { self = [super init]; _value.uint16 = uint16; _type = OF_NUMBER_TYPE_UINT16; return self; } -- initWithUInt32: (uint32_t)uint32 +- (instancetype)initWithUInt32: (uint32_t)uint32 { self = [super init]; _value.uint32 = uint32; _type = OF_NUMBER_TYPE_UINT32; return self; } -- initWithUInt64: (uint64_t)uint64 +- (instancetype)initWithUInt64: (uint64_t)uint64 { self = [super init]; _value.uint64 = uint64; _type = OF_NUMBER_TYPE_UINT64; return self; } -- initWithSize: (size_t)size +- (instancetype)initWithSize: (size_t)size { self = [super init]; _value.size = size; _type = OF_NUMBER_TYPE_SIZE; return self; } -- initWithSSize: (ssize_t)ssize +- (instancetype)initWithSSize: (ssize_t)ssize { self = [super init]; _value.ssize = ssize; _type = OF_NUMBER_TYPE_SSIZE; return self; } -- initWithIntMax: (intmax_t)intmax +- (instancetype)initWithIntMax: (intmax_t)intmax { self = [super init]; _value.intmax = intmax; _type = OF_NUMBER_TYPE_INTMAX; return self; } -- initWithUIntMax: (uintmax_t)uintmax +- (instancetype)initWithUIntMax: (uintmax_t)uintmax { self = [super init]; _value.uintmax = uintmax; _type = OF_NUMBER_TYPE_UINTMAX; return self; } -- initWithPtrDiff: (ptrdiff_t)ptrdiff +- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrdiff { self = [super init]; _value.ptrdiff = ptrdiff; _type = OF_NUMBER_TYPE_PTRDIFF; return self; } -- initWithIntPtr: (intptr_t)intptr +- (instancetype)initWithIntPtr: (intptr_t)intptr { self = [super init]; _value.intptr = intptr; _type = OF_NUMBER_TYPE_INTPTR; return self; } -- initWithUIntPtr: (uintptr_t)uintptr +- (instancetype)initWithUIntPtr: (uintptr_t)uintptr { self = [super init]; _value.uintptr = uintptr; _type = OF_NUMBER_TYPE_UINTPTR; return self; } -- initWithFloat: (float)float_ +- (instancetype)initWithFloat: (float)float_ { self = [super init]; _value.float_ = float_; _type = OF_NUMBER_TYPE_FLOAT; return self; } -- initWithDouble: (double)double_ +- (instancetype)initWithDouble: (double)double_ { self = [super init]; _value.double_ = double_; _type = OF_NUMBER_TYPE_DOUBLE; return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -864,11 +864,11 @@ OF_HASH_FINALIZE(hash); return hash; } -- copy +- (id)copy { return [self retain]; } - (OFString *)description Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -356,11 +356,11 @@ * @brief Increases the retain count. * * Each time an object is released, the retain count gets decreased and the * object deallocated if it reaches 0. */ -- retain; +- (instancetype)retain; /*! * @brief Returns the retain count. * * @return The retain count @@ -379,18 +379,18 @@ * @brief Adds the object to the topmost OFAutoreleasePool of the thread's * autorelease pool stack. * * @return The object */ -- autorelease; +- (instancetype)autorelease; /*! * @brief Returns the receiver. * * @return The receiver */ -- self; +- (instancetype)self; /*! * @brief Returns whether the object is a proxy object. * * @return A boolean whether the object is a proxy object @@ -469,17 +469,17 @@ * This method will never return `nil`, instead, it will throw an * @ref OFAllocFailedException. * * @return The allocated object */ -+ alloc; ++ (instancetype)alloc; /*! * @brief Allocates memory for a new instance and calls @ref init on it. * @return An allocated and initialized object */ -+ new; ++ (instancetype)new; /*! * @brief Returns the class. * * @return The class @@ -624,11 +624,11 @@ * This method exists so that classes can be used in collections requiring * conformance to the OFCopying protocol. * * @return The class of the object */ -+ copy; ++ (id)copy; /*! * @brief Initializes an already allocated object. * * Derived classes may override this, but need to do @@ -639,11 +639,11 @@ * `nil`, instead an exception (for example @ref * OFInitializationFailedException) should be thrown. * * @return An initialized object */ -- init; +- (instancetype)init; /*! * @brief Returns the method signature for the specified selector. * * @param selector The selector for which the method signature should be @@ -1116,11 +1116,11 @@ * copy. If only a mutable version of the class exists, it creates a mutable * copy. * * @return A copy of the object */ -- copy; +- (id)copy; @end /*! * @protocol OFMutableCopying OFObject.h ObjFW/OFObject.h * @@ -1133,11 +1133,11 @@ /*! * @brief Creates a mutable copy of the object. * * @return A mutable copy of the object */ -- mutableCopy; +- (id)mutableCopy; @end /*! * @protocol OFComparing OFObject.h ObjFW/OFObject.h * Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -278,16 +278,16 @@ + (void)initialize { } -+ alloc ++ (instancetype)alloc { return of_alloc_object(self, 0, 0, NULL); } -+ new ++ (instancetype)new { return [[self alloc] init]; } + (Class)class @@ -475,11 +475,11 @@ + (BOOL)resolveInstanceMethod: (SEL)selector { return NO; } -- init +- (instancetype)init { return self; } - (Class)class @@ -1155,11 +1155,11 @@ { @throw [OFNotImplementedException exceptionWithSelector: selector object: self]; } -- retain +- (instancetype)retain { #if defined(OF_HAVE_ATOMIC_OPS) of_atomic_int_inc(&PRE_IVARS->retainCount); #else OF_ENSURE(of_spinlock_lock(&PRE_IVARS->retainCountSpinlock)); @@ -1196,16 +1196,16 @@ if (c == 0) [self dealloc]; #endif } -- autorelease +- (instancetype)autorelease { return _objc_rootAutorelease(self); } -- self +- (instancetype)self { return self; } - (bool)isProxy @@ -1248,21 +1248,21 @@ free((char *)self - PRE_IVARS_ALIGN); } /* Required to use properties with the Apple runtime */ -- copyWithZone: (void *)zone +- (id)copyWithZone: (void *)zone { if OF_UNLIKELY (zone != NULL) { [self doesNotRecognizeSelector: _cmd]; abort(); } return [(id)self copy]; } -- mutableCopyWithZone: (void *)zone +- (id)mutableCopyWithZone: (void *)zone { if OF_UNLIKELY (zone != NULL) { [self doesNotRecognizeSelector: _cmd]; abort(); } @@ -1301,16 +1301,16 @@ + (void)freeMemory: (void *)pointer { OF_UNRECOGNIZED_SELECTOR } -+ retain ++ (id)retain { return self; } -+ autorelease ++ (id)autorelease { return self; } + (unsigned int)retainCount @@ -1325,26 +1325,26 @@ + (void)dealloc { OF_UNRECOGNIZED_SELECTOR } -+ copy ++ (id)copy { return self; } -+ mutableCopyWithZone: (void *)zone ++ (id)mutableCopyWithZone: (void *)zone { OF_UNRECOGNIZED_SELECTOR } /* Required to use ObjFW from Swift */ -+ allocWithZone: (void *)zone ++ (instancetype)allocWithZone: (void *)zone { if OF_UNLIKELY (zone != NULL) { [self doesNotRecognizeSelector: _cmd]; abort(); } return [self alloc]; } @end Index: src/OFOptionsParser.h ================================================================== --- src/OFOptionsParser.h +++ src/OFOptionsParser.h @@ -118,11 +118,11 @@ * * @return A new, autoreleased OFOptionsParser */ + (instancetype)parserWithOptions: (const of_options_parser_option_t *)options; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFOptionsParser so that it accepts * the specified options. * @@ -130,11 +130,11 @@ * accepted options, terminated with an option whose short * option is `\0` and long option is `nil`. * * @return An initialized OFOptionsParser */ -- initWithOptions: (const of_options_parser_option_t *)options +- (instancetype)initWithOptions: (const of_options_parser_option_t *)options OF_DESIGNATED_INITIALIZER; /*! * @brief Returns the next option. * Index: src/OFOptionsParser.m ================================================================== --- src/OFOptionsParser.m +++ src/OFOptionsParser.m @@ -42,16 +42,16 @@ + (instancetype)parserWithOptions: (const of_options_parser_option_t *)options { return [[[self alloc] initWithOptions: options] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithOptions: (const of_options_parser_option_t *)options +- (instancetype)initWithOptions: (const of_options_parser_option_t *)options { self = [super init]; @try { size_t count = 0; Index: src/OFPair.h ================================================================== --- src/OFPair.h +++ src/OFPair.h @@ -61,12 +61,12 @@ * * @param firstObject The first object for the pair * @param secondObject The second object for the pair * @return An initialized OFPair */ -- initWithFirstObject: (nullable FirstType)firstObject - secondObject: (nullable SecondType)secondObject; +- (instancetype)initWithFirstObject: (nullable FirstType)firstObject + secondObject: (nullable SecondType)secondObject; #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef FirstType # undef SecondType #endif @end Index: src/OFPair.m ================================================================== --- src/OFPair.m +++ src/OFPair.m @@ -25,12 +25,12 @@ { return [[[self alloc] initWithFirstObject: firstObject secondObject: secondObject] autorelease]; } -- initWithFirstObject: (id)firstObject - secondObject: (id)secondObject +- (instancetype)initWithFirstObject: (id)firstObject + secondObject: (id)secondObject { self = [super init]; @try { _firstObject = [firstObject retain]; @@ -93,16 +93,16 @@ OF_HASH_FINALIZE(hash); return hash; } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { return [[OFMutablePair alloc] initWithFirstObject: _firstObject secondObject: _secondObject]; } Index: src/OFPlugin.m ================================================================== --- src/OFPlugin.m +++ src/OFPlugin.m @@ -92,11 +92,11 @@ plugin->_handle = handle; return plugin; } -- init +- (instancetype)init { if (object_getClass(self) == [OFPlugin class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { Index: src/OFProcess.h ================================================================== --- src/OFProcess.h +++ src/OFProcess.h @@ -116,21 +116,21 @@ programName: (OFString *)programName arguments: (nullable OFArray OF_GENERIC(OFString *) *)arguments environment: (nullable OFDictionary OF_GENERIC(OFString *, OFString *) *)environment; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFProcess with the specified program * and invokes the program. * * @param program The program to execute. If it does not start with a slash, the * search path specified in PATH is used. * @return An initialized OFProcess. */ -- initWithProgram: (OFString *)program; +- (instancetype)initWithProgram: (OFString *)program; /*! * @brief Initializes an already allocated OFProcess with the specified program * and arguments and invokes the program. * @@ -137,12 +137,13 @@ * @param program The program to execute. If it does not start with a slash, the * search path specified in PATH is used. * @param arguments The arguments to pass to the program, or `nil` * @return An initialized OFProcess. */ -- initWithProgram: (OFString *)program - arguments: (nullable OFArray OF_GENERIC(OFString *) *)arguments; +- (instancetype) + initWithProgram: (OFString *)program + arguments: (nullable OFArray OF_GENERIC(OFString *) *)arguments; /*! * @brief Initializes an already allocated OFProcess with the specified program, * program name and arguments and invokes the program. * @@ -151,13 +152,14 @@ * @param programName The program name for the program to invoke (argv[0]). * Usually, this is equal to program. * @param arguments The arguments to pass to the program, or `nil` * @return An initialized OFProcess. */ -- initWithProgram: (OFString *)program - programName: (OFString *)programName - arguments: (nullable OFArray OF_GENERIC(OFString *) *)arguments; +- (instancetype) + initWithProgram: (OFString *)program + programName: (OFString *)programName + arguments: (nullable OFArray OF_GENERIC(OFString *) *)arguments; /*! * @brief Initializes an already allocated OFProcess with the specified program, * program name, arguments and environment and invokes the program. * @@ -171,15 +173,16 @@ * override the environment. If you want to add to the * existing environment, you need to get the existing * environment first, copy it, modify it and then pass it. * @return An initialized OFProcess. */ -- initWithProgram: (OFString *)program - programName: (OFString *)programName - arguments: (nullable OFArray OF_GENERIC(OFString *) *)arguments - environment: (nullable OFDictionary - OF_GENERIC(OFString *, OFString *) *)environment +- (instancetype) + initWithProgram: (OFString *)program + programName: (OFString *)programName + arguments: (nullable OFArray OF_GENERIC(OFString *) *)arguments + environment: (nullable OFDictionary + OF_GENERIC(OFString *, OFString *) *)environment OF_DESIGNATED_INITIALIZER; /*! * @brief Closes the write direction of the process. * Index: src/OFProcess.m ================================================================== --- src/OFProcess.m +++ src/OFProcess.m @@ -93,46 +93,46 @@ programName: programName arguments: arguments environment: environment] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithProgram: (OFString *)program +- (instancetype)initWithProgram: (OFString *)program { return [self initWithProgram: program programName: program arguments: nil environment: nil]; } -- initWithProgram: (OFString *)program - arguments: (OFArray *)arguments +- (instancetype)initWithProgram: (OFString *)program + arguments: (OFArray *)arguments { return [self initWithProgram: program programName: program arguments: arguments environment: nil]; } -- initWithProgram: (OFString *)program - programName: (OFString *)programName - arguments: (OFArray *)arguments +- (instancetype)initWithProgram: (OFString *)program + programName: (OFString *)programName + arguments: (OFArray *)arguments { return [self initWithProgram: program programName: program arguments: arguments environment: nil]; } -- initWithProgram: (OFString *)program - programName: (OFString *)programName - arguments: (OFArray *)arguments - environment: (OFDictionary *)environment +- (instancetype)initWithProgram: (OFString *)program + programName: (OFString *)programName + arguments: (OFArray *)arguments + environment: (OFDictionary *)environment { self = [super init]; @try { #ifndef OF_WINDOWS Index: src/OFRIPEMD160Hash.m ================================================================== --- src/OFRIPEMD160Hash.m +++ src/OFRIPEMD160Hash.m @@ -146,11 +146,11 @@ + (instancetype)cryptoHash { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; [self of_resetState]; @@ -162,11 +162,11 @@ [self reset]; [super dealloc]; } -- copy +- (id)copy { OFRIPEMD160Hash *copy = [[OFRIPEMD160Hash alloc] init]; memcpy(copy->_state, _state, sizeof(_state)); copy->_bits = _bits; Index: src/OFRecursiveMutex.m ================================================================== --- src/OFRecursiveMutex.m +++ src/OFRecursiveMutex.m @@ -30,11 +30,11 @@ + (instancetype)mutex { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; if (!of_rmutex_new(&_rmutex)) { Class c = [self class]; Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -756,11 +756,11 @@ objc_autoreleasePoolPop(pool); } #endif -- init +- (instancetype)init { self = [super init]; @try { _timersQueue = [[OFSortedList alloc] init]; Index: src/OFSHA1Hash.m ================================================================== --- src/OFSHA1Hash.m +++ src/OFSHA1Hash.m @@ -106,11 +106,11 @@ + (instancetype)cryptoHash { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; [self of_resetState]; @@ -122,11 +122,11 @@ [self reset]; [super dealloc]; } -- copy +- (id)copy { OFSHA1Hash *copy = [[OFSHA1Hash alloc] init]; memcpy(copy->_state, _state, sizeof(_state)); copy->_bits = _bits; Index: src/OFSHA224Or256Hash.m ================================================================== --- src/OFSHA224Or256Hash.m +++ src/OFSHA224Or256Hash.m @@ -128,11 +128,11 @@ + (instancetype)cryptoHash { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; @try { if ([self class] == [OFSHA224Or256Hash class]) { @@ -154,11 +154,11 @@ [self reset]; [super dealloc]; } -- copy +- (id)copy { OFSHA224Or256Hash *copy = [[[self class] alloc] init]; memcpy(copy->_state, _state, sizeof(_state)); copy->_bits = _bits; Index: src/OFSHA384Or512Hash.m ================================================================== --- src/OFSHA384Or512Hash.m +++ src/OFSHA384Or512Hash.m @@ -139,11 +139,11 @@ + (instancetype)cryptoHash { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; @try { if ([self class] == [OFSHA384Or512Hash class]) { @@ -165,11 +165,11 @@ [self reset]; [super dealloc]; } -- copy +- (id)copy { OFSHA384Or512Hash *copy = [[[self class] alloc] init]; memcpy(copy->_state, _state, sizeof(_state)); memcpy(copy->_bits, _bits, sizeof(_bits)); Index: src/OFSandbox.m ================================================================== --- src/OFSandbox.m +++ src/OFSandbox.m @@ -304,11 +304,11 @@ - (bool)allowsBPF { return _allowsBPF; } -- copy +- (id)copy { OFSandbox *copy = [[OFSandbox alloc] init]; copy->_allowsStdIO = _allowsStdIO; copy->_allowsReadingFiles = _allowsReadingFiles; Index: src/OFSeekableStream.m ================================================================== --- src/OFSeekableStream.m +++ src/OFSeekableStream.m @@ -22,11 +22,11 @@ #include #import "OFSeekableStream.h" @implementation OFSeekableStream -- init +- (instancetype)init { if (object_getClass(self) == [OFSeekableStream class]) { @try { [self doesNotRecognizeSelector: _cmd]; abort(); Index: src/OFSerialization.h ================================================================== --- src/OFSerialization.h +++ src/OFSerialization.h @@ -32,11 +32,11 @@ * @brief Initializes the object with the specified XML element serialization. * * @param element An OFXMLElement with the serialized object * @return An initialized object */ -- initWithSerialization: (OFXMLElement *)element; +- (instancetype)initWithSerialization: (OFXMLElement *)element; /*! * @brief Serializes the object into an XML element. * * @return The object serialized into an XML element Index: src/OFSet.h ================================================================== --- src/OFSet.h +++ src/OFSet.h @@ -110,48 +110,48 @@ * @brief Initializes an already allocated set with the specified set. * * @param set The set to initialize the set with * @return An initialized set with the specified set */ -- initWithSet: (OFSet OF_GENERIC(ObjectType) *)set; +- (instancetype)initWithSet: (OFSet OF_GENERIC(ObjectType) *)set; /*! * @brief Initializes an already allocated set with the specified array. * * @param array The array to initialize the set with * @return An initialized set with the specified array */ -- initWithArray: (OFArray OF_GENERIC(ObjectType) *)array; +- (instancetype)initWithArray: (OFArray OF_GENERIC(ObjectType) *)array; /*! * @brief Initializes an already allocated set with the specified objects. * * @param firstObject The first object for the set * @return An initialized set with the specified objects */ -- initWithObjects: (ObjectType)firstObject, ...; +- (instancetype)initWithObjects: (ObjectType)firstObject, ...; /*! * @brief Initializes an already allocated set with the specified objects. * * @param objects An array of objects for the set * @param count The number of objects in the specified array * @return An initialized set with the specified objects */ -- initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects - count: (size_t)count; +- (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects + count: (size_t)count; /*! * @brief Initializes an already allocated set with the specified object and * va_list. * * @param firstObject The first object for the set * @param arguments A va_list with the other objects * @return An initialized set with the specified object and va_list */ -- initWithObject: (ObjectType)firstObject - arguments: (va_list)arguments; +- (instancetype)initWithObject: (ObjectType)firstObject + arguments: (va_list)arguments; /*! * @brief Returns whether the receiver is a subset of the specified set. * * @return Whether the receiver is a subset of the specified set Index: src/OFSet.m ================================================================== --- src/OFSet.m +++ src/OFSet.m @@ -31,26 +31,26 @@ @interface OFSet_placeholder: OFSet @end @implementation OFSet_placeholder -- init +- (instancetype)init { return (id)[[OFSet_hashtable alloc] init]; } -- initWithSet: (OFSet *)set +- (instancetype)initWithSet: (OFSet *)set { return (id)[[OFSet_hashtable alloc] initWithSet: set]; } -- initWithArray: (OFArray *)array +- (instancetype)initWithArray: (OFArray *)array { return (id)[[OFSet_hashtable alloc] initWithArray: array]; } -- initWithObjects: (id)firstObject, ... +- (instancetype)initWithObjects: (id)firstObject, ... { id ret; va_list arguments; va_start(arguments, firstObject); @@ -59,35 +59,35 @@ va_end(arguments); return ret; } -- initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { return (id)[[OFSet_hashtable alloc] initWithObjects: objects count: count]; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments { return (id)[[OFSet_hashtable alloc] initWithObject: firstObject arguments: arguments]; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFSet_hashtable alloc] initWithSerialization: element]; } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (void)release @@ -105,11 +105,11 @@ { if (self == [OFSet class]) placeholder.isa = [OFSet_placeholder class]; } -+ alloc ++ (instancetype)alloc { if (self == [OFSet class]) return (id)&placeholder; return [super alloc]; @@ -148,11 +148,11 @@ { return [[[self alloc] initWithObjects: objects count: count] autorelease]; } -- init +- (instancetype)init { if (object_getClass(self) == [OFSet class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { @@ -164,27 +164,27 @@ } return [super init]; } -- initWithSet: (OFSet *)set +- (instancetype)initWithSet: (OFSet *)set { OF_INVALID_INIT_METHOD } -- initWithArray: (OFArray *)array +- (instancetype)initWithArray: (OFArray *)array { OF_INVALID_INIT_METHOD } -- initWithObjects: (id const *)objects +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { OF_INVALID_INIT_METHOD } -- (id)initWithObjects: (id)firstObject, ... +- (instancetype)initWithObjects: (id)firstObject, ... { id ret; va_list arguments; va_start(arguments, firstObject); @@ -193,17 +193,17 @@ va_end(arguments); return ret; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments { OF_INVALID_INIT_METHOD } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { OF_INVALID_INIT_METHOD } - (size_t)count @@ -337,16 +337,16 @@ objc_autoreleasePoolPop(pool); return ret; } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { return [[OFMutableSet alloc] initWithSet: self]; } - (bool)isSubsetOfSet: (OFSet *)set Index: src/OFSet_hashtable.h ================================================================== --- src/OFSet_hashtable.h +++ src/OFSet_hashtable.h @@ -23,9 +23,9 @@ @interface OFSet_hashtable: OFSet { OFMapTable *_mapTable; } -- initWithCapacity: (size_t)capacity; +- (instancetype)initWithCapacity: (size_t)capacity; @end OF_ASSUME_NONNULL_END Index: src/OFSet_hashtable.m ================================================================== --- src/OFSet_hashtable.m +++ src/OFSet_hashtable.m @@ -59,16 +59,16 @@ .equal = equal }; static const of_map_table_functions_t objectFunctions = { NULL }; @implementation OFSet_hashtable -- init +- (instancetype)init { return [self initWithCapacity: 0]; } -- initWithCapacity: (size_t)capacity +- (instancetype)initWithCapacity: (size_t)capacity { self = [super init]; @try { _mapTable = [[OFMapTable alloc] @@ -81,11 +81,11 @@ } return self; } -- initWithSet: (OFSet *)set +- (instancetype)initWithSet: (OFSet *)set { size_t count; if (set == nil) return [self init]; @@ -109,11 +109,11 @@ } return self; } -- initWithArray: (OFArray *)array +- (instancetype)initWithArray: (OFArray *)array { size_t count; if (array == nil) return self; @@ -137,12 +137,12 @@ } return self; } -- initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { self = [self initWithCapacity: count]; @try { for (size_t i = 0; i < count; i++) @@ -154,12 +154,12 @@ } return self; } -- initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject + arguments: (va_list)arguments { self = [super init]; @try { id object; @@ -187,11 +187,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [self init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFSettings.h ================================================================== --- src/OFSettings.h +++ src/OFSettings.h @@ -50,21 +50,21 @@ * accessed * @return A new, autoreleased OFSettings instance */ + (instancetype)settingsWithApplicationName: (OFString *)applicationName; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFSettings instance with the * specified application name. * * @param applicationName The name of the application whose settings should be * accessed * @return An initialized OFSettings instance */ -- initWithApplicationName: (OFString *)applicationName +- (instancetype)initWithApplicationName: (OFString *)applicationName OF_DESIGNATED_INITIALIZER; /*! * @brief Sets the specified path to the specified string. * Index: src/OFSettings.m ================================================================== --- src/OFSettings.m +++ src/OFSettings.m @@ -21,11 +21,11 @@ #import "OFString.h" @implementation OFSettings @synthesize applicationName = _applicationName; -+ alloc ++ (instancetype)alloc { if (self == [OFSettings class]) return [OFSettings_INIFile alloc]; return [super alloc]; @@ -35,16 +35,16 @@ { return [[[self alloc] initWithApplicationName: applicationName] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithApplicationName: (OFString *)applicationName +- (instancetype)initWithApplicationName: (OFString *)applicationName { self = [super init]; @try { _applicationName = [applicationName copy]; Index: src/OFSettings_INIFile.m ================================================================== --- src/OFSettings_INIFile.m +++ src/OFSettings_INIFile.m @@ -21,11 +21,11 @@ #import "OFArray.h" #import "OFINIFile.h" #import "OFSystemInfo.h" @implementation OFSettings_INIFile -- initWithApplicationName: (OFString *)applicationName +- (instancetype)initWithApplicationName: (OFString *)applicationName { self = [super initWithApplicationName: applicationName]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFStdIOStream.h ================================================================== --- src/OFStdIOStream.h +++ src/OFStdIOStream.h @@ -44,11 +44,11 @@ bool _closable; #endif bool _atEndOfStream; } -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Query the underlying terminal for the number of columns. * * @return The number of columns, or -1 if there is no underlying terminal or Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -128,11 +128,11 @@ closable: errorClosable]; # endif } #endif -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } #ifndef OF_MORPHOS @@ -294,16 +294,16 @@ #endif [super close]; } -- autorelease +- (instancetype)autorelease { return self; } -- retain +- (instancetype)retain { return self; } - (void)release Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -65,11 +65,11 @@ if (self == [OFStream class]) signal(SIGPIPE, SIG_IGN); } #endif -- init +- (instancetype)init { if (object_getClass(self) == [OFStream class]) { @try { [self doesNotRecognizeSelector: _cmd]; abort(); @@ -101,11 +101,11 @@ length: (size_t)length { OF_UNRECOGNIZED_SELECTOR } -- copy +- (id)copy { return [self retain]; } - (bool)isAtEndOfStream Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -365,22 +365,22 @@ * string. * * @param UTF8String A UTF-8 encoded C string to initialize the OFString with * @return An initialized OFString */ -- initWithUTF8String: (const char *)UTF8String; +- (instancetype)initWithUTF8String: (const char *)UTF8String; /*! * @brief Initializes an already allocated OFString from a UTF-8 encoded C * string with the specified length. * * @param UTF8String A UTF-8 encoded C string to initialize the OFString with * @param UTF8StringLength The length of the UTF-8 encoded C string * @return An initialized OFString */ -- initWithUTF8String: (const char *)UTF8String - length: (size_t)UTF8StringLength; +- (instancetype)initWithUTF8String: (const char *)UTF8String + length: (size_t)UTF8StringLength; /*! * @brief Initializes an already allocated OFString from an UTF-8 encoded C * string without copying it, if possible. * @@ -389,23 +389,23 @@ * @param UTF8String A UTF-8 encoded C string to initialize the OFString with * @param freeWhenDone Whether to free the C string when it is not needed * anymore * @return An initialized OFString */ -- initWithUTF8StringNoCopy: (char *)UTF8String - freeWhenDone: (bool)freeWhenDone; +- (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String + freeWhenDone: (bool)freeWhenDone; /*! * @brief Initializes an already allocated OFString from a C string with the * specified encoding. * * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @return An initialized OFString */ -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding; +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding; /*! * @brief Initializes an already allocated OFString from a C string with the * specified encoding and length. * @@ -412,73 +412,73 @@ * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @param cStringLength The length of the C string * @return An initialized OFString */ -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding - length: (size_t)cStringLength; +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding + length: (size_t)cStringLength; /*! * @brief Initializes an already allocated OFString from OFData with the * specified encoding. * * @param data OFData with the contents of the string * @param encoding The encoding in which the string is stored in the OFData * @return An initialized OFString */ -- initWithData: (OFData *)data - encoding: (of_string_encoding_t)encoding; +- (instancetype)initWithData: (OFData *)data + encoding: (of_string_encoding_t)encoding; /*! * @brief Initializes an already allocated OFString with another string. * * @param string A string to initialize the OFString with * @return An initialized OFString */ -- initWithString: (OFString *)string; +- (instancetype)initWithString: (OFString *)string; /*! * @brief Initializes an already allocated OFString with a Unicode string with * the specified length. * * @param characters An array of Unicode characters * @param length The length of the Unicode character array * @return An initialized OFString */ -- initWithCharacters: (const of_unichar_t *)characters - length: (size_t)length; +- (instancetype)initWithCharacters: (const of_unichar_t *)characters + length: (size_t)length; /*! * @brief Initializes an already allocated OFString with a UTF-16 string. * * @param string The UTF-16 string * @return An initialized OFString */ -- initWithUTF16String: (const char16_t *)string; +- (instancetype)initWithUTF16String: (const char16_t *)string; /*! * @brief Initializes an already allocated OFString with a UTF-16 string with * the specified length. * * @param string The UTF-16 string * @param length The length of the UTF-16 string * @return An initialized OFString */ -- initWithUTF16String: (const char16_t *)string - length: (size_t)length; +- (instancetype)initWithUTF16String: (const char16_t *)string + length: (size_t)length; /*! * @brief Initializes an already allocated OFString with a UTF-16 string, * assuming the specified byte order if no byte order mark is found. * * @param string The UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ -- initWithUTF16String: (const char16_t *)string - byteOrder: (of_byte_order_t)byteOrder; +- (instancetype)initWithUTF16String: (const char16_t *)string + byteOrder: (of_byte_order_t)byteOrder; /*! * @brief Initializes an already allocated OFString with a UTF-16 string with * the specified length, assuming the specified byte order if no byte * order mark is found. @@ -486,43 +486,43 @@ * @param string The UTF-16 string * @param length The length of the UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ -- initWithUTF16String: (const char16_t *)string - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder; +- (instancetype)initWithUTF16String: (const char16_t *)string + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder; /*! * @brief Initializes an already allocated OFString with a UTF-32 string. * * @param string The UTF-32 string * @return An initialized OFString */ -- initWithUTF32String: (const char32_t *)string; +- (instancetype)initWithUTF32String: (const char32_t *)string; /*! * @brief Initializes an already allocated OFString with a UTF-32 string with * the specified length * * @param string The UTF-32 string * @param length The length of the UTF-32 string * @return An initialized OFString */ -- initWithUTF32String: (const char32_t *)string - length: (size_t)length; +- (instancetype)initWithUTF32String: (const char32_t *)string + length: (size_t)length; /*! * @brief Initializes an already allocated OFString with a UTF-32 string, * assuming the specified byte order if no byte order mark is found. * * @param string The UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ -- initWithUTF32String: (const char32_t *)string - byteOrder: (of_byte_order_t)byteOrder; +- (instancetype)initWithUTF32String: (const char32_t *)string + byteOrder: (of_byte_order_t)byteOrder; /*! * @brief Initializes an already allocated OFString with a UTF-32 string with * the specified length, assuming the specified byte order if no byte * order mark is found. @@ -530,13 +530,13 @@ * @param string The UTF-32 string * @param length The length of the UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ -- initWithUTF32String: (const char32_t *)string - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder; +- (instancetype)initWithUTF32String: (const char32_t *)string + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder; /*! * @brief Initializes an already allocated OFString with a format string. * * See printf for the format syntax. As an addition, `%@` is available as @@ -544,11 +544,11 @@ * `const of_unichar_t *`. * * @param format A string used as format to initialize the OFString * @return An initialized OFString */ -- initWithFormat: (OFConstantString *)format, ...; +- (instancetype)initWithFormat: (OFConstantString *)format, ...; /*! * @brief Initializes an already allocated OFString with a format string. * * See printf for the format syntax. As an addition, `%@` is available as @@ -557,33 +557,33 @@ * * @param format A string used as format to initialize the OFString * @param arguments The arguments used in the format string * @return An initialized OFString */ -- initWithFormat: (OFConstantString *)format - arguments: (va_list)arguments; +- (instancetype)initWithFormat: (OFConstantString *)format + arguments: (va_list)arguments; #ifdef OF_HAVE_FILES /*! * @brief Initializes an already allocated OFString with the contents of the * specified file in the specified encoding. * * @param path The path to the file * @return An initialized OFString */ -- initWithContentsOfFile: (OFString *)path; +- (instancetype)initWithContentsOfFile: (OFString *)path; /*! * @brief Initializes an already allocated OFString with the contents of the * specified file in the specified encoding. * * @param path The path to the file * @param encoding The encoding of the file * @return An initialized OFString */ -- initWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding; +- (instancetype)initWithContentsOfFile: (OFString *)path + encoding: (of_string_encoding_t)encoding; #endif #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) /*! * @brief Initializes an already allocated OFString with the contents of the @@ -596,22 +596,22 @@ * UTF-8. * * @param URL The URL to the contents for the string * @return An initialized OFString */ -- initWithContentsOfURL: (OFURL *)URL; +- (instancetype)initWithContentsOfURL: (OFURL *)URL; /*! * @brief Initializes an already allocated OFString with the contents of the * specified URL in the specified encoding. * * @param URL The URL to the contents for the string * @param encoding The encoding to assume * @return An initialized OFString */ -- initWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding; +- (instancetype)initWithContentsOfURL: (OFURL *)URL + encoding: (of_string_encoding_t)encoding; #endif /*! * @brief Writes the OFString into the specified C string with the specified * encoding. Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -376,16 +376,16 @@ @interface OFString_placeholder: OFString @end @implementation OFString_placeholder -- init +- (instancetype)init { return (id)[[OFString_UTF8 alloc] init]; } -- initWithUTF8String: (const char *)UTF8String +- (instancetype)initWithUTF8String: (const char *)UTF8String { id string; size_t length; void *storage; @@ -396,12 +396,12 @@ return (id)[string of_initWithUTF8String: UTF8String length: length storage: storage]; } -- initWithUTF8String: (const char *)UTF8String - length: (size_t)UTF8StringLength +- (instancetype)initWithUTF8String: (const char *)UTF8String + length: (size_t)UTF8StringLength { id string; void *storage; string = of_alloc_object([OFString_UTF8 class], @@ -410,20 +410,20 @@ return (id)[string of_initWithUTF8String: UTF8String length: UTF8StringLength storage: storage]; } -- initWithUTF8StringNoCopy: (char *)UTF8String - freeWhenDone: (bool)freeWhenDone +- (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String + freeWhenDone: (bool)freeWhenDone { return (id)[[OFString_UTF8 alloc] initWithUTF8StringNoCopy: UTF8String freeWhenDone: freeWhenDone]; } -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding { if (encoding == OF_STRING_ENCODING_UTF_8) { id string; size_t length; void *storage; @@ -439,13 +439,13 @@ return (id)[[OFString_UTF8 alloc] initWithCString: cString encoding: encoding]; } -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding - length: (size_t)cStringLength +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding + length: (size_t)cStringLength { if (encoding == OF_STRING_ENCODING_UTF_8) { id string; void *storage; @@ -460,86 +460,86 @@ return (id)[[OFString_UTF8 alloc] initWithCString: cString encoding: encoding length: cStringLength]; } -- initWithData: (OFData *)data - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithData: (OFData *)data + encoding: (of_string_encoding_t)encoding { return (id)[[OFString_UTF8 alloc] initWithData: data encoding: encoding]; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { return (id)[[OFString_UTF8 alloc] initWithString: string]; } -- initWithCharacters: (const of_unichar_t *)string - length: (size_t)length +- (instancetype)initWithCharacters: (const of_unichar_t *)string + length: (size_t)length { return (id)[[OFString_UTF8 alloc] initWithCharacters: string length: length]; } -- initWithUTF16String: (const char16_t *)string +- (instancetype)initWithUTF16String: (const char16_t *)string { return (id)[[OFString_UTF8 alloc] initWithUTF16String: string]; } -- initWithUTF16String: (const char16_t *)string - length: (size_t)length +- (instancetype)initWithUTF16String: (const char16_t *)string + length: (size_t)length { return (id)[[OFString_UTF8 alloc] initWithUTF16String: string length: length]; } -- initWithUTF16String: (const char16_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const char16_t *)string + byteOrder: (of_byte_order_t)byteOrder { return (id)[[OFString_UTF8 alloc] initWithUTF16String: string byteOrder: byteOrder]; } -- initWithUTF16String: (const char16_t *)string - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const char16_t *)string + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { return (id)[[OFString_UTF8 alloc] initWithUTF16String: string length: length byteOrder: byteOrder]; } -- initWithUTF32String: (const char32_t *)string +- (instancetype)initWithUTF32String: (const char32_t *)string { return (id)[[OFString_UTF8 alloc] initWithUTF32String: string]; } -- initWithUTF32String: (const char32_t *)string - length: (size_t)length +- (instancetype)initWithUTF32String: (const char32_t *)string + length: (size_t)length { return (id)[[OFString_UTF8 alloc] initWithUTF32String: string length: length]; } -- initWithUTF32String: (const char32_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const char32_t *)string + byteOrder: (of_byte_order_t)byteOrder { return (id)[[OFString_UTF8 alloc] initWithUTF32String: string byteOrder: byteOrder]; } -- initWithUTF32String: (const char32_t *)string - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const char32_t *)string + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { return (id)[[OFString_UTF8 alloc] initWithUTF32String: string length: length byteOrder: byteOrder]; } -- initWithFormat: (OFConstantString *)format, ... +- (instancetype)initWithFormat: (OFConstantString *)format, ... { id ret; va_list arguments; va_start(arguments, format); @@ -548,56 +548,56 @@ va_end(arguments); return ret; } -- initWithFormat: (OFConstantString *)format - arguments: (va_list)arguments +- (instancetype)initWithFormat: (OFConstantString *)format + arguments: (va_list)arguments { return (id)[[OFString_UTF8 alloc] initWithFormat: format arguments: arguments]; } #ifdef OF_HAVE_FILES -- initWithContentsOfFile: (OFString *)path +- (instancetype)initWithContentsOfFile: (OFString *)path { return (id)[[OFString_UTF8 alloc] initWithContentsOfFile: path]; } -- initWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithContentsOfFile: (OFString *)path + encoding: (of_string_encoding_t)encoding { return (id)[[OFString_UTF8 alloc] initWithContentsOfFile: path encoding: encoding]; } #endif #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) -- initWithContentsOfURL: (OFURL *)URL +- (instancetype)initWithContentsOfURL: (OFURL *)URL { return (id)[[OFString_UTF8 alloc] initWithContentsOfURL: URL]; } -- initWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithContentsOfURL: (OFURL *)URL + encoding: (of_string_encoding_t)encoding { return (id)[[OFString_UTF8 alloc] initWithContentsOfURL: URL encoding: encoding]; } #endif -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFString_UTF8 alloc] initWithSerialization: element]; } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (void)release @@ -623,11 +623,11 @@ @throw [OFInitializationFailedException exceptionWithClass: self]; #endif } -+ alloc ++ (instancetype)alloc { if (self == [OFString class]) return (id)&placeholder; return [super alloc]; @@ -806,11 +806,11 @@ } return ret; } -- init +- (instancetype)init { if (object_getClass(self) == [OFString class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { @@ -822,48 +822,48 @@ } return [super init]; } -- initWithUTF8String: (const char *)UTF8String +- (instancetype)initWithUTF8String: (const char *)UTF8String { return [self initWithCString: UTF8String encoding: OF_STRING_ENCODING_UTF_8 length: strlen(UTF8String)]; } -- initWithUTF8String: (const char *)UTF8String - length: (size_t)UTF8StringLength +- (instancetype)initWithUTF8String: (const char *)UTF8String + length: (size_t)UTF8StringLength { return [self initWithCString: UTF8String encoding: OF_STRING_ENCODING_UTF_8 length: UTF8StringLength]; } -- initWithUTF8StringNoCopy: (char *)UTF8String - freeWhenDone: (bool)freeWhenDone +- (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String + freeWhenDone: (bool)freeWhenDone { return [self initWithUTF8String: UTF8String]; } -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding { return [self initWithCString: cString encoding: encoding length: strlen(cString)]; } -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding - length: (size_t)cStringLength +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding + length: (size_t)cStringLength { OF_INVALID_INIT_METHOD } -- initWithData: (OFData *)data - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithData: (OFData *)data + encoding: (of_string_encoding_t)encoding { @try { if ([data itemSize] != 1) @throw [OFInvalidArgumentException exception]; @@ -876,82 +876,82 @@ } return self; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { OF_INVALID_INIT_METHOD } -- initWithCharacters: (const of_unichar_t *)string - length: (size_t)length +- (instancetype)initWithCharacters: (const of_unichar_t *)string + length: (size_t)length { OF_INVALID_INIT_METHOD } -- initWithUTF16String: (const char16_t *)string +- (instancetype)initWithUTF16String: (const char16_t *)string { return [self initWithUTF16String: string length: of_string_utf16_length(string) byteOrder: OF_BYTE_ORDER_NATIVE]; } -- initWithUTF16String: (const char16_t *)string - length: (size_t)length +- (instancetype)initWithUTF16String: (const char16_t *)string + length: (size_t)length { return [self initWithUTF16String: string length: length byteOrder: OF_BYTE_ORDER_NATIVE]; } -- initWithUTF16String: (const char16_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const char16_t *)string + byteOrder: (of_byte_order_t)byteOrder { return [self initWithUTF16String: string length: of_string_utf16_length(string) byteOrder: byteOrder]; } -- initWithUTF16String: (const char16_t *)string - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const char16_t *)string + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { OF_INVALID_INIT_METHOD } -- initWithUTF32String: (const char32_t *)string +- (instancetype)initWithUTF32String: (const char32_t *)string { return [self initWithUTF32String: string length: of_string_utf32_length(string) byteOrder: OF_BYTE_ORDER_NATIVE]; } -- initWithUTF32String: (const char32_t *)string - length: (size_t)length +- (instancetype)initWithUTF32String: (const char32_t *)string + length: (size_t)length { return [self initWithUTF32String: string length: length byteOrder: OF_BYTE_ORDER_NATIVE]; } -- initWithUTF32String: (const char32_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const char32_t *)string + byteOrder: (of_byte_order_t)byteOrder { return [self initWithUTF32String: string length: of_string_utf32_length(string) byteOrder: byteOrder]; } -- initWithUTF32String: (const char32_t *)string - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const char32_t *)string + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { OF_INVALID_INIT_METHOD } -- initWithFormat: (OFConstantString *)format, ... +- (instancetype)initWithFormat: (OFConstantString *)format, ... { id ret; va_list arguments; va_start(arguments, format); @@ -960,25 +960,25 @@ va_end(arguments); return ret; } -- initWithFormat: (OFConstantString *)format - arguments: (va_list)arguments +- (instancetype)initWithFormat: (OFConstantString *)format + arguments: (va_list)arguments { OF_INVALID_INIT_METHOD } #ifdef OF_HAVE_FILES -- initWithContentsOfFile: (OFString *)path +- (instancetype)initWithContentsOfFile: (OFString *)path { return [self initWithContentsOfFile: path encoding: OF_STRING_ENCODING_UTF_8]; } -- initWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithContentsOfFile: (OFString *)path + encoding: (of_string_encoding_t)encoding { char *tmp; of_offset_t fileSize; @try { @@ -1022,18 +1022,18 @@ return self; } #endif #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) -- initWithContentsOfURL: (OFURL *)URL +- (instancetype)initWithContentsOfURL: (OFURL *)URL { return [self initWithContentsOfURL: URL encoding: OF_STRING_ENCODING_AUTODETECT]; } -- initWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding +- (instancetype)initWithContentsOfURL: (OFURL *)URL + encoding: (of_string_encoding_t)encoding { void *pool = objc_autoreleasePoolPush(); OFString *scheme = [URL scheme]; # ifdef OF_HAVE_FILES @@ -1051,11 +1051,11 @@ return self; } #endif -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { @try { void *pool = objc_autoreleasePoolPush(); if (![[element namespace] isEqual: OF_SERIALIZATION_NS]) @@ -1498,16 +1498,16 @@ objc_autoreleasePoolPop(pool); return true; } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { return [[OFMutableString alloc] initWithString: self]; } - (of_comparison_result_t)compare: (id )object Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -170,11 +170,11 @@ return index; } @implementation OFString_UTF8 -- init +- (instancetype)init { self = [super init]; @try { _s = &_storage; @@ -224,13 +224,13 @@ } return self; } -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding - length: (size_t)cStringLength +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding + length: (size_t)cStringLength { self = [super init]; @try { const char16_t *table; @@ -388,12 +388,12 @@ } return self; } -- initWithUTF8StringNoCopy: (char *)UTF8String - freeWhenDone: (bool)freeWhenDone +- (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String + freeWhenDone: (bool)freeWhenDone { self = [super init]; @try { size_t UTF8StringLength = strlen(UTF8String); @@ -426,11 +426,11 @@ } return self; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { self = [super init]; @try { _s = &_storage; @@ -453,12 +453,12 @@ } return self; } -- initWithCharacters: (const of_unichar_t *)characters - length: (size_t)length +- (instancetype)initWithCharacters: (const of_unichar_t *)characters + length: (size_t)length { self = [super init]; @try { size_t j; @@ -497,13 +497,13 @@ } return self; } -- initWithUTF16String: (const char16_t *)string - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const char16_t *)string + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { self = [super init]; @try { size_t j; @@ -582,13 +582,13 @@ } return self; } -- initWithUTF32String: (const char32_t *)characters - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const char32_t *)characters + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { self = [super init]; @try { size_t j; @@ -649,12 +649,12 @@ } return self; } -- initWithFormat: (OFConstantString *)format - arguments: (va_list)arguments +- (instancetype)initWithFormat: (OFConstantString *)format + arguments: (va_list)arguments { self = [super init]; @try { char *tmp; Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -129,11 +129,11 @@ # endif numberOfCPUs = 1; #endif } -+ alloc ++ (instancetype)alloc { OF_UNRECOGNIZED_SELECTOR } + (size_t)pageSize Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -79,34 +79,35 @@ of_tcp_socket_async_connect_block_t _block; # endif id _exception; } -- initWithSourceThread: (OFThread *)sourceThread - socket: (OFTCPSocket *)socket - host: (OFString *)host - port: (uint16_t)port - target: (id)target - selector: (SEL)selector - context: (id)context; +- (instancetype)initWithSourceThread: (OFThread *)sourceThread + socket: (OFTCPSocket *)socket + host: (OFString *)host + port: (uint16_t)port + target: (id)target + selector: (SEL)selector + context: (id)context; # ifdef OF_HAVE_BLOCKS -- initWithSourceThread: (OFThread *)sourceThread - socket: (OFTCPSocket *)socket - host: (OFString *)host - port: (uint16_t)port - block: (of_tcp_socket_async_connect_block_t)block; +- (instancetype)initWithSourceThread: (OFThread *)sourceThread + socket: (OFTCPSocket *)socket + host: (OFString *)host + port: (uint16_t)port + block: (of_tcp_socket_async_connect_block_t) + block; # endif @end @implementation OFTCPSocket_ConnectThread -- initWithSourceThread: (OFThread *)sourceThread - socket: (OFTCPSocket *)socket - host: (OFString *)host - port: (uint16_t)port - target: (id)target - selector: (SEL)selector - context: (id)context +- (instancetype)initWithSourceThread: (OFThread *)sourceThread + socket: (OFTCPSocket *)socket + host: (OFString *)host + port: (uint16_t)port + target: (id)target + selector: (SEL)selector + context: (id)context { self = [super init]; @try { _sourceThread = [sourceThread retain]; @@ -123,15 +124,15 @@ return self; } # ifdef OF_HAVE_BLOCKS -- initWithSourceThread: (OFThread *)sourceThread - socket: (OFTCPSocket *)socket - host: (OFString *)host - port: (uint16_t)port - block: (of_tcp_socket_async_connect_block_t)block +- (instancetype)initWithSourceThread: (OFThread *)sourceThread + socket: (OFTCPSocket *)socket + host: (OFString *)host + port: (uint16_t)port + block: (of_tcp_socket_async_connect_block_t)block { self = [super init]; @try { _sourceThread = [sourceThread retain]; @@ -227,11 +228,11 @@ + (uint16_t)SOCKS5Port { return defaultSOCKS5Port; } -- init +- (instancetype)init { self = [super init]; @try { _socket = INVALID_SOCKET; Index: src/OFTLSSocket.h ================================================================== --- src/OFTLSSocket.h +++ src/OFTLSSocket.h @@ -91,11 +91,11 @@ * @brief Initializes the TLS socket with the specified TCP socket as its * underlying socket. * * @param socket The TCP socket to use as underlying socket */ -- initWithSocket: (OFTCPSocket *)socket; +- (instancetype)initWithSocket: (OFTCPSocket *)socket; /*! * @brief Initiates the TLS handshake. * * @note This is only useful if you used @ref initWithSocket: to start TLS on Index: src/OFTarArchive.h ================================================================== --- src/OFTarArchive.h +++ src/OFTarArchive.h @@ -74,12 +74,12 @@ * @param mode The mode for the tar file. Valid modes are "r" for reading, * "w" for creating a new file and "a" for appending to an existing * archive. * @return An initialized OFTarArchive */ -- initWithStream: (OF_KINDOF(OFStream *))stream - mode: (OFString *)mode OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream + mode: (OFString *)mode OF_DESIGNATED_INITIALIZER; #ifdef OF_HAVE_FILES /*! * @brief Initializes an already allocated OFTarArchive object with the * specified file. @@ -88,12 +88,12 @@ * @param mode The mode for the tar file. Valid modes are "r" for reading, * "w" for creating a new file and "a" for appending to an existing * archive. * @return An initialized OFTarArchive */ -- initWithPath: (OFString *)path - mode: (OFString *)mode; +- (instancetype)initWithPath: (OFString *)path + mode: (OFString *)mode; #endif /*! * @brief Returns the next entry from the tar archive or `nil` if all entries * have been read. Index: src/OFTarArchive.m ================================================================== --- src/OFTarArchive.m +++ src/OFTarArchive.m @@ -39,12 +39,12 @@ OF_KINDOF(OFStream *) _stream; uint64_t _toRead; bool _atEndOfStream; } -- initWithStream: (OFStream *)stream - entry: (OFTarArchiveEntry *)entry; +- (instancetype)initWithStream: (OFStream *)stream + entry: (OFTarArchiveEntry *)entry; - (void)of_skip; @end @interface OFTarArchive_FileWriteStream: OFStream { @@ -51,12 +51,12 @@ OFTarArchiveEntry *_entry; OFStream *_stream; uint64_t _toWrite; } -- initWithStream: (OFStream *)stream - entry: (OFTarArchiveEntry *)entry; +- (instancetype)initWithStream: (OFStream *)stream + entry: (OFTarArchiveEntry *)entry; @end @implementation OFTarArchive: OFObject + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode @@ -72,12 +72,12 @@ return [[[self alloc] initWithPath: path mode: mode] autorelease]; } #endif -- initWithStream: (OF_KINDOF(OFStream *))stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream + mode: (OFString *)mode { self = [super init]; @try { _stream = [stream retain]; @@ -123,12 +123,12 @@ return self; } #ifdef OF_HAVE_FILES -- initWithPath: (OFString *)path - mode: (OFString *)mode +- (instancetype)initWithPath: (OFString *)path + mode: (OFString *)mode { OFFile *file; if ([mode isEqual: @"a"]) file = [[OFFile alloc] initWithPath: path @@ -260,12 +260,12 @@ _stream = nil; } @end @implementation OFTarArchive_FileReadStream -- initWithStream: (OFStream *)stream - entry: (OFTarArchiveEntry *)entry +- (instancetype)initWithStream: (OFStream *)stream + entry: (OFTarArchiveEntry *)entry { self = [super init]; @try { _entry = [entry copy]; @@ -382,12 +382,12 @@ } } @end @implementation OFTarArchive_FileWriteStream -- initWithStream: (OFStream *)stream - entry: (OFTarArchiveEntry *)entry +- (instancetype)initWithStream: (OFStream *)stream + entry: (OFTarArchiveEntry *)entry { self = [super init]; @try { _entry = [entry copy]; Index: src/OFTarArchiveEntry.h ================================================================== --- src/OFTarArchiveEntry.h +++ src/OFTarArchiveEntry.h @@ -129,20 +129,20 @@ * @param fileName The file name for the OFTarArchiveEntry * @return A new, autoreleased OFTarArchiveEntry */ + (instancetype)entryWithFileName: (OFString *)fileName; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFTarArchiveEntry with the specified * file name. * * @param fileName The file name for the OFTarArchiveEntry * @return An initialized OFTarArchiveEntry */ -- initWithFileName: (OFString *)fileName; +- (instancetype)initWithFileName: (OFString *)fileName; @end OF_ASSUME_NONNULL_END #import "OFMutableTarArchiveEntry.h" Index: src/OFTarArchiveEntry.m ================================================================== --- src/OFTarArchiveEntry.m +++ src/OFTarArchiveEntry.m @@ -74,11 +74,11 @@ + (instancetype)entryWithFileName: (OFString *)fileName { return [[[self alloc] initWithFileName: fileName] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithHeader: (unsigned char [512])header @@ -139,11 +139,11 @@ } return self; } -- initWithFileName: (OFString *)fileName +- (instancetype)initWithFileName: (OFString *)fileName { self = [super init]; @try { _fileName = [fileName copy]; @@ -166,16 +166,16 @@ [_group release]; [super dealloc]; } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { OFTarArchiveEntry *copy = [[OFMutableTarArchiveEntry alloc] initWithFileName: _fileName]; @try { Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -191,11 +191,11 @@ * @brief Initializes an already allocated thread with the specified block. * * @param threadBlock A block which is executed by the thread * @return An initialized OFThread. */ -- initWithThreadBlock: (of_thread_block_t)threadBlock; +- (instancetype)initWithThreadBlock: (of_thread_block_t)threadBlock; # endif /*! * @brief The main routine of the thread. You need to reimplement this! * @@ -268,10 +268,10 @@ * * @param stackSize The stack size for the thread */ - (void)setStackSize: (size_t)stackSize; #else -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; #endif @end OF_ASSUME_NONNULL_END Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -305,11 +305,11 @@ if (!of_tlskey_set(threadSelfKey, mainThread)) @throw [OFInitializationFailedException exceptionWithClass: self]; } -- init +- (instancetype)init { self = [super init]; @try { if (!of_thread_attr_init(&_attr)) @@ -322,11 +322,11 @@ return self; } # ifdef OF_HAVE_BLOCKS -- initWithThreadBlock: (of_thread_block_t)threadBlock +- (instancetype)initWithThreadBlock: (of_thread_block_t)threadBlock { self = [self init]; @try { _threadBlock = [threadBlock copy]; @@ -385,11 +385,11 @@ _running = OF_THREAD_NOT_RUNNING; return _returnValue; } -- copy +- (id)copy { return [self retain]; } - (OFRunLoop *)runLoop @@ -458,11 +458,11 @@ # endif [super dealloc]; } #else -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } #endif @end Index: src/OFThreadPool.h ================================================================== --- src/OFThreadPool.h +++ src/OFThreadPool.h @@ -75,11 +75,11 @@ * number of threads. * * @param size The number of threads for the pool * @return An initialized OFThreadPool with the specified number of threads */ -- initWithSize: (size_t)size OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSize: (size_t)size OF_DESIGNATED_INITIALIZER; /*! * @brief Execute the specified selector on the specified target with the * specified object as soon as a thread is ready. * Index: src/OFThreadPool.m ================================================================== --- src/OFThreadPool.m +++ src/OFThreadPool.m @@ -31,23 +31,23 @@ #ifdef OF_HAVE_BLOCKS of_thread_pool_block_t _block; #endif } -- initWithTarget: (id)target - selector: (SEL)selector - object: (id)object; +- (instancetype)initWithTarget: (id)target + selector: (SEL)selector + object: (id)object; #ifdef OF_HAVE_BLOCKS -- initWithBlock: (of_thread_pool_block_t)block; +- (instancetype)initWithBlock: (of_thread_pool_block_t)block; #endif - (void)perform; @end @implementation OFThreadPoolJob -- initWithTarget: (id)target - selector: (SEL)selector - object: (id)object +- (instancetype)initWithTarget: (id)target + selector: (SEL)selector + object: (id)object { self = [super init]; @try { _target = [target retain]; @@ -60,11 +60,11 @@ return self; } #ifdef OF_HAVE_BLOCKS -- initWithBlock: (of_thread_pool_block_t)block +- (instancetype)initWithBlock: (of_thread_pool_block_t)block { self = [super init]; @try { _block = [block copy]; @@ -108,20 +108,20 @@ volatile bool _terminate; volatile int *_doneCount; } + (instancetype)threadWithThreadPool: (OFThreadPool *)threadPool; -- initWithThreadPool: (OFThreadPool *)threadPool; +- (instancetype)initWithThreadPool: (OFThreadPool *)threadPool; @end @implementation OFThreadPoolThread + (instancetype)threadWithThreadPool: (OFThreadPool *)threadPool { return [[[self alloc] initWithThreadPool: threadPool] autorelease]; } -- initWithThreadPool: (OFThreadPool *)threadPool +- (instancetype)initWithThreadPool: (OFThreadPool *)threadPool { self = [super init]; @try { _queue = [threadPool->_queue retain]; @@ -226,16 +226,16 @@ + (instancetype)threadPoolWithSize: (size_t)size { return [[[self alloc] initWithSize: size] autorelease]; } -- init +- (instancetype)init { return [self initWithSize: [OFSystemInfo numberOfCPUs]]; } -- initWithSize: (size_t)size +- (instancetype)initWithSize: (size_t)size { self = [super init]; @try { _size = size; Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -301,11 +301,11 @@ + (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval repeats: (bool)repeats block: (of_timer_block_t)block; #endif -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated timer with the specified time * interval. * @@ -315,15 +315,15 @@ * @param target The target on which to call the selector * @param selector The selector to call on the target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - repeats: (bool)repeats; +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + repeats: (bool)repeats; /*! * @brief Initializes an already allocated timer with the specified time * interval. * @@ -334,16 +334,16 @@ * @param selector The selector to call on the target * @param object An object to pass when calling the selector on the target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - object: (nullable id)object - repeats: (bool)repeats; +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + object: (nullable id)object + repeats: (bool)repeats; /*! * @brief Initializes an already allocated timer with the specified time * interval. * @@ -357,17 +357,17 @@ * @param object2 The second object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - object: (nullable id)object1 - object: (nullable id)object2 - repeats: (bool)repeats; +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + object: (nullable id)object1 + object: (nullable id)object2 + repeats: (bool)repeats; /*! * @brief Initializes an already allocated timer with the specified time * interval. * @@ -383,18 +383,18 @@ * @param object3 The third object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - object: (nullable id)object1 - object: (nullable id)object2 - object: (nullable id)object3 - repeats: (bool)repeats; +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + object: (nullable id)object1 + object: (nullable id)object2 + object: (nullable id)object3 + repeats: (bool)repeats; /*! * @brief Initializes an already allocated timer with the specified time * interval. * @@ -412,19 +412,19 @@ * @param object4 The fourth object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - object: (nullable id)object1 - object: (nullable id)object2 - object: (nullable id)object3 - object: (nullable id)object4 - repeats: (bool)repeats; +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + object: (nullable id)object1 + object: (nullable id)object2 + object: (nullable id)object3 + object: (nullable id)object4 + repeats: (bool)repeats; #ifdef OF_HAVE_BLOCKS /*! * @brief Initializes an already allocated timer with the specified time * interval. @@ -434,14 +434,14 @@ * a repeating timer * @param repeats Whether the timer repeats after it has been executed * @param block The block to invoke when the timer fires * @return An initialized timer */ -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - repeats: (bool)repeats - block: (of_timer_block_t)block; +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + repeats: (bool)repeats + block: (of_timer_block_t)block; #endif /*! * @brief Fires the timer, meaning it will execute the specified selector on the * target. Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -313,11 +313,11 @@ return [timer autorelease]; } #endif -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithFireDate: (OFDate *)fireDate @@ -354,15 +354,15 @@ } return self; } -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - repeats: (bool)repeats +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + repeats: (bool)repeats { return [self of_initWithFireDate: fireDate interval: interval target: target selector: selector @@ -372,16 +372,16 @@ object: nil arguments: 0 repeats: repeats]; } -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - object: (id)object - repeats: (bool)repeats +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + object: (id)object + repeats: (bool)repeats { return [self of_initWithFireDate: fireDate interval: interval target: target selector: selector @@ -391,17 +391,17 @@ object: nil arguments: 1 repeats: repeats]; } -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - object: (id)object1 - object: (id)object2 - repeats: (bool)repeats +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + object: (id)object1 + object: (id)object2 + repeats: (bool)repeats { return [self of_initWithFireDate: fireDate interval: interval target: target selector: selector @@ -411,18 +411,18 @@ object: nil arguments: 2 repeats: repeats]; } -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - object: (id)object1 - object: (id)object2 - object: (id)object3 - repeats: (bool)repeats +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + object: (id)object1 + object: (id)object2 + object: (id)object3 + repeats: (bool)repeats { return [self of_initWithFireDate: fireDate interval: interval target: target selector: selector @@ -432,19 +432,19 @@ object: nil arguments: 3 repeats: repeats]; } -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - target: (id)target - selector: (SEL)selector - object: (id)object1 - object: (id)object2 - object: (id)object3 - object: (id)object4 - repeats: (bool)repeats +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + target: (id)target + selector: (SEL)selector + object: (id)object1 + object: (id)object2 + object: (id)object3 + object: (id)object4 + repeats: (bool)repeats { return [self of_initWithFireDate: fireDate interval: interval target: target selector: selector @@ -455,14 +455,14 @@ arguments: 4 repeats: repeats]; } #ifdef OF_HAVE_BLOCKS -- initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval - repeats: (bool)repeats - block: (of_timer_block_t)block +- (instancetype)initWithFireDate: (OFDate *)fireDate + interval: (of_time_interval_t)interval + repeats: (bool)repeats + block: (of_timer_block_t)block { self = [super init]; @try { _fireDate = [fireDate retain]; Index: src/OFTriple.h ================================================================== --- src/OFTriple.h +++ src/OFTriple.h @@ -72,13 +72,13 @@ * @param firstObject The first object for the triple * @param secondObject The second object for the triple * @param thirdObject The second object for the triple * @return An initialized OFTriple */ -- initWithFirstObject: (nullable FirstType)firstObject - secondObject: (nullable SecondType)secondObject - thirdObject: (nullable ThirdType)thirdObject; +- (instancetype)initWithFirstObject: (nullable FirstType)firstObject + secondObject: (nullable SecondType)secondObject + thirdObject: (nullable ThirdType)thirdObject; #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # undef FirstType # undef SecondType # undef ThirdType #endif Index: src/OFTriple.m ================================================================== --- src/OFTriple.m +++ src/OFTriple.m @@ -27,13 +27,13 @@ return [[[self alloc] initWithFirstObject: firstObject secondObject: secondObject thirdObject: thirdObject] autorelease]; } -- initWithFirstObject: (id)firstObject - secondObject: (id)secondObject - thirdObject: (id)thirdObject +- (instancetype)initWithFirstObject: (id)firstObject + secondObject: (id)secondObject + thirdObject: (id)thirdObject { self = [super init]; @try { _firstObject = [firstObject retain]; @@ -108,16 +108,16 @@ OF_HASH_FINALIZE(hash); return hash; } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { return [[OFMutableTriple alloc] initWithFirstObject: _firstObject secondObject: _secondObject thirdObject: _thirdObject]; } Index: src/OFUDPSocket.m ================================================================== --- src/OFUDPSocket.m +++ src/OFUDPSocket.m @@ -57,31 +57,32 @@ # endif of_udp_socket_address_t _address; id _exception; } -- initWithSourceThread: (OFThread *)sourceThread - host: (OFString *)host - port: (uint16_t)port - target: (id)target - selector: (SEL)selector - context: (id)context; +- (instancetype)initWithSourceThread: (OFThread *)sourceThread + host: (OFString *)host + port: (uint16_t)port + target: (id)target + selector: (SEL)selector + context: (id)context; # ifdef OF_HAVE_BLOCKS -- initWithSourceThread: (OFThread *)sourceThread - host: (OFString *)host - port: (uint16_t)port - block: (of_udp_socket_async_resolve_block_t)block; +- (instancetype)initWithSourceThread: (OFThread *)sourceThread + host: (OFString *)host + port: (uint16_t)port + block: (of_udp_socket_async_resolve_block_t) + block; # endif @end @implementation OFUDPSocket_ResolveThread -- initWithSourceThread: (OFThread *)sourceThread - host: (OFString *)host - port: (uint16_t)port - target: (id)target - selector: (SEL)selector - context: (id)context +- (instancetype)initWithSourceThread: (OFThread *)sourceThread + host: (OFString *)host + port: (uint16_t)port + target: (id)target + selector: (SEL)selector + context: (id)context { self = [super init]; @try { _sourceThread = [sourceThread retain]; @@ -97,14 +98,14 @@ return self; } # ifdef OF_HAVE_BLOCKS -- initWithSourceThread: (OFThread *)sourceThread - host: (OFString *)host - port: (uint16_t)port - block: (of_udp_socket_async_resolve_block_t)block +- (instancetype)initWithSourceThread: (OFThread *)sourceThread + host: (OFString *)host + port: (uint16_t)port + block: (of_udp_socket_async_resolve_block_t)block { self = [super init]; @try { _sourceThread = [sourceThread retain]; @@ -368,11 +369,11 @@ { of_address_to_string_and_port( (struct sockaddr *)&address->address, address->length, host, port); } -- init +- (instancetype)init { self = [super init]; _socket = INVALID_SOCKET; @@ -385,11 +386,11 @@ [self close]; [super dealloc]; } -- copy +- (id)copy { return [self retain]; } - (uint16_t)bindToHost: (OFString *)host Index: src/OFURL.h ================================================================== --- src/OFURL.h +++ src/OFURL.h @@ -105,30 +105,30 @@ * @param path The local file path * @return A new, autoreleased OFURL */ + (instancetype)fileURLWithPath: (OFString *)path; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFURL with the specified string. * * @param string A string describing a URL * @return An initialized OFURL */ -- initWithString: (OFString *)string; +- (instancetype)initWithString: (OFString *)string; /*! * @brief Initializes an already allocated OFURL with the specified string and * relative URL. * * @param string A string describing a URL * @param URL A URL to which the string is relative * @return An initialized OFURL */ -- initWithString: (OFString *)string - relativeToURL: (OFURL *)URL; +- (instancetype)initWithString: (OFString *)string + relativeToURL: (OFURL *)URL; /*! * @brief Returns the URL as a string. * * @return The URL as a string Index: src/OFURL.m ================================================================== --- src/OFURL.m +++ src/OFURL.m @@ -60,21 +60,21 @@ objc_autoreleasePoolPop(pool); return URL; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_init { return [super init]; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { char *UTF8String, *UTF8String2 = NULL; self = [super init]; @@ -204,12 +204,12 @@ } return self; } -- initWithString: (OFString *)string - relativeToURL: (OFURL *)URL +- (instancetype)initWithString: (OFString *)string + relativeToURL: (OFURL *)URL { char *UTF8String, *UTF8String2 = NULL; if ([string containsString: @"://"]) return [self initWithString: string]; @@ -278,11 +278,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { @try { void *pool = objc_autoreleasePoolPush(); if (![[element name] isEqual: [self className]] || @@ -414,16 +414,16 @@ - (OFString *)fragment { return _fragment; } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { OFMutableURL *copy = [[OFMutableURL alloc] init]; @try { [copy setScheme: _scheme]; Index: src/OFXMLAttribute.h ================================================================== --- src/OFXMLAttribute.h +++ src/OFXMLAttribute.h @@ -73,24 +73,24 @@ * * @param name The name of the attribute * @param stringValue The string value of the attribute * @return An initialized OFXMLAttribute with the specified parameters */ -- initWithName: (OFString *)name - stringValue: (OFString *)stringValue; +- (instancetype)initWithName: (OFString *)name + stringValue: (OFString *)stringValue; /*! * @brief Initializes an already allocated OFXMLAttribute. * * @param name The name of the attribute * @param namespace_ The namespace of the attribute * @param stringValue The string value of the attribute * @return An initialized OFXMLAttribute with the specified parameters */ -- initWithName: (OFString *)name - namespace: (nullable OFString *)namespace_ - stringValue: (OFString *)stringValue; +- (instancetype)initWithName: (OFString *)name + namespace: (nullable OFString *)namespace_ + stringValue: (OFString *)stringValue; -- initWithSerialization: (OFXMLElement *)element; +- (instancetype)initWithSerialization: (OFXMLElement *)element; @end OF_ASSUME_NONNULL_END Index: src/OFXMLAttribute.m ================================================================== --- src/OFXMLAttribute.m +++ src/OFXMLAttribute.m @@ -41,21 +41,21 @@ { return [[[self alloc] initWithName: name stringValue: stringValue] autorelease]; } -- initWithName: (OFString *)name - stringValue: (OFString *)stringValue +- (instancetype)initWithName: (OFString *)name + stringValue: (OFString *)stringValue { return [self initWithName: name namespace: nil stringValue: stringValue]; } -- initWithName: (OFString *)name - namespace: (OFString *)namespace - stringValue: (OFString *)stringValue +- (instancetype)initWithName: (OFString *)name + namespace: (OFString *)namespace + stringValue: (OFString *)stringValue { self = [super of_init]; @try { _name = [name copy]; @@ -67,11 +67,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [super of_init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFXMLCDATA.h ================================================================== --- src/OFXMLCDATA.h +++ src/OFXMLCDATA.h @@ -40,11 +40,11 @@ * @brief Initializes an already allocated OFXMLCDATA with the specified string. * * @param string The string value for the CDATA * @return An initialized OFXMLCDATA */ -- initWithString: (OFString *)string; +- (instancetype)initWithString: (OFString *)string; -- initWithSerialization: (OFXMLElement *)element; +- (instancetype)initWithSerialization: (OFXMLElement *)element; @end OF_ASSUME_NONNULL_END Index: src/OFXMLCDATA.m ================================================================== --- src/OFXMLCDATA.m +++ src/OFXMLCDATA.m @@ -27,11 +27,11 @@ + (instancetype)CDATAWithString: (OFString *)string { return [[[self alloc] initWithString: string] autorelease]; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { self = [super of_init]; @try { _CDATA = [string copy]; @@ -41,11 +41,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [super of_init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFXMLCharacters.h ================================================================== --- src/OFXMLCharacters.h +++ src/OFXMLCharacters.h @@ -41,11 +41,11 @@ * string. * * @param string The string value for the characters * @return An initialized OFXMLCharacters */ -- initWithString: (OFString *)string; +- (instancetype)initWithString: (OFString *)string; -- initWithSerialization: (OFXMLElement *)element; +- (instancetype)initWithSerialization: (OFXMLElement *)element; @end OF_ASSUME_NONNULL_END Index: src/OFXMLCharacters.m ================================================================== --- src/OFXMLCharacters.m +++ src/OFXMLCharacters.m @@ -27,11 +27,11 @@ + (instancetype)charactersWithString: (OFString *)string { return [[[self alloc] initWithString: string] autorelease]; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { self = [super of_init]; @try { _characters = [string copy]; @@ -41,11 +41,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [super of_init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFXMLComment.h ================================================================== --- src/OFXMLComment.h +++ src/OFXMLComment.h @@ -41,11 +41,11 @@ * string. * * @param string The string for the comment * @return An initialized OFXMLComment */ -- initWithString: (OFString *)string; +- (instancetype)initWithString: (OFString *)string; -- initWithSerialization: (OFXMLElement *)element; +- (instancetype)initWithSerialization: (OFXMLElement *)element; @end OF_ASSUME_NONNULL_END Index: src/OFXMLComment.m ================================================================== --- src/OFXMLComment.m +++ src/OFXMLComment.m @@ -29,11 +29,11 @@ + (instancetype)commentWithString: (OFString *)string { return [[[self alloc] initWithString: string] autorelease]; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { self = [super of_init]; @try { _comment = [string copy]; @@ -43,11 +43,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [super of_init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFXMLElement.h ================================================================== --- src/OFXMLElement.h +++ src/OFXMLElement.h @@ -129,19 +129,19 @@ * file */ + (instancetype)elementWithFile: (OFString *)path; #endif -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFXMLElement with the specified name. * * @param name The name for the element * @return An initialized OFXMLElement with the specified element name */ -- initWithName: (OFString *)name; +- (instancetype)initWithName: (OFString *)name; /*! * @brief Initializes an already allocated OFXMLElement with the specified name * and string value. * @@ -148,12 +148,12 @@ * @param name The name for the element * @param stringValue The value for the element * @return An initialized OFXMLElement with the specified element name and * value */ -- initWithName: (OFString *)name - stringValue: (nullable OFString *)stringValue; +- (instancetype)initWithName: (OFString *)name + stringValue: (nullable OFString *)stringValue; /*! * @brief Initializes an already allocated OFXMLElement with the specified name * and namespace. * @@ -160,12 +160,12 @@ * @param name The name for the element * @param namespace_ The namespace for the element * @return An initialized OFXMLElement with the specified element name and * namespace */ -- initWithName: (OFString *)name - namespace: (nullable OFString *)namespace_; +- (instancetype)initWithName: (OFString *)name + namespace: (nullable OFString *)namespace_; /*! * @brief Initializes an already allocated OFXMLElement with the specified name, * namespace and value. * @@ -173,45 +173,45 @@ * @param namespace_ The namespace for the element * @param stringValue The value for the element * @return An initialized OFXMLElement with the specified element name, * namespace and value */ -- initWithName: (OFString *)name - namespace: (nullable OFString *)namespace_ - stringValue: (nullable OFString *)stringValue; +- (instancetype)initWithName: (OFString *)name + namespace: (nullable OFString *)namespace_ + stringValue: (nullable OFString *)stringValue; /*! * @brief Initializes an already allocated OFXMLElement with the specified * element. * * @param element An OFXMLElement to initialize the OFXMLElement with * @return A new autoreleased OFXMLElement with the contents of the specified * element */ -- initWithElement: (OFXMLElement *)element; +- (instancetype)initWithElement: (OFXMLElement *)element; /*! * @brief Parses the string and initializes an already allocated OFXMLElement * with it. * * @param string The string to parse * @return An initialized OFXMLElement with the contents of the string */ -- initWithXMLString: (OFString *)string; +- (instancetype)initWithXMLString: (OFString *)string; #ifdef OF_HAVE_FILES /*! * @brief Parses the specified file and initializes an already allocated * OFXMLElement with it. * * @param path The path to the file * @return An initialized OFXMLElement with the contents of the specified file */ -- initWithFile: (OFString *)path; +- (instancetype)initWithFile: (OFString *)path; #endif -- initWithSerialization: (OFXMLElement *)element; +- (instancetype)initWithSerialization: (OFXMLElement *)element; /*! * @brief Sets a prefix for a namespace. * * @param prefix The prefix for the namespace Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -127,41 +127,41 @@ { return [[[self alloc] initWithFile: path] autorelease]; } #endif -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithName: (OFString *)name +- (instancetype)initWithName: (OFString *)name { return [self initWithName: name namespace: nil stringValue: nil]; } -- initWithName: (OFString *)name - stringValue: (OFString *)stringValue +- (instancetype)initWithName: (OFString *)name + stringValue: (OFString *)stringValue { return [self initWithName: name namespace: nil stringValue: stringValue]; } -- initWithName: (OFString *)name - namespace: (OFString *)namespace +- (instancetype)initWithName: (OFString *)name + namespace: (OFString *)namespace { return [self initWithName: name namespace: namespace stringValue: nil]; } -- initWithName: (OFString *)name - namespace: (OFString *)namespace - stringValue: (OFString *)stringValue +- (instancetype)initWithName: (OFString *)name + namespace: (OFString *)namespace + stringValue: (OFString *)stringValue { self = [super of_init]; @try { if (name == nil) @@ -183,11 +183,11 @@ } return self; } -- initWithElement: (OFXMLElement *)element +- (instancetype)initWithElement: (OFXMLElement *)element { self = [super of_init]; @try { if (element == nil) @@ -205,11 +205,11 @@ } return self; } -- initWithXMLString: (OFString *)string +- (instancetype)initWithXMLString: (OFString *)string { void *pool; OFXMLParser *parser; OFXMLElementBuilder *builder; OFXMLElement_OFXMLElementBuilderDelegate *delegate; @@ -240,11 +240,11 @@ return self; } #ifdef OF_HAVE_FILES -- initWithFile: (OFString *)path +- (instancetype)initWithFile: (OFString *)path { void *pool; OFXMLParser *parser; OFXMLElementBuilder *builder; OFXMLElement_OFXMLElementBuilderDelegate *delegate; @@ -272,11 +272,11 @@ return self; } #endif -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [super of_init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -1075,10 +1075,10 @@ OF_HASH_FINALIZE(hash); return hash; } -- copy +- (id)copy { return [[[self class] alloc] initWithElement: self]; } @end Index: src/OFXMLElementBuilder.m ================================================================== --- src/OFXMLElementBuilder.m +++ src/OFXMLElementBuilder.m @@ -34,11 +34,11 @@ + (instancetype)elementBuilder { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; @try { _stack = [[OFMutableArray alloc] init]; Index: src/OFXMLNode.h ================================================================== --- src/OFXMLNode.h +++ src/OFXMLNode.h @@ -25,12 +25,12 @@ * @class OFXMLNode OFXMLNode.h ObjFW/OFXMLNode.h * * @brief A class which stores an XML element. */ @interface OFXMLNode: OFObject -- init OF_UNAVAILABLE; -- initWithSerialization: (OFXMLElement *)element OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; +- (instancetype)initWithSerialization: (OFXMLElement *)element OF_UNAVAILABLE; /*! * @brief Returns the contents of the receiver as a string value. * * @return A string with the string value Index: src/OFXMLNode.m ================================================================== --- src/OFXMLNode.m +++ src/OFXMLNode.m @@ -23,16 +23,16 @@ - (instancetype)of_init { return [super init]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { OF_INVALID_INIT_METHOD } - (OFString *)stringValue @@ -91,10 +91,10 @@ - (OFXMLElement *)XMLElementBySerializing { OF_UNRECOGNIZED_SELECTOR } -- copy +- (id)copy { return [self retain]; } @end Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -201,11 +201,11 @@ + (instancetype)parser { return [[[self alloc] init] autorelease]; } -- init +- (instancetype)init { self = [super init]; @try { void *pool; Index: src/OFXMLProcessingInstructions.h ================================================================== --- src/OFXMLProcessingInstructions.h +++ src/OFXMLProcessingInstructions.h @@ -42,11 +42,11 @@ * specified string. * * @param string The string for the processing instructions * @return An initialized OFXMLProcessingInstructions */ -- initWithString: (OFString *)string; +- (instancetype)initWithString: (OFString *)string; -- initWithSerialization: (OFXMLElement *)element; +- (instancetype)initWithSerialization: (OFXMLElement *)element; @end OF_ASSUME_NONNULL_END Index: src/OFXMLProcessingInstructions.m ================================================================== --- src/OFXMLProcessingInstructions.m +++ src/OFXMLProcessingInstructions.m @@ -29,11 +29,11 @@ + (instancetype)processingInstructionsWithString: (OFString *)string { return [[[self alloc] initWithString: string] autorelease]; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { self = [super of_init]; @try { _processingInstructions = [string copy]; @@ -43,11 +43,11 @@ } return self; } -- initWithSerialization: (OFXMLElement *)element +- (instancetype)initWithSerialization: (OFXMLElement *)element { self = [super of_init]; @try { void *pool = objc_autoreleasePoolPush(); Index: src/OFZIPArchive.h ================================================================== --- src/OFZIPArchive.h +++ src/OFZIPArchive.h @@ -80,11 +80,11 @@ */ + (instancetype)archiveWithPath: (OFString *)path mode: (OFString *)mode; #endif -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFZIPArchive object with the * specified stream. * @@ -93,12 +93,12 @@ * @param mode The mode for the ZIP file. Valid modes are "r" for reading, * "w" for creating a new file and "a" for appending to an existing * archive. * @return An initialized OFZIPArchive */ -- initWithStream: (OF_KINDOF(OFStream *))stream - mode: (OFString *)mode OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream + mode: (OFString *)mode OF_DESIGNATED_INITIALIZER; #ifdef OF_HAVE_FILES /*! * @brief Initializes an already allocated OFZIPArchive object with the * specified file. @@ -107,12 +107,12 @@ * @param mode The mode for the ZIP file. Valid modes are "r" for reading, * "w" for creating a new file and "a" for appending to an existing * archive. * @return An initialized OFZIPArchive */ -- initWithPath: (OFString *)path - mode: (OFString *)mode; +- (instancetype)initWithPath: (OFString *)path + mode: (OFString *)mode; #endif /*! * @brief Returns the entries of the central directory of the archive as an * array of objects of class @ref OFZIPArchiveEntry. Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -66,11 +66,11 @@ uint64_t _compressedSize, _uncompressedSize; OFString *_fileName; OFData *_extraField; } -- initWithStream: (OFStream *)stream; +- (instancetype)initWithStream: (OFStream *)stream; - (bool)matchesEntry: (OFZIPArchiveEntry *)entry; @end @interface OFZIPArchive_FileReadStream: OFStream { @@ -79,12 +79,12 @@ uint64_t _toRead; uint32_t _CRC32; bool _atEndOfStream; } -- initWithStream: (OFStream *)stream - entry: (OFZIPArchiveEntry *)entry; +- (instancetype)initWithStream: (OFStream *)stream + entry: (OFZIPArchiveEntry *)entry; @end @interface OFZIPArchive_FileWriteStream: OFStream { OFStream *_stream; @@ -92,12 +92,12 @@ @public int64_t _bytesWritten; OFMutableZIPArchiveEntry *_entry; } -- initWithStream: (OFStream *)stream - entry: (OFMutableZIPArchiveEntry *)entry; +- (instancetype)initWithStream: (OFStream *)stream + entry: (OFMutableZIPArchiveEntry *)entry; @end uint32_t of_zip_archive_read_field32(const uint8_t **data, uint16_t *size) { @@ -164,17 +164,17 @@ return [[[self alloc] initWithPath: path mode: mode] autorelease]; } #endif -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithStream: (OF_KINDOF(OFStream *))stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream + mode: (OFString *)mode { self = [super init]; @try { if ([mode isEqual: @"r"]) @@ -219,12 +219,12 @@ return self; } #ifdef OF_HAVE_FILES -- initWithPath: (OFString *)path - mode: (OFString *)mode +- (instancetype)initWithPath: (OFString *)path + mode: (OFString *)mode { OFFile *file; if ([mode isEqual: @"a"]) file = [[OFFile alloc] initWithPath: path @@ -625,11 +625,11 @@ _stream = nil; } @end @implementation OFZIPArchive_LocalFileHeader -- initWithStream: (OFStream *)stream +- (instancetype)initWithStream: (OFStream *)stream { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -725,12 +725,12 @@ return true; } @end @implementation OFZIPArchive_FileReadStream -- initWithStream: (OFStream *)stream - entry: (OFZIPArchiveEntry *)entry +- (instancetype)initWithStream: (OFStream *)stream + entry: (OFZIPArchiveEntry *)entry { self = [super init]; @try { _stream = [stream retain]; @@ -821,12 +821,12 @@ [super close]; } @end @implementation OFZIPArchive_FileWriteStream -- initWithStream: (OFStream *)stream - entry: (OFMutableZIPArchiveEntry *)entry +- (instancetype)initWithStream: (OFStream *)stream + entry: (OFMutableZIPArchiveEntry *)entry { self = [super init]; _stream = [stream retain]; _entry = [entry retain]; Index: src/OFZIPArchiveEntry.h ================================================================== --- src/OFZIPArchiveEntry.h +++ src/OFZIPArchiveEntry.h @@ -196,20 +196,20 @@ * @param fileName The file name for the OFZIPArchiveEntry * @return A new, autoreleased OFZIPArchiveEntry */ + (instancetype)entryWithFileName: (OFString *)fileName; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFZIPArchiveEntry with the specified * file name. * * @param fileName The file name for the OFZIPArchiveEntry * @return An initialized OFZIPArchiveEntry */ -- initWithFileName: (OFString *)fileName; +- (instancetype)initWithFileName: (OFString *)fileName; @end #ifdef __cplusplus extern "C" { #endif Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -145,16 +145,16 @@ + (instancetype)entryWithFileName: (OFString *)fileName { return [[[self alloc] initWithFileName: fileName] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithFileName: (OFString *)fileName +- (instancetype)initWithFileName: (OFString *)fileName { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -269,16 +269,16 @@ [_fileComment release]; [super dealloc]; } -- copy +- (id)copy { return [self retain]; } -- mutableCopy +- (id)mutableCopy { OFZIPArchiveEntry *copy = [[OFMutableZIPArchiveEntry alloc] initWithFileName: _fileName]; @try { Index: src/bridge/NSArray_OFArray.h ================================================================== --- src/bridge/NSArray_OFArray.h +++ src/bridge/NSArray_OFArray.h @@ -23,9 +23,9 @@ @interface NSArray_OFArray: NSArray { OFArray *_array; } -- initWithOFArray: (OFArray *)array; +- (instancetype)initWithOFArray: (OFArray *)array; @end NS_ASSUME_NONNULL_END Index: src/bridge/NSArray_OFArray.m ================================================================== --- src/bridge/NSArray_OFArray.m +++ src/bridge/NSArray_OFArray.m @@ -19,11 +19,11 @@ #import "OFBridging.h" #import "OFOutOfRangeException.h" @implementation NSArray_OFArray -- initWithOFArray: (OFArray *)array +- (instancetype)initWithOFArray: (OFArray *)array { if ((self = [super init]) != nil) { @try { _array = [array retain]; } @catch (id e) { Index: src/bridge/NSDictionary_OFDictionary.h ================================================================== --- src/bridge/NSDictionary_OFDictionary.h +++ src/bridge/NSDictionary_OFDictionary.h @@ -23,9 +23,9 @@ @interface NSDictionary_OFDictionary: NSDictionary { OFDictionary *_dictionary; } -- initWithOFDictionary: (OFDictionary *)dictionary; +- (instancetype)initWithOFDictionary: (OFDictionary *)dictionary; @end NS_ASSUME_NONNULL_END Index: src/bridge/NSDictionary_OFDictionary.m ================================================================== --- src/bridge/NSDictionary_OFDictionary.m +++ src/bridge/NSDictionary_OFDictionary.m @@ -21,11 +21,11 @@ #import "OFBridging.h" #import "OFOutOfRangeException.h" @implementation NSDictionary_OFDictionary -- initWithOFDictionary: (OFDictionary *)dictionary +- (instancetype)initWithOFDictionary: (OFDictionary *)dictionary { if ((self = [super init]) != nil) { @try { _dictionary = [dictionary retain]; } @catch (id e) { Index: src/bridge/OFArray_NSArray.h ================================================================== --- src/bridge/OFArray_NSArray.h +++ src/bridge/OFArray_NSArray.h @@ -31,9 +31,9 @@ @interface OFArray_NSArray: OFArray { NSArray *_array; } -- initWithNSArray: (NSArray *)array; +- (instancetype)initWithNSArray: (NSArray *)array; @end OF_ASSUME_NONNULL_END Index: src/bridge/OFArray_NSArray.m ================================================================== --- src/bridge/OFArray_NSArray.m +++ src/bridge/OFArray_NSArray.m @@ -21,11 +21,11 @@ #import "OFInitializationFailedException.h" #import "OFOutOfRangeException.h" @implementation OFArray_NSArray -- initWithNSArray: (NSArray *)array +- (instancetype)initWithNSArray: (NSArray *)array { self = [super init]; @try { if (array == nil) Index: src/bridge/OFDictionary_NSDictionary.h ================================================================== --- src/bridge/OFDictionary_NSDictionary.h +++ src/bridge/OFDictionary_NSDictionary.h @@ -31,9 +31,9 @@ @interface OFDictionary_NSDictionary: OFDictionary { NSDictionary *_dictionary; } -- initWithNSDictionary: (NSDictionary *)dictionary; +- (instancetype)initWithNSDictionary: (NSDictionary *)dictionary; @end OF_ASSUME_NONNULL_END Index: src/bridge/OFDictionary_NSDictionary.m ================================================================== --- src/bridge/OFDictionary_NSDictionary.m +++ src/bridge/OFDictionary_NSDictionary.m @@ -22,11 +22,11 @@ #import "OFBridging.h" #import "OFInitializationFailedException.h" @implementation OFDictionary_NSDictionary -- initWithNSDictionary: (NSDictionary *)dictionary +- (instancetype)initWithNSDictionary: (NSDictionary *)dictionary { self = [super init]; @try { if (dictionary == nil) Index: src/exceptions/OFAcceptFailedException.h ================================================================== --- src/exceptions/OFAcceptFailedException.h +++ src/exceptions/OFAcceptFailedException.h @@ -54,19 +54,19 @@ * @return A new, autoreleased accept failed exception */ + (instancetype)exceptionWithSocket: (id)socket errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated accept failed exception. * * @param socket The socket which could not accept a connection * @param errNo The errno for the error * @return An initialized accept failed exception */ -- initWithSocket: (id)socket - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSocket: (id)socket + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFAcceptFailedException.m ================================================================== --- src/exceptions/OFAcceptFailedException.m +++ src/exceptions/OFAcceptFailedException.m @@ -32,17 +32,17 @@ { return [[[self alloc] initWithSocket: socket errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithSocket: (id)socket - errNo: (int)errNo +- (instancetype)initWithSocket: (id)socket + errNo: (int)errNo { self = [super init]; _socket = [socket retain]; _errNo = errNo; Index: src/exceptions/OFAddressTranslationFailedException.h ================================================================== --- src/exceptions/OFAddressTranslationFailedException.h +++ src/exceptions/OFAddressTranslationFailedException.h @@ -56,11 +56,11 @@ * @brief Initializes an already allocated address translation failed exception. * * @param host The host for which translation was requested * @return An initialized address translation failed exception */ -- initWithHost: (nullable OFString *)host; +- (instancetype)initWithHost: (nullable OFString *)host; - (instancetype)initWithError: (int)error; - (instancetype)initWithHost: (nullable OFString *)host error: (int)error OF_DESIGNATED_INITIALIZER; @end Index: src/exceptions/OFAddressTranslationFailedException.m ================================================================== --- src/exceptions/OFAddressTranslationFailedException.m +++ src/exceptions/OFAddressTranslationFailedException.m @@ -61,17 +61,17 @@ { return [[[self alloc] initWithHost: host error: error] autorelease]; } -- init +- (instancetype)init { return [self initWithHost: nil error: 0]; } -- initWithHost: (OFString *)host +- (instancetype)initWithHost: (OFString *)host { return [self initWithHost: host error: 0]; } Index: src/exceptions/OFAllocFailedException.h ================================================================== --- src/exceptions/OFAllocFailedException.h +++ src/exceptions/OFAllocFailedException.h @@ -35,11 +35,11 @@ * like other exceptions, as the exception handling code is not allowed to * allocate *any* memory. */ @interface OFAllocFailedException: OFObject + (instancetype)exception OF_UNAVAILABLE; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Returns a description of the exception. * * @return A description of the exception Index: src/exceptions/OFAllocFailedException.m ================================================================== --- src/exceptions/OFAllocFailedException.m +++ src/exceptions/OFAllocFailedException.m @@ -23,16 +23,16 @@ + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } -+ alloc ++ (instancetype)alloc { OF_UNRECOGNIZED_SELECTOR } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } - (void *)allocMemoryWithSize: (size_t)size @@ -62,16 +62,16 @@ - (void)freeMemory: (void *)ptr { OF_UNRECOGNIZED_SELECTOR } -- retain +- (instancetype)retain { return self; } -- autorelease +- (instancetype)autorelease { return self; } - (unsigned int)retainCount Index: src/exceptions/OFAlreadyConnectedException.h ================================================================== --- src/exceptions/OFAlreadyConnectedException.h +++ src/exceptions/OFAlreadyConnectedException.h @@ -51,9 +51,9 @@ * @brief Initializes an already allocated already connected exception. * * @param socket The socket which is already connected * @return An initialized already connected exception */ -- initWithSocket: (nullable id)socket OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSocket: (nullable id)socket OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFAlreadyConnectedException.m ================================================================== --- src/exceptions/OFAlreadyConnectedException.m +++ src/exceptions/OFAlreadyConnectedException.m @@ -25,16 +25,16 @@ + (instancetype)exceptionWithSocket: (id)socket { return [[[self alloc] initWithSocket: socket] autorelease]; } -- init +- (instancetype)init { return [self initWithSocket: nil]; } -- initWithSocket: (id)socket +- (instancetype)initWithSocket: (id)socket { self = [super init]; _socket = [socket retain]; Index: src/exceptions/OFBindFailedException.h ================================================================== --- src/exceptions/OFBindFailedException.h +++ src/exceptions/OFBindFailedException.h @@ -70,11 +70,11 @@ + (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated bind failed exception. * * @param host The host on which binding failed @@ -81,12 +81,12 @@ * @param port The port on which binding failed * @param socket The socket which could not be bound * @param errNo The errno of the error that occurred * @return An initialized bind failed exception */ -- initWithHost: (OFString *)host - port: (uint16_t)port - socket: (id)socket - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithHost: (OFString *)host + port: (uint16_t)port + socket: (id)socket + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFBindFailedException.m ================================================================== --- src/exceptions/OFBindFailedException.m +++ src/exceptions/OFBindFailedException.m @@ -38,19 +38,19 @@ port: port socket: socket errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithHost: (OFString *)host - port: (uint16_t)port - socket: (id)socket - errNo: (int)errNo +- (instancetype)initWithHost: (OFString *)host + port: (uint16_t)port + socket: (id)socket + errNo: (int)errNo { self = [super init]; @try { _host = [host copy]; Index: src/exceptions/OFChangeCurrentDirectoryPathFailedException.h ================================================================== --- src/exceptions/OFChangeCurrentDirectoryPathFailedException.h +++ src/exceptions/OFChangeCurrentDirectoryPathFailedException.h @@ -54,20 +54,20 @@ * @return A new, autoreleased change current directory path failed exception */ + (instancetype)exceptionWithPath: (OFString *)path errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated change directory failed exception. * * @param path The path of the directory to which the current path could not be * changed * @param errNo The errno of the error that occurred * @return An initialized change current directory path failed exception */ -- initWithPath: (OFString *)path - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPath: (OFString *)path + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFChangeCurrentDirectoryPathFailedException.m ================================================================== --- src/exceptions/OFChangeCurrentDirectoryPathFailedException.m +++ src/exceptions/OFChangeCurrentDirectoryPathFailedException.m @@ -32,17 +32,17 @@ { return [[[self alloc] initWithPath: path errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPath: (OFString *)path - errNo: (int)errNo +- (instancetype)initWithPath: (OFString *)path + errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; Index: src/exceptions/OFChangeOwnerFailedException.h ================================================================== --- src/exceptions/OFChangeOwnerFailedException.h +++ src/exceptions/OFChangeOwnerFailedException.h @@ -64,11 +64,11 @@ + (instancetype)exceptionWithPath: (OFString *)path owner: (nullable OFString *)owner group: (nullable OFString *)group errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated change owner failed exception. * * @param path The path of the item @@ -75,12 +75,12 @@ * @param owner The new owner for the item * @param group The new group for the item * @param errNo The errno of the error that occurred * @return An initialized change owner failed exception */ -- initWithPath: (OFString *)path - owner: (nullable OFString *)owner - group: (nullable OFString *)group - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPath: (OFString *)path + owner: (nullable OFString *)owner + group: (nullable OFString *)group + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFChangeOwnerFailedException.m ================================================================== --- src/exceptions/OFChangeOwnerFailedException.m +++ src/exceptions/OFChangeOwnerFailedException.m @@ -36,19 +36,19 @@ owner: owner group: group errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPath: (OFString *)path - owner: (OFString *)owner - group: (OFString *)group - errNo: (int)errNo +- (instancetype)initWithPath: (OFString *)path + owner: (OFString *)owner + group: (OFString *)group + errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; Index: src/exceptions/OFChangePermissionsFailedException.h ================================================================== --- src/exceptions/OFChangePermissionsFailedException.h +++ src/exceptions/OFChangePermissionsFailedException.h @@ -60,21 +60,21 @@ */ + (instancetype)exceptionWithPath: (OFString *)path permissions: (uint16_t)permissions errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated change permissions failed exception. * * @param path The path of the item * @param permissions The new permissions for the item * @param errNo The errno of the error that occurred * @return An initialized change permissions failed exception */ -- initWithPath: (OFString *)path - permissions: (uint16_t)permissions - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPath: (OFString *)path + permissions: (uint16_t)permissions + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFChangePermissionsFailedException.m ================================================================== --- src/exceptions/OFChangePermissionsFailedException.m +++ src/exceptions/OFChangePermissionsFailedException.m @@ -34,18 +34,18 @@ return [[[self alloc] initWithPath: path permissions: permissions errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPath: (OFString *)path - permissions: (uint16_t)permissions - errNo: (int)errNo +- (instancetype)initWithPath: (OFString *)path + permissions: (uint16_t)permissions + errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; Index: src/exceptions/OFConditionBroadcastFailedException.h ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.h +++ src/exceptions/OFConditionBroadcastFailedException.h @@ -53,10 +53,10 @@ * @brief Initializes an already allocated condition broadcast failed exception. * * @param condition The condition which could not be broadcasted * @return An initialized condition broadcast failed exception */ -- initWithCondition: (nullable OFCondition *)condition +- (instancetype)initWithCondition: (nullable OFCondition *)condition OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFConditionBroadcastFailedException.m ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.m +++ src/exceptions/OFConditionBroadcastFailedException.m @@ -26,16 +26,16 @@ + (instancetype)exceptionWithCondition: (OFCondition *)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } -- init +- (instancetype)init { return [self initWithCondition: nil]; } -- initWithCondition: (OFCondition *)condition +- (instancetype)initWithCondition: (OFCondition *)condition { self = [super init]; _condition = [condition retain]; Index: src/exceptions/OFConditionSignalFailedException.h ================================================================== --- src/exceptions/OFConditionSignalFailedException.h +++ src/exceptions/OFConditionSignalFailedException.h @@ -53,10 +53,10 @@ * @brief Initializes an already allocated condition signal failed exception. * * @param condition The condition which could not be signaled * @return An initialized condition signal failed exception */ -- initWithCondition: (nullable OFCondition *)condition +- (instancetype)initWithCondition: (nullable OFCondition *)condition OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFConditionSignalFailedException.m ================================================================== --- src/exceptions/OFConditionSignalFailedException.m +++ src/exceptions/OFConditionSignalFailedException.m @@ -26,16 +26,16 @@ + (instancetype)exceptionWithCondition: (OFCondition *)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } -- init +- (instancetype)init { return [self initWithCondition: nil]; } -- initWithCondition: (OFCondition *)condition +- (instancetype)initWithCondition: (OFCondition *)condition { self = [super init]; _condition = [condition retain]; Index: src/exceptions/OFConditionStillWaitingException.h ================================================================== --- src/exceptions/OFConditionStillWaitingException.h +++ src/exceptions/OFConditionStillWaitingException.h @@ -54,10 +54,10 @@ * @brief Initializes an already allocated condition still waiting exception. * * @param condition The condition for which is still being waited * @return An initialized condition still waiting exception */ -- initWithCondition: (nullable OFCondition *)condition +- (instancetype)initWithCondition: (nullable OFCondition *)condition OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFConditionStillWaitingException.m ================================================================== --- src/exceptions/OFConditionStillWaitingException.m +++ src/exceptions/OFConditionStillWaitingException.m @@ -26,16 +26,16 @@ + (instancetype)exceptionWithCondition: (OFCondition *)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } -- init +- (instancetype)init { return [self initWithCondition: nil]; } -- initWithCondition: (OFCondition *)condition +- (instancetype)initWithCondition: (OFCondition *)condition { self = [super init]; _condition = [condition retain]; Index: src/exceptions/OFConditionWaitFailedException.h ================================================================== --- src/exceptions/OFConditionWaitFailedException.h +++ src/exceptions/OFConditionWaitFailedException.h @@ -53,10 +53,10 @@ * @brief Initializes an already allocated condition wait failed exception. * * @param condition The condition for which could not be waited * @return An initialized condition wait failed exception */ -- initWithCondition: (nullable OFCondition *)condition +- (instancetype)initWithCondition: (nullable OFCondition *)condition OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFConditionWaitFailedException.m ================================================================== --- src/exceptions/OFConditionWaitFailedException.m +++ src/exceptions/OFConditionWaitFailedException.m @@ -26,16 +26,16 @@ + (instancetype)exceptionWithCondition: (OFCondition *)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } -- init +- (instancetype)init { return [self initWithCondition: nil]; } -- initWithCondition: (OFCondition *)condition +- (instancetype)initWithCondition: (OFCondition *)condition { self = [super init]; _condition = [condition retain]; Index: src/exceptions/OFConnectionFailedException.h ================================================================== --- src/exceptions/OFConnectionFailedException.h +++ src/exceptions/OFConnectionFailedException.h @@ -70,11 +70,11 @@ + (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated connection failed exception. * * @param host The host to which the connection failed @@ -81,12 +81,12 @@ * @param port The port on the host to which the connection failed * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return An initialized connection failed exception */ -- initWithHost: (OFString *)host - port: (uint16_t)port - socket: (id)socket - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithHost: (OFString *)host + port: (uint16_t)port + socket: (id)socket + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFConnectionFailedException.m ================================================================== --- src/exceptions/OFConnectionFailedException.m +++ src/exceptions/OFConnectionFailedException.m @@ -38,19 +38,19 @@ port: port socket: socket errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithHost: (OFString *)host - port: (uint16_t)port - socket: (id)socket - errNo: (int)errNo +- (instancetype)initWithHost: (OFString *)host + port: (uint16_t)port + socket: (id)socket + errNo: (int)errNo { self = [super init]; @try { _host = [host copy]; Index: src/exceptions/OFCopyItemFailedException.h ================================================================== --- src/exceptions/OFCopyItemFailedException.h +++ src/exceptions/OFCopyItemFailedException.h @@ -57,21 +57,21 @@ */ + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated copy item failed exception. * * @param sourcePath The original path * @param destinationPath The new path * @param errNo The errno of the error that occurred * @return An initialized copy item failed exception */ -- initWithSourcePath: (OFString *)sourcePath - destinationPath: (OFString *)destinationPath - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSourcePath: (OFString *)sourcePath + destinationPath: (OFString *)destinationPath + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFCopyItemFailedException.m ================================================================== --- src/exceptions/OFCopyItemFailedException.m +++ src/exceptions/OFCopyItemFailedException.m @@ -35,18 +35,18 @@ return [[[self alloc] initWithSourcePath: sourcePath destinationPath: destinationPath errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithSourcePath: (OFString *)sourcePath - destinationPath: (OFString *)destinationPath - errNo: (int)errNo +- (instancetype)initWithSourcePath: (OFString *)sourcePath + destinationPath: (OFString *)destinationPath + errNo: (int)errNo { self = [super init]; @try { _sourcePath = [sourcePath copy]; Index: src/exceptions/OFCreateDirectoryFailedException.h ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.h +++ src/exceptions/OFCreateDirectoryFailedException.h @@ -52,20 +52,20 @@ * @return A new, autoreleased create directory failed exception */ + (instancetype)exceptionWithPath: (OFString *)path errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated create directory failed exception. * * @param path A string with the path of the directory which could not be * created * @param errNo The errno of the error that occurred * @return An initialized create directory failed exception */ -- initWithPath: (OFString *)path - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPath: (OFString *)path + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFCreateDirectoryFailedException.m ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.m +++ src/exceptions/OFCreateDirectoryFailedException.m @@ -32,17 +32,17 @@ { return [[[self alloc] initWithPath: path errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPath: (OFString *)path - errNo: (int)errNo +- (instancetype)initWithPath: (OFString *)path + errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; Index: src/exceptions/OFCreateSymbolicLinkFailedException.h ================================================================== --- src/exceptions/OFCreateSymbolicLinkFailedException.h +++ src/exceptions/OFCreateSymbolicLinkFailedException.h @@ -58,11 +58,11 @@ */ + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated create symbolic link failed * exception. * @@ -69,11 +69,11 @@ * @param sourcePath The source for the symbolic link * @param destinationPath The destination for the symbolic link * @param errNo The errno of the error that occurred * @return An initialized create symbolic link failed exception */ -- initWithSourcePath: (OFString *)sourcePath - destinationPath: (OFString *)destinationPath - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSourcePath: (OFString *)sourcePath + destinationPath: (OFString *)destinationPath + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFCreateSymbolicLinkFailedException.m ================================================================== --- src/exceptions/OFCreateSymbolicLinkFailedException.m +++ src/exceptions/OFCreateSymbolicLinkFailedException.m @@ -35,18 +35,18 @@ return [[[self alloc] initWithSourcePath: sourcePath destinationPath: destinationPath errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithSourcePath: (OFString *)sourcePath - destinationPath: (OFString *)destinationPath - errNo: (int)errNo +- (instancetype)initWithSourcePath: (OFString *)sourcePath + destinationPath: (OFString *)destinationPath + errNo: (int)errNo { self = [super init]; @try { _sourcePath = [sourcePath copy]; Index: src/exceptions/OFEnumerationMutationException.h ================================================================== --- src/exceptions/OFEnumerationMutationException.h +++ src/exceptions/OFEnumerationMutationException.h @@ -44,17 +44,17 @@ * @param object The object which was mutated during enumeration * @return A new, autoreleased enumeration mutation exception */ + (instancetype)exceptionWithObject: (id)object; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated enumeration mutation exception. * * @param object The object which was mutated during enumeration * @return An initialized enumeration mutation exception */ -- initWithObject: (id)object OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithObject: (id)object OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFEnumerationMutationException.m ================================================================== --- src/exceptions/OFEnumerationMutationException.m +++ src/exceptions/OFEnumerationMutationException.m @@ -30,16 +30,16 @@ + (instancetype)exceptionWithObject: (id)object { return [[[self alloc] initWithObject: object] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithObject: (id)object +- (instancetype)initWithObject: (id)object { self = [super init]; _object = [object retain]; Index: src/exceptions/OFException.m ================================================================== --- src/exceptions/OFException.m +++ src/exceptions/OFException.m @@ -251,11 +251,11 @@ { return [[[self alloc] init] autorelease]; } #ifdef HAVE_DWARF_EXCEPTIONS -- init +- (instancetype)init { struct backtrace_ctx ctx; self = [super init]; Index: src/exceptions/OFGetOptionFailedException.h ================================================================== --- src/exceptions/OFGetOptionFailedException.h +++ src/exceptions/OFGetOptionFailedException.h @@ -52,19 +52,19 @@ * @return A new, autoreleased get option failed exception */ + (instancetype)exceptionWithStream: (OFStream *)stream errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated get option failed exception. * * @param stream The stream for which the option could not be gotten * @param errNo The errno of the error that occurred * @return An initialized get option failed exception */ -- initWithStream: (OFStream *)stream - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithStream: (OFStream *)stream + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFGetOptionFailedException.m ================================================================== --- src/exceptions/OFGetOptionFailedException.m +++ src/exceptions/OFGetOptionFailedException.m @@ -33,17 +33,17 @@ { return [[[self alloc] initWithStream: stream errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithStream: (OFStream *)stream - errNo: (int)errNo +- (instancetype)initWithStream: (OFStream *)stream + errNo: (int)errNo { self = [super init]; _stream = [stream retain]; _errNo = errNo; Index: src/exceptions/OFHTTPRequestFailedException.h ================================================================== --- src/exceptions/OFHTTPRequestFailedException.h +++ src/exceptions/OFHTTPRequestFailedException.h @@ -58,19 +58,20 @@ * @return A new, autoreleased HTTP request failed exception */ + (instancetype)exceptionWithRequest: (OFHTTPRequest *)request response: (OFHTTPResponse *)response; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated HTTP request failed exception. * * @param request The HTTP request which failed * @param response The response for the failed HTTP request * @return A new HTTP request failed exception */ -- initWithRequest: (OFHTTPRequest *)request - response: (OFHTTPResponse *)response OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithRequest: (OFHTTPRequest *)request + response: (OFHTTPResponse *)response + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFHTTPRequestFailedException.m ================================================================== --- src/exceptions/OFHTTPRequestFailedException.m +++ src/exceptions/OFHTTPRequestFailedException.m @@ -34,17 +34,17 @@ { return [[[self alloc] initWithRequest: request response: response] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithRequest: (OFHTTPRequest *)request - response: (OFHTTPResponse *)response +- (instancetype)initWithRequest: (OFHTTPRequest *)request + response: (OFHTTPResponse *)response { self = [super init]; _request = [request retain]; _response = [response retain]; Index: src/exceptions/OFHashAlreadyCalculatedException.h ================================================================== --- src/exceptions/OFHashAlreadyCalculatedException.h +++ src/exceptions/OFHashAlreadyCalculatedException.h @@ -43,17 +43,17 @@ * @param object The hash which has already been calculated * @return A new, autoreleased hash already calculated exception */ + (instancetype)exceptionWithObject: (id)object; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated hash already calculated exception. * * @param object The hash which has already been calculated * @return An initialized hash already calculated exception */ -- initWithObject: (id)object OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithObject: (id)object OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFHashAlreadyCalculatedException.m ================================================================== --- src/exceptions/OFHashAlreadyCalculatedException.m +++ src/exceptions/OFHashAlreadyCalculatedException.m @@ -30,16 +30,16 @@ + (instancetype)exceptionWithObject: (id)object { return [[[self alloc] initWithObject: object] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithObject: (id)object +- (instancetype)initWithObject: (id)object { self = [super init]; _object = [object retain]; Index: src/exceptions/OFInitializationFailedException.h ================================================================== --- src/exceptions/OFInitializationFailedException.h +++ src/exceptions/OFInitializationFailedException.h @@ -47,9 +47,9 @@ * @brief Initializes an already allocated initialization failed exception. * * @param class_ The class for which initialization failed * @return An initialized initialization failed exception */ -- initWithClass: (nullable Class)class_ OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithClass: (nullable Class)class_ OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFInitializationFailedException.m ================================================================== --- src/exceptions/OFInitializationFailedException.m +++ src/exceptions/OFInitializationFailedException.m @@ -25,16 +25,16 @@ + (instancetype)exceptionWithClass: (Class)class { return [[[self alloc] initWithClass: class] autorelease]; } -- init +- (instancetype)init { return [self initWithClass: Nil]; } -- initWithClass: (Class)class +- (instancetype)initWithClass: (Class)class { self = [super init]; _inClass = class; Index: src/exceptions/OFInvalidJSONException.h ================================================================== --- src/exceptions/OFInvalidJSONException.h +++ src/exceptions/OFInvalidJSONException.h @@ -50,19 +50,19 @@ * @return A new, autoreleased invalid JSON exception */ + (instancetype)exceptionWithString: (nullable OFString *)string line: (size_t)line; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated invalid JSON exception. * * @param string The string containing the invalid JSON representation * @param line The line in which the parsing error was encountered * @return An initialized invalid JSON exception */ -- initWithString: (nullable OFString *)string - line: (size_t)line OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithString: (nullable OFString *)string + line: (size_t)line OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFInvalidJSONException.m ================================================================== --- src/exceptions/OFInvalidJSONException.m +++ src/exceptions/OFInvalidJSONException.m @@ -32,17 +32,17 @@ { return [[[self alloc] initWithString: string line: line] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithString: (OFString *)string - line: (size_t)line +- (instancetype)initWithString: (OFString *)string + line: (size_t)line { self = [super init]; @try { _string = [string copy]; Index: src/exceptions/OFLinkFailedException.h ================================================================== --- src/exceptions/OFLinkFailedException.h +++ src/exceptions/OFLinkFailedException.h @@ -57,21 +57,21 @@ */ + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated link failed exception. * * @param sourcePath The source for the link * @param destinationPath The destination for the link * @param errNo The errno of the error that occurred * @return An initialized link failed exception */ -- initWithSourcePath: (OFString *)sourcePath - destinationPath: (OFString *)destinationPath - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSourcePath: (OFString *)sourcePath + destinationPath: (OFString *)destinationPath + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFLinkFailedException.m ================================================================== --- src/exceptions/OFLinkFailedException.m +++ src/exceptions/OFLinkFailedException.m @@ -35,18 +35,18 @@ return [[[self alloc] initWithSourcePath: sourcePath destinationPath: destinationPath errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithSourcePath: (OFString *)sourcePath - destinationPath: (OFString *)destinationPath - errNo: (int)errNo +- (instancetype)initWithSourcePath: (OFString *)sourcePath + destinationPath: (OFString *)destinationPath + errNo: (int)errNo { self = [super init]; @try { _sourcePath = [sourcePath copy]; Index: src/exceptions/OFListenFailedException.h ================================================================== --- src/exceptions/OFListenFailedException.h +++ src/exceptions/OFListenFailedException.h @@ -61,21 +61,21 @@ */ + (instancetype)exceptionWithSocket: (id)socket backLog: (int)backLog errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated listen failed exception * * @param socket The socket which failed to listen * @param backLog The requested size of the back log * @param errNo The errno of the error that occurred * @return An initialized listen failed exception */ -- initWithSocket: (id)socket - backLog: (int)backLog - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSocket: (id)socket + backLog: (int)backLog + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFListenFailedException.m ================================================================== --- src/exceptions/OFListenFailedException.m +++ src/exceptions/OFListenFailedException.m @@ -34,18 +34,18 @@ return [[[self alloc] initWithSocket: socket backLog: backLog errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithSocket: (id)socket - backLog: (int)backLog - errNo: (int)errNo +- (instancetype)initWithSocket: (id)socket + backLog: (int)backLog + errNo: (int)errNo { self = [super init]; _socket = [socket retain]; _backLog = backLog; Index: src/exceptions/OFLockFailedException.h ================================================================== --- src/exceptions/OFLockFailedException.h +++ src/exceptions/OFLockFailedException.h @@ -47,9 +47,10 @@ * @brief Initializes an already allocated lock failed exception. * * @param lock The lock which could not be locked * @return An initialized lock failed exception */ -- initWithLock: (nullable id )lock OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithLock: (nullable id )lock + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFLockFailedException.m ================================================================== --- src/exceptions/OFLockFailedException.m +++ src/exceptions/OFLockFailedException.m @@ -25,16 +25,16 @@ + (instancetype)exceptionWithLock: (id )lock { return [[[self alloc] initWithLock: lock] autorelease]; } -- init +- (instancetype)init { return [self initWithLock: nil]; } -- initWithLock: (id )lock +- (instancetype)initWithLock: (id )lock { self = [super init]; _lock = [lock retain]; Index: src/exceptions/OFMalformedXMLException.h ================================================================== --- src/exceptions/OFMalformedXMLException.h +++ src/exceptions/OFMalformedXMLException.h @@ -48,9 +48,10 @@ * @brief Initializes an already allocated malformed XML exception. * * @param parser The parser which encountered malformed XML * @return An initialized malformed XML exception */ -- initWithParser: (nullable OFXMLParser *)parser OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithParser: (nullable OFXMLParser *)parser + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFMalformedXMLException.m ================================================================== --- src/exceptions/OFMalformedXMLException.m +++ src/exceptions/OFMalformedXMLException.m @@ -26,16 +26,16 @@ + (instancetype)exceptionWithParser: (OFXMLParser *)parser { return [[[self alloc] initWithParser: parser] autorelease]; } -- init +- (instancetype)init { return [self initWithParser: nil]; } -- initWithParser: (OFXMLParser *)parser +- (instancetype)initWithParser: (OFXMLParser *)parser { self = [super init]; _parser = [parser retain]; Index: src/exceptions/OFMemoryNotPartOfObjectException.h ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.h +++ src/exceptions/OFMemoryNotPartOfObjectException.h @@ -51,19 +51,19 @@ * @return A new, autoreleased memory not part of object exception */ + (instancetype)exceptionWithPointer: (nullable void *)pointer object: (id)object; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated memory not part of object exception. * * @param pointer A pointer to the memory that is not part of the object * @param object The object which the memory is not part of * @return An initialized memory not part of object exception */ -- initWithPointer: (nullable void *)pointer - object: (id)object OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPointer: (nullable void *)pointer + object: (id)object OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFMemoryNotPartOfObjectException.m ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.m +++ src/exceptions/OFMemoryNotPartOfObjectException.m @@ -32,17 +32,17 @@ { return [[[self alloc] initWithPointer: pointer object: object] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPointer: (void *)pointer - object: (id)object +- (instancetype)initWithPointer: (void *)pointer + object: (id)object { self = [super init]; _pointer = pointer; _object = [object retain]; Index: src/exceptions/OFMoveItemFailedException.h ================================================================== --- src/exceptions/OFMoveItemFailedException.h +++ src/exceptions/OFMoveItemFailedException.h @@ -57,21 +57,21 @@ */ + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated move item failed exception. * * @param sourcePath The original path * @param destinationPath The new path * @param errNo The errno of the error that occurred * @return An initialized move item failed exception */ -- initWithSourcePath: (OFString *)sourcePath - destinationPath: (OFString *)destinationPath - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSourcePath: (OFString *)sourcePath + destinationPath: (OFString *)destinationPath + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFMoveItemFailedException.m ================================================================== --- src/exceptions/OFMoveItemFailedException.m +++ src/exceptions/OFMoveItemFailedException.m @@ -35,18 +35,18 @@ return [[[self alloc] initWithSourcePath: sourcePath destinationPath: destinationPath errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithSourcePath: (OFString *)sourcePath - destinationPath: (OFString *)destinationPath - errNo: (int)errNo +- (instancetype)initWithSourcePath: (OFString *)sourcePath + destinationPath: (OFString *)destinationPath + errNo: (int)errNo { self = [super init]; @try { _sourcePath = [sourcePath copy]; Index: src/exceptions/OFNotImplementedException.h ================================================================== --- src/exceptions/OFNotImplementedException.h +++ src/exceptions/OFNotImplementedException.h @@ -51,19 +51,19 @@ * @return A new, autoreleased not implemented exception */ + (instancetype)exceptionWithSelector: (SEL)selector object: (id)object; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated not implemented exception. * * @param selector The selector which is not or not fully implemented * @param object The object which does not (fully) implement the selector * @return An initialized not implemented exception */ -- initWithSelector: (SEL)selector - object: (id)object OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSelector: (SEL)selector + object: (id)object OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFNotImplementedException.m ================================================================== --- src/exceptions/OFNotImplementedException.m +++ src/exceptions/OFNotImplementedException.m @@ -32,17 +32,17 @@ { return [[[self alloc] initWithSelector: selector object: object] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithSelector: (SEL)selector - object: (id)object +- (instancetype)initWithSelector: (SEL)selector + object: (id)object { self = [super init]; _selector = selector; _object = [object retain]; Index: src/exceptions/OFNotOpenException.h ================================================================== --- src/exceptions/OFNotOpenException.h +++ src/exceptions/OFNotOpenException.h @@ -41,17 +41,17 @@ * @param object The object which is not open, connected or bound * @return A new, autoreleased not open exception */ + (instancetype)exceptionWithObject: (id)object; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated not open exception. * * @param object The object which is not open, connected or bound * @return An initialized not open exception */ -- initWithObject: (id)object OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithObject: (id)object OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFNotOpenException.m ================================================================== --- src/exceptions/OFNotOpenException.m +++ src/exceptions/OFNotOpenException.m @@ -30,16 +30,16 @@ + (instancetype)exceptionWithObject: (id)object { return [[[self alloc] initWithObject: object] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithObject: (id)object +- (instancetype)initWithObject: (id)object { self = [super init]; _object = [object retain]; Index: src/exceptions/OFObserveFailedException.h ================================================================== --- src/exceptions/OFObserveFailedException.h +++ src/exceptions/OFObserveFailedException.h @@ -52,19 +52,19 @@ * @return A new, autoreleased observe failed exception */ + (instancetype)exceptionWithObserver: (OFKernelEventObserver *)observer errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated observe failed exception. * * @param observer The observer which failed to observe * @param errNo The errno of the error that occurred * @return An initialized observe failed exception */ -- initWithObserver: (OFKernelEventObserver *)observer - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithObserver: (OFKernelEventObserver *)observer + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFObserveFailedException.m ================================================================== --- src/exceptions/OFObserveFailedException.m +++ src/exceptions/OFObserveFailedException.m @@ -33,17 +33,17 @@ { return [[[self alloc] initWithObserver: observer errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithObserver: (OFKernelEventObserver *)observer - errNo: (int)errNo +- (instancetype)initWithObserver: (OFKernelEventObserver *)observer + errNo: (int)errNo { self = [super init]; @try { _observer = [observer retain]; Index: src/exceptions/OFOpenItemFailedException.h ================================================================== --- src/exceptions/OFOpenItemFailedException.h +++ src/exceptions/OFOpenItemFailedException.h @@ -57,21 +57,21 @@ */ + (instancetype)exceptionWithPath: (OFString *)path mode: (nullable OFString *)mode errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated open item failed exception. * * @param path A string with the path of the item which could not be opened * @param mode A string with the mode in which the item should have been opened * @param errNo The errno of the error that occurred * @return An initialized open item failed exception */ -- initWithPath: (OFString *)path - mode: (nullable OFString *)mode - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPath: (OFString *)path + mode: (nullable OFString *)mode + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFOpenItemFailedException.m ================================================================== --- src/exceptions/OFOpenItemFailedException.m +++ src/exceptions/OFOpenItemFailedException.m @@ -34,18 +34,18 @@ return [[[self alloc] initWithPath: path mode: mode errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPath: (OFString *)path - mode: (OFString *)mode - errNo: (int)errNo +- (instancetype)initWithPath: (OFString *)path + mode: (OFString *)mode + errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; Index: src/exceptions/OFOutOfMemoryException.h ================================================================== --- src/exceptions/OFOutOfMemoryException.h +++ src/exceptions/OFOutOfMemoryException.h @@ -46,9 +46,10 @@ * @brief Initializes an already allocated no memory exception. * * @param requestedSize The size of the memory that could not be allocated * @return An initialized no memory exception */ -- initWithRequestedSize: (size_t)requestedSize OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithRequestedSize: (size_t)requestedSize + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFOutOfMemoryException.m ================================================================== --- src/exceptions/OFOutOfMemoryException.m +++ src/exceptions/OFOutOfMemoryException.m @@ -26,16 +26,16 @@ { return [[[self alloc] initWithRequestedSize: requestedSize] autorelease]; } -- init +- (instancetype)init { return [self initWithRequestedSize: 0]; } -- initWithRequestedSize: (size_t)requestedSize +- (instancetype)initWithRequestedSize: (size_t)requestedSize { self = [super init]; _requestedSize = requestedSize; Index: src/exceptions/OFReadOrWriteFailedException.h ================================================================== --- src/exceptions/OFReadOrWriteFailedException.h +++ src/exceptions/OFReadOrWriteFailedException.h @@ -60,11 +60,11 @@ */ + (instancetype)exceptionWithObject: (id)object requestedLength: (size_t)requestedLength errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated read or write failed exception. * * @param object The object from which reading or to which writing failed @@ -71,11 +71,11 @@ * @param requestedLength The requested length of the data that could not be * read / written * @param errNo The errno of the error that occurred * @return A new open file failed exception */ -- initWithObject: (id)object - requestedLength: (size_t)requestedLength - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithObject: (id)object + requestedLength: (size_t)requestedLength + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFReadOrWriteFailedException.m ================================================================== --- src/exceptions/OFReadOrWriteFailedException.m +++ src/exceptions/OFReadOrWriteFailedException.m @@ -35,18 +35,18 @@ return [[[self alloc] initWithObject: object requestedLength: requestedLength errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithObject: (id)object - requestedLength: (size_t)requestedLength - errNo: (int)errNo +- (instancetype)initWithObject: (id)object + requestedLength: (size_t)requestedLength + errNo: (int)errNo { self = [super init]; _object = [object retain]; _requestedLength = requestedLength; Index: src/exceptions/OFRemoveItemFailedException.h ================================================================== --- src/exceptions/OFRemoveItemFailedException.h +++ src/exceptions/OFRemoveItemFailedException.h @@ -50,19 +50,19 @@ * @return A new, autoreleased remove item failed exception */ + (instancetype)exceptionWithPath: (OFString *)path errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated remove failed exception. * * @param path The path of the item which could not be removed * @param errNo The errno of the error that occurred * @return An initialized remove item failed exception */ -- initWithPath: (OFString *)path - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPath: (OFString *)path + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFRemoveItemFailedException.m ================================================================== --- src/exceptions/OFRemoveItemFailedException.m +++ src/exceptions/OFRemoveItemFailedException.m @@ -32,17 +32,17 @@ { return [[[self alloc] initWithPath: path errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPath: (OFString *)path - errNo: (int)errNo +- (instancetype)initWithPath: (OFString *)path + errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; Index: src/exceptions/OFSandboxActivationFailedException.h ================================================================== --- src/exceptions/OFSandboxActivationFailedException.h +++ src/exceptions/OFSandboxActivationFailedException.h @@ -53,19 +53,19 @@ * @return A new, autoreleased sandboxing failed exception */ + (instancetype)exceptionWithSandbox: (OFSandbox *)sandbox errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated sandboxing failed exception. * * @param sandbox The sandbox which could not be activated * @param errNo The errno of the error that occurred * @return An initialized sandboxing failed exception */ -- initWithSandbox: (OFSandbox *)sandbox - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithSandbox: (OFSandbox *)sandbox + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFSandboxActivationFailedException.m ================================================================== --- src/exceptions/OFSandboxActivationFailedException.m +++ src/exceptions/OFSandboxActivationFailedException.m @@ -33,17 +33,17 @@ { return [[[self alloc] initWithSandbox: sandbox errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithSandbox: (OFSandbox *)sandbox - errNo: (int)errNo +- (instancetype)initWithSandbox: (OFSandbox *)sandbox + errNo: (int)errNo { self = [super init]; _sandbox = [sandbox retain]; _errNo = errNo; Index: src/exceptions/OFSeekFailedException.h ================================================================== --- src/exceptions/OFSeekFailedException.h +++ src/exceptions/OFSeekFailedException.h @@ -66,11 +66,11 @@ + (instancetype)exceptionWithStream: (OFSeekableStream *)stream offset: (of_offset_t)offset whence: (int)whence errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated seek failed exception. * * @param stream The stream for which seeking failed @@ -77,12 +77,12 @@ * @param offset The offset to which seeking failed * @param whence To what the offset is relative * @param errNo The errno of the error that occurred * @return An initialized seek failed exception */ -- initWithStream: (OFSeekableStream *)stream - offset: (of_offset_t)offset - whence: (int)whence - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithStream: (OFSeekableStream *)stream + offset: (of_offset_t)offset + whence: (int)whence + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFSeekFailedException.m ================================================================== --- src/exceptions/OFSeekFailedException.m +++ src/exceptions/OFSeekFailedException.m @@ -38,19 +38,19 @@ offset: offset whence: whence errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithStream: (OFSeekableStream *)stream - offset: (of_offset_t)offset - whence: (int)whence - errNo: (int)errNo +- (instancetype)initWithStream: (OFSeekableStream *)stream + offset: (of_offset_t)offset + whence: (int)whence + errNo: (int)errNo { self = [super init]; _stream = [stream retain]; _offset = offset; Index: src/exceptions/OFSetOptionFailedException.h ================================================================== --- src/exceptions/OFSetOptionFailedException.h +++ src/exceptions/OFSetOptionFailedException.h @@ -52,19 +52,19 @@ * @return A new, autoreleased set option failed exception */ + (instancetype)exceptionWithStream: (OFStream *)stream errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated set option failed exception. * * @param stream The stream for which the option could not be set * @param errNo The errno of the error that occurred * @return An initialized set option failed exception */ -- initWithStream: (OFStream *)stream - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithStream: (OFStream *)stream + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFSetOptionFailedException.m ================================================================== --- src/exceptions/OFSetOptionFailedException.m +++ src/exceptions/OFSetOptionFailedException.m @@ -33,17 +33,17 @@ { return [[[self alloc] initWithStream: stream errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithStream: (OFStream *)stream - errNo: (int)errNo +- (instancetype)initWithStream: (OFStream *)stream + errNo: (int)errNo { self = [super init]; _stream = [stream retain]; _errNo = errNo; Index: src/exceptions/OFStatItemFailedException.h ================================================================== --- src/exceptions/OFStatItemFailedException.h +++ src/exceptions/OFStatItemFailedException.h @@ -51,20 +51,20 @@ * @return A new, autoreleased stat item failed exception */ + (instancetype)exceptionWithPath: (OFString *)path errNo: (int)errNo; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated stat item failed exception. * * @param path A string with the path of the item whose status could not be * retrieved * @param errNo The errno of the error that occurred * @return An initialized stat item failed exception */ -- initWithPath: (OFString *)path - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPath: (OFString *)path + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFStatItemFailedException.m ================================================================== --- src/exceptions/OFStatItemFailedException.m +++ src/exceptions/OFStatItemFailedException.m @@ -32,17 +32,17 @@ { return [[[self alloc] initWithPath: path errNo: errNo] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPath: (OFString *)path - errNo: (int)errNo +- (instancetype)initWithPath: (OFString *)path + errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; Index: src/exceptions/OFStillLockedException.h ================================================================== --- src/exceptions/OFStillLockedException.h +++ src/exceptions/OFStillLockedException.h @@ -47,9 +47,10 @@ * @brief Initializes an already allocated still locked exception. * * @param lock The lock which is still locked * @return An initialized still locked exception */ -- initWithLock: (nullable id )lock OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithLock: (nullable id )lock + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFStillLockedException.m ================================================================== --- src/exceptions/OFStillLockedException.m +++ src/exceptions/OFStillLockedException.m @@ -25,16 +25,16 @@ + (instancetype)exceptionWithLock: (id )lock { return [[[self alloc] initWithLock: lock] autorelease]; } -- init +- (instancetype)init { return [self initWithLock: nil]; } -- initWithLock: (id )lock +- (instancetype)initWithLock: (id )lock { self = [super init]; _lock = [lock retain]; Index: src/exceptions/OFThreadJoinFailedException.h ================================================================== --- src/exceptions/OFThreadJoinFailedException.h +++ src/exceptions/OFThreadJoinFailedException.h @@ -52,9 +52,10 @@ * @brief Initializes an already allocated thread join failed exception. * * @param thread The thread which could not be joined * @return An initialized thread join failed exception */ -- initWithThread: (nullable OFThread *)thread OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithThread: (nullable OFThread *)thread + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFThreadJoinFailedException.m ================================================================== --- src/exceptions/OFThreadJoinFailedException.m +++ src/exceptions/OFThreadJoinFailedException.m @@ -26,16 +26,16 @@ + (instancetype)exceptionWithThread: (OFThread *)thread { return [[[self alloc] initWithThread: thread] autorelease]; } -- init +- (instancetype)init { return [self initWithThread: nil]; } -- initWithThread: (OFThread *)thread +- (instancetype)initWithThread: (OFThread *)thread { self = [super init]; _thread = [thread retain]; Index: src/exceptions/OFThreadStartFailedException.h ================================================================== --- src/exceptions/OFThreadStartFailedException.h +++ src/exceptions/OFThreadStartFailedException.h @@ -52,9 +52,10 @@ * @brief Initializes an already allocated thread start failed exception. * * @param thread The thread which could not be started * @return An initialized thread start failed exception */ -- initWithThread: (nullable OFThread *)thread OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithThread: (nullable OFThread *)thread + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFThreadStartFailedException.m ================================================================== --- src/exceptions/OFThreadStartFailedException.m +++ src/exceptions/OFThreadStartFailedException.m @@ -26,16 +26,16 @@ + (instancetype)exceptionWithThread: (OFThread *)thread { return [[[self alloc] initWithThread: thread] autorelease]; } -- init +- (instancetype)init { return [self initWithThread: nil]; } -- initWithThread: (OFThread *)thread +- (instancetype)initWithThread: (OFThread *)thread { self = [super init]; _thread = [thread retain]; Index: src/exceptions/OFThreadStillRunningException.h ================================================================== --- src/exceptions/OFThreadStillRunningException.h +++ src/exceptions/OFThreadStillRunningException.h @@ -52,9 +52,10 @@ * @brief Initializes an already allocated thread still running exception. * * @param thread The thread which is still running * @return An initialized thread still running exception */ -- initWithThread: (nullable OFThread *)thread OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithThread: (nullable OFThread *)thread + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFThreadStillRunningException.m ================================================================== --- src/exceptions/OFThreadStillRunningException.m +++ src/exceptions/OFThreadStillRunningException.m @@ -26,16 +26,16 @@ + (instancetype)exceptionWithThread: (OFThread *)thread { return [[[self alloc] initWithThread: thread] autorelease]; } -- init +- (instancetype)init { return [self initWithThread: nil]; } -- initWithThread: (OFThread *)thread +- (instancetype)initWithThread: (OFThread *)thread { self = [super init]; _thread = [thread retain]; Index: src/exceptions/OFUnboundNamespaceException.h ================================================================== --- src/exceptions/OFUnboundNamespaceException.h +++ src/exceptions/OFUnboundNamespaceException.h @@ -56,19 +56,20 @@ * @return A new, autoreleased unbound namespace exception */ + (instancetype)exceptionWithNamespace: (OFString *)namespace_ element: (OFXMLElement *)element; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated unbound namespace exception. * * @param namespace_ The namespace which is unbound * @param element The element in which the namespace was not bound * @return An initialized unbound namespace exception */ -- initWithNamespace: (OFString *)namespace_ - element: (OFXMLElement *)element OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithNamespace: (OFString *)namespace_ + element: (OFXMLElement *)element + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnboundNamespaceException.m ================================================================== --- src/exceptions/OFUnboundNamespaceException.m +++ src/exceptions/OFUnboundNamespaceException.m @@ -33,17 +33,17 @@ { return [[[self alloc] initWithNamespace: namespace element: element] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithNamespace: (OFString *)namespace - element: (OFXMLElement *)element +- (instancetype)initWithNamespace: (OFString *)namespace + element: (OFXMLElement *)element { self = [super init]; @try { _namespace = [namespace copy]; Index: src/exceptions/OFUnboundPrefixException.h ================================================================== --- src/exceptions/OFUnboundPrefixException.h +++ src/exceptions/OFUnboundPrefixException.h @@ -52,19 +52,19 @@ * @return A new, autoreleased unbound prefix exception */ + (instancetype)exceptionWithPrefix: (OFString *)prefix parser: (OFXMLParser *)parser; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated unbound prefix exception. * * @param prefix The prefix which is unbound * @param parser The parser which encountered the unbound prefix * @return An initialized unbound prefix exception */ -- initWithPrefix: (OFString *)prefix - parser: (OFXMLParser *)parser OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithPrefix: (OFString *)prefix + parser: (OFXMLParser *)parser OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnboundPrefixException.m ================================================================== --- src/exceptions/OFUnboundPrefixException.m +++ src/exceptions/OFUnboundPrefixException.m @@ -33,17 +33,17 @@ { return [[[self alloc] initWithPrefix: prefix parser: parser] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithPrefix: (OFString *)prefix - parser: (OFXMLParser *)parser +- (instancetype)initWithPrefix: (OFString *)prefix + parser: (OFXMLParser *)parser { self = [super init]; @try { _prefix = [prefix copy]; Index: src/exceptions/OFUndefinedKeyException.h ================================================================== --- src/exceptions/OFUndefinedKeyException.h +++ src/exceptions/OFUndefinedKeyException.h @@ -70,22 +70,22 @@ */ + (instancetype)exceptionWithObject: (id)object key: (OFString *)key value: (nullable id)value; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated undefined key exception. * * @param object The object on which the key is undefined * @param key The key which is undefined * * @return An initialized undefined key exception */ -- initWithObject: (id)object - key: (OFString *)key; +- (instancetype)initWithObject: (id)object + key: (OFString *)key; /*! * @brief Initializes an already allocated undefined key exception. * * @param object The object on which the key is undefined @@ -92,11 +92,11 @@ * @param key The key which is undefined * @param value The value for the undefined key * * @return An initialized undefined key exception */ -- initWithObject: (id)object - key: (OFString *)key - value: (nullable id)value OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithObject: (id)object + key: (OFString *)key + value: (nullable id)value OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFUndefinedKeyException.m ================================================================== --- src/exceptions/OFUndefinedKeyException.m +++ src/exceptions/OFUndefinedKeyException.m @@ -41,26 +41,26 @@ return [[[self alloc] initWithObject: object key: key value: value] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithObject: (id)object - key: (OFString *)key +- (instancetype)initWithObject: (id)object + key: (OFString *)key { return [self initWithObject: object key: key value: nil]; } -- initWithObject: (id)object - key: (OFString *)key - value: (id)value +- (instancetype)initWithObject: (id)object + key: (OFString *)key + value: (id)value { self = [super init]; @try { _object = [object retain]; Index: src/exceptions/OFUnknownXMLEntityException.h ================================================================== --- src/exceptions/OFUnknownXMLEntityException.h +++ src/exceptions/OFUnknownXMLEntityException.h @@ -41,17 +41,18 @@ * @param entityName The name of the unknown XML entity * @return A new, autoreleased unknown XML entity exception */ + (instancetype)exceptionWithEntityName: (OFString *)entityName; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated unknown XML entity exception. * * @param entityName The name of the unknown XML entity * @return An initialized unknown XML entity exception */ -- initWithEntityName: (OFString *)entityName OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithEntityName: (OFString *)entityName + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnknownXMLEntityException.m ================================================================== --- src/exceptions/OFUnknownXMLEntityException.m +++ src/exceptions/OFUnknownXMLEntityException.m @@ -25,16 +25,16 @@ + (instancetype)exceptionWithEntityName: (OFString *)entityName { return [[[self alloc] initWithEntityName: entityName] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithEntityName: (OFString *)entityName +- (instancetype)initWithEntityName: (OFString *)entityName { self = [super init]; @try { _entityName = [entityName copy]; Index: src/exceptions/OFUnlockFailedException.h ================================================================== --- src/exceptions/OFUnlockFailedException.h +++ src/exceptions/OFUnlockFailedException.h @@ -47,9 +47,10 @@ * @brief Initializes an already allocated unlock failed exception. * * @param lock The lock which could not be unlocked * @return An initialized unlock failed exception */ -- initWithLock: (nullable id )lock OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithLock: (nullable id )lock + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnlockFailedException.m ================================================================== --- src/exceptions/OFUnlockFailedException.m +++ src/exceptions/OFUnlockFailedException.m @@ -25,16 +25,16 @@ + (instancetype)exceptionWithLock: (id )lock { return [[[self alloc] initWithLock: lock] autorelease]; } -- init +- (instancetype)init { return [self initWithLock: nil]; } -- initWithLock: (id )lock +- (instancetype)initWithLock: (id )lock { self = [super init]; _lock = [lock retain]; Index: src/exceptions/OFUnsupportedProtocolException.h ================================================================== --- src/exceptions/OFUnsupportedProtocolException.h +++ src/exceptions/OFUnsupportedProtocolException.h @@ -46,17 +46,17 @@ * @param URL The URL whose protocol is unsupported * @return A new, autoreleased unsupported protocol exception */ + (instancetype)exceptionWithURL: (OFURL*)URL; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated unsupported protocol exception * * @param URL The URL whose protocol is unsupported * @return An initialized unsupported protocol exception */ -- initWithURL: (OFURL*)URL OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithURL: (OFURL*)URL OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnsupportedProtocolException.m ================================================================== --- src/exceptions/OFUnsupportedProtocolException.m +++ src/exceptions/OFUnsupportedProtocolException.m @@ -31,16 +31,16 @@ + (instancetype)exceptionWithURL: (OFURL *)URL { return [[[self alloc] initWithURL: URL] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithURL: (OFURL *)URL +- (instancetype)initWithURL: (OFURL *)URL { self = [super init]; _URL = [URL retain]; Index: src/exceptions/OFUnsupportedVersionException.h ================================================================== --- src/exceptions/OFUnsupportedVersionException.h +++ src/exceptions/OFUnsupportedVersionException.h @@ -43,17 +43,17 @@ * @param version The version which is unsupported * @return A new, autoreleased unsupported version exception */ + (instancetype)exceptionWithVersion: (OFString *)version; -- init OF_UNAVAILABLE; +- (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated unsupported protocol exception. * * @param version The version which is unsupported * @return An initialized unsupported version exception */ -- initWithVersion: (OFString *)version OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithVersion: (OFString *)version OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnsupportedVersionException.m ================================================================== --- src/exceptions/OFUnsupportedVersionException.m +++ src/exceptions/OFUnsupportedVersionException.m @@ -30,16 +30,16 @@ + (instancetype)exceptionWithVersion: (OFString *)version { return [[[self alloc] initWithVersion: version] autorelease]; } -- init +- (instancetype)init { OF_INVALID_INIT_METHOD } -- initWithVersion: (OFString *)version +- (instancetype)initWithVersion: (OFString *)version { self = [super init]; @try { _version = [version copy]; Index: src/exceptions/OFWriteFailedException.h ================================================================== --- src/exceptions/OFWriteFailedException.h +++ src/exceptions/OFWriteFailedException.h @@ -55,13 +55,13 @@ + (instancetype)exceptionWithObject: (id)object requestedLength: (size_t)requestedLength bytesWritten: (size_t)bytesWritten errNo: (int)errNo; -- initWithObject: (id)object - requestedLength: (size_t)requestedLength - errNo: (int)errNo OF_UNAVAILABLE; +- (instancetype)initWithObject: (id)object + requestedLength: (size_t)requestedLength + errNo: (int)errNo OF_UNAVAILABLE; /*! * @brief Initializes an already allocated write failed exception. * * @param object The object from which reading or to which writing failed @@ -70,12 +70,12 @@ * @param bytesWritten The amount of bytes already written before the write * failed * @param errNo The errno of the error that occurred * @return A new open file failed exception */ -- initWithObject: (id)object - requestedLength: (size_t)requestedLength - bytesWritten: (size_t)bytesWritten - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithObject: (id)object + requestedLength: (size_t)requestedLength + bytesWritten: (size_t)bytesWritten + errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFWriteFailedException.m ================================================================== --- src/exceptions/OFWriteFailedException.m +++ src/exceptions/OFWriteFailedException.m @@ -40,21 +40,21 @@ requestedLength: requestedLength bytesWritten: bytesWritten errNo: errNo] autorelease]; } -- initWithObject: (id)object - requestedLength: (size_t)requestedLength - errNo: (int)errNo +- (instancetype)initWithObject: (id)object + requestedLength: (size_t)requestedLength + errNo: (int)errNo { OF_INVALID_INIT_METHOD } -- initWithObject: (id)object - requestedLength: (size_t)requestedLength - bytesWritten: (size_t)bytesWritten - errNo: (int)errNo +- (instancetype)initWithObject: (id)object + requestedLength: (size_t)requestedLength + bytesWritten: (size_t)bytesWritten + errNo: (int)errNo { self = [super initWithObject: object requestedLength: requestedLength errNo: errNo]; Index: tests/OFArrayTests.m ================================================================== --- tests/OFArrayTests.m +++ tests/OFArrayTests.m @@ -45,11 +45,11 @@ OFMutableArray *_array; } @end @implementation SimpleArray -- init +- (instancetype)init { self = [super init]; @try { _array = [[OFMutableArray alloc] init]; @@ -59,12 +59,12 @@ } return self; } -- initWithObject: (id)object - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)object + arguments: (va_list)arguments { self = [super init]; @try { _array = [[OFMutableArray alloc] initWithObject: object @@ -75,12 +75,12 @@ } return self; } -- initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects + count: (size_t)count { self = [super init]; @try { _array = [[OFMutableArray alloc] initWithObjects: objects Index: tests/OFDictionaryTests.m ================================================================== --- tests/OFDictionaryTests.m +++ tests/OFDictionaryTests.m @@ -48,11 +48,11 @@ OFMutableDictionary *_dictionary; } @end @implementation SimpleDictionary -- init +- (instancetype)init { self = [super init]; @try { _dictionary = [[OFMutableDictionary alloc] init]; @@ -62,12 +62,12 @@ } return self; } -- initWithKey: (id)key - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)key + arguments: (va_list)arguments { self = [super init]; @try { _dictionary = [[OFMutableDictionary alloc] @@ -79,13 +79,13 @@ } return self; } -- initWithObjects: (const id *)objects - forKeys: (const id *)keys_ - count: (size_t)count +- (instancetype)initWithObjects: (const id *)objects + forKeys: (const id *)keys_ + count: (size_t)count { self = [super init]; @try { _dictionary = [[OFMutableDictionary alloc] Index: tests/OFHTTPClientTests.m ================================================================== --- tests/OFHTTPClientTests.m +++ tests/OFHTTPClientTests.m @@ -48,11 +48,11 @@ uint16_t _port; } @end @implementation HTTPClientTestsServer -- main +- (id)main { OFTCPSocket *listener, *client; [cond lock]; Index: tests/OFKernelEventObserverTests.m ================================================================== --- tests/OFKernelEventObserverTests.m +++ tests/OFKernelEventObserverTests.m @@ -53,11 +53,11 @@ - (void)run; @end @implementation ObserverTest -- initWithTestsAppDelegate: (TestsAppDelegate *)testsAppDelegate +- (instancetype)initWithTestsAppDelegate: (TestsAppDelegate *)testsAppDelegate { self = [super init]; @try { uint16_t port; Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -65,11 +65,11 @@ OFMutableString *_string; } @end @implementation SimpleString -- init +- (instancetype)init { self = [super init]; @try { _string = [[OFMutableString alloc] init]; @@ -79,11 +79,11 @@ } return self; } -- initWithString: (OFString *)string +- (instancetype)initWithString: (OFString *)string { self = [super init]; @try { _string = [string mutableCopy]; @@ -93,13 +93,13 @@ } return self; } -- initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding - length: (size_t)length +- (instancetype)initWithCString: (const char *)cString + encoding: (of_string_encoding_t)encoding + length: (size_t)length { self = [super init]; @try { _string = [[OFMutableString alloc] initWithCString: cString @@ -111,13 +111,13 @@ } return self; } -- initWithUTF16String: (const char16_t *)UTF16String - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const char16_t *)UTF16String + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { self = [super init]; @try { _string = [[OFMutableString alloc] @@ -130,13 +130,13 @@ } return self; } -- initWithUTF32String: (const char32_t *)UTF32String - length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const char32_t *)UTF32String + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder { self = [super init]; @try { _string = [[OFMutableString alloc] @@ -149,12 +149,12 @@ } return self; } -- initWithFormat: (OFConstantString *)format - arguments: (va_list)arguments +- (instancetype)initWithFormat: (OFConstantString *)format + arguments: (va_list)arguments { self = [super init]; @try { _string = [[OFMutableString alloc] initWithFormat: format Index: utils/ofhttp/OFHTTP.m ================================================================== --- utils/ofhttp/OFHTTP.m +++ utils/ofhttp/OFHTTP.m @@ -236,11 +236,11 @@ objc_autoreleasePoolPop(pool); return [fileName autorelease]; } @implementation OFHTTP -- init +- (instancetype)init { self = [super init]; @try { _method = OF_HTTP_REQUEST_METHOD_GET; Index: utils/ofhttp/ProgressBar.h ================================================================== --- utils/ofhttp/ProgressBar.h +++ utils/ofhttp/ProgressBar.h @@ -27,12 +27,12 @@ bool _stopped; float _BPS; double _ETA; } -- initWithLength: (intmax_t)length - resumedFrom: (intmax_t)resumedFrom; +- (instancetype)initWithLength: (intmax_t)length + resumedFrom: (intmax_t)resumedFrom; - (void)setReceived: (intmax_t)received; - (void)draw; - (void)calculateBPSAndETA; - (void)stop; @end Index: utils/ofhttp/ProgressBar.m ================================================================== --- utils/ofhttp/ProgressBar.m +++ utils/ofhttp/ProgressBar.m @@ -30,12 +30,12 @@ #define KIBIBYTE (1024) #define UPDATE_INTERVAL 0.1 @implementation ProgressBar -- initWithLength: (intmax_t)length - resumedFrom: (intmax_t)resumedFrom +- (instancetype)initWithLength: (intmax_t)length + resumedFrom: (intmax_t)resumedFrom { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); Index: utils/ofzip/Archive.h ================================================================== --- utils/ofzip/Archive.h +++ utils/ofzip/Archive.h @@ -19,12 +19,12 @@ #import "OFArray.h" @protocol Archive + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode; -- initWithStream: (OF_KINDOF(OFStream *))stream - mode: (OFString *)mode; +- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream + mode: (OFString *)mode; - (void)listFiles; - (void)extractFiles: (OFArray OF_GENERIC(OFString *) *)files; - (void)printFiles: (OFArray OF_GENERIC(OFString *) *)files; @optional - (void)addFiles: (OFArray OF_GENERIC(OFString *) *)files; Index: utils/ofzip/GZIPArchive.m ================================================================== --- utils/ofzip/GZIPArchive.m +++ utils/ofzip/GZIPArchive.m @@ -50,12 +50,12 @@ { return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } -- initWithStream: (OF_KINDOF(OFStream *))stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream + mode: (OFString *)mode { self = [super init]; @try { _stream = [[OFGZIPStream alloc] initWithStream: stream Index: utils/ofzip/TarArchive.m ================================================================== --- utils/ofzip/TarArchive.m +++ utils/ofzip/TarArchive.m @@ -52,12 +52,12 @@ { return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } -- initWithStream: (OF_KINDOF(OFStream *))stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream + mode: (OFString *)mode { self = [super init]; @try { _archive = [[OFTarArchive alloc] initWithStream: stream Index: utils/ofzip/ZIPArchive.m ================================================================== --- utils/ofzip/ZIPArchive.m +++ utils/ofzip/ZIPArchive.m @@ -62,12 +62,12 @@ { return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } -- initWithStream: (OF_KINDOF(OFStream *))stream - mode: (OFString *)mode +- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream + mode: (OFString *)mode { self = [super init]; @try { _archive = [[OFZIPArchive alloc] initWithStream: stream