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 2a4b5f9e80
)
Change-Id: Ie6e2027e59b49ca634c7308bcda7bb492d372f46
This commit is contained in:
parent
d5b4176788
commit
77262e7db2
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue