RFC: 64bit compilation warning removal

Shaw Vrana shaw at vranix.com
Thu Nov 10 10:31:12 EST 2005


Hi Darren,

Take for example format_rate() in progressmeter.c, specifically this code:
before:
snprintf(buf, size, "%3lld.%1lld%c%s",
         (int64_t) (bytes + 5) / 100,
         (int64_t) (bytes + 5) / 10 % 10,
         unit[i],
         i ? "B" : " ");

after:
snprintf(buf, size, "%3" PRId64 ".%1" PRId64 "%c%s",
     (int64_t) (bytes + 5) / 100,
         (int64_t) (bytes + 5) / 10 % 10,
         unit[i],
         i ? "B" : " ");


PRId64 is defined in inttypes.h as "ld" for 64 bit machines or "lld" for 
32bit machines.  This allows the code to compile cleanly.

I'm also purposing that these macros be added using autoconf if the user 
does not have inttypes.h.

Thanks,
Shaw




More information about the openssh-unix-dev mailing list