aboutsummaryrefslogtreecommitdiff
path: root/Foundation
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2014-04-26 00:00:07 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2014-04-26 00:00:07 +0000
commit7652afc74f51fa3c4f4b56898c2e14fce157af5f (patch)
tree37ac34389d05d43f04c4f13eb56437dedfd0d527 /Foundation
parent6945781e0b3094d2547d31589c3a249bd65a2f41 (diff)
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
Diffstat (limited to 'Foundation')
-rw-r--r--Foundation/GTMNSString+URLArguments.m18
-rw-r--r--Foundation/GTMURITemplate.m4
2 files changed, 11 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;
}