From 7652afc74f51fa3c4f4b56898c2e14fce157af5f Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Sat, 26 Apr 2014 00:00:07 +0000 Subject: Comment on the difference between GTMCFAutorelease and iOS 7's CFAutorelease. Update GTM's definition of the standard OS X/iOS version macros. Remove GTMDefines dependency from GTMNSString+URLArguments and GTMURITemplate. DELTA=38 (27 added, 4 deleted, 7 changed) DELTA_BY_EXTENSION=h=23,m=11 --- Foundation/GTMNSString+URLArguments.m | 18 ++++++++++-------- Foundation/GTMURITemplate.m | 4 +--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'Foundation') 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 // () - 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; } -- cgit v1.2.3