From 1136bc5e2f8493cab0db582b336581c18d01e3dc Mon Sep 17 00:00:00 2001 From: Gareth du Plooy Date: Thu, 23 Aug 2012 11:59:54 -0500 Subject: [PATCH 1/3] Calling downloadProgress no longer casting [data length] to (long long) AFURLConnectionOperationProgressBlock specifies "bytes" as an NSInteger. Master was casting [data length] as a long long, resulting in compilation errors if attempting to compile with more strict complication rules. Only the totalBytes and totalBytesExpected are specified as (and correctly called with) long long values. --- AFNetworking/AFURLConnectionOperation.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index ad462a4..e668aa2 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -563,7 +563,7 @@ didReceiveResponse:(NSURLResponse *)response if (self.downloadProgress) { dispatch_async(dispatch_get_main_queue(), ^{ - self.downloadProgress((long long)[data length], self.totalBytesRead, self.response.expectedContentLength); + self.downloadProgress([data length], self.totalBytesRead, self.response.expectedContentLength); }); } } From dd0e659e09d34288bbe73bd80ff3e232a9bf901e Mon Sep 17 00:00:00 2001 From: Steven Fisher Date: Thu, 23 Aug 2012 10:08:12 -0700 Subject: [PATCH 2/3] Spelling corrections. --- AFNetworking/AFHTTPClient.h | 4 ++-- AFNetworking/AFHTTPRequestOperation.h | 12 ++++++------ AFNetworking/AFJSONRequestOperation.h | 2 +- AFNetworking/AFURLConnectionOperation.h | 6 +++--- AFNetworking/AFXMLRequestOperation.h | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/AFNetworking/AFHTTPClient.h b/AFNetworking/AFHTTPClient.h index 2e590ff..84d5965 100644 --- a/AFNetworking/AFHTTPClient.h +++ b/AFNetworking/AFHTTPClient.h @@ -114,7 +114,7 @@ extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *paramete ## URL Construction Using Relative Paths - Both `requestWithMethod:path:parameters` and `multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:` construct URLs from the path relative to the `baseURL`, using `NSURL +URLWithString:relativeToURL:`. Below are a few examples of how `baseURL` and relative paths interract: + Both `requestWithMethod:path:parameters` and `multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:` construct URLs from the path relative to the `baseURL`, using `NSURL +URLWithString:relativeToURL:`. Below are a few examples of how `baseURL` and relative paths interact: NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"]; [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo @@ -138,7 +138,7 @@ extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *paramete ///--------------------------------------- /** - The url used as the base for paths specified in methods such as `getPath:parameteres:success:failure` + The url used as the base for paths specified in methods such as `getPath:parameters:success:failure` */ @property (readonly, nonatomic, retain) NSURL *baseURL; diff --git a/AFNetworking/AFHTTPRequestOperation.h b/AFNetworking/AFHTTPRequestOperation.h index 891cd0f..608a6cb 100644 --- a/AFNetworking/AFHTTPRequestOperation.h +++ b/AFNetworking/AFHTTPRequestOperation.h @@ -66,9 +66,9 @@ extern NSSet * AFContentTypesFromHTTPHeader(NSString *string); */ @property (nonatomic, assign) dispatch_queue_t failureCallbackQueue; -///------------------------------------------------------------- -/// @name Managing Accceptable HTTP Status Codes & Content Types -///------------------------------------------------------------- +///------------------------------------------------------------ +/// @name Managing Acceptable HTTP Status Codes & Content Types +///------------------------------------------------------------ /** Returns an `NSIndexSet` object containing the ranges of acceptable HTTP status codes. When non-`nil`, the operation will set the `error` property to an error in `AFErrorDomain`. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html @@ -78,7 +78,7 @@ extern NSSet * AFContentTypesFromHTTPHeader(NSString *string); + (NSIndexSet *)acceptableStatusCodes; /** - Adds status codes to the set of acceptable HTTP status codes returned by `+acceptableStatusCodes` in subsequent calls by this class and its descendents. + Adds status codes to the set of acceptable HTTP status codes returned by `+acceptableStatusCodes` in subsequent calls by this class and its descendants. @param statusCodes The status codes to be added to the set of acceptable HTTP status codes */ @@ -92,7 +92,7 @@ extern NSSet * AFContentTypesFromHTTPHeader(NSString *string); + (NSSet *)acceptableContentTypes; /** - Adds content types to the set of acceptable MIME types returned by `+acceptableContentTypes` in subsequent calls by this class and its descendents. + Adds content types to the set of acceptable MIME types returned by `+acceptableContentTypes` in subsequent calls by this class and its descendants. @param contentTypes The content types to be added to the set of acceptable MIME types */ @@ -118,7 +118,7 @@ extern NSSet * AFContentTypesFromHTTPHeader(NSString *string); Sets the `completionBlock` property with a block that executes either the specified success or failure block, depending on the state of the request on completion. If `error` returns a value, which can be caused by an unacceptable status code or content type, then `failure` is executed. Otherwise, `success` is executed. @param success The block to be executed on the completion of a successful request. This block has no return value and takes two arguments: the receiver operation and the object constructed from the response data of the request. - @param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occured during the request. + @param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occurred during the request. @discussion This method should be overridden in subclasses in order to specify the response object passed into the success block. */ diff --git a/AFNetworking/AFJSONRequestOperation.h b/AFNetworking/AFJSONRequestOperation.h index a1191f9..84746f2 100644 --- a/AFNetworking/AFJSONRequestOperation.h +++ b/AFNetworking/AFJSONRequestOperation.h @@ -55,7 +55,7 @@ @param urlRequest The request object to be loaded asynchronously during execution of the operation @param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the JSON object created from the response data of request. - @param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse data as JSON. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred. + @param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data as JSON. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred. @return A new JSON request operation */ diff --git a/AFNetworking/AFURLConnectionOperation.h b/AFNetworking/AFURLConnectionOperation.h index 4fa20ed..ab08518 100644 --- a/AFNetworking/AFURLConnectionOperation.h +++ b/AFNetworking/AFURLConnectionOperation.h @@ -23,7 +23,7 @@ #import /** - Indicates an error occured in AFNetworking. + Indicates an error occurred in AFNetworking. @discussion Error codes for AFNetworkingErrorDomain correspond to codes in NSURLErrorDomain. */ @@ -61,7 +61,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; - `connection:canAuthenticateAgainstProtectionSpace:` - `connection:didReceiveAuthenticationChallenge:` - If any of these methods are overriden in a subclass, they _must_ call the `super` implementation first. + If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first. ## Class Constructors @@ -114,7 +114,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; @property (readonly, nonatomic, retain) NSURLResponse *response; /** - The error, if any, that occured in the lifecycle of the request. + The error, if any, that occurred in the lifecycle of the request. */ @property (readonly, nonatomic, retain) NSError *error; diff --git a/AFNetworking/AFXMLRequestOperation.h b/AFNetworking/AFXMLRequestOperation.h index 0beb677..876c127 100644 --- a/AFNetworking/AFXMLRequestOperation.h +++ b/AFNetworking/AFXMLRequestOperation.h @@ -77,7 +77,7 @@ @param urlRequest The request object to be loaded asynchronously during execution of the operation @param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the XML document created from the response data of request. - @param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse data as XML. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred. + @param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data as XML. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred. @return A new XML request operation */ From 13ec70cc8f5bc5acd3d579c60704e7a8638abc24 Mon Sep 17 00:00:00 2001 From: Gareth du Plooy Date: Thu, 23 Aug 2012 13:15:47 -0500 Subject: [PATCH 3/3] AFURLConnectionOperationProgressBlock bytes now NSUinteger This seems to be the most proper data type for this parameter. What gets passed in for uploadProgress is an NSInteger (guaranteed to be positive), and [NSData length], which is an NSUInteger, for downloadProgress. --- AFNetworking/AFURLConnectionOperation.h | 4 ++-- AFNetworking/AFURLConnectionOperation.m | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/AFNetworking/AFURLConnectionOperation.h b/AFNetworking/AFURLConnectionOperation.h index 4fa20ed..127747c 100644 --- a/AFNetworking/AFURLConnectionOperation.h +++ b/AFNetworking/AFURLConnectionOperation.h @@ -216,7 +216,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; @see setDownloadProgressBlock */ -- (void)setUploadProgressBlock:(void (^)(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block; +- (void)setUploadProgressBlock:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block; /** Sets a callback to be called when an undetermined number of bytes have been downloaded from the server. @@ -225,7 +225,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; @see setUploadProgressBlock */ -- (void)setDownloadProgressBlock:(void (^)(NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block; +- (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block; ///------------------------------------------------- /// @name Setting NSURLConnection Delegate Callbacks diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index e668aa2..98a0343 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -47,7 +47,7 @@ NSString * const AFNetworkingErrorDomain = @"com.alamofire.networking.error"; NSString * const AFNetworkingOperationDidStartNotification = @"com.alamofire.networking.operation.start"; NSString * const AFNetworkingOperationDidFinishNotification = @"com.alamofire.networking.operation.finish"; -typedef void (^AFURLConnectionOperationProgressBlock)(NSInteger bytes, long long totalBytes, long long totalBytesExpected); +typedef void (^AFURLConnectionOperationProgressBlock)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected); typedef BOOL (^AFURLConnectionOperationAuthenticationAgainstProtectionSpaceBlock)(NSURLConnection *connection, NSURLProtectionSpace *protectionSpace); typedef void (^AFURLConnectionOperationAuthenticationChallengeBlock)(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge); typedef NSCachedURLResponse * (^AFURLConnectionOperationCacheResponseBlock)(NSURLConnection *connection, NSCachedURLResponse *cachedResponse); @@ -287,11 +287,11 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat } #endif -- (void)setUploadProgressBlock:(void (^)(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block { +- (void)setUploadProgressBlock:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block { self.uploadProgress = block; } -- (void)setDownloadProgressBlock:(void (^)(NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block { +- (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block { self.downloadProgress = block; }