From bb28ed7b7a10535c4f3f275b3bef3643f9ce46d3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 28 Jun 2009 19:58:11 +0000 Subject: Changed OSystem::setWindowCaption to expect ISO LATIN 1 encoded input; also intentionally broke WinCE and Symbian ports (in an obvious way that can be undo by commenting out some text) -- hopefully this will get the maintainers' attention during the next release cycle, unlike my emails svn-id: r41932 --- backends/platform/sdl/sdl.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'backends/platform/sdl') diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index c11c97c041..af6d350688 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -391,13 +391,20 @@ Common::WriteStream *OSystem_SDL::createConfigWriteStream() { } void OSystem_SDL::setWindowCaption(const char *caption) { - Common::String cap(caption); + Common::String cap; + byte c; + + // The string caption is supposed to be in LATIN-1 encoding. + // SDL expects UTF-8. So we perform the conversion here. + while ((c = *(const byte *)caption++)) { + if (c < 0x80) + cap += c; + else { + cap += 0xc0 | (c >> 6); + cap += 0x80 | (c & 0x3F); + } + } - // 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()); } -- cgit v1.2.3 From d120ca8f5ccaf3d431a61ca074740e518740d9e9 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 28 Jun 2009 22:20:28 +0000 Subject: For consistency, use upper-case letter in hex constant. svn-id: r41938 --- backends/platform/sdl/sdl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/platform/sdl') diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index af6d350688..5d156ebd88 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -400,7 +400,7 @@ void OSystem_SDL::setWindowCaption(const char *caption) { if (c < 0x80) cap += c; else { - cap += 0xc0 | (c >> 6); + cap += 0xC0 | (c >> 6); cap += 0x80 | (c & 0x3F); } } -- cgit v1.2.3 From beca7b16c4a597d6c486020ed1439834b357d776 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 29 Jun 2009 12:33:47 +0000 Subject: Indentation fix. svn-id: r41940 --- backends/platform/sdl/sdl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/platform/sdl') diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 5d156ebd88..b353c79495 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -490,7 +490,7 @@ void OSystem_SDL::quit() { void OSystem_SDL::setupIcon() { int x, y, w, h, ncols, nbytes, i; unsigned int rgba[256]; - unsigned int *icon; + unsigned int *icon; sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes); if ((w > 512) || (h > 512) || (ncols > 255) || (nbytes > 1)) { -- cgit v1.2.3