From 2ac260a2719e01571a49bb5ccea674991171eb31 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Mon, 20 Apr 2026 11:54:35 +0300 Subject: [PATCH] media-libs/libgphoto2: C23 fix * Clang-22 is picker about these incompatabilities. This compounds with autoconf 2.73 opportunistically using C23 where possible. Signed-off-by: Alfred Wingate Part-of: https://codeberg.org/gentoo/gentoo/pulls/675 Merges: https://codeberg.org/gentoo/gentoo/pulls/675 Signed-off-by: Sam James --- .../files/libgphoto2-2.5.33-c23.patch | 71 +++++++++++++++++++ .../libgphoto2/libgphoto2-2.5.33.ebuild | 4 ++ 2 files changed, 75 insertions(+) create mode 100644 media-libs/libgphoto2/files/libgphoto2-2.5.33-c23.patch diff --git a/media-libs/libgphoto2/files/libgphoto2-2.5.33-c23.patch b/media-libs/libgphoto2/files/libgphoto2-2.5.33-c23.patch new file mode 100644 index 0000000000000..71bd5e1618f7c --- /dev/null +++ b/media-libs/libgphoto2/files/libgphoto2-2.5.33-c23.patch @@ -0,0 +1,71 @@ +https://github.com/gphoto/libgphoto2/pull/1235 +https://github.com/gphoto/libgphoto2/commit/7cbc8b7241f73835270493d26e440b27060cb3df + +From 7cbc8b7241f73835270493d26e440b27060cb3df Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 4 Apr 2026 14:56:01 -0700 +Subject: [PATCH] libgphoto2: fix const-correctness for c23 builds + +C23 treats the return values of strrchr() and strchr() as const char * +when the input string is const-qualified. Update local variables to use +const char * where appropriate to avoid discarded-qualifier warnings and +build failures with -std=gnu23. + +No functional change intended. + +Signed-off-by: Khem Raj +--- a/camlibs/directory/directory.c ++++ b/camlibs/directory/directory.c +@@ -125,7 +125,7 @@ static const char * + get_mime_type (const char *filename) + { + +- char *dot; ++ const char *dot; + int x=0; + + dot = strrchr(filename, '.'); +--- a/libgphoto2/gphoto2-file.c ++++ b/libgphoto2/gphoto2-file.c +@@ -611,7 +611,7 @@ int + gp_file_open (CameraFile *file, const char *filename) + { + FILE *fp; +- char *name, *dot; ++ const char *name, *dot; + long size, size_read; + int i; + struct stat s; +@@ -907,8 +907,8 @@ gp_file_get_name (CameraFile *file, const char **name) + int + gp_file_get_name_by_type (CameraFile *file, const char *basename, CameraFileType type, char **newname) + { +- char *prefix = NULL, *s, *new, *slash = NULL; +- const char *suffix = NULL; ++ char *prefix = NULL, *new; ++ const char *suffix = NULL, *s, *slash = NULL; + int i; + + C_PARAMS (file && basename && newname); +--- a/libgphoto2/gphoto2-filesys.c ++++ b/libgphoto2/gphoto2-filesys.c +@@ -521,7 +521,7 @@ append_to_folder (CameraFilesystemFolder *folder, + CameraFilesystemFolder **newfolder + ) { + CameraFilesystemFolder *f; +- char *s; ++ const char *s; + + GP_LOG_D ("Append to folder %p/%s - %s", folder, folder->name, foldername); + /* Handle multiple slashes, and slashes at the end */ +--- a/packaging/generic/print-camera-list.c ++++ b/packaging/generic/print-camera-list.c +@@ -1138,7 +1138,7 @@ escape_html(const char *str) { + newstr = malloc(strlen(str)+1+inc); + s = str; ns = newstr; + do { +- char *x; ++ const char *x; + x = strchr(s,'&'); + if (x) { + memcpy (ns, s, x-s); diff --git a/media-libs/libgphoto2/libgphoto2-2.5.33.ebuild b/media-libs/libgphoto2/libgphoto2-2.5.33.ebuild index 1bf99a30f571c..3f88862acd130 100644 --- a/media-libs/libgphoto2/libgphoto2-2.5.33.ebuild +++ b/media-libs/libgphoto2/libgphoto2-2.5.33.ebuild @@ -80,6 +80,10 @@ MULTILIB_CHOST_TOOLS=( /usr/bin/gphoto2-config ) +PATCHES=( + "${FILESDIR}"/libgphoto2-2.5.33-c23.patch +) + src_prepare() { default