From d538d13ee08fae91075a6b2f0e62bb8a8ad276f0 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Mon, 23 Sep 2019 21:08:00 -0500 Subject: 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 --- backends/platform/sdl/sdl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backends/platform') 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) } -- cgit v1.2.3