[haiku-commits] Re: BOM: r37694 fwohci.c:2433: error: format '%08x' expects type 'unsigned int', but argument 8 has type 'uint32'

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 15 Aug 2010 08:34:59 +0200

On 2010-08-14 at 19:36:15 [+0200], François Revol <revol@xxxxxxx> wrote:
> Le 14 août 2010 à 19:07, Ingo Weinhold a écrit :
> > On 2010-08-14 at 14:32:14 [+0200], Andreas Färber <andreas.faerber@xxxxxx>
> > wrote:
> >> Am 22.07.2010 um 18:06 schrieb buildomatic@xxxxxxxxx:
> >> 
> >> Anyone any suggestion how to fix this? It looks like the offending
> >> code is from some BSD...
> > 
> > Adjust the definition of the htole32() and le32toh() macros (cast to
> > uint32_t at least). The printf() code is not portable, though, since it
> > doesn't use the PRI* format macros.
> 
> Can't you use B_PRIu32 from SupportDefs.h ?

The macros are the main problem, since they use the __swap_int32() function, 
returning the wrong type (uint32 instead of uint32_t, which the rest of the 
code seems to expect). Use of the PRI* macros would be necessary to make the 
code portable, but fixing the macros should suffice for the time being.

CU, Ingo

Other related posts: