From b75c673a2c28233884a0d88fe85311173727c244 Mon Sep 17 00:00:00 2001 From: Oliver Jones Date: Fri, 30 Nov 2012 18:12:47 +1100 Subject: [PATCH] Fixes warning: 'X' is not defined, evaluates to 0 [-Werror,-Wundef] --- AFNetworking/AFHTTPClient.m | 6 +++--- AFNetworking/AFImageRequestOperation.m | 24 ++++++++++++------------ AFNetworking/AFNetworking.h | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index e8898d1..c55ce85 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -35,7 +35,7 @@ #import #endif -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) #import #endif @@ -230,10 +230,10 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) { NSString *preferredLanguageCodes = [[NSLocale preferredLanguages] componentsJoinedByString:@", "]; [self setDefaultHeader:@"Accept-Language" value:[NSString stringWithFormat:@"%@, en-us;q=0.8", preferredLanguageCodes]]; -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 [self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)]]; -#elif __MAC_OS_X_VERSION_MIN_REQUIRED +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) [self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]]; #endif diff --git a/AFNetworking/AFImageRequestOperation.m b/AFNetworking/AFImageRequestOperation.m index f4f724a..cf24f31 100644 --- a/AFNetworking/AFImageRequestOperation.m +++ b/AFNetworking/AFImageRequestOperation.m @@ -32,20 +32,20 @@ static dispatch_queue_t image_request_operation_processing_queue() { } @interface AFImageRequestOperation () -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) @property (readwrite, nonatomic, strong) UIImage *responseImage; -#elif __MAC_OS_X_VERSION_MIN_REQUIRED +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) @property (readwrite, nonatomic, strong) NSImage *responseImage; #endif @end @implementation AFImageRequestOperation @synthesize responseImage = _responseImage; -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) @synthesize imageScale = _imageScale; #endif -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest success:(void (^)(UIImage *image))success { @@ -55,7 +55,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { } } failure:nil]; } -#elif __MAC_OS_X_VERSION_MIN_REQUIRED +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) + (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest success:(void (^)(NSImage *image))success { @@ -68,7 +68,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { #endif -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest imageProcessingBlock:(UIImage *(^)(UIImage *))imageProcessingBlock success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success @@ -99,7 +99,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { return requestOperation; } -#elif __MAC_OS_X_VERSION_MIN_REQUIRED +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) + (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest imageProcessingBlock:(NSImage *(^)(NSImage *))imageProcessingBlock success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success @@ -137,7 +137,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { return nil; } -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) self.imageScale = [[UIScreen mainScreen] scale]; #endif @@ -145,7 +145,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { } -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - (UIImage *)responseImage { if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) { UIImage *image = [UIImage imageWithData:self.responseData]; @@ -168,7 +168,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { self.responseImage = nil; } -#elif __MAC_OS_X_VERSION_MIN_REQUIRED +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) - (NSImage *)responseImage { if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) { // Ensure that the image is set to it's correct pixel width and height @@ -216,9 +216,9 @@ static dispatch_queue_t image_request_operation_processing_queue() { } } else { if (success) { -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) UIImage *image = nil; -#elif __MAC_OS_X_VERSION_MIN_REQUIRED +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) NSImage *image = nil; #endif diff --git a/AFNetworking/AFNetworking.h b/AFNetworking/AFNetworking.h index 49e596c..c0e8e62 100644 --- a/AFNetworking/AFNetworking.h +++ b/AFNetworking/AFNetworking.h @@ -36,7 +36,7 @@ #import "AFImageRequestOperation.h" -#if __IPHONE_OS_VERSION_MIN_REQUIRED +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) #import "AFNetworkActivityIndicatorManager.h" #import "UIImageView+AFNetworking.h" #endif