tools: env: Fix format warnings in debug

Format warnings (-Wformat) were shown in printf() calls after defining
DEBUG macro.

Update format string and explicitly cast variables to suppress all
warnings.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
Marcin Niestroj 2016-05-06 14:58:29 +02:00 committed by Heiko Schocher
parent 4579720412
commit 81c878dd3c

17
tools/env/fw_env.c vendored
View file

@ -661,8 +661,8 @@ static int flash_bad_block (int fd, uint8_t mtd_type, loff_t *blockstart)
if (badblock) { if (badblock) {
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr, "Bad block at 0x%llx, " fprintf (stderr, "Bad block at 0x%llx, skipping\n",
"skipping\n", *blockstart); (unsigned long long) *blockstart);
#endif #endif
return badblock; return badblock;
} }
@ -749,7 +749,8 @@ static int flash_read_buf (int dev, int fd, void *buf, size_t count,
} }
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "Read 0x%x bytes at 0x%llx on %s\n", fprintf(stderr, "Read 0x%x bytes at 0x%llx on %s\n",
rc, blockstart + block_seek, DEVNAME(dev)); rc, (unsigned long long) blockstart + block_seek,
DEVNAME(dev));
#endif #endif
processed += readlen; processed += readlen;
readlen = min (blocklen, count - processed); readlen = min (blocklen, count - processed);
@ -847,8 +848,9 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
if (block_seek + count != write_total) { if (block_seek + count != write_total) {
if (block_seek != 0) if (block_seek != 0)
fprintf(stderr, " and "); fprintf(stderr, " and ");
fprintf(stderr, "0x%lx - 0x%x", fprintf(stderr, "0x%lx - 0x%lx",
block_seek + count, write_total - 1); (unsigned long) block_seek + count,
(unsigned long) write_total - 1);
} }
fprintf(stderr, "\n"); fprintf(stderr, "\n");
#endif #endif
@ -911,8 +913,9 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
} }
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "Write 0x%x bytes at 0x%llx\n", erasesize, fprintf(stderr, "Write 0x%llx bytes at 0x%llx\n",
blockstart); (unsigned long long) erasesize,
(unsigned long long) blockstart);
#endif #endif
if (write (fd, data + processed, erasesize) != erasesize) { if (write (fd, data + processed, erasesize) != erasesize) {
fprintf (stderr, "Write error on %s: %s\n", fprintf (stderr, "Write error on %s: %s\n",