[Scummvm-git-logs] scummvm branch-2-1 -> 7baace5f237df3699a0a4a461dae2aae8c9de2fb

tsoliman tarek at bashasoliman.com
Tue Sep 24 16:58:44 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7baace5f23 SDL: Fix build for older SDL versions


Commit: 7baace5f237df3699a0a4a461dae2aae8c9de2fb
    https://github.com/scummvm/scummvm/commit/7baace5f237df3699a0a4a461dae2aae8c9de2fb
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2019-09-24T09:58:02-05:00

Commit Message:
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()

(cherry picked from commit d538d13ee08fae91075a6b2f0e62bb8a8ad276f0)

Changed paths:
    backends/platform/sdl/sdl.cpp


diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index b799d6a..2badbb8 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)
 }
 





More information about the Scummvm-git-logs mailing list