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 <giulio.benetti@benettiengineering.com>
[Julien: add "Upstream:" tag in patch]
Signed-off-by: Julien Olivain <ju.o@free.fr>
(cherry picked from commit 03394b4989)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
committed by
Thomas Perale
parent
784ac62c94
commit
df847b57a2
@@ -0,0 +1,50 @@
|
||||
From 390974b8a9d5e513d48d794818dbe180e0f80b16 Mon Sep 17 00:00:00 2001
|
||||
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
|
||||
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 <giulio.benetti@benettiengineering.com>
|
||||
---
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user