brl: don't use conversion to float for offset and count
Volker.Lendecke at SerNet.DE
Tue Jun 3 07:41:07 MDT 2014
On Sun, Jun 01, 2014 at 08:37:18PM +0200, Ralph Böhme wrote:
> attached is a small fix, that deals with wrong results by printf()
> conversion from integer to float when printing lock offsets and
> sizes. For large values such a conversion may produce wrong results,
> instead use one of the standard conversion specifiers for integers.
> Example: The integer
> 9223372036854775798 (= 0x7FFFFFFFFFFFFFF6)
> is printed as
> 9223372036854775808 (= 0x7FFFFFFFFFFFFFFF)
> when using a cast to float (double) and a double conversion specifier.
> Review appreciated.
Thanks, good catch!
has PRIu64 as the format specifier for a uint64_t. If you
look deep inside
it seems that this is C99 standard these days. Samba does
already use this in various places.
I could not find a reference to "j" in C99, only in susv4.
Both are probably possible, but for orthogonality reasons I
would argue to settle on one of both.
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical