summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Sutton2014-11-19 13:50:48 -0600
committerJean-Michel Trivi2015-01-14 11:32:36 -0600
commit017c97a5b1a55d402da1a793c91fc37f11b05747 (patch)
tree2349f325f81451641a75b859cf201119f2446bec
parentf2bd3fdd190fc1234913febfe254f8bcc4e675da (diff)
downloadplatform-system-core-017c97a5b1a55d402da1a793c91fc37f11b05747.tar.gz
platform-system-core-017c97a5b1a55d402da1a793c91fc37f11b05747.tar.xz
platform-system-core-017c97a5b1a55d402da1a793c91fc37f11b05747.zip
Fix building on modern versions of Xcode and OS X.
Recent versions of XCode fail to compile the adb and fastboot binaries due to two functions being deprecated in 10.9 (GetCurrentProcess and ProcessInformationCopyDictionary), and the use of -Werrror. This patch replaces the method implementations which use calls to methods deprecated in the 10.9 SDK with versions which only call non-deprecated methods. (cherry picked from commit f456d47c506d87265ce0ff6080cba5374dced011) Change-Id: Ibd80dda73ccdd7c561b50b4065581e645d9855d6
-rw-r--r--adb/get_my_path_darwin.c14
-rw-r--r--fastboot/util_osx.c17
2 files changed, 16 insertions, 15 deletions
diff --git a/adb/get_my_path_darwin.c b/adb/get_my_path_darwin.c
index 5b95d1534..9141b5799 100644
--- a/adb/get_my_path_darwin.c
+++ b/adb/get_my_path_darwin.c
@@ -19,12 +19,12 @@
19 19
20void get_my_path(char *s, size_t maxLen) 20void get_my_path(char *s, size_t maxLen)
21{ 21{
22 ProcessSerialNumber psn; 22 CFBundleRef mainBundle = CFBundleGetMainBundle();
23 GetCurrentProcess(&psn); 23 CFURLRef bundleURL = CFBundleCopyBundleURL(mainBundle);
24 CFDictionaryRef dict; 24 CFStringRef bundlePathString = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
25 dict = ProcessInformationCopyDictionary(&psn, 0xffffffff); 25 CFRelease(bundleURL);
26 CFStringRef value = (CFStringRef)CFDictionaryGetValue(dict, 26
27 CFSTR("CFBundleExecutable")); 27 CFStringGetCString(bundlePathString, s, maxLen, kCFStringEncodingASCII);
28 CFStringGetCString(value, s, maxLen, kCFStringEncodingUTF8); 28 CFRelease(bundlePathString);
29} 29}
30 30
diff --git a/fastboot/util_osx.c b/fastboot/util_osx.c
index 26b832a35..e80a8f356 100644
--- a/fastboot/util_osx.c
+++ b/fastboot/util_osx.c
@@ -31,14 +31,15 @@
31 31
32void get_my_path(char s[PATH_MAX]) 32void get_my_path(char s[PATH_MAX])
33{ 33{
34 char *x; 34 CFBundleRef mainBundle = CFBundleGetMainBundle();
35 ProcessSerialNumber psn; 35 CFURLRef bundleURL = CFBundleCopyBundleURL(mainBundle);
36 GetCurrentProcess(&psn); 36 CFStringRef bundlePathString = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
37 CFDictionaryRef dict; 37 CFRelease(bundleURL);
38 dict = ProcessInformationCopyDictionary(&psn, 0xffffffff); 38
39 CFStringRef value = (CFStringRef)CFDictionaryGetValue(dict, 39 CFStringGetCString(bundlePathString, s, PATH_MAX - 1, kCFStringEncodingASCII);
40 CFSTR("CFBundleExecutable")); 40 CFRelease(bundlePathString);
41 CFStringGetCString(value, s, PATH_MAX - 1, kCFStringEncodingUTF8); 41
42 char *x;
42 x = strrchr(s, '/'); 43 x = strrchr(s, '/');
43 if(x) x[1] = 0; 44 if(x) x[1] = 0;
44} 45}