]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add straightforward casts for %o and %x (#2458)
authorGraham Percival <gperciva@tarsnap.com>
Sun, 29 Dec 2024 00:29:47 +0000 (16:29 -0800)
committerMartin Matuska <martin@matuska.de>
Tue, 11 Mar 2025 09:29:49 +0000 (10:29 +0100)
(cherry picked from commit 14221c7ba20d50598b56f455a6d613ed186e3510)

libarchive/test/test_acl_pax.c
libarchive/test/test_acl_platform_nfs4.c
libarchive/test/test_acl_platform_posix1e.c
libarchive/test/test_acl_posix1e.c
libarchive/test/test_compat_solaris_tar_acl.c
libarchive/test/test_compat_star_acl.c
test_utils/test_main.c

index 659073170fad7d727f119e1527980795b4a91209..3e0c3d7c08b410ed071d3ed1919d3b50d7721f3c 100644 (file)
@@ -287,7 +287,7 @@ DEFINE_TEST(test_acl_pax_posix1e)
        failure("Basic ACLs shouldn't be stored as extended ACLs");
        assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
        failure("Basic ACLs should set mode to 0142, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0142);
 
        /* Second item has a few ACLs */
@@ -297,7 +297,7 @@ DEFINE_TEST(test_acl_pax_posix1e)
        assertEntryCompareAcls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]),
            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0142);
        failure("Basic ACLs should set mode to 0142, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0142);
 
        /* Third item has pretty extensive ACLs */
@@ -307,7 +307,7 @@ DEFINE_TEST(test_acl_pax_posix1e)
        assertEntryCompareAcls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]),
            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0543);
        failure("Basic ACLs should set mode to 0543, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0543);
 
        /* Fourth item has no ACLs */
@@ -315,7 +315,7 @@ DEFINE_TEST(test_acl_pax_posix1e)
        failure("Basic ACLs shouldn't be stored as extended ACLs");
        assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
        failure("Basic ACLs should set mode to 0142, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0142);
 
        /* Close the archive. */
index 18f047b149e686eac739261af480b3746dc0383c..6e19bca4fde7eda2fca02f581ed57c2bd8ef6c07 100644 (file)
@@ -772,7 +772,8 @@ compare_acls(
                failure(" ACL entry %d missing from %s: "
                    "type=%#010x,permset=%#010x,tag=%d,qual=%d,name=``%s''\n",
                    marker[i], filename,
-                   myacls[marker[i]].type, myacls[marker[i]].permset,
+                   (unsigned int)myacls[marker[i]].type,
+                   (unsigned int)myacls[marker[i]].permset,
                    myacls[marker[i]].tag, myacls[marker[i]].qual,
                    myacls[marker[i]].name);
                assert(0); /* Record this as a failure. */
@@ -824,7 +825,7 @@ compare_entry_acls(struct archive_entry *ae, struct myacl_t *myacls, const char
 
                failure("ACL entry on file that shouldn't be there: "
                        "type=%#010x,permset=%#010x,tag=%d,qual=%d",
-                       type,permset,tag,qual);
+                       (unsigned int)type, (unsigned int)permset, tag, qual);
                assert(matched == 1);
        }
 
@@ -833,7 +834,8 @@ compare_entry_acls(struct archive_entry *ae, struct myacl_t *myacls, const char
                failure(" ACL entry %d missing from %s: "
                    "type=%#010x,permset=%#010x,tag=%d,qual=%d,name=``%s''\n",
                    marker[i], filename,
-                   myacls[marker[i]].type, myacls[marker[i]].permset,
+                   (unsigned int)myacls[marker[i]].type,
+                   (unsigned int)myacls[marker[i]].permset,
                    myacls[marker[i]].tag, myacls[marker[i]].qual,
                    myacls[marker[i]].name);
                assert(0); /* Record this as a failure. */
index f23eec0d336a514f59932cf1f280baba41c3f448..ef1b08541404078d6f6c20cf1d2c1e81a820e6da 100644 (file)
@@ -274,7 +274,8 @@ compare_acls(
        for (i = 0; i < n; ++i) {
                failure(" ACL entry missing from file: "
                    "type=%#010x,permset=%#010x,tag=%d,qual=%d,name=``%s''\n",
-                   myacls[marker[i]].type, myacls[marker[i]].permset,
+                   (unsigned int)myacls[marker[i]].type,
+                   (unsigned int)myacls[marker[i]].permset,
                    myacls[marker[i]].tag, myacls[marker[i]].qual,
                    myacls[marker[i]].name);
                assert(0); /* Record this as a failure. */
index 3f9c9850f4958c2c9fc64dbfa252b472a72a7872..025ef6afd102d67569d8f1d18372f4172c987d4a 100644 (file)
@@ -119,7 +119,7 @@ DEFINE_TEST(test_acl_posix1e)
        failure("Basic ACLs shouldn't be stored as extended ACLs");
        assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
        failure("Basic ACLs should set mode to 0142, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0142);
 
        /* With any extended ACL entry, we should read back a full set. */
@@ -136,7 +136,7 @@ DEFINE_TEST(test_acl_posix1e)
        assertEntryCompareAcls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]),
            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0142);
        failure("Basic ACLs should set mode to 0142, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0142);
 
 
@@ -146,7 +146,7 @@ DEFINE_TEST(test_acl_posix1e)
        assertEntryCompareAcls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]),
            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0543);
        failure("Basic ACLs should set mode to 0543, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0543);
 
        /*
@@ -157,7 +157,7 @@ DEFINE_TEST(test_acl_posix1e)
        failure("Basic ACLs shouldn't be stored as extended ACLs");
        assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
        failure("Basic ACLs should set mode to 0142, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0142);
 
        /*
index df7435c7cbecb4b62daf7717573c07221aa9312b..afdeddf0702fb98697c53812cafea79b2566e992 100644 (file)
@@ -229,7 +229,7 @@ DEFINE_TEST(test_compat_solaris_tar_acl)
        assertEntryCompareAcls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]),
            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0644);
        failure("Basic ACLs should set mode to 0644, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0644);
 
        /* Second item has default and access ACLs */
@@ -239,7 +239,7 @@ DEFINE_TEST(test_compat_solaris_tar_acl)
        assertEntryCompareAcls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]),
            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0750);
        failure("Basic ACLs should set mode to 0750, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0750);
        assertEqualInt(6, archive_entry_acl_reset(ae,
            ARCHIVE_ENTRY_ACL_TYPE_DEFAULT));
index 749f5ce342943cdb87b79f43d8f8eb28f73068d8..8e205c22c025135f5085d481954b6a5d49fa6716 100644 (file)
@@ -251,7 +251,7 @@ DEFINE_TEST(test_compat_star_acl_posix1e)
        assertEntryCompareAcls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]),
            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0142);
        failure("Basic ACLs should set mode to 0142, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0142);
 
        /* Second item has pretty extensive ACLs */
@@ -261,7 +261,7 @@ DEFINE_TEST(test_compat_star_acl_posix1e)
        assertEntryCompareAcls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]),
            ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0543);
        failure("Basic ACLs should set mode to 0543, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0543);
 
        /* Third item has default ACLs */
@@ -271,7 +271,7 @@ DEFINE_TEST(test_compat_star_acl_posix1e)
        assertEntryCompareAcls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]),
            ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, 0142);
        failure("Basic ACLs should set mode to 0142, not %04o",
-           archive_entry_mode(ae)&0777);
+           (unsigned int)archive_entry_mode(ae)&0777);
        assert((archive_entry_mode(ae) & 0777) == 0142);
 
        /* Close the archive. */
index 60b1dc8c69995a26bb5d272f16090169cf87b100..de6a6107a6f98ada22205d3c4be3ee6fb2f29941 100644 (file)
@@ -3319,7 +3319,8 @@ assertion_entry_set_acls(const char *file, int line, struct archive_entry *ae,
                        ret = 1;
                        failure_start(file, line, "type=%#010x, "
                            "permset=%#010x, tag=%d, qual=%d name=%s",
-                           acls[i].type, acls[i].permset, acls[i].tag,
+                           (unsigned int)acls[i].type,
+                           (unsigned int)acls[i].permset, acls[i].tag,
                            acls[i].qual, acls[i].name);
                        failure_finish(NULL);
                }
@@ -3451,7 +3452,8 @@ assertion_entry_compare_acls(const char *file, int line,
                } else if (matched != 1) {
                        failure_start(file, line, "Could not find match for "
                            "ACL (type=%#010x,permset=%#010x,tag=%d,qual=%d,"
-                           "name=``%s'')", type, permset, tag, qual, name);
+                           "name=``%s'')", (unsigned int)type,
+                           (unsigned int)permset, tag, qual, name);
                        failure_finish(NULL);
                        ret = 1;
                }
@@ -3471,7 +3473,8 @@ assertion_entry_compare_acls(const char *file, int line,
        if (n != 0) {
                failure_start(file, line, "Could not find match for ACL "
                    "(type=%#010x,permset=%#010x,tag=%d,qual=%d,name=``%s'')",
-                   acls[marker[0]].type, acls[marker[0]].permset,
+                   (unsigned int)acls[marker[0]].type,
+                   (unsigned int)acls[marker[0]].permset,
                    acls[marker[0]].tag, acls[marker[0]].qual,
                    acls[marker[0]].name);
                failure_finish(NULL);