Ver Fonte

Fixed compiler warnings for upcoming version of Xcode

Nick Banks há 11 anos atrás
pai
commit
810ef612c4

+ 1 - 1
AFNetworking/AFURLConnectionOperation.m

@@ -643,7 +643,7 @@ didReceiveResponse:(NSURLResponse *)response
     }
 
     dispatch_async(dispatch_get_main_queue(), ^{
-        self.totalBytesRead += length;
+        self.totalBytesRead += (long long)length;
 
         if (self.downloadProgress) {
             self.downloadProgress(length, self.totalBytesRead, self.response.expectedContentLength);

+ 3 - 5
AFNetworking/AFURLRequestSerialization.m

@@ -408,8 +408,6 @@ static NSString * const kAFMultipartFormBoundary = @"Boundary+0xAbCdEfGbOuNdArY"
 
 static NSString * const kAFMultipartFormCRLF = @"\r\n";
 
-static NSInteger const kAFStreamToStreamBufferSize = 1024 * 1024; //1 meg default
-
 static inline NSString * AFMultipartFormInitialBoundary() {
     return [NSString stringWithFormat:@"--%@%@", kAFMultipartFormBoundary, kAFMultipartFormCRLF];
 }
@@ -575,7 +573,7 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
     bodyPart.headers = mutableHeaders;
     bodyPart.body = inputStream;
 
-    bodyPart.bodyContentLength = length;
+    bodyPart.bodyContentLength = (unsigned long long)length;
 
     [self.bodyStream appendHTTPBodyPart:bodyPart];
 }
@@ -1083,7 +1081,7 @@ typedef enum {
         return nil;
     }
 
-    self.writingOptions = (NSPropertyListFormat)[decoder decodeIntegerForKey:NSStringFromSelector(@selector(writingOptions))];
+    self.writingOptions = (NSJSONWritingOptions)[decoder decodeIntegerForKey:NSStringFromSelector(@selector(writingOptions))];
 
     return self;
 }
@@ -1160,7 +1158,7 @@ typedef enum {
     }
 
     self.format = (NSPropertyListFormat)[decoder decodeIntegerForKey:NSStringFromSelector(@selector(format))];
-    self.writeOptions = [decoder decodeIntegerForKey:NSStringFromSelector(@selector(writeOptions))];
+    self.writeOptions = (NSPropertyListWriteOptions)[decoder decodeIntegerForKey:NSStringFromSelector(@selector(writeOptions))];
 
     return self;
 }

+ 3 - 3
AFNetworking/AFURLResponseSerialization.m

@@ -102,7 +102,7 @@ static BOOL AFErrorOrUnderlyingErrorHasCode(NSError *error, NSInteger code) {
 
         if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode]) {
             NSDictionary *userInfo = @{
-                                       NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%d)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], response.statusCode],
+                                       NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode],
                                        NSURLErrorFailingURLErrorKey:[response URL],
                                        AFNetworkingOperationFailingURLResponseErrorKey: response
                                        };
@@ -249,7 +249,7 @@ static BOOL AFErrorOrUnderlyingErrorHasCode(NSError *error, NSInteger code) {
         return nil;
     }
 
-    self.readingOptions = [decoder decodeIntegerForKey:NSStringFromSelector(@selector(readingOptions))];
+    self.readingOptions = (NSJSONReadingOptions)[decoder decodeIntegerForKey:NSStringFromSelector(@selector(readingOptions))];
 
     return self;
 }
@@ -455,7 +455,7 @@ static BOOL AFErrorOrUnderlyingErrorHasCode(NSError *error, NSInteger code) {
     }
 
     self.format = (NSPropertyListFormat)[decoder decodeIntegerForKey:NSStringFromSelector(@selector(format))];
-    self.readOptions = [decoder decodeIntegerForKey:NSStringFromSelector(@selector(readOptions))];
+    self.readOptions = (NSPropertyListReadOptions)[decoder decodeIntegerForKey:NSStringFromSelector(@selector(readOptions))];
 
     return self;
 }

+ 1 - 1
AFNetworking/AFURLSessionManager.m

@@ -222,7 +222,7 @@ didCompleteWithError:(NSError *)error
 {
     [self.mutableData appendData:data];
 
-    self.downloadProgress.totalUnitCount += [data length];
+    self.downloadProgress.totalUnitCount += (int64_t)[data length];
 }
 
 #pragma mark - NSURLSessionDownloadTaskDelegate

+ 1 - 1
Example/Classes/Models/Post.m

@@ -33,7 +33,7 @@
         return nil;
     }
     
-    self.postID = [[attributes valueForKeyPath:@"id"] integerValue];
+    self.postID = (NSUInteger)[[attributes valueForKeyPath:@"id"] integerValue];
     self.text = [attributes valueForKeyPath:@"text"];
     
     self.user = [[User alloc] initWithAttributes:[attributes valueForKeyPath:@"user"]];

+ 1 - 1
Example/Classes/Models/User.m

@@ -44,7 +44,7 @@ NSString * const kUserProfileImageDidLoadNotification = @"com.alamofire.user.pro
         return nil;
     }
     
-    self.userID = [[attributes valueForKeyPath:@"id"] integerValue];
+    self.userID = (NSUInteger)[[attributes valueForKeyPath:@"id"] integerValue];
     self.username = [attributes valueForKeyPath:@"username"];
     self.avatarImageURLString = [attributes valueForKeyPath:@"avatar_image.url"];
     

+ 1 - 1
Example/Classes/Views/PostTableViewCell.m

@@ -62,7 +62,7 @@
     CGSize sizeToFit = [post.text sizeWithFont:[UIFont systemFontOfSize:12.0f] constrainedToSize:CGSizeMake(220.0f, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
 #pragma clang diagnostic pop
     
-    return fmaxf(70.0f, sizeToFit.height + 45.0f);
+    return fmaxf(70.0f, (float)sizeToFit.height + 45.0f);
 }
 
 #pragma mark - UIView

+ 1 - 1
UIKit+AFNetworking/UIAlertView+AFNetworking.m

@@ -44,7 +44,7 @@ static void AFGetAlertViewTitleAndMessageFromError(NSError *error, NSString * __
         *message = error.localizedDescription;
     } else {
         *title = NSLocalizedStringFromTable(@"Error", @"AFNetworking", @"Fallback Error Description");
-        *message = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%@ Error: %d", @"AFNetworking", @"Fallback Error Failure Reason Format"), error.domain, error.code];
+        *message = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%@ Error: %ld", @"AFNetworking", @"Fallback Error Failure Reason Format"), error.domain, (long)error.code];
     }
 }