[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coreutils] [PATCH] build: avoid a new -Wformat-induced warning

From: Jim Meyering
Subject: [coreutils] [PATCH] build: avoid a new -Wformat-induced warning
Date: Mon, 17 May 2010 09:11:14 +0200

With -Werror I get a new failure:

  sort.c: In function 'mark_key':
  sort.c:2125: error: field width should have type 'int', but argument 2 has 
type 'size_t' [-Wformat]
  make[3]: *** [sort.o] Error 1

Fixed like this:

>From fe953ad710fa6e568d6baddf7921c04d785816e6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 17 May 2010 09:09:28 +0200
Subject: [PATCH] build: avoid a new -Wformat-induced warning

* src/sort.c (mark_key): Add a cast-to-int of a printf field width,
to placate -Wformat.
 src/sort.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/sort.c b/src/sort.c
index e099640..8a9309a 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -2122,7 +2122,7 @@ count_tabs (char const *text, const size_t len)
 static void
 mark_key (size_t offset, size_t width)
-  printf ("%*s", offset, "");
+  printf ("%*s", (int) offset, "");

   if (!width)
     printf (_("^ no match for key\n"));

reply via email to

[Prev in Thread] Current Thread [Next in Thread]