From mboxrd@z Thu Jan 1 00:00:00 1970 From: Horst Kronstorfer Date: Fri, 06 Apr 2012 10:28:05 +0200 Subject: [U-Boot] [PATCH] mkenvimage: Fix compiler warning In-Reply-To: <1333692030-25831-1-git-send-email-dirk.behme@gmail.com> References: <1333692030-25831-1-git-send-email-dirk.behme@gmail.com> Message-ID: <4F7EA915.3000504@aon.at> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 04/06/2012 08:00 AM, Dirk Behme wrote: > From: Dirk Behme > > 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 > CC: David Wagner > CC: Anatolij Gustschin > CC: Mike Frysinger > --- > tools/mkenvimage.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c > index 9dbb3b2..1298998 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 (%d bytes) failed: %s\n", this patch would now trigger a -Wformat on 64-bit hosts. you should use the size_t formatter '%zu'. > 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 (%d bytes): %s\n", ditto! br -h > sizeof(*envptr) * filesize, > strerror(errno)); >