>From 0e7ac9a4609248663af76f202418dabf1c13efbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Mon, 27 Apr 2015 10:44:25 +0100 Subject: [PATCH 3/5] maint: fix printf format for signed integers With GCC 5 and the newly added warnings from gnulib, ensure the correct signed integer is passed for the printf format, to avoid -Werror=format= failures. --- src/dd.c | 2 +- src/factor.c | 2 +- src/kill.c | 4 ++-- src/make-prime-list.c | 2 +- src/numfmt.c | 4 ++-- src/split.c | 2 +- src/timeout.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dd.c b/src/dd.c index 321b096..6b09bc6 100644 --- a/src/dd.c +++ b/src/dd.c @@ -1685,7 +1685,7 @@ skip_via_lseek (char const *filename, int fdesc, off_t offset, int whence) error (0, 0, _("warning: working around lseek kernel bug for file " "(%s)\n of mt_type=0x%0lx -- " "see for the list of types"), - filename, s2.mt_type); + filename, s2.mt_type + 0Lu); errno = 0; new_position = -1; } diff --git a/src/factor.c b/src/factor.c index f694534..4e4d0c7 100644 --- a/src/factor.c +++ b/src/factor.c @@ -2337,7 +2337,7 @@ print_uintmaxes (uintmax_t t1, uintmax_t t0) r = t1 % 1000000000; udiv_qrnnd (t0, r, r, t0, 1000000000); print_uintmaxes (q, t0); - printf ("%09u", (int) r); + printf ("%09u", (unsigned int) r); } } diff --git a/src/kill.c b/src/kill.c index 49e6ef6..83016ed 100644 --- a/src/kill.c +++ b/src/kill.c @@ -109,8 +109,8 @@ PID is an integer; if negative it identifies a process group.\n\ maximum name width is NAME_WIDTH, and SIGNAME is the name to print. */ static void -print_table_row (unsigned int num_width, int signum, - unsigned int name_width, char const *signame) +print_table_row (int num_width, int signum, + int name_width, char const *signame) { char const *description = strsignal (signum); printf ("%*d %-*s %s\n", num_width, signum, name_width, signame, diff --git a/src/make-prime-list.c b/src/make-prime-list.c index 69b91e8..b31e1ed 100644 --- a/src/make-prime-list.c +++ b/src/make-prime-list.c @@ -131,7 +131,7 @@ output_primes (const struct prime *primes, unsigned nprimes) abort (); printf ("P (%u, %u,\n (", primes[i].p - p, d8); print_wide_uint (primes[i].pinv, 0, wide_uint_bits); - printf ("),\n UINTMAX_MAX / %d)\n", primes[i].p); + printf ("),\n UINTMAX_MAX / %u)\n", primes[i].p); p = primes[i].p; } diff --git a/src/numfmt.c b/src/numfmt.c index 550e384..9cbcb27 100644 --- a/src/numfmt.c +++ b/src/numfmt.c @@ -729,7 +729,7 @@ double_to_human (long double val, int precision, /* Normalize val to scale. */ unsigned int power = 0; val = expld (val, scale_base, &power); - devmsg (" scaled value to %Lf * %0.f ^ %d\n", val, scale_base, power); + devmsg (" scaled value to %Lf * %0.f ^ %u\n", val, scale_base, power); /* Perform rounding. */ int ten_or_less = 0; @@ -757,7 +757,7 @@ double_to_human (long double val, int precision, int show_decimal_point = (val != 0) && (absld (val) < 10) && (power > 0); /* && (absld (val) > simple_round_floor (val))) */ - devmsg (" after rounding, value=%Lf * %0.f ^ %d\n", val, scale_base, power); + devmsg (" after rounding, value=%Lf * %0.f ^ %u\n", val, scale_base, power); stpcpy (pfmt, show_decimal_point ? ".1Lf%s" : ".0Lf%s"); diff --git a/src/split.c b/src/split.c index 8d03c16..e0f8369 100644 --- a/src/split.c +++ b/src/split.c @@ -521,7 +521,7 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name) { /* shouldn't happen. */ error (EXIT_FAILURE, 0, - _("unknown status from command (0x%X)"), wstatus); + _("unknown status from command (0x%X)"), wstatus + 0u); } } } diff --git a/src/timeout.c b/src/timeout.c index 4d089bf..19c0765 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -492,7 +492,7 @@ main (int argc, char **argv) else { /* shouldn't happen. */ - error (0, 0, _("unknown status from command (0x%X)"), status); + error (0, 0, _("unknown status from command (%d)"), status); status = EXIT_FAILURE; } } -- 2.3.4