aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorTarek Soliman2019-09-23 21:08:00 -0500
committerTarek Soliman2019-09-24 09:55:27 -0500
commitd538d13ee08fae91075a6b2f0e62bb8a8ad276f0 (patch)
tree959978f9ef33d959d73884a165b2a61bc9254763 /backends/platform
parent2a26b3eef57c9f993786700e5b20351dcf1582fd (diff)
downloadscummvm-rg350-d538d13ee08fae91075a6b2f0e62bb8a8ad276f0.tar.gz
scummvm-rg350-d538d13ee08fae91075a6b2f0e62bb8a8ad276f0.tar.bz2
scummvm-rg350-d538d13ee08fae91075a6b2f0e62bb8a8ad276f0.zip
SDL: Fix build for older SDL versions
This fixed the breakage caused by 6dba0bbfd421121056fba0d348794ead2928c662 in ancient SDL1 versions that don't have SDL_iconv_string() Closes gh-1862
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/sdl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index b799d6a026..2badbb858f 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -760,6 +760,7 @@ int SDL_SetColorKey_replacement(SDL_Surface *surface, Uint32 flag, Uint32 key) {
#endif
char *OSystem_SDL::convertEncoding(const char *to, const char *from, const char *string, size_t length) {
+#if SDL_VERSION_ATLEAST(1, 2, 10)
int zeroBytes = 1;
if (Common::String(from).hasPrefixIgnoreCase("utf-16"))
zeroBytes = 2;
@@ -776,7 +777,7 @@ char *OSystem_SDL::convertEncoding(const char *to, const char *from, const char
memcpy(stringCopy, string, length);
result = SDL_iconv_string(to, from, stringCopy, length + zeroBytes);
free(stringCopy);
-#endif
+#endif // SDL_VERSION_ATLEAST(2, 0, 0)
if (result == nullptr)
return nullptr;
@@ -800,5 +801,8 @@ char *OSystem_SDL::convertEncoding(const char *to, const char *from, const char
memcpy(finalResult, result, newLength + zeroBytes);
SDL_free(result);
return finalResult;
+#else
+ return ModularBackend::convertEncoding(to, from, string, length);
+#endif // SDL_VERSION_ATLEAST(1, 2, 10)
}