* [PATCH] ubiformat.c: fix printf(%d, size_t) warning
@ 2008-12-09 13:28 Mike Frysinger
2008-12-09 13:31 ` Artem Bityutskiy
0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2008-12-09 13:28 UTC (permalink / raw)
To: linux-mtd
A size_t should be printed using %zu (unsigned size_t) rather than %d. This
fixes the following warning on my system:
gcc -O2 -Werror -Wall -Iinclude -Isrc -I../../include src/ubiformat.c -c -o ubiformat.o
cc1: warnings being treated as errors
src/ubiformat.c: In function ‘read_all’:
src/ubiformat.c:345: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
src/ubiformat.c:352: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
make: *** [ubiformat.o] Error 1
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
ubi-utils/new-utils/src/ubiformat.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ubi-utils/new-utils/src/ubiformat.c b/ubi-utils/new-utils/src/ubiformat.c
index fb4f2ee..7a6d1b7 100644
--- a/ubi-utils/new-utils/src/ubiformat.c
+++ b/ubi-utils/new-utils/src/ubiformat.c
@@ -342,14 +342,14 @@ static int read_all(int fd, void *buf, size_t len)
while (len > 0) {
ssize_t l = read(fd, buf, len);
if (l == 0)
- return errmsg("eof reached; %d bytes remaining", len);
+ return errmsg("eof reached; %zu bytes remaining", len);
else if (l > 0) {
buf += l;
len -= l;
} else if (errno == EINTR || errno == EAGAIN)
continue;
else
- return sys_errmsg("reading failed; %d bytes remaining", len);
+ return sys_errmsg("reading failed; %zu bytes remaining", len);
}
return 0;
--
1.6.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ubiformat.c: fix printf(%d, size_t) warning
2008-12-09 13:28 [PATCH] ubiformat.c: fix printf(%d, size_t) warning Mike Frysinger
@ 2008-12-09 13:31 ` Artem Bityutskiy
0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2008-12-09 13:31 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Tue, 2008-12-09 at 08:28 -0500, Mike Frysinger wrote:
> A size_t should be printed using %zu (unsigned size_t) rather than %d. This
> fixes the following warning on my system:
> gcc -O2 -Werror -Wall -Iinclude -Isrc -I../../include src/ubiformat.c -c -o ubiformat.o
> cc1: warnings being treated as errors
> src/ubiformat.c: In function ‘read_all’:
> src/ubiformat.c:345: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
> src/ubiformat.c:352: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
> make: *** [ubiformat.o] Error 1
Pushed, thanks.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-09 13:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 13:28 [PATCH] ubiformat.c: fix printf(%d, size_t) warning Mike Frysinger
2008-12-09 13:31 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox