]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix %d -> %u for unsigned int from i4le() (#2448)
authorGraham Percival <gperciva@tarsnap.com>
Tue, 24 Dec 2024 23:27:26 +0000 (15:27 -0800)
committerGitHub <noreply@github.com>
Tue, 24 Dec 2024 23:27:26 +0000 (15:27 -0800)
`i4le()` returns an unsigned int, so `'%d'` is incorrect.

Reported by `clang -Wformat`. (Many more such fixes to come, but this is
the simplest set of them.)

libarchive/test/test_write_format_zip64_stream.c
libarchive/test/test_write_format_zip_compression_bzip2.c
libarchive/test/test_write_format_zip_compression_lzmaxz.c
libarchive/test/test_write_format_zip_compression_store.c
libarchive/test/test_write_format_zip_compression_zstd.c
libarchive/test/test_write_format_zip_file.c
libarchive/test/test_write_format_zip_file_zip64.c
libarchive/test/test_write_format_zip_stream.c

index 208406b30ce4bcda6b5e275f0ea5e5f2034e9820..5f650bccb74dc49802a7b1997f625967a1406f51 100644 (file)
@@ -124,7 +124,7 @@ DEFINE_TEST(test_write_format_zip64_stream)
 
        /* Get address of first entry in central directory. */
        central_header = p = buff + i4le(buffend - 6);
-       failure("Central file record at offset %d should begin with"
+       failure("Central file record at offset %u should begin with"
            " PK\\001\\002 signature",
            i4le(buffend - 10));
 
index cf1621dad3cb69ad18c0baa98bf5f61045e18121..969c4ddd92ff968fae792c3c54a59314eae5a9d6 100644 (file)
@@ -130,7 +130,7 @@ static void verify_bzip2_contents(const char *buff, size_t used)
        assertEqualInt(i2le(p + 6), 0);
        failure("All central dir entries are on this disk");
        assertEqualInt(i2le(p + 8), i2le(p + 10));
-       failure("CD start (%d) + CD length (%d) should == archive size - 22",
+       failure("CD start (%u) + CD length (%u) should == archive size - 22",
            i4le(p + 12), i4le(p + 16));
        assertEqualInt(i4le(p + 12) + i4le(p + 16), used - 22);
        failure("no zip comment");
@@ -138,7 +138,7 @@ static void verify_bzip2_contents(const char *buff, size_t used)
 
        /* Get address of first entry in central directory. */
        p = buff + i4le(buffend - 6);
-       failure("Central file record at offset %d should begin with"
+       failure("Central file record at offset %u should begin with"
            " PK\\001\\002 signature",
            i4le(buffend - 10));
 
index ad24e1409e249896ac38ce8964b326d2c2433e7f..4b5be2913979ca39f415cc45d5d95b751cb4e81e 100644 (file)
@@ -105,7 +105,7 @@ static void verify_xz_lzma(const char *buff, size_t used, uint16_t id,
        assertEqualInt(i2le(p + 6), 0);
        failure("All central dir entries are on this disk");
        assertEqualInt(i2le(p + 8), i2le(p + 10));
-       failure("CD start (%d) + CD length (%d) should == archive size - 22",
+       failure("CD start (%u) + CD length (%u) should == archive size - 22",
            i4le(p + 12), i4le(p + 16));
        assertEqualInt(i4le(p + 12) + i4le(p + 16), used - 22);
        failure("no zip comment");
@@ -113,7 +113,7 @@ static void verify_xz_lzma(const char *buff, size_t used, uint16_t id,
 
        /* Get address of first entry in central directory. */
        p = buff + i4le(buffend - 6);
-       failure("Central file record at offset %d should begin with"
+       failure("Central file record at offset %u should begin with"
            " PK\\001\\002 signature",
            i4le(buffend - 10));
 
index afd517eb21bf1f0dc25ef75b546e695f523b72e2..495509c05d102938df13963fc7233a64db85640e 100644 (file)
@@ -142,7 +142,7 @@ static void verify_uncompressed_contents(const char *buff, size_t used)
        assertEqualInt(i2le(p + 6), 0);
        failure("All central dir entries are on this disk");
        assertEqualInt(i2le(p + 8), i2le(p + 10));
-       failure("CD start (%d) + CD length (%d) should == archive size - 22",
+       failure("CD start (%u) + CD length (%u) should == archive size - 22",
            i4le(p + 12), i4le(p + 16));
        assertEqualInt(i4le(p + 12) + i4le(p + 16), used - 22);
        failure("no zip comment");
@@ -150,7 +150,7 @@ static void verify_uncompressed_contents(const char *buff, size_t used)
 
        /* Get address of first entry in central directory. */
        p = buff + i4le(buffend - 6);
-       failure("Central file record at offset %d should begin with"
+       failure("Central file record at offset %u should begin with"
            " PK\\001\\002 signature",
            i4le(buffend - 10));
 
index cc71e5cb8b2ae3cba3760de75af64eccc48418b6..aeef3553590055186e8a5cd817da8d7b879fee2c 100644 (file)
@@ -130,7 +130,7 @@ static void verify_zstd_contents(const char *buff, size_t used)
        assertEqualInt(i2le(p + 6), 0);
        failure("All central dir entries are on this disk");
        assertEqualInt(i2le(p + 8), i2le(p + 10));
-       failure("CD start (%d) + CD length (%d) should == archive size - 22",
+       failure("CD start (%u) + CD length (%u) should == archive size - 22",
            i4le(p + 12), i4le(p + 16));
        assertEqualInt(i4le(p + 12) + i4le(p + 16), used - 22);
        failure("no zip comment");
@@ -138,7 +138,7 @@ static void verify_zstd_contents(const char *buff, size_t used)
 
        /* Get address of first entry in central directory. */
        p = buff + i4le(buffend - 6);
-       failure("Central file record at offset %d should begin with"
+       failure("Central file record at offset %u should begin with"
            " PK\\001\\002 signature",
            i4le(buffend - 10));
 
index 7796b06a2ccf0f8a21e2d221c2efd92c70227a61..24b23843613ae73d68e2b0295e4a99b8fd351abd 100644 (file)
@@ -138,7 +138,7 @@ DEFINE_TEST(test_write_format_zip_file)
 
        /* Get address of first entry in central directory. */
        central_header = p = buff + i4le(buffend - 6);
-       failure("Central file record at offset %d should begin with"
+       failure("Central file record at offset %u should begin with"
            " PK\\001\\002 signature",
            i4le(buffend - 10));
 
index da0428a82ded619bb8be62c80c026d974085875b..9d1bdffbe00e94344deb9100b49bc362f8a03620 100644 (file)
@@ -139,7 +139,7 @@ DEFINE_TEST(test_write_format_zip_file_zip64)
 
        /* Get address of first entry in central directory. */
        central_header = p = buff + i4le(buffend - 6);
-       failure("Central file record at offset %d should begin with"
+       failure("Central file record at offset %u should begin with"
            " PK\\001\\002 signature",
            i4le(buffend - 10));
 
index ff4344e146783a17499e1830e36faceaaa1c55ee..c9d2db0b0fb48458a068473a5de2f867d0951ee3 100644 (file)
@@ -127,7 +127,7 @@ DEFINE_TEST(test_write_format_zip_stream)
 
        /* Get address of first entry in central directory. */
        central_header = p = buff + i4le(buffend - 6);
-       failure("Central file record at offset %d should begin with"
+       failure("Central file record at offset %u should begin with"
            " PK\\001\\002 signature",
            i4le(buffend - 10));