[Scummvm-git-logs] scummvm master -> c2e0e90c276f6ca98bb32e8258ac2a729651e99a
digitall
dgturner at iee.org
Sat Aug 24 22:44:01 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:
c2e0e90c27 SDL: Use a non-const string for SDL_iconv_string
Commit: c2e0e90c276f6ca98bb32e8258ac2a729651e99a
https://github.com/scummvm/scummvm/commit/c2e0e90c276f6ca98bb32e8258ac2a729651e99a
Author: Jaromir Wysoglad (jaromirwysoglad at gmail.com)
Date: 2019-08-24T21:43:57+01:00
Commit Message:
SDL: Use a non-const string for SDL_iconv_string
With some older versions of SDL1, the SDL_iconv_string takes
char * instead of const char * as it's argument. This should
fix the build issue with gp2xwiz.
Changed paths:
backends/platform/sdl/sdl.cpp
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index b9cccbf..c89a560 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -774,6 +774,17 @@ char *OSystem_SDL::convertEncoding(const char *to, const char *from, const char
zeroBytes = 2;
if (Common::String(from).hasPrefixIgnoreCase("utf-32"))
zeroBytes = 4;
+
+ // SDL_iconv_string() takes char * instead of const char * as it's third parameter
+ // with some older versions of SDL.
+#if SDL_VERSION_ATLEAST(2, 0, 0)
return SDL_iconv_string(to, from, string, length + zeroBytes);
+#else
+ char *stringCopy = (char *) calloc(sizeof(char), length + zeroBytes);
+ memcpy(stringCopy, string, length);
+ char *result = SDL_iconv_string(to, from, stringCopy, length + zeroBytes);
+ free(stringCopy);
+ return result;
+#endif
}
More information about the Scummvm-git-logs
mailing list