Commit d75d12be authored by Marvin Scholz's avatar Marvin Scholz

darwinvlc: Use FromCFString

parent 82c18a3b
......@@ -27,6 +27,9 @@
#endif
#include <vlc/vlc.h>
#include <vlc_common.h>
#include <vlc_charset.h>
#include <stdlib.h>
#include <locale.h>
#include <signal.h>
......@@ -244,21 +247,13 @@ int main(int i_argc, const char *ppsz_argv[])
language = (CFStringRef)CFPreferencesCopyAppValue(CFSTR("language"),
kCFPreferencesCurrentApplication);
if (language) {
CFIndex length = CFStringGetLength(language) + 1;
if (length > 0) {
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
lang = (char *)malloc(maxSize);
if(lang) {
CFStringGetCString(language, lang, maxSize - 1, kCFStringEncodingUTF8);
if (strncmp( lang, "auto", 4 )) {
char tmp[11];
snprintf(tmp, 11, "LANG=%s", lang);
putenv(tmp);
}
}
free(lang);
lang = FromCFString(language, kCFStringEncodingUTF8);
if (strncmp( lang, "auto", 4 )) {
char tmp[11];
snprintf(tmp, 11, "LANG=%s", lang);
putenv(tmp);
}
free(lang);
CFRelease(language);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment