Signed-off-by: Khem Raj <raj.k...@gmail.com>
---
 ...iconv-use-portable-across-glibc-musl.patch | 52 +++++++++++++++++++
 .../recipes-graphics/libsdl/libsdl_1.2.15.bb  |  1 +
 2 files changed, 53 insertions(+)
 create mode 100644 
meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-stdlib-Make-iconv-use-portable-across-glibc-musl.patch

diff --git 
a/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-stdlib-Make-iconv-use-portable-across-glibc-musl.patch
 
b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-stdlib-Make-iconv-use-portable-across-glibc-musl.patch
new file mode 100644
index 0000000000..2007766f74
--- /dev/null
+++ 
b/meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-stdlib-Make-iconv-use-portable-across-glibc-musl.patch
@@ -0,0 +1,52 @@
+From 6c35fc94ca30a4d0662479f7ef8a704d97aa7352 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.k...@gmail.com>
+Date: Sat, 18 May 2024 18:13:30 -0700
+Subject: [PATCH] stdlib: Make iconv use portable across glibc/musl
+
+This is a backport from libsdl2
+
+Upstream-Status: Backport 
[https://github.com/libsdl-org/SDL/blob/main/src/stdlib/SDL_iconv.c#L49C1-L51C1]
+Signed-off-by: Khem Raj <raj.k...@gmail.com>
+---
+ src/stdlib/SDL_iconv.c | 19 ++++---------------
+ 1 file changed, 4 insertions(+), 15 deletions(-)
+
+diff --git a/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c
+index fa56a99..087b6ec 100644
+--- a/src/stdlib/SDL_iconv.c
++++ b/src/stdlib/SDL_iconv.c
+@@ -28,27 +28,16 @@
+ 
+ #ifdef HAVE_ICONV
+ 
+-/* Depending on which standard the iconv() was implemented with,
+-   iconv() may or may not use const char ** for the inbuf param.
+-   If we get this wrong, it's just a warning, so no big deal.
+-*/
+-#if defined(_XGP6) || \
+-    defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && 
__GLIBC_MINOR__ >= 2))
+-#define ICONV_INBUF_NONCONST
+-#endif
+-
+ #include <errno.h>
+ 
+ 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.45.1
+
diff --git a/meta-oe/recipes-graphics/libsdl/libsdl_1.2.15.bb 
b/meta-oe/recipes-graphics/libsdl/libsdl_1.2.15.bb
index 4fc4679f7f..1f436c6d7f 100644
--- a/meta-oe/recipes-graphics/libsdl/libsdl_1.2.15.bb
+++ b/meta-oe/recipes-graphics/libsdl/libsdl_1.2.15.bb
@@ -15,6 +15,7 @@ SRC_URI = "http://www.libsdl.org/release/SDL-${PV}.tar.gz \
            file://libsdl-1.2.15-xdata32.patch \
            file://pkgconfig.patch \
            file://0001-build-Pass-tag-CC-explictly-when-using-libtool.patch \
+           file://0001-stdlib-Make-iconv-use-portable-across-glibc-musl.patch \
            file://CVE-2019-7577.patch \
            file://CVE-2019-7574.patch \
            file://CVE-2019-7572.patch \
-- 
2.45.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#110450): 
https://lists.openembedded.org/g/openembedded-devel/message/110450
Mute This Topic: https://lists.openembedded.org/mt/106228484/21656
Group Owner: openembedded-devel+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to