]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add more casts for %c, %o, and %x (#2463)
authorGraham Percival <gperciva@tarsnap.com>
Sun, 29 Dec 2024 18:20:24 +0000 (10:20 -0800)
committerGitHub <noreply@github.com>
Sun, 29 Dec 2024 18:20:24 +0000 (10:20 -0800)
libarchive/archive_read_support_format_rar5.c
libarchive/archive_write_set_format_iso9660.c
tar/util.c
test_utils/test_main.c

index 7e7fa6cf407ce14e9a85e5ebf66afb122750d79c..0671427c98569260d919ad7ac3ab24e5b90f8a18 100644 (file)
@@ -691,7 +691,8 @@ static int run_filter(struct archive_read* a, struct filter_info* flt) {
                default:
                        archive_set_error(&a->archive,
                            ARCHIVE_ERRNO_FILE_FORMAT,
-                           "Unsupported filter type: 0x%x", flt->type);
+                           "Unsupported filter type: 0x%x",
+                           (unsigned int)flt->type);
                        return ARCHIVE_FATAL;
        }
 
@@ -3983,7 +3984,7 @@ static int do_unpack(struct archive_read* a, struct rar5* rar,
                                archive_set_error(&a->archive,
                                    ARCHIVE_ERRNO_FILE_FORMAT,
                                    "Compression method not supported: 0x%x",
-                                   rar->cstate.method);
+                                   (unsigned int)rar->cstate.method);
 
                                return ARCHIVE_FATAL;
                }
index bc86047f63599b8c82b12418d06f58c2c2c35de6..3c5b8899434ebd7c5008da6866edb99a72bbb979 100644 (file)
@@ -4037,7 +4037,7 @@ set_option_info(struct archive_string *info, int *opt, const char *key,
        case KEY_HEX:
                d = va_arg(ap, int);
                archive_string_sprintf(info, "%c%s=%x",
-                   prefix, key, d);
+                   prefix, key, (unsigned int)d);
                break;
        }
        va_end(ap);
index e91234c926bd9b589bdd7a4b40502530be02c591..3b099cb5fce0c0c42279fa3e3087400ef678f72e 100644 (file)
@@ -202,7 +202,8 @@ bsdtar_expand_char(char *buff, size_t buffsize, size_t offset, char c)
                case '\v': buff[i++] = 'v'; break;
                case '\\': buff[i++] = '\\'; break;
                default:
-                       snprintf(buff + i, buffsize - i, "%03o", 0xFF & (int)c);
+                       snprintf(buff + i, buffsize - i, "%03o",
+                           0xFF & (unsigned int)c);
                        i += 3;
                }
        }
index abd99b5da0828718ef7815aa19cb8587dda08cb0..b2eae6381f8acbbba4ca1054c932b9c54eeb6a0b 100644 (file)
@@ -758,7 +758,7 @@ static void strdump(const char *e, const char *p, int ewidth, int utf8)
                case '\r': logprintf("\\r"); break;
                default:
                        if (c >= 32 && c < 127)
-                               logprintf("%c", c);
+                               logprintf("%c", (int)c);
                        else
                                logprintf("\\x%02X", c);
                }
@@ -832,7 +832,7 @@ wcsdump(const char *e, const wchar_t *w)
        while (*w != L'\0') {
                unsigned int c = *w++;
                if (c >= 32 && c < 127)
-                       logprintf("%c", c);
+                       logprintf("%c", (int)c);
                else if (c < 256)
                        logprintf("\\x%02X", c);
                else if (c < 0x10000)
@@ -3415,8 +3415,9 @@ assertion_entry_compare_acls(const char *file, int line,
                        }
                        if ((permset << 6) != (mode & 0700)) {
                                failure_start(file, line, "USER_OBJ permset "
-                                   "(%02o) != user mode (%02o)", permset,
-                                   07 & (mode >> 6));
+                                   "(%02o) != user mode (%02o)",
+                                   (unsigned int)permset,
+                                   (unsigned int)(07 & (mode >> 6)));
                                failure_finish(NULL);
                                ret = 1;
                        }
@@ -3430,8 +3431,9 @@ assertion_entry_compare_acls(const char *file, int line,
                        }
                        if ((permset << 3) != (mode & 0070)) {
                                failure_start(file, line, "GROUP_OBJ permset "
-                                   "(%02o) != group mode (%02o)", permset,
-                                   07 & (mode >> 3));
+                                   "(%02o) != group mode (%02o)",
+                                   (unsigned int)permset,
+                                   (unsigned int)(07 & (mode >> 3)));
                                failure_finish(NULL);
                                ret = 1;
                        }
@@ -3445,8 +3447,9 @@ assertion_entry_compare_acls(const char *file, int line,
                        }
                        if ((permset << 0) != (mode & 0007)) {
                                failure_start(file, line, "OTHER permset "
-                                   "(%02o) != other mode (%02o)", permset,
-                                   mode & 07);
+                                   "(%02o) != other mode (%02o)",
+                                   (unsigned int)permset,
+                                   (unsigned int)mode & 07);
                                failure_finish(NULL);
                                ret = 1;
                        }