[Scummvm-cvs-logs] scummvm master -> de8da01b0e8a309b9ed3f5b0f152ebbcf8f4af37
digitall
dgturner at iee.org
Sun Nov 3 18:13:29 CET 2013
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
de8da01b0e SDL: Remove side effect of setlocale() call to get Language.
Commit: de8da01b0e8a309b9ed3f5b0f152ebbcf8f4af37
https://github.com/scummvm/scummvm/commit/de8da01b0e8a309b9ed3f5b0f152ebbcf8f4af37
Author: D G Turner (digitall at scummvm.org)
Date: 2013-11-03T09:10:18-08:00
Commit Message:
SDL: Remove side effect of setlocale() call to get Language.
This is to fix bug #3615148 - "ALL: sscanf("%f"), atof() etc. not
portable due to Locale"
The side effect of setlocale("") is to change the active locale
from the default of "C" to the detected system locale, but this
changes the behaviour of sscanf() and several other functions
in a system dependent and non-portable way. This has caused
bugs in the ZVISION engine when running Zork Nemesis.
The solution is to restore the default "C" locale after the call
to get the language.
Thanks to criezy for working out this fix.
Changed paths:
backends/platform/sdl/sdl.cpp
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index c240727..508c5f4 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -393,6 +393,11 @@ Common::String OSystem_SDL::getSystemLanguage() const {
#else // WIN32
// Activating current locale settings
const char *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) {
More information about the Scummvm-git-logs
mailing list