[ scummvm-Bugs-3615148 ] Locale-related problems

SourceForge.net noreply at sourceforge.net
Sun Oct 27 11:31:24 CET 2013


Bugs item #3615148, was opened at 2013-10-27 03:31
Message generated for change (Tracker Item Submitted) made by eriktorbjorn
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418820&aid=3615148&group_id=37116

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Unknown Crash/Other
Group: Unknown
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Torbjörn Andersson (eriktorbjorn)
Assigned to: Nobody/Anonymous (nobody)
Summary: Locale-related problems

Initial Comment:
I noticed yesterday that Zork Nemesis fails to render properly. Fair enough, it's not yet a supported game, but the reason is worth bringing up: It uses sscanf() to parse floating-point values. This fails because the strings it parses use a period as decimal separator, while in my locale it's a comma. The result comes out looking less than the Great Underground Empire and more like the rings of Saturn.

Which raises the question, do these problems occur in any other parts of ScummVM, and how should we deal with them? A quick search suggests that the Wintermute engine may be affected, since it uses sscanf() and %f in base_persistence_manager.cpp, but there are several other format strings that are also used for floating-point values and I haven't looked for them. I assume atof() could also be problematic.

I'm not sure what the appropriate fix for this would be. Do we explicitly set the locale for ScummVM to use, or do we introduce or own locale-independent family of functions? Are there tools to scan for this kind of potential problems? (I'm actually a bit surprised that I haven't seen anything about it in our Coverity issues.)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418820&aid=3615148&group_id=37116




More information about the Scummvm-tracker mailing list