[PATCH] tcp.c: elimiate warining "format '%ld', but argument has type 'ssize_t'
jhutz at cmu.edu
Tue Feb 2 00:56:23 CET 2010
--On Monday, February 01, 2010 04:17:56 PM -0500 Frank Cusack
<fcusack at fcusack.com> wrote:
>> I took a look... it's size_t. Which is 0-4K for any RADIUS packet.
>> The "portable" fix is to change %ld to %d, and to add an explicit
>> cast: (int) packet->data_len.
> There is a size_t printf format specifier. %z I think. Barring that,
> since size_t is probably "at least" 32 bits and int is only guaranteed
> to be 16 bits, and also since size_t is unsigned, the more correct fix
> would be casting to unsigned long. But %z if that is correct is better.
Yes, it's 'z', but it's a size modifier, not a conversion. So '%zd' will
work to print a size_t value in decimal. If your printf conforms to C99,
which may not be a constraint FreeRadius wishes to adopt.
More information about the Freeradius-Devel