]> www.infradead.org Git - mtd-utils.git/commitdiff
mtd-utils: fix wrong format specifiers on mips32
authorMathias Kresin <dev@kresin.me>
Sun, 12 Jun 2016 10:05:45 +0000 (12:05 +0200)
committerRichard Weinberger <richard@nod.at>
Thu, 25 Aug 2016 13:32:14 +0000 (15:32 +0200)
This patch fixes the follwing compiler warnings:

flash_erase.c: In function 'show_progress':
flash_erase.c:56:22: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'off_t {aka long long int}' [-Wformat=]
  bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIxoff_t" -- %2i %% complete ",
                      ^
./include/common.h:81:10: note: in definition of macro 'bareverbose'
   printf(fmt, ##__VA_ARGS__);

which are linked to the following buggy numerical output:

Erasing 128 Kibyte @ 0 -- 917504 % complete flash_erase:  Cleanmarker written at 0
Erasing 128 Kibyte @ 0 -- 1048576 % complete flash_erase:  Cleanmarker written at 0

Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Richard Weinberger <richard@nod.at>
include/common.h

index 8cb314276051cc0f87a493774c4efde532219b36..ca4c62e4feb09a24e78a9e7ad942b8709857d64a 100644 (file)
@@ -72,8 +72,13 @@ extern "C" {
 #define PRIxoff_t PRIx64
 #define PRIdoff_t PRId64
 #else
+#if (SIZEOF_LONG >= 8)
 #define PRIxoff_t "l"PRIx32
 #define PRIdoff_t "l"PRId32
+#else
+#define PRIxoff_t "ll"PRIx32
+#define PRIdoff_t "ll"PRId32
+#endif
 #endif
 
 /* Verbose messages */