[Git][NTPsec/ntpsec][master] 3 commits: Fix 120 warnings, and round on conversion from double to l_fp.

Gary E. Miller gitlab at mg.gitlab.com
Fri Apr 7 02:59:15 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
194cbd22 by Gary E. Miller at 2017-04-06T19:09:04-07:00
Fix 120 warnings, and round on conversion from double to l_fp.

Fixes:
    warning: cast from function call of type 'double'
    to non-matching type 'long int' [-Wbad-function-cast]

- - - - -
c234152d by Gary E. Miller at 2017-04-06T19:22:07-07:00
Fix one cast, add one cast.

- - - - -
f62be6ad by Gary E. Miller at 2017-04-06T19:58:19-07:00
remove duplicate extern.

- - - - -


3 changed files:

- include/ntp_fp.h
- libparse/clk_computime.c
- libparse/parse_conf.c


Changes:

=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -165,9 +165,10 @@ static inline l_fp ntohl_fp(l_fp_w lfpw) {
 static inline l_fp dtolfp(double d)
 /* double to l_fp
  * assumes signed l_fp, i.e. a time offset
+ * undefined return if d in NaN
  */
 {
-	return (l_fp)((int64_t)ldexp(d, 32));
+	return (l_fp)(llround(ldexp(d, 32)));
 }
 
 static inline double lfptod(l_fp r)


=====================================
libparse/clk_computime.c
=====================================
--- a/libparse/clk_computime.c
+++ b/libparse/clk_computime.c
@@ -122,7 +122,8 @@ inp_computime(
 {
 	unsigned int rtc;
 
-	parseprintf(DD_PARSE, ("inp_computime(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+	parseprintf(DD_PARSE, ("inp_computime(0x%lx, 0x%x, ...)\n",
+                    (long unsigned)parseio, (unsigned int)ch));
 
 	switch (ch)
 	{


=====================================
libparse/parse_conf.c
=====================================
--- a/libparse/parse_conf.c
+++ b/libparse/parse_conf.c
@@ -44,10 +44,6 @@ extern clockformat_t clock_rcc8000;
 extern clockformat_t clock_hopf6021;
 #endif
 
-#ifdef CLOCK_COMPUTIME
-extern clockformat_t clock_computime;
-#endif
-
 #ifdef CLOCK_WHARTON_400A
 extern clockformat_t clock_wharton_400a;
 #endif



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/5a1b4ae6f49d57dc1295d83e5ce915c43e5d0f98...f62be6ad016b42ad2f1a6a01a3ddbccbca2b58b7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170407/0d543fc6/attachment.html>


More information about the vc mailing list