From da06935f6ea4d2c248c01486adae98adb020dd42 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 13 Jul 2015 09:29:51 -0700 Subject: [PATCH] tar: pacify GCC 5.1 -Wformat-signedness * lib/wordsplit.c (struct wordsplit_node.flags): Now unsigned, so that 'printf ("%x", p->flags)' doesn't provoke GCC. * src/incremen.c (read_num, dumpdir_ok): Don't printf an int with %x or %o. --- lib/wordsplit.c | 2 +- src/incremen.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/wordsplit.c b/lib/wordsplit.c index bda64d3..69db2e0 100644 --- a/lib/wordsplit.c +++ b/lib/wordsplit.c @@ -221,7 +221,7 @@ struct wordsplit_node { struct wordsplit_node *prev; /* Previous element */ struct wordsplit_node *next; /* Next element */ - int flags; /* Node flags */ + unsigned flags; /* Node flags */ union { struct diff --git a/src/incremen.c b/src/incremen.c index b1b70ba..e549bbd 100644 --- a/src/incremen.c +++ b/src/incremen.c @@ -735,7 +735,7 @@ scan_directory (struct tar_stat_info *st) savedir_error (dir); info_attach_exclist (st); - + tmp = xstrdup (dir); zap_slashes (tmp); @@ -1155,11 +1155,14 @@ read_num (FILE *fp, char const *fieldname, } if (c) - FATAL_ERROR ((0, 0, - _("%s: byte %s: %s %s followed by invalid byte 0x%02x"), - quotearg_colon (listed_incremental_option), - offtostr (ftello (fp), offbuf), - fieldname, buf, c)); + { + unsigned uc = c; + FATAL_ERROR ((0, 0, + _("%s: byte %s: %s %s followed by invalid byte 0x%02x"), + quotearg_colon (listed_incremental_option), + offtostr (ftello (fp), offbuf), + fieldname, buf, uc)); + } *pval = strtosysint (buf, NULL, min_val, max_val); conversion_errno = errno; @@ -1541,9 +1544,10 @@ dumpdir_ok (char *dumpdir) { if (expect && *p != expect) { + unsigned char uc = *p; ERROR ((0, 0, _("Malformed dumpdir: expected '%c' but found %#3o"), - expect, *p)); + expect, uc)); return false; } switch (*p) -- 2.45.2