diff options
-rw-r--r-- | Foundation/GTMNSString+URLArguments.m | 18 | ||||
-rw-r--r-- | Foundation/GTMURITemplate.m | 4 | ||||
-rw-r--r-- | GTMDefines.h | 23 |
3 files changed, 34 insertions, 11 deletions
diff --git a/Foundation/GTMNSString+URLArguments.m b/Foundation/GTMNSString+URLArguments.m index 90c65c5..e785c5e 100644 --- a/Foundation/GTMNSString+URLArguments.m +++ b/Foundation/GTMNSString+URLArguments.m @@ -6,9 +6,9 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy // of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -18,23 +18,25 @@ #import "GTMNSString+URLArguments.h" -#import "GTMDefines.h" - @implementation NSString (GTMNSStringURLArgumentsAdditions) -- (NSString*)gtm_stringByEscapingForURLArgument { +- (NSString *)gtm_stringByEscapingForURLArgument { // Encode all the reserved characters, per RFC 3986 // (<http://www.ietf.org/rfc/rfc3986.txt>) - CFStringRef escaped = + CFStringRef escaped = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)self, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8); - return GTMCFAutorelease(escaped); +#if defined(__has_feature) && __has_feature(objc_arc) + return CFBridgingRelease(escaped); +#else + return [(NSString *)escaped autorelease]; +#endif } -- (NSString*)gtm_stringByUnescapingFromURLArgument { +- (NSString *)gtm_stringByUnescapingFromURLArgument { NSMutableString *resultString = [NSMutableString stringWithString:self]; [resultString replaceOccurrencesOfString:@"+" withString:@" " diff --git a/Foundation/GTMURITemplate.m b/Foundation/GTMURITemplate.m index 7721d84..5938b72 100644 --- a/Foundation/GTMURITemplate.m +++ b/Foundation/GTMURITemplate.m @@ -15,8 +15,6 @@ #import "GTMURITemplate.h" -#import "GTMDefines.h" - #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 // Key constants for handling variables. @@ -63,7 +61,7 @@ static NSString *EscapeString(NSString *str, BOOL allowReserved) { forceEscapedChars, kCFStringEncodingUTF8); if (escapedStr) { - resultStr = GTMCFAutorelease(escapedStr); + resultStr = [(NSString *)escapedStr autorelease]; } return resultStr; } diff --git a/GTMDefines.h b/GTMDefines.h index 14ffa7e..c24053e 100644 --- a/GTMDefines.h +++ b/GTMDefines.h @@ -39,6 +39,12 @@ #ifndef MAC_OS_X_VERSION_10_7 #define MAC_OS_X_VERSION_10_7 1070 #endif +#ifndef MAC_OS_X_VERSION_10_8 + #define MAC_OS_X_VERSION_10_8 1080 +#endif +#ifndef MAC_OS_X_VERSION_10_9 + #define MAC_OS_X_VERSION_10_9 1090 +#endif // Not all __IPHONE_X macros defined in past SDKs #ifndef __IPHONE_3_0 @@ -59,6 +65,21 @@ #ifndef __IPHONE_5_0 #define __IPHONE_5_0 50000 #endif +#ifndef __IPHONE_5_1 + #define __IPHONE_5_1 50100 +#endif +#ifndef __IPHONE_6_0 + #define __IPHONE_6_0 60000 +#endif +#ifndef __IPHONE_6_1 + #define __IPHONE_6_1 60100 +#endif +#ifndef __IPHONE_7_0 + #define __IPHONE_7_0 70000 +#endif +#ifndef __IPHONE_7_1 + #define __IPHONE_7_1 70100 +#endif // ---------------------------------------------------------------------------- // CPP symbols that can be overridden in a prefix to control how the toolbox @@ -379,6 +400,8 @@ #endif #ifndef GTMCFAutorelease + // GTMCFAutorelease returns an id. In contrast, Apple's CFAutorelease returns + // a CFTypeRef. #if __has_feature(objc_arc) #define GTMCFAutorelease(x) CFBridgingRelease(x) #else |