]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: fix printf format for signed integers
authorPádraig Brady <P@draigBrady.com>
Mon, 27 Apr 2015 09:44:25 +0000 (10:44 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 27 Apr 2015 09:55:26 +0000 (10:55 +0100)
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
src/factor.c
src/kill.c
src/make-prime-list.c
src/numfmt.c
src/split.c
src/timeout.c

index 321b096d4492b3311d02d1097508cc041075bd94..6b09bc6452327736381c6e98809822dc95118e30 100644 (file)
--- 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 <sys/mtio.h> for the list of types"),
-               filename, s2.mt_type);
+               filename, s2.mt_type + 0Lu);
       errno = 0;
       new_position = -1;
     }
index f6945342deff1886e2d602d577f1fb19d7f4d9e1..4e4d0c7cbeb329858a37307066b584b15d96ca6f 100644 (file)
@@ -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);
     }
 }
 
index 49e6ef6e0c548af715cfcf13db8899d473e58ebe..83016ed3ca76365d94a788e6a1747cc3f36857e1 100644 (file)
@@ -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,
index 69b91e895d04f989562e3eb540f3dc8cfb78f3aa..b31e1ed261cdcbc60a012867c238a02d80446cf4 100644 (file)
@@ -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;
     }
 
index 550e3845f48b074d21728386180f80a6648a6304..9cbcb27530a3b5b19925533c23a98a1ad012b381 100644 (file)
@@ -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");
 
index 8d03c1620081cbee9f9996047a682c1701112c18..e0f83692bdad955c8fb98660d73725673241e2de 100644 (file)
@@ -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);
         }
     }
 }
index 4d089bf23e2908595e2280f62f7424ebaed56033..19c07653a944f04f1563eb04b80b8c407bb83f4c 100644 (file)
@@ -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;
             }
         }