[Scummvm-cvs-logs] SF.net SVN: scummvm:[40381] scummvm/trunk/backends/platform/sdl/sdl.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri May 8 14:37:11 CEST 2009


Revision: 40381
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40381&view=rev
Author:   fingolfin
Date:     2009-05-08 12:37:11 +0000 (Fri, 08 May 2009)

Log Message:
-----------
SDL: Modified OSystem_SDL::setWindowCaption to strip out non-ASCII chars (this prevents a crash on OS X). Note that the OSystem specs cleary state that only ASCII may be passed to setWindowCaption(), but we ignore this e.g. in the launcher

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/sdl.cpp

Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp	2009-05-08 11:37:39 UTC (rev 40380)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp	2009-05-08 12:37:11 UTC (rev 40381)
@@ -396,7 +396,14 @@
 }
 
 void OSystem_SDL::setWindowCaption(const char *caption) {
-	SDL_WM_SetCaption(caption, caption);
+	Common::String cap(caption);
+
+	// Filter out any non-ASCII characters, replacing them by question marks.
+	// At some point, we may wish to allow LATIN 1 or UTF-8.
+	for (uint i = 0; i < cap.size(); ++i)
+		if ((byte)cap[i] > 0x7F)
+			cap.setChar('?', i);
+	SDL_WM_SetCaption(cap.c_str(), cap.c_str());
 }
 
 bool OSystem_SDL::hasFeature(Feature f) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list