Yo All!

I was playing with the clang option -Weverything and ran into a weird one.
well, many weird ones, but this stuck out first:

In include/ntp_fp.h:

l_fp is unsigned:

typedef uint64_t l_fp;

But strangely lfpinit() takes a signed first paramter and returns
an l_fp, which is unsigned:

static inline l_fp lfpinit(int32_t hi, uint32_t lo)

Strange, but not too strange, until I saw this in ntpd/ntp_control.c:
        ts = lfpinit((uint32_t)ts_i, (uint32_t)ts_f);

And stranger still here tests/libntp/strtolfp.c:
        l_fp expected = lfpinit(-300, 0);

Clearly the test is broken as lfpinit() can never return a negative and
the test expects a negative.

I can't find any place in the code, outside of the tests, where the
first parameter to lpfpinit() did not statrt out as an unsigned.

Does lfpinit() need to return a signed?  Or should the parameters to 
lfpinit() annd be unsigned?  I'm guessing the later, but I'm new to that
part of the code...

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        g...@rellim.com  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin

Attachment: pgphzwCONnNEs.pgp
Description: OpenPGP digital signature

_______________________________________________
devel mailing list
devel@ntpsec.org
http://lists.ntpsec.org/mailman/listinfo/devel

Reply via email to