From: Graham Percival Date: Mon, 30 Dec 2024 21:31:48 +0000 (-0800) Subject: Fix compiler nitpicks (#2469) X-Git-Tag: v3.8.0~80 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=982747fd66ea69875052ec62598a72d2fa2f9469;p=thirdparty%2Flibarchive.git Fix compiler nitpicks (#2469) --- diff --git a/cpio/test/test_format_newc.c b/cpio/test/test_format_newc.c index 884b6c9c4..0d59c173f 100644 --- a/cpio/test/test_format_newc.c +++ b/cpio/test/test_format_newc.c @@ -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); diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c index baf265f46..7d3655a95 100644 --- a/libarchive/archive_read_support_format_iso9660.c +++ b/libarchive/archive_read_support_format_iso9660.c @@ -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); diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index b1344ae57..34ba85409 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -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); }