diff options
Diffstat (limited to 'meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-stdlib-Make-iconv-use-portable-across-glibc-musl.patch')
-rw-r--r-- | meta-oe/recipes-graphics/libsdl/libsdl-1.2.15/0001-stdlib-Make-iconv-use-portable-across-glibc-musl.patch | 52 |
1 files changed, 52 insertions, 0 deletions
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 @@ | |||
1 | From 6c35fc94ca30a4d0662479f7ef8a704d97aa7352 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 18 May 2024 18:13:30 -0700 | ||
4 | Subject: [PATCH] stdlib: Make iconv use portable across glibc/musl | ||
5 | |||
6 | This is a backport from libsdl2 | ||
7 | |||
8 | Upstream-Status: Backport [https://github.com/libsdl-org/SDL/blob/main/src/stdlib/SDL_iconv.c#L49C1-L51C1] | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | src/stdlib/SDL_iconv.c | 19 ++++--------------- | ||
12 | 1 file changed, 4 insertions(+), 15 deletions(-) | ||
13 | |||
14 | diff --git a/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c | ||
15 | index fa56a99..087b6ec 100644 | ||
16 | --- a/src/stdlib/SDL_iconv.c | ||
17 | +++ b/src/stdlib/SDL_iconv.c | ||
18 | @@ -28,27 +28,16 @@ | ||
19 | |||
20 | #ifdef HAVE_ICONV | ||
21 | |||
22 | -/* Depending on which standard the iconv() was implemented with, | ||
23 | - iconv() may or may not use const char ** for the inbuf param. | ||
24 | - If we get this wrong, it's just a warning, so no big deal. | ||
25 | -*/ | ||
26 | -#if defined(_XGP6) || \ | ||
27 | - defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) | ||
28 | -#define ICONV_INBUF_NONCONST | ||
29 | -#endif | ||
30 | - | ||
31 | #include <errno.h> | ||
32 | |||
33 | size_t SDL_iconv(SDL_iconv_t cd, | ||
34 | const char **inbuf, size_t *inbytesleft, | ||
35 | char **outbuf, size_t *outbytesleft) | ||
36 | { | ||
37 | - size_t retCode; | ||
38 | -#ifdef ICONV_INBUF_NONCONST | ||
39 | - retCode = iconv(cd, (char **)inbuf, inbytesleft, outbuf, outbytesleft); | ||
40 | -#else | ||
41 | - retCode = iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft); | ||
42 | -#endif | ||
43 | + /* iconv's second parameter may or may not be `const char const *` depending on the | ||
44 | + C runtime's whims. Casting to void * seems to make everyone happy, though. */ | ||
45 | + | ||
46 | + const size_t retCode = iconv((iconv_t)((uintptr_t)cd), (void *)inbuf, inbytesleft, outbuf, outbytesleft); | ||
47 | if ( retCode == (size_t)-1 ) { | ||
48 | switch(errno) { | ||
49 | case E2BIG: | ||
50 | -- | ||
51 | 2.45.1 | ||
52 | |||