Global: only enable locale if necessary

Fix  #995
This commit is contained in:
Carter Li
2024-06-07 08:59:58 +08:00
parent 550eeb850c
commit b324e4f664
3 changed files with 11 additions and 8 deletions
+4 -4
View File
@@ -12,12 +12,12 @@ void ffDetectLocale(FFstrbuf* result)
if(result->length > 0)
return;
setlocale(LC_ALL, "");
#ifdef LC_MESSAGES
ffStrbufAppendS(result, setlocale(LC_MESSAGES, NULL));
if(result->length > 0)
return;
if(result->length == 0)
ffStrbufAppendS(result, setlocale(LC_ALL, NULL));
#endif
ffStrbufAppendS(result, setlocale(LC_ALL, NULL));
setlocale(LC_ALL, "C");
}