diff mbox series

[1/2] gd: Add patch to fix compiler error about missing const

Message ID 11abf2a38c37c565257019092e68b85ac257fb4f.1773489599.git.joerg.sommer@navimatix.de
State New
Headers show
Series [1/2] gd: Add patch to fix compiler error about missing const | expand

Commit Message

Jörg Sommer March 14, 2026, noon UTC
From: Jörg Sommer <joerg.sommer@navimatix.de>

Gcc complains about:

| ../../sources/gd-2.3.3/src/gd_filename.c: In function 'ftype':
| ../../sources/gd-2.3.3/src/gd_filename.c:99:9: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
|    99 |     ext = strrchr(filename, '.');
|       |         ^
| cc1: all warnings being treated as errors

Even the newest git master commit does not fix this.

Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de>
---
 .../gd/gd/Fix-ftype-missing-const.patch       | 23 +++++++++++++++++++
 meta-oe/recipes-support/gd/gd_2.3.3.bb        |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 meta-oe/recipes-support/gd/gd/Fix-ftype-missing-const.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/gd/gd/Fix-ftype-missing-const.patch b/meta-oe/recipes-support/gd/gd/Fix-ftype-missing-const.patch
new file mode 100644
index 0000000000..294979ffd9
--- /dev/null
+++ b/meta-oe/recipes-support/gd/gd/Fix-ftype-missing-const.patch
@@ -0,0 +1,23 @@ 
+gcc complains about
+
+| ../../sources/gd-2.3.3/src/gd_filename.c: In function 'ftype':
+| ../../sources/gd-2.3.3/src/gd_filename.c:99:9: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
+|    99 |     ext = strrchr(filename, '.');
+|       |         ^
+| cc1: all warnings being treated as errors
+
+Upstream-Status: Submitted [https://github.com/libgd/libgd/issues/985]
+
+diff --git i/src/gd_filename.c w/src/gd_filename.c
+index 7ce4817f..89b25204 100644
+--- i/src/gd_filename.c
++++ w/src/gd_filename.c
+@@ -93,7 +93,7 @@ static const struct FileType {
+ static const struct FileType *
+ ftype(const char *filename) {
+     int n;
+-    char *ext;
++    const char *ext;
+
+     /* Find the file extension (i.e. the last period in the string. */
+     ext = strrchr(filename, '.');
diff --git a/meta-oe/recipes-support/gd/gd_2.3.3.bb b/meta-oe/recipes-support/gd/gd_2.3.3.bb
index ea5c487c52..0d7a6d34f9 100644
--- a/meta-oe/recipes-support/gd/gd_2.3.3.bb
+++ b/meta-oe/recipes-support/gd/gd_2.3.3.bb
@@ -15,6 +15,7 @@  DEPENDS = "freetype libpng jpeg zlib tiff"
 
 SRC_URI = "git://github.com/libgd/libgd.git;nobranch=1;protocol=https \
            file://0001-Fix-deprecared-function-prototypes.patch \
+           file://Fix-ftype-missing-const.patch \
            "
 
 SRCREV = "b5319a41286107b53daa0e08e402aa1819764bdc"