diff options
author | Mark Mentovai <mark@chromium.org> | 2017-07-10 17:24:25 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2017-07-10 17:41:00 -0400 |
commit | ec72a2bc500a716369c383837bffdc7d2a22855b (patch) | |
tree | 51caaa4dff0df947186a969f697acd3d53f55a41 /Foundation | |
parent | c867eb4055d715b8aa56e1ce630e739df3abdc0a (diff) |
10.13 SDK (and iOS 11 equivalent) compatibility for GTM
Starting in the 10.6 SDK, the non-underscored and all-lowercase macro
names in <AssertMacros.h> were deprecated. In the 10.13 SDK shipping in
Xcode 9 beta 3 (but not previous betas of Xcode 9), Apple has made good
on its promise to eventually disable these names. Update GTM to use the
new underscored mixed-case names.
Provided that nobody needs to target anything older than the 10.5 SDK
anymore, this should be a safe change.
Aside from GTMCarbonEvent.m, which is used by Chrome, this change is
untested, and was made by mechanically replacing uses of the various
check, require, and verify macros found in GTM.
Diffstat (limited to 'Foundation')
-rw-r--r-- | Foundation/GTMNSFileManager+Carbon.m | 25 | ||||
-rw-r--r-- | Foundation/GTMServiceManagement.c | 4 | ||||
-rw-r--r-- | Foundation/GTMSystemVersion.m | 9 |
3 files changed, 21 insertions, 17 deletions
diff --git a/Foundation/GTMNSFileManager+Carbon.m b/Foundation/GTMNSFileManager+Carbon.m index d829cd9..8bd5f69 100644 --- a/Foundation/GTMNSFileManager+Carbon.m +++ b/Foundation/GTMNSFileManager+Carbon.m @@ -28,10 +28,10 @@ FSRef ref; AliasHandle alias = NULL; - require_quiet([path length], CantUseParams); - require_noerr(FSPathMakeRef((UInt8 *)[path fileSystemRepresentation], - &ref, NULL), CantMakeRef); - require_noerr(FSNewAlias(NULL, &ref, &alias), CantMakeAlias); + __Require_Quiet([path length], CantUseParams); + __Require_noErr(FSPathMakeRef((UInt8 *)[path fileSystemRepresentation], + &ref, NULL), CantMakeRef); + __Require_noErr(FSNewAlias(NULL, &ref, &alias), CantMakeAlias); Size length = GetAliasSize(alias); data = [NSData dataWithBytes:*alias length:length]; @@ -52,12 +52,12 @@ CantUseParams: resolve:(BOOL)resolve withUI:(BOOL)withUI { NSString *path = nil; - require_quiet(data, CantUseParams); + __Require_Quiet(data, CantUseParams); AliasHandle alias; const void *bytes = [data bytes]; NSUInteger length = [data length]; - require_noerr(PtrToHand(bytes, (Handle *)&alias, length), CantMakeHandle); + __Require_noErr(PtrToHand(bytes, (Handle *)&alias, length), CantMakeHandle); FSRef ref; Boolean wasChanged; @@ -85,14 +85,14 @@ CantUseParams: - (FSRef *)gtm_FSRefForPath:(NSString *)path { FSRef* fsRef = NULL; - require_quiet([path length], CantUseParams); + __Require_Quiet([path length], CantUseParams); NSMutableData *fsRefData = [NSMutableData dataWithLength:sizeof(FSRef)]; - require(fsRefData, CantAllocateFSRef); + __Require(fsRefData, CantAllocateFSRef); fsRef = (FSRef*)[fsRefData mutableBytes]; Boolean isDir = FALSE; const UInt8 *filePath = (const UInt8 *)[path fileSystemRepresentation]; - require_noerr_action(FSPathMakeRef(filePath, fsRef, &isDir), - CantMakeRef, fsRef = NULL); + __Require_noErr_action(FSPathMakeRef(filePath, fsRef, &isDir), + CantMakeRef, fsRef = NULL); CantMakeRef: CantAllocateFSRef: CantUseParams: @@ -101,10 +101,11 @@ CantUseParams: - (NSString *)gtm_pathFromFSRef:(FSRef *)fsRef { NSString *nsPath = nil; - require_quiet(fsRef, CantUseParams); + __Require_Quiet(fsRef, CantUseParams); char path[MAXPATHLEN]; - require_noerr(FSRefMakePath(fsRef, (UInt8 *)path, MAXPATHLEN), CantMakePath); + __Require_noErr(FSRefMakePath(fsRef, (UInt8 *)path, MAXPATHLEN), + CantMakePath); nsPath = [self stringWithFileSystemRepresentation:path length:strlen(path)]; nsPath = [nsPath stringByStandardizingPath]; diff --git a/Foundation/GTMServiceManagement.c b/Foundation/GTMServiceManagement.c index dfd0dc6..a57bc2a 100644 --- a/Foundation/GTMServiceManagement.c +++ b/Foundation/GTMServiceManagement.c @@ -88,9 +88,9 @@ static bool IsOsYosemiteOrGreater() { #else SInt32 version_major; SInt32 version_minor; - require_noerr(Gestalt(gestaltSystemVersionMajor, &version_major), + __Require_noErr(Gestalt(gestaltSystemVersionMajor, &version_major), failedGestalt); - require_noerr(Gestalt(gestaltSystemVersionMinor, &version_minor), + __Require_noErr(Gestalt(gestaltSystemVersionMinor, &version_minor), failedGestalt); return version_major > 10 || (version_major == 10 && version_minor >= 10); failedGestalt: diff --git a/Foundation/GTMSystemVersion.m b/Foundation/GTMSystemVersion.m index 5738d78..446766b 100644 --- a/Foundation/GTMSystemVersion.m +++ b/Foundation/GTMSystemVersion.m @@ -50,9 +50,12 @@ static NSString *const kSystemVersionPlistPath = @"/System/Library/CoreServices/ // <http://lists.apple.com/archives/carbon-dev/2007/Aug/msg00089.html>). // The iPhone doesn't have Gestalt though, so use the plist there. #if GTM_MACOS_SDK - require_noerr(Gestalt(gestaltSystemVersionMajor, &sGTMSystemVersionMajor), failedGestalt); - require_noerr(Gestalt(gestaltSystemVersionMinor, &sGTMSystemVersionMinor), failedGestalt); - require_noerr(Gestalt(gestaltSystemVersionBugFix, &sGTMSystemVersionBugFix), failedGestalt); + __Require_noErr(Gestalt(gestaltSystemVersionMajor, + &sGTMSystemVersionMajor), failedGestalt); + __Require_noErr(Gestalt(gestaltSystemVersionMinor, + &sGTMSystemVersionMinor), failedGestalt); + __Require_noErr(Gestalt(gestaltSystemVersionBugFix, + &sGTMSystemVersionBugFix), failedGestalt); return; |