summaryrefslogtreecommitdiff
path: root/test_utils/test_main.c
diff options
context:
space:
mode:
authorzoulasc <christos@zoulas.com>2020-01-21 13:34:18 -0500
committerMartin Matuska <martin@matuska.org>2020-01-23 00:19:32 +0100
commit343642bcd20450cacb534d6ea403a1ff6e420806 (patch)
tree1c2a6445898230483befa01f14b7554d82d287e5 /test_utils/test_main.c
parent849740bac9788af44b0e2ae6403ee743b27b628f (diff)
downloadlibarchive-343642bcd20450cacb534d6ea403a1ff6e420806.tar.gz
Add printf attributes to the printflike functions used in tests and fix
the format errors. Closes #1318
Diffstat (limited to 'test_utils/test_main.c')
-rw-r--r--test_utils/test_main.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/test_utils/test_main.c b/test_utils/test_main.c
index c34c0249..7b8aa70f 100644
--- a/test_utils/test_main.c
+++ b/test_utils/test_main.c
@@ -388,7 +388,7 @@ static const char *refdir;
*/
static int log_console = 0;
static FILE *logfile;
-static void
+static void __LA_PRINTFLIKE(1, 0)
vlogprintf(const char *fmt, va_list ap)
{
#ifdef va_copy
@@ -406,7 +406,7 @@ vlogprintf(const char *fmt, va_list ap)
#endif
}
-static void
+static void __LA_PRINTFLIKE(1, 2)
logprintf(const char *fmt, ...)
{
va_list ap;
@@ -478,7 +478,7 @@ static struct line {
const char *failed_filename;
/* Count this failure, setup up log destination and handle initial report. */
-static void
+static void __LA_PRINTFLIKE(3, 4)
failure_start(const char *filename, int line, const char *fmt, ...)
{
va_list ap;
@@ -751,7 +751,7 @@ static void strdump(const char *e, const char *p, int ewidth, int utf8)
logprintf("]");
logprintf(" (count %d", cnt);
if (n < 0) {
- logprintf(",unknown %d bytes", len);
+ logprintf(",unknown %zu bytes", len);
}
logprintf(")");
@@ -1167,7 +1167,7 @@ assertion_text_file_contents(const char *filename, int line, const char *buff, c
logprintf(" file=\"%s\"\n", fn);
if (n > 0) {
hexdump(contents, buff, n, 0);
- logprintf(" expected\n", fn);
+ logprintf(" expected\n");
hexdump(buff, contents, s, 0);
} else {
logprintf(" File empty, contents should be:\n");
@@ -1497,7 +1497,7 @@ assertion_file_time(const char *file, int line,
}
} else if (filet != t || filet_nsec != nsec) {
failure_start(file, line,
- "File %s has %ctime %lld.%09lld, expected %lld.%09lld",
+ "File %s has %ctime %lld.%09lld, expected %ld.%09ld",
pathname, type, filet, filet_nsec, t, nsec);
failure_finish(NULL);
return (0);
@@ -1593,8 +1593,8 @@ assertion_file_nlinks(const char *file, int line,
r = my_GetFileInformationByName(pathname, &bhfi);
if (r != 0 && bhfi.nNumberOfLinks == (DWORD)nlinks)
return (1);
- failure_start(file, line, "File %s has %d links, expected %d",
- pathname, bhfi.nNumberOfLinks, nlinks);
+ failure_start(file, line, "File %s has %jd links, expected %d",
+ pathname, (intmax_t)bhfi.nNumberOfLinks, nlinks);
failure_finish(NULL);
return (0);
#else
@@ -1605,8 +1605,8 @@ assertion_file_nlinks(const char *file, int line,
r = lstat(pathname, &st);
if (r == 0 && (int)st.st_nlink == nlinks)
return (1);
- failure_start(file, line, "File %s has %d links, expected %d",
- pathname, st.st_nlink, nlinks);
+ failure_start(file, line, "File %s has %jd links, expected %d",
+ pathname, (intmax_t)st.st_nlink, nlinks);
failure_finish(NULL);
return (0);
#endif
@@ -3271,7 +3271,7 @@ assertion_entry_set_acls(const char *file, int line, struct archive_entry *ae,
acls[i].qual, acls[i].name);
if (r != 0) {
ret = 1;
- failure_start(file, line, "type=%#010x, ",
+ failure_start(file, line, "type=%#010x, "
"permset=%#010x, tag=%d, qual=%d name=%s",
acls[i].type, acls[i].permset, acls[i].tag,
acls[i].qual, acls[i].name);