summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Sutton <al@funkyandroid.com>2014-11-21 15:56:59 +0000
committerJean-Michel Trivi <jmtrivi@google.com>2015-01-14 09:41:33 -0800
commit77262e7db26a244ef013fcafc561ccd93c047a52 (patch)
treed62e28ee28ea7243bdf0c951d27d95cb4c81586c
parentd5b41767886de71e570edea98fd80228bb1211af (diff)
downloadcore-77262e7db26a244ef013fcafc561ccd93c047a52.tar.gz
Remove explict use of ASCII encoding
Replace the use of CFStringGetCString with kCFStringEncodingASCII specified with CFStringGetFileSystemRepresentation which will ensure the correct character encoding is used to conver the CFString into a NULL terminated char array suitable for use with POSIX APIs. (cherry picked from commit 2a4b5f9e804f019c0d565c86579f07963989ed1b) Change-Id: Ie6e2027e59b49ca634c7308bcda7bb492d372f46
-rw-r--r--adb/get_my_path_darwin.c2
-rw-r--r--fastboot/util_osx.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/adb/get_my_path_darwin.c b/adb/get_my_path_darwin.c
index 65dd2263c..ff1396c31 100644
--- a/adb/get_my_path_darwin.c
+++ b/adb/get_my_path_darwin.c
@@ -24,7 +24,7 @@ void get_my_path(char *s, size_t maxLen)
CFStringRef executablePathString = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle);
CFRelease(executableURL);
- CFStringGetCString(executablePathString, s, maxLen, kCFStringEncodingASCII);
+ CFStringGetFileSystemRepresentation(executablePathString, s, maxLen);
CFRelease(executablePathString);
}
diff --git a/fastboot/util_osx.c b/fastboot/util_osx.c
index a8f5c3158..e71856273 100644
--- a/fastboot/util_osx.c
+++ b/fastboot/util_osx.c
@@ -36,7 +36,7 @@ void get_my_path(char s[PATH_MAX])
CFStringRef executablePathString = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle);
CFRelease(executableURL);
- CFStringGetCString(executablePathString, s, PATH_MAX-1, kCFStringEncodingASCII);
+ CFStringGetFileSystemRepresentation(executablePathString, s, PATH_MAX-1);
CFRelease(executablePathString);
char *x;