]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
fix handling of missing const type qualifier
authorRudi Heitbaum <rudi@heitbaum.com>
Mon, 16 Feb 2026 10:20:04 +0000 (10:20 +0000)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 9 May 2026 10:21:27 +0000 (12:21 +0200)
Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
libarchive/archive_pack_dev.c
libarchive/archive_read_support_format_mtree.c
libarchive/archive_read_support_format_tar.c
libarchive/archive_write_set_format_iso9660.c
libarchive/archive_write_set_format_mtree.c
libarchive/archive_write_set_format_warc.c

index 3c6209b9840560d7fb4e6cecf65780042802eee3..e29351292895a7a3d2d5e04e0e361cea0f671f84 100644 (file)
@@ -319,7 +319,7 @@ compare_format(const void *key, const void *element)
 pack_t *
 pack_find(const char *name)
 {
-       struct format   *format;
+       const struct format     *format;
 
        format = bsearch(name, formats,
            sizeof(formats)/sizeof(formats[0]),
index 4a5a49ca813635c7113a30595838a4487ebff473..7a13c8e6e82511482bf77a71a13dd1f0948f0675 100644 (file)
@@ -2100,8 +2100,7 @@ readline(struct archive_read *a, struct mtree *mtree, char **start,
        ssize_t bytes_read;
        ssize_t total_size = 0;
        ssize_t find_off = 0;
-       const void *t;
-       void *nl;
+       const void *nl, *t;
        char *u;
 
        /* Accumulate line in a line buffer. */
index a16f4c064776048e8d30a360f0d768b360c156fe..dadc8370842d99971d9755c805dd3490ac799057 100644 (file)
@@ -3636,9 +3636,8 @@ readline(struct archive_read *a, struct tar *tar, const char **start,
 {
        ssize_t bytes_read;
        ssize_t total_size = 0;
-       const void *t;
+       const void *p, *t;
        const char *s;
-       void *p;
 
        if (tar_flush_unconsumed(a, unconsumed) != ARCHIVE_OK) {
                return (ARCHIVE_FATAL);
index 576b3ba52b0c7506b3e5bdc453dded1a5ff18fee..eee9f2c75aec7bbf98f70a083eb0c79ce5e5b849 100644 (file)
@@ -5537,7 +5537,7 @@ isoent_setup_file_location(struct iso9660 *iso9660, int location)
 static int
 get_path_component(char *name, size_t n, const char *fn)
 {
-       char *p;
+       const char *p;
        size_t l;
 
        p = strchr(fn, '/');
index 36e00191c8c76afdae3dbe59307ac3ffd5b3e3e3..0a00a3550bbd2d55c6b01bbd3d8d9f8f8311b781 100644 (file)
@@ -2039,7 +2039,7 @@ mtree_entry_find_child(struct mtree_entry *parent, const char *child_name)
 static int
 get_path_component(char *name, size_t n, const char *fn)
 {
-       char *p;
+       const char *p;
        size_t l;
 
        p = strchr(fn, '/');
index 3d22e1f4ba57f58cdd41a0b0b11fb3516df59416..5a0ca0b5261108c008bd2f11caa1912169bec292 100644 (file)
@@ -371,7 +371,7 @@ _popul_ehdr(struct archive_string *tgt, size_t tsz, warc_essential_hdr_t hdr)
                static const char _uri[] = "";
                static const char _fil[] = "file://";
                const char *u;
-               char *chk = strchr(hdr.tgturi, ':');
+               const char *chk = strchr(hdr.tgturi, ':');
 
                if (chk != NULL && chk[1U] == '/' && chk[2U] == '/') {
                        /* yep, it's definitely a URI */