]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use explicit casts for some functions (#2480)
authorGraham Percival <gperciva@tarsnap.com>
Sun, 6 Apr 2025 07:26:53 +0000 (00:26 -0700)
committerGitHub <noreply@github.com>
Sun, 6 Apr 2025 07:26:53 +0000 (09:26 +0200)
libarchive/archive_disk_acl_freebsd.c
libarchive/archive_getdate.c
libarchive/archive_read_support_format_rar.c
libarchive/archive_string.c
libarchive/test/test_acl_platform_nfs4.c
libarchive/test/test_archive_string_conversion.c
unzip/bsdunzip.c

index ed4e7a7896a9e22a201db4d03dd9defaf61f691c..2fbdb17aa5645e025c56199a3c68be8dd6dc6624 100644 (file)
@@ -262,7 +262,7 @@ translate_acl(struct archive_read_disk *a,
                        }
                        for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
                                r = acl_get_flag_np(acl_flagset,
-                                   acl_nfs4_flag_map[i].p_perm);
+                                   (acl_flag_t)acl_nfs4_flag_map[i].p_perm);
                                if (r == -1) {
                                        archive_set_error(&a->archive, errno,
                                            "Failed to check flag in a NFSv4 "
@@ -517,7 +517,7 @@ set_acl(struct archive *a, int fd, const char *name,
                        for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
                                if (ae_permset & acl_nfs4_flag_map[i].a_perm) {
                                        if (acl_add_flag_np(acl_flagset,
-                                           acl_nfs4_flag_map[i].p_perm) != 0) {
+                                           (acl_flag_t)acl_nfs4_flag_map[i].p_perm) != 0) {
                                                archive_set_error(a, errno,
                                                    "Failed to add flag to "
                                                    "NFSv4 ACL flagset");
index 69eebb0a079f2ec729b9720b1d9c321ef5ed4168..bf387ac695d609210d4edeae483734a8ac1ada8a 100644 (file)
@@ -861,7 +861,8 @@ nexttoken(const char **in, time_t *value)
                            && i < sizeof(buff)-1) {
                                if (*src != '.') {
                                        if (isupper((unsigned char)*src))
-                                               buff[i++] = tolower((unsigned char)*src);
+                                               buff[i++] = (char)tolower(
+                                                   (unsigned char)*src);
                                        else
                                                buff[i++] = *src;
                                }
index 9d155c66d0924c3a1fd9a8d659c94f22f23b36cf..b4e61f6d957f4226928a5396709d38fd23bfd225 100644 (file)
@@ -2933,7 +2933,7 @@ expand(struct archive_read *a, int64_t *end)
 
     if (symbol < 256)
     {
-      lzss_emit_literal(rar, symbol);
+      lzss_emit_literal(rar, (uint8_t)symbol);
       continue;
     }
     else if (symbol == 256)
index 8ab3b994b4bb2febaa793a217bf9f2b81ec3c6a8..a996334d641fc69b6650d494c6b6643753962ba6 100644 (file)
@@ -2634,7 +2634,7 @@ unicode_to_utf16be(char *p, size_t remaining, uint32_t uc)
        } else {
                if (remaining < 2)
                        return (0);
-               archive_be16enc(utf16, uc);
+               archive_be16enc(utf16, (uint16_t)uc);
                return (2);
        }
 }
@@ -2656,7 +2656,7 @@ unicode_to_utf16le(char *p, size_t remaining, uint32_t uc)
        } else {
                if (remaining < 2)
                        return (0);
-               archive_le16enc(utf16, uc);
+               archive_le16enc(utf16, (uint16_t)uc);
                return (2);
        }
 }
@@ -3825,9 +3825,9 @@ best_effort_strncat_to_utf16(struct archive_string *as16, const void *_p,
                        ret = -1;
                }
                if (bigendian)
-                       archive_be16enc(utf16, c);
+                       archive_be16enc(utf16, (uint16_t)c);
                else
-                       archive_le16enc(utf16, c);
+                       archive_le16enc(utf16, (uint16_t)c);
                utf16 += 2;
        }
        as16->length = utf16 - as16->s;
index 6e19bca4fde7eda2fca02f581ed57c2bd8ef6c07..bcd8974316d4c6bddba50c3e615e16ab324646d6 100644 (file)
@@ -424,7 +424,7 @@ acl_flagset_to_bitmap(acl_flagset_t opaque_fs)
 #if ARCHIVE_ACL_SUNOS_NFS4 || ARCHIVE_ACL_LIBRICHACL
                if (flags & perms[i].machine)
 #else
-               if (acl_get_flag_np(opaque_fs, perms[i].machine))
+               if (acl_get_flag_np(opaque_fs, (acl_flag_t)perms[i].machine))
 #endif
                        flagset |= perms[i].portable;
        return flagset;
index 67e9b762aa58563e798b361996e67394cb484a05..12976f3e70ecb45c445b041a6d8c192531f44456 100644 (file)
@@ -91,7 +91,7 @@ unicode_to_utf16be(char *p, uint32_t uc)
                archive_be16enc(utf16+2, (uc & 0x3ff) + 0xDC00);
                return (4);
        } else {
-               archive_be16enc(utf16, uc);
+               archive_be16enc(utf16, (uint16_t)uc);
                return (2);
        }
 }
@@ -118,7 +118,7 @@ unicode_to_utf16le(char *p, uint32_t uc)
                archive_le16enc(utf16+2, (uc & 0x3ff) + 0xDC00);
                return (4);
        } else {
-               archive_le16enc(utf16, uc);
+               archive_le16enc(utf16, (uint16_t)uc);
                return (2);
        }
 }
index 4a9028b79b2c56c37b6079191a829796e37841a5..f2bd143569e0c8b764b7212b3c3c9e87fb634e35 100644 (file)
@@ -233,7 +233,7 @@ pathdup(const char *path)
        }
        if (L_opt) {
                for (i = 0; i < len; ++i)
-                       str[i] = tolower((unsigned char)path[i]);
+                       str[i] = (char)tolower((unsigned char)path[i]);
        } else {
                memcpy(str, path, len);
        }