diff options
author | Kamil Zbróg | 2013-11-04 11:40:22 +0000 |
---|---|---|
committer | Kamil Zbróg | 2013-11-04 11:40:22 +0000 |
commit | 85694ec1f5793eb4025f4153ef4bf71d3769d699 (patch) | |
tree | c93fab58eb2f52eca244895a9867d28134dbd7f5 /backends/platform/sdl/sdl.cpp | |
parent | 026390145b0e947be7cccf3d9ba329eb2270a2ed (diff) | |
parent | 9dc35033f523c9c694f24e15ed45ba6194786a25 (diff) | |
download | scummvm-rg350-85694ec1f5793eb4025f4153ef4bf71d3769d699.tar.gz scummvm-rg350-85694ec1f5793eb4025f4153ef4bf71d3769d699.tar.bz2 scummvm-rg350-85694ec1f5793eb4025f4153ef4bf71d3769d699.zip |
Merge remote-tracking branch 'own/prince' into prince-malik
Conflicts:
engines/prince/debugger.cpp
engines/prince/debugger.h
engines/prince/detection.cpp
engines/prince/font.cpp
engines/prince/graphics.cpp
engines/prince/prince.cpp
engines/prince/prince.h
engines/prince/script.cpp
engines/prince/script.h
Diffstat (limited to 'backends/platform/sdl/sdl.cpp')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index c240727069..bc80d8ad6a 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -392,10 +392,15 @@ Common::String OSystem_SDL::getSystemLanguage() const { } #else // WIN32 // Activating current locale settings - const char *locale = setlocale(LC_ALL, ""); + const Common::String locale = setlocale(LC_ALL, ""); + + // Restore default C locale to prevent issues with + // portability of sscanf(), atof(), etc. + // See bug #3615148 + setlocale(LC_ALL, "C"); // Detect the language from the locale - if (!locale) { + if (locale.empty()) { return ModularBackend::getSystemLanguage(); } else { int length = 0; @@ -404,14 +409,14 @@ Common::String OSystem_SDL::getSystemLanguage() const { // ".UTF-8" or the like. We do this, since // our translation languages are usually // specified without any charset information. - for (int i = 0; locale[i]; ++i, ++length) { + for (int size = locale.size(); length < size; ++length) { // TODO: Check whether "@" should really be checked // here. - if (locale[i] == '.' || locale[i] == ' ' || locale[i] == '@') + if (locale[length] == '.' || locale[length] == ' ' || locale[length] == '@') break; } - return Common::String(locale, length); + return Common::String(locale.c_str(), length); } #endif // WIN32 #else // USE_DETECTLANG |