]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add more casts for %o (#2461)
authorGraham Percival <gperciva@tarsnap.com>
Sun, 29 Dec 2024 18:18:06 +0000 (10:18 -0800)
committerGitHub <noreply@github.com>
Sun, 29 Dec 2024 18:18:06 +0000 (10:18 -0800)
libarchive/archive_write_add_filter_b64encode.c
libarchive/archive_write_add_filter_uuencode.c
libarchive/archive_write_disk_posix.c
test_utils/test_main.c

index 2c361bfb974eff0236eefd2011966b55603655c6..dbedf9d305c30d304afe330b9e4703d47ea61fdb 100644 (file)
@@ -166,7 +166,7 @@ archive_filter_b64encode_open(struct archive_write_filter *f)
        }
 
        archive_string_sprintf(&state->encoded_buff, "begin-base64 %o %s\n",
-           state->mode, state->name.s);
+           (unsigned int)state->mode, state->name.s);
 
        f->data = state;
        return (0);
index 50bfeb6eaa60c251a30e1d5b66992e953cfb8b3a..99c7a2cb7a7ece680404b471fbd383e3035980eb 100644 (file)
@@ -155,7 +155,7 @@ archive_filter_uuencode_open(struct archive_write_filter *f)
        }
 
        archive_string_sprintf(&state->encoded_buff, "begin %o %s\n",
-           state->mode, state->name.s);
+           (unsigned int)state->mode, state->name.s);
 
        f->data = state;
        return (0);
index d69ab34e8bb35abc598be07b27271a0b7519cd14..899f50f50ed47cb6fe89802a74b68dc3d1a9e10f 100644 (file)
@@ -3803,7 +3803,8 @@ set_mode(struct archive_write_disk *a, int mode)
                                break;
                        default:
                                archive_set_error(&a->archive, errno,
-                                   "Can't set permissions to 0%o", (int)mode);
+                                   "Can't set permissions to 0%o",
+                                   (unsigned int)mode);
                                r = ARCHIVE_WARN;
                        }
                }
@@ -3826,7 +3827,7 @@ set_mode(struct archive_write_disk *a, int mode)
 
                if (r2 != 0) {
                        archive_set_error(&a->archive, errno,
-                           "Can't set permissions to 0%o", (int)mode);
+                           "Can't set permissions to 0%o", (unsigned int)mode);
                        r = ARCHIVE_WARN;
                }
        }
index de6a6107a6f98ada22205d3c4be3ee6fb2f29941..abd99b5da0828718ef7815aa19cb8587dda08cb0 100644 (file)
@@ -613,7 +613,8 @@ assertion_chmod(const char *file, int line, const char *pathname, int mode)
        assertion_count(file, line);
        if (chmod(pathname, mode) == 0)
                return (1);
-       failure_start(file, line, "chmod(\"%s\", %4.o)", pathname, mode);
+       failure_start(file, line, "chmod(\"%s\", %4.o)", pathname,
+           (unsigned int)mode);
        failure_finish(NULL);
        return (0);
 
@@ -1602,7 +1603,7 @@ assertion_file_mode(const char *file, int line, const char *pathname, int expect
        if (r == 0 && mode == expected_mode)
                        return (1);
        failure_start(file, line, "File %s has mode %o, expected %o",
-           pathname, mode, expected_mode);
+           pathname, (unsigned int)mode, (unsigned int)expected_mode);
 #endif
        failure_finish(NULL);
        return (0);
@@ -1712,8 +1713,8 @@ assertion_is_dir(const char *file, int line, const char *pathname, int mode)
        /* TODO: Can we do better here? */
        if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) {
                failure_start(file, line, "Dir %s has wrong mode", pathname);
-               logprintf("  Expected: 0%3o\n", mode);
-               logprintf("  Found: 0%3o\n", st.st_mode & 07777);
+               logprintf("  Expected: 0%3o\n", (unsigned int)mode);
+               logprintf("  Found: 0%3o\n", (unsigned int)st.st_mode & 07777);
                failure_finish(NULL);
                return (0);
        }
@@ -1745,8 +1746,8 @@ assertion_is_reg(const char *file, int line, const char *pathname, int mode)
        /* TODO: Can we do better here? */
        if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) {
                failure_start(file, line, "File %s has wrong mode", pathname);
-               logprintf("  Expected: 0%3o\n", mode);
-               logprintf("  Found: 0%3o\n", st.st_mode & 07777);
+               logprintf("  Expected: 0%3o\n", (unsigned int)mode);
+               logprintf("  Found: 0%3o\n", (unsigned int)st.st_mode & 07777);
                failure_finish(NULL);
                return (0);
        }
@@ -3466,7 +3467,8 @@ assertion_entry_compare_acls(const char *file, int line,
        if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0 &&
            (mode_t)(mode & 0777) != (archive_entry_mode(ae) & 0777)) {
                failure_start(file, line, "Mode (%02o) and entry mode (%02o) "
-                   "mismatch", mode, archive_entry_mode(ae));
+                   "mismatch", (unsigned int)mode,
+                   (unsigned int)archive_entry_mode(ae));
                failure_finish(NULL);
                ret = 1;
        }