From df847b57a2543e39135ca073296bfe201082b942 Mon Sep 17 00:00:00 2001 From: Giulio Benetti Date: Fri, 28 Nov 2025 11:03:05 +0100 Subject: [PATCH] package/sdl: fix build failure due to type mismatch Add local patch to fix: ./src/stdlib/SDL_iconv.c: In function 'SDL_iconv': ./src/stdlib/SDL_iconv.c:50:29: error: passing argument 2 of 'iconv' from incompatible pointer type [-Wincompatible-pointer-types] 50 | retCode = iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft); | ^~~~~ | | | const char ** Fixes: https://autobuild.buildroot.net/results/cfb/cfb1f9a0137332cf080ce862722e4fe8ad275031/ Signed-off-by: Giulio Benetti [Julien: add "Upstream:" tag in patch] Signed-off-by: Julien Olivain (cherry picked from commit 03394b4989b1722b2946c31fd32c5e4690088ddd) Signed-off-by: Thomas Perale --- ...tdlib-SDL_iconv.c-fix-types-mismatch.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 package/sdl/0004-src-stdlib-SDL_iconv.c-fix-types-mismatch.patch diff --git a/package/sdl/0004-src-stdlib-SDL_iconv.c-fix-types-mismatch.patch b/package/sdl/0004-src-stdlib-SDL_iconv.c-fix-types-mismatch.patch new file mode 100644 index 0000000000..4915c6cadc --- /dev/null +++ b/package/sdl/0004-src-stdlib-SDL_iconv.c-fix-types-mismatch.patch @@ -0,0 +1,50 @@ +From 390974b8a9d5e513d48d794818dbe180e0f80b16 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti +Date: Fri, 28 Nov 2025 10:57:41 +0100 +Subject: [PATCH] src/stdlib/SDL_iconv.c: fix types mismatch + +When building sdl this error shows up: +./src/stdlib/SDL_iconv.c: In function 'SDL_iconv': +./src/stdlib/SDL_iconv.c:50:29: error: passing argument 2 of 'iconv' from incompatible pointer type [-Wincompatible-pointer-types] + 50 | retCode = iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft); + | ^~~~~ + | | + | const char ** + +Let's pick only this code from upstream commit[1] and left the rest +untouched. + +Upstream: [1] + +[1]: +https://github.com/libsdl-org/SDL-1.2/commit/8a8135d91f9361448521765c9da00401fab866a1 + +Signed-off-by: Giulio Benetti +--- + src/stdlib/SDL_iconv.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c +index fa56a99e..369f6881 100644 +--- a/src/stdlib/SDL_iconv.c ++++ b/src/stdlib/SDL_iconv.c +@@ -43,12 +43,10 @@ size_t SDL_iconv(SDL_iconv_t cd, + const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) + { +- size_t retCode; +-#ifdef ICONV_INBUF_NONCONST +- retCode = iconv(cd, (char **)inbuf, inbytesleft, outbuf, outbytesleft); +-#else +- retCode = iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft); +-#endif ++ /* iconv's second parameter may or may not be `const char const *` depending on the ++ C runtime's whims. Casting to void * seems to make everyone happy, though. */ ++ const size_t retCode = iconv((iconv_t) ((uintptr_t) cd), (void *)inbuf, inbytesleft, outbuf, outbytesleft); ++ + if ( retCode == (size_t)-1 ) { + switch(errno) { + case E2BIG: +-- +2.47.3 +