[Git][NTPsec/ntpsec][master] 4 commits: atolfp: fix a potential unintended sign conversion.

Gary E. Miller gitlab at mg.gitlab.com
Tue May 16 20:35:09 UTC 2017


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


Commits:
130f1da8 by Gary E. Miller at 2017-05-16T13:34:52-07:00
atolfp: fix a potential unintended sign conversion.

Fixes a waring on 32-bit Raspi.

- - - - -
ff13467e by Gary E. Miller at 2017-05-16T13:34:52-07:00
hextolfp: fix a ptotential unintended sign conversion.

Fixes a warning on 32-bit RasPi.

- - - - -
5aacb636 by Gary E. Miller at 2017-05-16T13:34:52-07:00
refclock_gpsd: tv_nsec is long, not utin32_t.

Fixs a sign conversion warning on 32-bit RasPi.

- - - - -
2147872d by Gary E. Miller at 2017-05-16T13:34:52-07:00
refclock_jjy: fix two sign conversion warnings.

The warnings only showed up on 32-bit RasPi.

- - - - -


4 changed files:

- libntp/atolfp.c
- libntp/hextolfp.c
- ntpd/refclock_gpsd.c
- ntpd/refclock_jjy.c


Changes:

=====================================
libntp/atolfp.c
=====================================
--- a/libntp/atolfp.c
+++ b/libntp/atolfp.c
@@ -119,6 +119,6 @@ atolfp(
 		(dec_i) = ~(dec_i) + ((dec_f) == 0);
 	}
 
-	*lfp = lfpinit(dec_i, dec_f);
+	*lfp = lfpinit_u(dec_i, dec_f);
 	return true;
 }


=====================================
libntp/hextolfp.c
=====================================
--- a/libntp/hextolfp.c
+++ b/libntp/hextolfp.c
@@ -62,6 +62,6 @@ hextolfp(
 	if (*cp != '\0' && !isspace((unsigned char)*cp))
 	    return false;
 
-	*lfp = lfpinit(dec_i, dec_f);
+	*lfp = lfpinit_u(dec_i, dec_f);
 	return true;
 }


=====================================
ntpd/refclock_gpsd.c
=====================================
--- a/ntpd/refclock_gpsd.c
+++ b/ntpd/refclock_gpsd.c
@@ -2061,10 +2061,10 @@ convert_ascii_time(
 	if (NULL == ep)
 		return false; /* could not parse the mandatory stuff! */
 	if (*ep == '.') {
-		dw = 100000000u;
+		dw = 100000000;
 		while (isdigit(*(unsigned char*)++ep)) {
-		    ts.tv_nsec += (uint32_t)(*(unsigned char*)ep - '0') * dw;
-		    dw /= 10u;
+		    ts.tv_nsec += (long)(*(unsigned char*)ep - '0') * dw;
+		    dw /= 10;
 		}
 	}
 	if (ep[0] != 'Z' || ep[1] != '\0')


=====================================
ntpd/refclock_jjy.c
=====================================
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -3078,7 +3078,7 @@ teljjy_getDelay ( struct peer *peer, struct jjyunit *up )
 	int	i ;
 	int	minIndex = 0, maxIndex = 0, iAverCount = 0 ;
 	int	iThresholdSecond, iThresholdMicroSecond ;
-	unsigned int	iPercent ;
+	int	iPercent ;
 
 	minTime.tv_sec = minTime.tv_nsec = 0 ;
 	maxTime.tv_sec = maxTime.tv_nsec = 0 ;
@@ -3149,7 +3149,7 @@ teljjy_getDelay ( struct peer *peer, struct jjyunit *up )
 
 	/* subtype 101 = 1%, subtype 150 = 50%, subtype 180 = 80% */
 
-	iPercent = ( peer->ttl - 100 ) ;
+	iPercent = (int)peer->ttl - 100 ;
 
 	/* Average delay time in milli second */
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/6d7b5ac29b4d508aee73d5dbd5a66b832c20ef39...2147872da9542a9fb25c66ba9c10ccf6b3ed8ab4

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/6d7b5ac29b4d508aee73d5dbd5a66b832c20ef39...2147872da9542a9fb25c66ba9c10ccf6b3ed8ab4
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170516/45b30c5d/attachment.html>


More information about the vc mailing list