From 2a4b5f9e804f019c0d565c86579f07963989ed1b Mon Sep 17 00:00:00 2001
From: Al Sutton <al@funkyandroid.com>
Date: Fri, 21 Nov 2014 15:56:59 +0000
Subject: [PATCH] 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.

Change-Id: Ibab1dc05c4f4db8604d329a493b4241992b8e69d
---
 adb/get_my_path_darwin.c | 2 +-
 fastboot/util_osx.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/adb/get_my_path_darwin.c b/adb/get_my_path_darwin.c
index 65dd2263c9..ff1396c318 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 a8f5c31586..e718562733 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;
-- 
GitLab