[U-Boot] [PATCH] kwbimage.c: Fix compile warning when building on 32/64 bit systems

Wolfgang Denk wd at denx.de
Tue Sep 15 12:10:19 CEST 2009


Dear Stefan Roese,

In message <1253002223-16773-1-git-send-email-sr at denx.de> you 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.

Heh. Casts are evil.

Now that both of us stabbed at this and failed it's time to remember
to use "%zu" (hm... now why does this remind me of dzu? ;-)

Will submit a patch ASAP.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I came home the other night and tried to open the door  with  my  car
keys...and  the  building started up. So I took it out for a drive. A
cop pulled me over for speeding. He asked me where I  live...  "Right
here".                                                - Steven Wright


More information about the U-Boot mailing list