Эх сурвалжийг харах

Updated to "instancetype" type

Pierre-Olivier Latour 11 жил өмнө
parent
commit
e26c9b76ea

+ 1 - 0
CGDWebServer/GCDWebServer.h

@@ -51,6 +51,7 @@ NSString* GCDWebServerGetPrimaryIPv4Address();  // Returns IPv4 address of prima
 @property(nonatomic, readonly, getter=isRunning) BOOL running;
 @property(nonatomic, readonly) NSUInteger port;
 @property(nonatomic, readonly) NSString* bonjourName;  // Only non-nil if Bonjour registration is active
+- (instancetype)init;
 - (void)addHandlerWithMatchBlock:(GCDWebServerMatchBlock)matchBlock processBlock:(GCDWebServerProcessBlock)processBlock;
 - (void)removeAllHandlers;
 

+ 1 - 1
CGDWebServer/GCDWebServer.m

@@ -261,7 +261,7 @@ static void _SignalHandler(int signal) {
   [GCDWebServerConnection class];  // Initialize class immediately to make sure it happens on the main thread
 }
 
-- (id)init {
+- (instancetype)init {
   if ((self = [super init])) {
     _handlers = [[NSMutableArray alloc] init];
   }

+ 12 - 12
CGDWebServer/GCDWebServerDataResponse.h

@@ -28,19 +28,19 @@
 #import "GCDWebServerResponse.h"
 
 @interface GCDWebServerDataResponse : GCDWebServerResponse
-+ (GCDWebServerDataResponse*)responseWithData:(NSData*)data contentType:(NSString*)type;
-- (id)initWithData:(NSData*)data contentType:(NSString*)type;
++ (instancetype)responseWithData:(NSData*)data contentType:(NSString*)type;
+- (instancetype)initWithData:(NSData*)data contentType:(NSString*)type;
 @end
 
 @interface GCDWebServerDataResponse (Extensions)
-+ (GCDWebServerDataResponse*)responseWithText:(NSString*)text;
-+ (GCDWebServerDataResponse*)responseWithHTML:(NSString*)html;
-+ (GCDWebServerDataResponse*)responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables;
-+ (GCDWebServerDataResponse*)responseWithJSONObject:(id)object;
-+ (GCDWebServerDataResponse*)responseWithJSONObject:(id)object contentType:(NSString*)type;
-- (id)initWithText:(NSString*)text;  // Encodes using UTF-8
-- (id)initWithHTML:(NSString*)html;  // Encodes using UTF-8
-- (id)initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables;  // Simple template system that replaces all occurences of "%variable%" with corresponding value (encodes using UTF-8)
-- (id)initWithJSONObject:(id)object;
-- (id)initWithJSONObject:(id)object contentType:(NSString*)type;
++ (instancetype)responseWithText:(NSString*)text;
++ (instancetype)responseWithHTML:(NSString*)html;
++ (instancetype)responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables;
++ (instancetype)responseWithJSONObject:(id)object;
++ (instancetype)responseWithJSONObject:(id)object contentType:(NSString*)type;
+- (instancetype)initWithText:(NSString*)text;  // Encodes using UTF-8
+- (instancetype)initWithHTML:(NSString*)html;  // Encodes using UTF-8
+- (instancetype)initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables;  // Simple template system that replaces all occurences of "%variable%" with corresponding value (encodes using UTF-8)
+- (instancetype)initWithJSONObject:(id)object;
+- (instancetype)initWithJSONObject:(id)object contentType:(NSString*)type;
 @end

+ 12 - 12
CGDWebServer/GCDWebServerDataResponse.m

@@ -36,11 +36,11 @@
 
 @implementation GCDWebServerDataResponse
 
-+ (GCDWebServerDataResponse*)responseWithData:(NSData*)data contentType:(NSString*)type {
++ (instancetype)responseWithData:(NSData*)data contentType:(NSString*)type {
   return ARC_AUTORELEASE([[[self class] alloc] initWithData:data contentType:type]);
 }
 
-- (id)initWithData:(NSData*)data contentType:(NSString*)type {
+- (instancetype)initWithData:(NSData*)data contentType:(NSString*)type {
   if (data == nil) {
     DNOT_REACHED();
     ARC_RELEASE(self);
@@ -77,27 +77,27 @@
 
 @implementation GCDWebServerDataResponse (Extensions)
 
-+ (GCDWebServerDataResponse*)responseWithText:(NSString*)text {
++ (instancetype)responseWithText:(NSString*)text {
   return ARC_AUTORELEASE([[self alloc] initWithText:text]);
 }
 
-+ (GCDWebServerDataResponse*)responseWithHTML:(NSString*)html {
++ (instancetype)responseWithHTML:(NSString*)html {
   return ARC_AUTORELEASE([[self alloc] initWithHTML:html]);
 }
 
-+ (GCDWebServerDataResponse*)responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables {
++ (instancetype)responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables {
   return ARC_AUTORELEASE([[self alloc] initWithHTMLTemplate:path variables:variables]);
 }
 
-+ (GCDWebServerDataResponse*)responseWithJSONObject:(id)object {
++ (instancetype)responseWithJSONObject:(id)object {
   return ARC_AUTORELEASE([[self alloc] initWithJSONObject:object]);
 }
 
-+ (GCDWebServerDataResponse*)responseWithJSONObject:(id)object contentType:(NSString*)type {
++ (instancetype)responseWithJSONObject:(id)object contentType:(NSString*)type {
   return ARC_AUTORELEASE([[self alloc] initWithJSONObject:object contentType:type]);
 }
 
-- (id)initWithText:(NSString*)text {
+- (instancetype)initWithText:(NSString*)text {
   NSData* data = [text dataUsingEncoding:NSUTF8StringEncoding];
   if (data == nil) {
     DNOT_REACHED();
@@ -107,7 +107,7 @@
   return [self initWithData:data contentType:@"text/plain; charset=utf-8"];
 }
 
-- (id)initWithHTML:(NSString*)html {
+- (instancetype)initWithHTML:(NSString*)html {
   NSData* data = [html dataUsingEncoding:NSUTF8StringEncoding];
   if (data == nil) {
     DNOT_REACHED();
@@ -117,7 +117,7 @@
   return [self initWithData:data contentType:@"text/html; charset=utf-8"];
 }
 
-- (id)initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables {
+- (instancetype)initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables {
   NSMutableString* html = [[NSMutableString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL];
   [variables enumerateKeysAndObjectsUsingBlock:^(NSString* key, NSString* value, BOOL* stop) {
     [html replaceOccurrencesOfString:[NSString stringWithFormat:@"%%%@%%", key] withString:value options:0 range:NSMakeRange(0, html.length)];
@@ -127,11 +127,11 @@
   return response;
 }
 
-- (id)initWithJSONObject:(id)object {
+- (instancetype)initWithJSONObject:(id)object {
   return [self initWithJSONObject:object contentType:@"application/json"];
 }
 
-- (id)initWithJSONObject:(id)object contentType:(NSString*)type {
+- (instancetype)initWithJSONObject:(id)object contentType:(NSString*)type {
   NSData* data = [NSJSONSerialization dataWithJSONObject:object options:0 error:NULL];
   if (data == nil) {
     ARC_RELEASE(self);

+ 8 - 8
CGDWebServer/GCDWebServerErrorResponse.h

@@ -30,12 +30,12 @@
 
 // Returns responses with an HTML body containing the error message
 @interface GCDWebServerErrorResponse : GCDWebServerDataResponse
-+ (GCDWebServerErrorResponse*)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3);
-+ (GCDWebServerErrorResponse*)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3);
-+ (GCDWebServerErrorResponse*)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
-+ (GCDWebServerErrorResponse*)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
-- (id)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3);
-- (id)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3);
-- (id)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
-- (id)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
++ (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3);
++ (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3);
++ (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
++ (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
+- (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3);
+- (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3);
+- (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
+- (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4);
 @end

+ 10 - 10
CGDWebServer/GCDWebServerErrorResponse.m

@@ -28,12 +28,12 @@
 #import "GCDWebServerPrivate.h"
 
 @interface GCDWebServerErrorResponse ()
-- (id)initWithStatusCode:(NSInteger)statusCode underlyingError:(NSError*)underlyingError messageFormat:(NSString*)format arguments:(va_list)arguments;
+- (instancetype)initWithStatusCode:(NSInteger)statusCode underlyingError:(NSError*)underlyingError messageFormat:(NSString*)format arguments:(va_list)arguments;
 @end
 
 @implementation GCDWebServerErrorResponse
 
-+ (GCDWebServerErrorResponse*)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... {
++ (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... {
   DCHECK(((NSInteger)errorCode >= 400) && ((NSInteger)errorCode < 500));
   va_list arguments;
   va_start(arguments, format);
@@ -42,7 +42,7 @@
   return response;
 }
 
-+ (GCDWebServerErrorResponse*)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... {
++ (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... {
   DCHECK(((NSInteger)errorCode >= 500) && ((NSInteger)errorCode < 600));
   va_list arguments;
   va_start(arguments, format);
@@ -51,7 +51,7 @@
   return response;
 }
 
-+ (GCDWebServerErrorResponse*)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... {
++ (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... {
   DCHECK(((NSInteger)errorCode >= 400) && ((NSInteger)errorCode < 500));
   va_list arguments;
   va_start(arguments, format);
@@ -60,7 +60,7 @@
   return response;
 }
 
-+ (GCDWebServerErrorResponse*)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... {
++ (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... {
   DCHECK(((NSInteger)errorCode >= 500) && ((NSInteger)errorCode < 600));
   va_list arguments;
   va_start(arguments, format);
@@ -73,7 +73,7 @@ static inline NSString* _EscapeHTMLString(NSString* string) {
   return [string stringByReplacingOccurrencesOfString:@"\"" withString:@"&quot;"];
 }
 
-- (id)initWithStatusCode:(NSInteger)statusCode underlyingError:(NSError*)underlyingError messageFormat:(NSString*)format arguments:(va_list)arguments {
+- (instancetype)initWithStatusCode:(NSInteger)statusCode underlyingError:(NSError*)underlyingError messageFormat:(NSString*)format arguments:(va_list)arguments {
   NSString* message = [[NSString alloc] initWithFormat:format arguments:arguments];
   NSString* title = [NSString stringWithFormat:@"HTTP Error %i", (int)statusCode];
   NSString* error = underlyingError ? [NSString stringWithFormat:@"[%@] %@ (%li)", underlyingError.domain, _EscapeHTMLString(underlyingError.localizedDescription), (long)underlyingError.code] : @"";
@@ -86,7 +86,7 @@ static inline NSString* _EscapeHTMLString(NSString* string) {
   return self;
 }
 
-- (id)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... {
+- (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... {
   DCHECK(((NSInteger)errorCode >= 400) && ((NSInteger)errorCode < 500));
   va_list arguments;
   va_start(arguments, format);
@@ -95,7 +95,7 @@ static inline NSString* _EscapeHTMLString(NSString* string) {
   return self;
 }
 
-- (id)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... {
+- (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... {
   DCHECK(((NSInteger)errorCode >= 500) && ((NSInteger)errorCode < 600));
   va_list arguments;
   va_start(arguments, format);
@@ -104,7 +104,7 @@ static inline NSString* _EscapeHTMLString(NSString* string) {
   return self;
 }
 
-- (id)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... {
+- (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... {
   DCHECK(((NSInteger)errorCode >= 400) && ((NSInteger)errorCode < 500));
   va_list arguments;
   va_start(arguments, format);
@@ -113,7 +113,7 @@ static inline NSString* _EscapeHTMLString(NSString* string) {
   return self;
 }
 
-- (id)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... {
+- (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... {
   DCHECK(((NSInteger)errorCode >= 500) && ((NSInteger)errorCode < 600));
   va_list arguments;
   va_start(arguments, format);

+ 1 - 1
CGDWebServer/GCDWebServerFileRequest.m

@@ -42,7 +42,7 @@ static inline NSError* _MakePosixError(int code) {
 
 @synthesize filePath=_filePath;
 
-- (id)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query {
+- (instancetype)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query {
   if ((self = [super initWithMethod:method url:url headers:headers path:path query:query])) {
     _filePath = ARC_RETAIN([NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]);
   }

+ 8 - 8
CGDWebServer/GCDWebServerFileResponse.h

@@ -28,12 +28,12 @@
 #import "GCDWebServerResponse.h"
 
 @interface GCDWebServerFileResponse : GCDWebServerResponse
-+ (GCDWebServerFileResponse*)responseWithFile:(NSString*)path;
-+ (GCDWebServerFileResponse*)responseWithFile:(NSString*)path isAttachment:(BOOL)attachment;
-+ (GCDWebServerFileResponse*)responseWithFile:(NSString*)path byteRange:(NSRange)range;
-+ (GCDWebServerFileResponse*)responseWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment;
-- (id)initWithFile:(NSString*)path;
-- (id)initWithFile:(NSString*)path isAttachment:(BOOL)attachment;
-- (id)initWithFile:(NSString*)path byteRange:(NSRange)range;  // Pass [NSNotFound, 0] to disable byte range entirely, [offset, length] to enable byte range from beginning of file or [NSNotFound, -bytes] from end of file
-- (id)initWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment;
++ (instancetype)responseWithFile:(NSString*)path;
++ (instancetype)responseWithFile:(NSString*)path isAttachment:(BOOL)attachment;
++ (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range;
++ (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment;
+- (instancetype)initWithFile:(NSString*)path;
+- (instancetype)initWithFile:(NSString*)path isAttachment:(BOOL)attachment;
+- (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range;  // Pass [NSNotFound, 0] to disable byte range entirely, [offset, length] to enable byte range from beginning of file or [NSNotFound, -bytes] from end of file
+- (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment;
 @end

+ 8 - 8
CGDWebServer/GCDWebServerFileResponse.m

@@ -46,35 +46,35 @@ static inline NSError* _MakePosixError(int code) {
 
 @implementation GCDWebServerFileResponse
 
-+ (GCDWebServerFileResponse*)responseWithFile:(NSString*)path {
++ (instancetype)responseWithFile:(NSString*)path {
   return ARC_AUTORELEASE([[[self class] alloc] initWithFile:path]);
 }
 
-+ (GCDWebServerFileResponse*)responseWithFile:(NSString*)path isAttachment:(BOOL)attachment {
++ (instancetype)responseWithFile:(NSString*)path isAttachment:(BOOL)attachment {
   return ARC_AUTORELEASE([[[self class] alloc] initWithFile:path isAttachment:attachment]);
 }
 
-+ (GCDWebServerFileResponse*)responseWithFile:(NSString*)path byteRange:(NSRange)range {
++ (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range {
   return ARC_AUTORELEASE([[[self class] alloc] initWithFile:path byteRange:range]);
 }
 
-+ (GCDWebServerFileResponse*)responseWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment {
++ (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment {
   return ARC_AUTORELEASE([[[self class] alloc] initWithFile:path byteRange:range isAttachment:attachment]);
 }
 
-- (id)initWithFile:(NSString*)path {
+- (instancetype)initWithFile:(NSString*)path {
   return [self initWithFile:path byteRange:NSMakeRange(NSNotFound, 0) isAttachment:NO];
 }
 
-- (id)initWithFile:(NSString*)path isAttachment:(BOOL)attachment {
+- (instancetype)initWithFile:(NSString*)path isAttachment:(BOOL)attachment {
   return [self initWithFile:path byteRange:NSMakeRange(NSNotFound, 0) isAttachment:attachment];
 }
 
-- (id)initWithFile:(NSString*)path byteRange:(NSRange)range {
+- (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range {
   return [self initWithFile:path byteRange:range isAttachment:NO];
 }
 
-- (id)initWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment {
+- (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment {
   struct stat info;
   if (lstat([path fileSystemRepresentation], &info) || !(info.st_mode & S_IFREG)) {
     DNOT_REACHED();

+ 1 - 1
CGDWebServer/GCDWebServerMultiPartFormRequest.m

@@ -185,7 +185,7 @@ static NSData* _dashNewlineData = nil;
   return @"multipart/form-data";
 }
 
-- (id)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query {
+- (instancetype)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query {
   if ((self = [super initWithMethod:method url:url headers:headers path:path query:query])) {
     NSString* boundary = GCDWebServerExtractHeaderParameter(self.contentType, @"boundary");
     if (boundary) {

+ 1 - 1
CGDWebServer/GCDWebServerRequest.h

@@ -42,7 +42,7 @@
 @property(nonatomic, readonly) NSString* contentType;  // Automatically parsed from headers (nil if request has no body or set to "application/octet-stream" if a body is present without a "Content-Type" header)
 @property(nonatomic, readonly) NSUInteger contentLength;  // Automatically parsed from headers (NSNotFound if request has no "Content-Length" header)
 @property(nonatomic, readonly) NSRange byteRange;  // Automatically parsed from headers ([NSNotFound, 0] if request has no "Range" header, [offset, length] for byte range from beginning or [NSNotFound, -bytes] from end)
-- (id)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query;
+- (instancetype)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query;
 - (BOOL)hasBody;  // Convenience method that checks if "contentType" is not nil
 - (BOOL)hasByteRange;  // Convenience method that checks "byteRange"
 @end

+ 1 - 1
CGDWebServer/GCDWebServerRequest.m

@@ -158,7 +158,7 @@
 @synthesize method=_method, URL=_url, headers=_headers, path=_path, query=_query, contentType=_type, contentLength=_length, byteRange=_range,
             usesChunkedTransferEncoding=_chunked;
 
-- (id)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query {
+- (instancetype)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query {
   if ((self = [super init])) {
     _method = [method copy];
     _url = ARC_RETAIN(url);

+ 6 - 6
CGDWebServer/GCDWebServerResponse.h

@@ -39,15 +39,15 @@
 @property(nonatomic) NSInteger statusCode;  // Default is 200
 @property(nonatomic) NSUInteger cacheControlMaxAge;  // Default is 0 seconds i.e. "no-cache"
 @property(nonatomic, getter=isGZipContentEncodingEnabled) BOOL gzipContentEncodingEnabled;  // Default is disabled
-+ (GCDWebServerResponse*) response;
-- (id)init;
++ (instancetype)response;
+- (instancetype)init;
 - (void)setValue:(NSString*)value forAdditionalHeader:(NSString*)header;  // Pass nil value to remove header
 - (BOOL)hasBody;  // Convenience method that checks if "contentType" is not nil
 @end
 
 @interface GCDWebServerResponse (Extensions)
-+ (GCDWebServerResponse*)responseWithStatusCode:(NSInteger)statusCode;
-+ (GCDWebServerResponse*)responseWithRedirect:(NSURL*)location permanent:(BOOL)permanent;
-- (id)initWithStatusCode:(NSInteger)statusCode;
-- (id)initWithRedirect:(NSURL*)location permanent:(BOOL)permanent;
++ (instancetype)responseWithStatusCode:(NSInteger)statusCode;
++ (instancetype)responseWithRedirect:(NSURL*)location permanent:(BOOL)permanent;
+- (instancetype)initWithStatusCode:(NSInteger)statusCode;
+- (instancetype)initWithRedirect:(NSURL*)location permanent:(BOOL)permanent;
 @end

+ 6 - 6
CGDWebServer/GCDWebServerResponse.m

@@ -171,11 +171,11 @@
 @synthesize contentType=_type, contentLength=_length, statusCode=_status, cacheControlMaxAge=_maxAge,
             gzipContentEncodingEnabled=_gzipped, additionalHeaders=_headers;
 
-+ (GCDWebServerResponse*)response {
++ (instancetype)response {
   return ARC_AUTORELEASE([[[self class] alloc] init]);
 }
 
-- (id)init {
+- (instancetype)init {
   if ((self = [super init])) {
     _type = nil;
     _length = NSNotFound;
@@ -248,22 +248,22 @@
 
 @implementation GCDWebServerResponse (Extensions)
 
-+ (GCDWebServerResponse*)responseWithStatusCode:(NSInteger)statusCode {
++ (instancetype)responseWithStatusCode:(NSInteger)statusCode {
   return ARC_AUTORELEASE([[self alloc] initWithStatusCode:statusCode]);
 }
 
-+ (GCDWebServerResponse*)responseWithRedirect:(NSURL*)location permanent:(BOOL)permanent {
++ (instancetype)responseWithRedirect:(NSURL*)location permanent:(BOOL)permanent {
   return ARC_AUTORELEASE([[self alloc] initWithRedirect:location permanent:permanent]);
 }
 
-- (id)initWithStatusCode:(NSInteger)statusCode {
+- (instancetype)initWithStatusCode:(NSInteger)statusCode {
   if ((self = [self init])) {
     self.statusCode = statusCode;
   }
   return self;
 }
 
-- (id)initWithRedirect:(NSURL*)location permanent:(BOOL)permanent {
+- (instancetype)initWithRedirect:(NSURL*)location permanent:(BOOL)permanent {
   if ((self = [self init])) {
     self.statusCode = permanent ? kGCDWebServerHTTPStatusCode_MovedPermanently : kGCDWebServerHTTPStatusCode_TemporaryRedirect;
     [self setValue:[location absoluteString] forAdditionalHeader:@"Location"];

+ 2 - 2
CGDWebServer/GCDWebServerStreamingResponse.h

@@ -30,6 +30,6 @@
 typedef NSData* (^GCDWebServerStreamBlock)(NSError** error);
 
 @interface GCDWebServerStreamingResponse : GCDWebServerResponse  // Automatically enables chunked transfer encoding
-+ (GCDWebServerStreamingResponse*)responseWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block;
-- (id)initWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block;  // Block must return empty NSData when done or nil on error
++ (instancetype)responseWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block;
+- (instancetype)initWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block;  // Block must return empty NSData when done or nil on error
 @end

+ 2 - 2
CGDWebServer/GCDWebServerStreamingResponse.m

@@ -35,11 +35,11 @@
 
 @implementation GCDWebServerStreamingResponse
 
-+ (GCDWebServerStreamingResponse*)responseWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block {
++ (instancetype)responseWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block {
   return ARC_AUTORELEASE([[[self class] alloc] initWithContentType:type streamBlock:block]);
 }
 
-- (id)initWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block {
+- (instancetype)initWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block {
   if ((self = [super init])) {
     _block = [block copy];
     

+ 1 - 1
GCDWebDAVServer/GCDWebDAVServer.h

@@ -46,7 +46,7 @@
 @property(nonatomic, assign) id<GCDWebDAVServerDelegate> delegate;
 @property(nonatomic, copy) NSArray* allowedFileExtensions;  // Default is nil i.e. all file extensions are allowed
 @property(nonatomic) BOOL showHiddenFiles;  // Default is NO
-- (id)initWithUploadDirectory:(NSString*)path;
+- (instancetype)initWithUploadDirectory:(NSString*)path;
 @end
 
 @interface GCDWebDAVServer (Subclassing)

+ 1 - 1
GCDWebDAVServer/GCDWebDAVServer.m

@@ -452,7 +452,7 @@ static inline xmlNodePtr _XMLChildWithName(xmlNodePtr child, const xmlChar* name
 
 @synthesize uploadDirectory=_uploadDirectory, delegate=_delegate, allowedFileExtensions=_allowedExtensions, showHiddenFiles=_showHidden;
 
-- (id)initWithUploadDirectory:(NSString*)path {
+- (instancetype)initWithUploadDirectory:(NSString*)path {
   if ((self = [super init])) {
     _uploadDirectory = [[path stringByStandardizingPath] copy];
     GCDWebDAVServer* __unsafe_unretained server = self;

+ 1 - 1
GCDWebUploader/GCDWebUploader.h

@@ -48,7 +48,7 @@
 @property(nonatomic, copy) NSString* prologue;  // Default is mini help (must be raw HTML)
 @property(nonatomic, copy) NSString* epilogue;  // Default is nothing (must be raw HTML)
 @property(nonatomic, copy) NSString* footer;  // Default is application name and version (must be HTML escaped)
-- (id)initWithUploadDirectory:(NSString*)path;
+- (instancetype)initWithUploadDirectory:(NSString*)path;
 @end
 
 @interface GCDWebUploader (Subclassing)

+ 1 - 1
GCDWebUploader/GCDWebUploader.m

@@ -267,7 +267,7 @@
 @synthesize uploadDirectory=_uploadDirectory, delegate=_delegate, allowedFileExtensions=_allowedExtensions, showHiddenFiles=_showHidden,
             title=_title, header=_header, prologue=_prologue, epilogue=_epilogue, footer=_footer;
 
-- (id)initWithUploadDirectory:(NSString*)path {
+- (instancetype)initWithUploadDirectory:(NSString*)path {
   if ((self = [super init])) {
     NSBundle* siteBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"GCDWebUploader" ofType:@"bundle"]];
     if (siteBundle == nil) {