mkenvimage: Fix compiler warning
PATCH v2 1/1 mkenvimage: Fix compiler warning
From: Dirk Behme <[email protected]>
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
---
Changes in v2: Use size_t formatter '%zu'.
tools/mkenvimage.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
tools/mkenvimage.c +2 -2
@@ -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));
Signature · 1 line
1.7.7.4
PATCH v2 1/1 mkenvimage: Fix compiler warning
tools/mkenvimage.c int main(int argc, char **argv) · line 216
Quoted 2 lines · On Friday 06 April 2012 05:15:07 Dirk Behme wrote:
tools/mkenvimage.c +1
-1- 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 :)
-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>
PATCH v2 1/1 mkenvimage: Fix compiler warning
In reply to Dirk BehmeQuoted 8 lines · Dirk Behme
From: Dirk Behme <[email protected]>
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 :)
Cheers,
David.
PATCH v2 1/1 mkenvimage: Fix compiler warning
In reply to Dirk BehmeQuoted 17 lines · On Fri, 6 Apr 2012 11:15:07 +0200 Dirk Behme <[email protected]> wrote:
From: Dirk Behme <[email protected]>
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 file6ee39f8055680654f9cc97b98dcce9588f1ab71eSigned-off-by Dirk Behme <[email protected]>CC David Wagner <[email protected]>CC Anatolij Gustschin <[email protected]>CC Mike Frysinger <[email protected]>
Quoted 5 lines
---
Changes in v2: Usesize_tformatter '%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