[Git][NTPsec/ntpsec][master] 2 commits: clk_trimtsip.c: Add missing casts

Gary E. Miller gitlab at mg.gitlab.com
Fri Mar 31 03:27:16 UTC 2017


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


Commits:
0c53fbb2 by Gary E. Miller at 2017-03-30T20:15:00-07:00
clk_trimtsip.c: Add missing casts

- - - - -
2b61cbf0 by Gary E. Miller at 2017-03-30T20:26:42-07:00
gpstolfp: Add missing casts, cleanup conversion.

- - - - -


2 changed files:

- libparse/clk_trimtsip.c
- libparse/gpstolfp.c


Changes:

=====================================
libparse/clk_trimtsip.c
=====================================
--- a/libparse/clk_trimtsip.c
+++ b/libparse/clk_trimtsip.c
@@ -130,7 +130,7 @@ inp_tsip(
 			parseio->parse_index = 0;
 			parseio->parse_data[parseio->parse_index++] = ch;
 			parseio->parse_dtime.parse_msglen = 0;
-			parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
+			parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = (unsigned char)ch;
 			parseio->parse_dtime.parse_stime = *tstamp; /* pick up time stamp at packet start */
 		} else if (t->t_dle) {
 			/* Double DLE -> insert a DLE */
@@ -149,7 +149,7 @@ inp_tsip(
 			parseio->parse_ldsize = (unsigned short) (parseio->parse_index + 1);
 			memcpy(parseio->parse_ldata, parseio->parse_data, parseio->parse_ldsize);
 			parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = DLE;
-			parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
+			parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = (unsigned char)ch;
 			t->t_in_pkt = t->t_dle = 0;
 			return PARSE_INP_TIME|PARSE_INP_DATA;
 		}
@@ -158,7 +158,7 @@ inp_tsip(
 	    default:		/* collect data */
 		t->t_dle = 0;
 		parseio->parse_data[parseio->parse_index++] = ch;
-		parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
+		parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = (unsigned char)ch;
 	}
 
   return PARSE_INP_SKIP;


=====================================
libparse/gpstolfp.c
=====================================
--- a/libparse/gpstolfp.c
+++ b/libparse/gpstolfp.c
@@ -25,7 +25,11 @@ gpstolfp(
       weeks += GPSWEEKS;
     }
 
-  setlfpuint(*lfp, (uint32_t)(weeks * SECSPERWEEK + days * SECSPERDAY + seconds + GPSORIGIN)); /* convert to NTP time */
+   /* convert to NTP time, note no fractional seconds */
+  *lfp = lfptouint((uint64_t)weeks * SECSPERWEEK
+                   + (uint64_t)days * SECSPERDAY
+                   + (uint64_t)seconds
+                   + GPSORIGIN);
   setlfpfrac(*lfp, 0);
 }
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/3f0ed9899e2b7770e55812feafe88b83f075c098...2b61cbf091a8f1c68f90dbc5f935d975f9b7ccb0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170331/836ac40a/attachment.html>


More information about the vc mailing list