diff options
author | Max Horn | 2009-05-08 12:37:11 +0000 |
---|---|---|
committer | Max Horn | 2009-05-08 12:37:11 +0000 |
commit | c38c0980cddf6b3703f5d86f2004841fdbfca0c3 (patch) | |
tree | dc362cdcfae8c0c84467cc2e12a8ba63f09c517e /backends/platform | |
parent | 1c50778e46b763290f51073ea968973a5eb97bb3 (diff) | |
download | scummvm-rg350-c38c0980cddf6b3703f5d86f2004841fdbfca0c3.tar.gz scummvm-rg350-c38c0980cddf6b3703f5d86f2004841fdbfca0c3.tar.bz2 scummvm-rg350-c38c0980cddf6b3703f5d86f2004841fdbfca0c3.zip |
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
svn-id: r40381
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 98b1feba6d..c4e376fe54 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -396,7 +396,14 @@ Common::WriteStream *OSystem_SDL::createConfigWriteStream() { } 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) { |