[U-Boot] [PATCH] kwbimage.c: Fix compile warning when building on 32/64 bit systems
Mike Frysinger
vapier at gentoo.org
Tue Sep 15 18:13:37 CEST 2009
On Tuesday 15 September 2009 04:10:23 Stefan Roese wrote:
> Commit 51003b89 [kwbimage.c: Fix compile warning when building on
> 64 bit systems] changed the printf format for "sizeof(uint32_t)"
> from "%d" to "%ld". This now generates the following warning on
> 32 bit build systems:
>
> tools/kwbimage.c: In function ‘kwbimage_checksum32’:
> tools/kwbimage.c:135: warning: format ‘%ld’ expects type ‘long int’,
> but argument 4 has type ‘unsigned int’
>
> The problem is that sizeof(uint32_t) has different types on 32 bit and
> 64 bit build systems. This patch now changes the format to "%d" again and
> casts sizeof() to uint32_t, fixing the problem on both build systems.
>
> if (len % sizeof(uint32_t)) {
> - printf ("Error:%s[%d] - lenght is not in multiple of %ld\n",
> - __FUNCTION__, len, sizeof(uint32_t));
> + printf ("Error:%s[%d] - lenght is not in multiple of %d\n",
> + __FUNCTION__, len, (uint32_t)sizeof(uint32_t));
why not do it right ? use PRIu32 from inttypes.h like POSIX intended. might
as well fix the typo in the message ("length") while you're here, and use the
standardized __func__ ...
-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/20090915/b100bc92/attachment.pgp
More information about the U-Boot
mailing list