]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix compilation warnings (#2246)
authorDuncan Horn <40036384+dunhor@users.noreply.github.com>
Wed, 14 Aug 2024 08:09:01 +0000 (01:09 -0700)
committerGitHub <noreply@github.com>
Wed, 14 Aug 2024 08:09:01 +0000 (10:09 +0200)
Fix warnings I'm hitting, at least with MSVC

libarchive/archive_read_support_format_rar.c
libarchive/archive_read_support_format_tar.c

index f4dcb75281fd3c4b7df16c9556eb84edd64f7dd8..e041ff765c0d3f69d54f892bac1d797a29d641c4 100644 (file)
@@ -3690,7 +3690,7 @@ execute_filter_e8(struct rar_filter *filter, struct rar_virtual_machine *vm, siz
     {
       uint32_t currpos = (uint32_t)pos + i + 1;
       int32_t address = (int32_t)vm_read_32(vm, i + 1);
-      if (address < 0 && currpos >= -(uint32_t)address)
+      if (address < 0 && currpos >= (~(uint32_t)address + 1))
         vm_write_32(vm, i + 1, address + filesize);
       else if (address >= 0 && (uint32_t)address < filesize)
         vm_write_32(vm, i + 1, address - currpos);
index f8005e1a238505e4ea893038c8c2b1e87bf9c0c0..af601efba63953e6274a9fae5eb020b11cf96fe9 100644 (file)
@@ -2476,13 +2476,13 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent
                        }
                        else if (key_length == 8 && memcmp(key, "devmajor", 8) == 0) {
                                if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
-                                       archive_entry_set_rdevmajor(entry, t);
+                                       archive_entry_set_rdevmajor(entry, (dev_t)t);
                                }
                                return (err);
                        }
                        else if (key_length == 8 && memcmp(key, "devminor", 8) == 0) {
                                if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
-                                       archive_entry_set_rdevminor(entry, t);
+                                       archive_entry_set_rdevminor(entry, (dev_t)t);
                                }
                                return (err);
                        }
@@ -2505,7 +2505,7 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent
                        }
                        else if (key_length == 3 && memcmp(key, "dev", 3) == 0) {
                                if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
-                                       archive_entry_set_dev(entry, t);
+                                       archive_entry_set_dev(entry, (dev_t)t);
                                }
                                return (err);
                        }
@@ -2517,7 +2517,7 @@ pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *ent
                        }
                        else if (key_length == 5 && memcmp(key, "nlink", 5) == 0) {
                                if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
-                                       archive_entry_set_nlink(entry, t);
+                                       archive_entry_set_nlink(entry, (unsigned int)t);
                                }
                                return (err);
                        }