public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] mkenvimage: Fix compiler warning
@ 2012-04-06  9:15 Dirk Behme
  2012-04-06 15:14 ` Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dirk Behme @ 2012-04-06  9:15 UTC (permalink / raw)
  To: u-boot

From: Dirk Behme <dirk.behme@googlemail.com>

Fix the compiler warning

mkenvimage.c: In function ?main?:
mkenvimage.c:218: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int?
mkenvimage.c:226: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int?

introduced with the commit

mkenvimage: Use mmap() when reading from a regular file
6ee39f8055680654f9cc97b98dcce9588f1ab71e

Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
CC: David Wagner <david.wagner@free-electrons.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Mike Frysinger <vapier@gentoo.org>
---
Changes in v2: Use size_t formatter '%zu'.

 tools/mkenvimage.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index 9dbb3b2..bfc4eb6 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -213,7 +213,7 @@ int main(int argc, char **argv)
 		filebuf = mmap(NULL, sizeof(*envptr) * filesize, PROT_READ,
 			       MAP_PRIVATE, txt_fd, 0);
 		if (filebuf == MAP_FAILED) {
-			fprintf(stderr, "mmap (%ld bytes) failed: %s\n",
+			fprintf(stderr, "mmap (%zu bytes) failed: %s\n",
 					sizeof(*envptr) * filesize,
 					strerror(errno));
 			fprintf(stderr, "Falling back to read()\n");
@@ -221,7 +221,7 @@ int main(int argc, char **argv)
 			filebuf = malloc(sizeof(*envptr) * filesize);
 			ret = read(txt_fd, filebuf, sizeof(*envptr) * filesize);
 			if (ret != sizeof(*envptr) * filesize) {
-				fprintf(stderr, "Can't read the whole input file (%ld bytes): %s\n",
+				fprintf(stderr, "Can't read the whole input file (%zu bytes): %s\n",
 					sizeof(*envptr) * filesize,
 					strerror(errno));
 
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] mkenvimage: Fix compiler warning
  2012-04-06  9:15 [U-Boot] [PATCH v2] mkenvimage: Fix compiler warning Dirk Behme
@ 2012-04-06 15:14 ` Mike Frysinger
  2012-04-06 18:48 ` David Wagner
  2012-04-10 21:55 ` Anatolij Gustschin
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2012-04-06 15:14 UTC (permalink / raw)
  To: u-boot

On Friday 06 April 2012 05:15:07 Dirk Behme wrote:
> -			fprintf(stderr, "mmap (%ld bytes) failed: %s\n",
> +			fprintf(stderr, "mmap (%zu bytes) failed: %s\n",

i was just about to point this out in your v1 patch :)

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120406/b4095ca3/attachment.pgp>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] mkenvimage: Fix compiler warning
  2012-04-06  9:15 [U-Boot] [PATCH v2] mkenvimage: Fix compiler warning Dirk Behme
  2012-04-06 15:14 ` Mike Frysinger
@ 2012-04-06 18:48 ` David Wagner
  2012-04-10 21:55 ` Anatolij Gustschin
  2 siblings, 0 replies; 4+ messages in thread
From: David Wagner @ 2012-04-06 18:48 UTC (permalink / raw)
  To: u-boot

On 06/04/2012 11:15, Dirk Behme wrote:
> From: Dirk Behme <dirk.behme@googlemail.com>
> 
> Fix the compiler warning
> 
> mkenvimage.c: In function ?main?:
> mkenvimage.c:218: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int?
> mkenvimage.c:226: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int?
> 

I don't have these warnings ... I guess it is because we don't have the
same compiler ?  Thank you, I didn't know the %zu format :)

Acked-by: David Wagner <deubeuliou@gmail.com>

	Cheers,
	David.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH v2] mkenvimage: Fix compiler warning
  2012-04-06  9:15 [U-Boot] [PATCH v2] mkenvimage: Fix compiler warning Dirk Behme
  2012-04-06 15:14 ` Mike Frysinger
  2012-04-06 18:48 ` David Wagner
@ 2012-04-10 21:55 ` Anatolij Gustschin
  2 siblings, 0 replies; 4+ messages in thread
From: Anatolij Gustschin @ 2012-04-10 21:55 UTC (permalink / raw)
  To: u-boot

On Fri,  6 Apr 2012 11:15:07 +0200
Dirk Behme <dirk.behme@googlemail.com> wrote:

> From: Dirk Behme <dirk.behme@googlemail.com>
> 
> Fix the compiler warning
> 
> mkenvimage.c: In function ?main?:
> mkenvimage.c:218: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int?
> mkenvimage.c:226: warning: format ?%ld? expects type ?long int?, but argument 3 has type ?unsigned int?
> 
> introduced with the commit
> 
> mkenvimage: Use mmap() when reading from a regular file
> 6ee39f8055680654f9cc97b98dcce9588f1ab71e
> 
> Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
> CC: David Wagner <david.wagner@free-electrons.com>
> CC: Anatolij Gustschin <agust@denx.de>
> CC: Mike Frysinger <vapier@gentoo.org>
> ---
> Changes in v2: Use size_t formatter '%zu'.
> 
>  tools/mkenvimage.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

GCC 4.6.1 and GCC 4.2.2 didn't warn here. But I've applied this patch since
it fixes warnings for you. Thanks!

Applied to u-boot-staging/agust at denx.de.

Thanks,
Anatolij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-10 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-06  9:15 [U-Boot] [PATCH v2] mkenvimage: Fix compiler warning Dirk Behme
2012-04-06 15:14 ` Mike Frysinger
2012-04-06 18:48 ` David Wagner
2012-04-10 21:55 ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox