Add more casts for %c, %o, and %x (#2463)

This commit is contained in:
Graham Percival authored and GitHub committed 2024-12-29 10:20:24 -08:00
1 parent dc5e1405b6
commit 4ce9c2f4be
4 files changed
+17 -12

No files matched your search

@@ -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;
}
@@ -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);
+2 -1
View 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;
}
}
+11 -8
View 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;
}