]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix compiler nitpicks (#2469)
authorGraham Percival <gperciva@tarsnap.com>
Mon, 30 Dec 2024 21:31:48 +0000 (13:31 -0800)
committerGitHub <noreply@github.com>
Mon, 30 Dec 2024 21:31:48 +0000 (13:31 -0800)
cpio/test/test_format_newc.c
libarchive/archive_read_support_format_iso9660.c
libarchive/archive_read_support_format_tar.c

index 884b6c9c4da71661bb8ffa0e7df20c8843878f53..0d59c173fa46e70647a728eddb2a3663c53fd805 100644 (file)
@@ -189,10 +189,10 @@ DEFINE_TEST(test_format_newc)
        gid = from_hex(e + 30, 8); /* gid */
        assertEqualMem(e + 38, "00000003", 8); /* nlink */
        t = from_hex(e + 46, 8); /* mtime */
-       failure("t=%#08jx now=%#08jx=%jd", (intmax_t)t, (intmax_t)now,
+       failure("t=%#08jx now=%#08jx=%jd", (uintmax_t)t, (uintmax_t)now,
            (intmax_t)now);
        assert(t <= now); /* File wasn't created in future. */
-       failure("t=%#08jx now - 2=%#08jx=%jd", (intmax_t)t, (intmax_t)now - 2,
+       failure("t=%#08jx now - 2=%#08jx=%jd", (uintmax_t)t, (uintmax_t)now - 2,
            (intmax_t)now - 2);
        assert(t >= now - 2); /* File was created w/in last 2 secs. */
        failure("newc format stores body only with last appearance of a link\n"
@@ -230,7 +230,7 @@ DEFINE_TEST(test_format_newc)
                assertEqualMem(e + 38, "00000001", 8); /* nlink */
                t2 = from_hex(e + 46, 8); /* mtime */
                failure("First entry created at t=%#08jx this entry created"
-                   " at t2=%#08jx", (intmax_t)t, (intmax_t)t2);
+                   " at t2=%#08jx", (uintmax_t)t, (uintmax_t)t2);
                assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
                assertEqualMem(e + 54, "00000005", 8); /* File size */
                fs = (uint64_t)from_hex(e + 54, 8);
@@ -266,7 +266,7 @@ DEFINE_TEST(test_format_newc)
 #endif
        t2 = from_hex(e + 46, 8); /* mtime */
        failure("First entry created at t=%#08jx this entry created at"
-           "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
+           "t2=%#08jx", (uintmax_t)t, (uintmax_t)t2);
        assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
        assertEqualMem(e + 54, "00000000", 8); /* File size */
        fs = (uint64_t)from_hex(e + 54, 8);
@@ -300,7 +300,7 @@ DEFINE_TEST(test_format_newc)
        assertEqualMem(e + 38, "00000003", 8); /* nlink */
        t2 = from_hex(e + 46, 8); /* mtime */
        failure("First entry created at t=%#08jx this entry created at"
-           "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
+           "t2=%#08jx", (uintmax_t)t, (uintmax_t)t2);
        assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
        assertEqualInt(10, from_hex(e + 54, 8)); /* File size */
        fs = (uint64_t)from_hex(e + 54, 8);
index baf265f462293596f15e957f7f87c5ba30b7c792..7d3655a951e6cc0e7ecf3ce08863a0c47feacaeb 100644 (file)
@@ -1429,7 +1429,7 @@ archive_read_format_iso9660_read_header(struct archive_read *a,
                         * information first, then store all file bodies. */
                        archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
                            "Ignoring out-of-order file @%jx (%s) %jd < %jd",
-                           (intmax_t)file->number,
+                           (uintmax_t)file->number,
                            iso9660->pathname.s,
                            (intmax_t)file->offset,
                            (intmax_t)iso9660->current_position);
index b1344ae57d4a1bd4d89dbaca5eab814bc308cd98..34ba85409418ba2590f5fd68ba240497318d1828 100644 (file)
@@ -1039,7 +1039,7 @@ header_Solaris_ACL(struct archive_read *a, struct tar *tar,
        struct archive_string    acl_text;
        size_t size;
        int err, acl_type;
-       int64_t type;
+       uint64_t type;
        char *acl, *p;
 
        header = (const struct archive_entry_header_ustar *)h;
@@ -1076,7 +1076,7 @@ header_Solaris_ACL(struct archive_read *a, struct tar *tar,
                }
                p++;
        }
-       switch ((int)type & ~0777777) {
+       switch (type & ~0777777) {
        case 01000000:
                /* POSIX.1e ACL */
                acl_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
@@ -1087,8 +1087,8 @@ header_Solaris_ACL(struct archive_read *a, struct tar *tar,
                break;
        default:
                archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
-                   "Malformed Solaris ACL attribute (unsupported type %o)",
-                   (int)type);
+                   "Malformed Solaris ACL attribute (unsupported type %"
+                   PRIo64 ")", type);
                archive_string_free(&acl_text);
                return (ARCHIVE_WARN);
        }