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
This commit is contained in:
Al Sutton 2014-11-21 15:56:59 +00:00
parent 5d8a5ade62
commit 2a4b5f9e80
2 changed files with 2 additions and 2 deletions

View file

@ -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);
}

View file

@ -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;