From: Graham Percival Date: Mon, 30 Dec 2024 16:30:42 +0000 (-0800) Subject: Fix compiler nitpicks (#2465) X-Git-Tag: v3.8.0~84 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=edcae6c164717df48c59e6c2dc3e2510fa34ad87;p=thirdparty%2Flibarchive.git Fix compiler nitpicks (#2465) --- diff --git a/cpio/test/test_option_c.c b/cpio/test/test_option_c.c index e87484495..211f2142d 100644 --- a/cpio/test/test_option_c.c +++ b/cpio/test/test_option_c.c @@ -117,7 +117,7 @@ DEFINE_TEST(test_option_c) gid = (int)from_octal(e + 30, 6); assertEqualMem(e + 36, "000001", 6); /* nlink */ failure("file entries should not have rdev set (dev field was 0%o)", - dev); + (unsigned int)dev); assertEqualMem(e + 42, "000000", 6); /* rdev */ t = from_octal(e + 48, 11); /* mtime */ assert(t <= now); /* File wasn't created in future. */ diff --git a/libarchive/archive_read_support_format_rar5.c b/libarchive/archive_read_support_format_rar5.c index 0671427c9..167d7e4f4 100644 --- a/libarchive/archive_read_support_format_rar5.c +++ b/libarchive/archive_read_support_format_rar5.c @@ -1294,7 +1294,7 @@ static int parse_file_extra_hash(struct archive_read* a, struct rar5* rar, *extra_data_size -= hash_size; } else { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unsupported hash type (0x%x)", (int) hash_type); + "Unsupported hash type (0x%jx)", (uintmax_t)hash_type); return ARCHIVE_FATAL; } @@ -1897,7 +1897,8 @@ static int process_head_file(struct archive_read* a, struct rar5* rar, } else { /* Unknown host OS */ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unsupported Host OS: 0x%x", (int) host_os); + "Unsupported Host OS: 0x%jx", + (uintmax_t)host_os); return ARCHIVE_FATAL; } @@ -2105,8 +2106,8 @@ static int process_head_main(struct archive_read* a, struct rar5* rar, default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unsupported extra type (0x%x)", - (int) extra_field_id); + "Unsupported extra type (0x%jx)", + (uintmax_t)extra_field_id); return ARCHIVE_FATAL; } diff --git a/libarchive/test/test_write_format_tar_sparse.c b/libarchive/test/test_write_format_tar_sparse.c index 1568b0ead..2e69f2239 100644 --- a/libarchive/test/test_write_format_tar_sparse.c +++ b/libarchive/test/test_write_format_tar_sparse.c @@ -38,7 +38,7 @@ test_1(void) char *buff2; size_t buff2_size = 0x13000; char buff3[1024]; - long i; + unsigned long i; assert((buff2 = malloc(buff2_size)) != NULL); /* Repeat the following for a variety of odd blocksizes. */ @@ -181,7 +181,7 @@ test_2(void) char *buff2; size_t buff2_size = 0x11000; char buff3[1024]; - long i; + unsigned long i; assert((buff2 = malloc(buff2_size)) != NULL); /* Create a new archive in memory. */ diff --git a/tar/test/test_stdio.c b/tar/test/test_stdio.c index 95f6f8db9..239f3815f 100644 --- a/tar/test/test_stdio.c +++ b/tar/test/test_stdio.c @@ -26,7 +26,7 @@ static const char *xvf_err = * This string should appear in the verbose listing regardless of platform, * locale, username, or groupname. */ -const char * tvf_contains = "l link to f"; +static const char * tvf_contains = "l link to f"; DEFINE_TEST(test_stdio) { diff --git a/test_utils/test_main.c b/test_utils/test_main.c index b2eae6381..1a0c2e0eb 100644 --- a/test_utils/test_main.c +++ b/test_utils/test_main.c @@ -629,8 +629,10 @@ assertion_equal_int(const char *file, int line, if (v1 == v2) return (1); failure_start(file, line, "%s != %s", e1, e2); - logprintf(" %s=%lld (0x%llx, 0%llo)\n", e1, v1, v1, v1); - logprintf(" %s=%lld (0x%llx, 0%llo)\n", e2, v2, v2, v2); + logprintf(" %s=%lld (0x%llx, 0%llo)\n", e1, v1, + (unsigned long long)v1, (unsigned long long)v1); + logprintf(" %s=%lld (0x%llx, 0%llo)\n", e2, v2, + (unsigned long long)v2, (unsigned long long)v2); failure_finish(extra); return (0); } @@ -899,7 +901,7 @@ hexdump(const char *p, const char *ref, size_t l, size_t offset) for (j = 0; j < 16 && i + j < l; j++) { if (ref != NULL && p[i + j] != ref[i + j]) sep = '_'; - logprintf("%c%02x", sep, 0xff & (int)p[i+j]); + logprintf("%c%02x", sep, 0xff & (unsigned int)p[i+j]); if (ref != NULL && p[i + j] == ref[i + j]) sep = ' '; }