[Git][NTPsec/ntpsec][master] Finish -Wextra signedness cleanup.

Eric S. Raymond gitlab at mg.gitlab.com
Sun Nov 22 22:03:40 UTC 2015


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
c1804e28 by Eric S. Raymond at 2015-11-22T17:02:57Z
Finish -Wextra signedness cleanup.

- - - - -


13 changed files:

- include/parse.h
- libntp/decodenetnum.c
- libntp/intercept.c
- libntp/systime.c
- ntpd/keyword-gen.c
- ntpd/ntp_proto.c
- ntpd/ntp_scanner.c
- ntpd/refclock_gpsdjson.c
- ntpd/refclock_jjy.c
- ntpd/refclock_mx4200.c
- ntpd/refclock_shm.c
- ntpq/libntpq.c
- pylib/configure.py


Changes:

=====================================
include/parse.h
=====================================
--- a/include/parse.h
+++ b/include/parse.h
@@ -34,9 +34,9 @@
 /*
  * some constants useful for GPS time conversion
  */
-#define GPSORIGIN       2524953600UL                /* NTP origin - GPS origin in seconds */
-#define GPSWRAP         990U                        /* assume week count less than this in the previous epoch */
-#define GPSWEEKS        1024U                       /* number of weeks until the GPS epch rolls over */
+#define GPSORIGIN       2524953600                 /* NTP origin - GPS origin in seconds */
+#define GPSWRAP         990                        /* assume week count less than this in the previous epoch */
+#define GPSWEEKS        1024                       /* number of weeks until the GPS epch rolls over */
 
 /*
  * state flags


=====================================
libntp/decodenetnum.c
=====================================
--- a/libntp/decodenetnum.c
+++ b/libntp/decodenetnum.c
@@ -98,7 +98,7 @@ decodenetnum(
 	   either NULL or pointing to the start of the port. Check
 	   whether the IP is short enough to possibly be valid and
 	   if so copy it into ip. */
-	if(ip_end - ip_start + 1 > sizeof ip) {
+	if(ip_end - ip_start + 1 > (int)sizeof(ip)) {
 		return false;
 	} else {
 		memcpy(ip, ip_start, ip_end - ip_start);


=====================================
libntp/intercept.c
=====================================
--- a/libntp/intercept.c
+++ b/libntp/intercept.c
@@ -169,7 +169,7 @@ void intercept_get_systime(const char *legend, l_fp *now)
 	printf("event systime %s %ld %ld\n",
 		legend, (long)ts.tv_sec, ts.tv_nsec);
 
-    normalize_time(ts, sys_fuzz > 0.0 ? ntp_random() : 0UL, now);
+    normalize_time(ts, sys_fuzz > 0.0 ? ntp_random() : 0, now);
 }
 
 long intercept_ntp_random(const char *legend)


=====================================
libntp/systime.c
=====================================
--- a/libntp/systime.c
+++ b/libntp/systime.c
@@ -200,7 +200,7 @@ get_systime(
 {
 	struct timespec ts;	/* seconds and nanoseconds */
 	get_ostime(&ts);
-	normalize_time(ts, sys_fuzz > 0.0 ? ntp_random() : 0UL, now);
+	normalize_time(ts, sys_fuzz > 0.0 ? ntp_random() : 0, now);
 }
 
 void


=====================================
ntpd/keyword-gen.c
=====================================
--- a/ntpd/keyword-gen.c
+++ b/ntpd/keyword-gen.c
@@ -708,7 +708,7 @@ populate_symb(
 	while (NULL != fgets(line, sizeof(line), yh))
 		if (2 == sscanf(line, "#define %s %d", name, &token)
 		    && 'T' == name[0] && '_' == name[1] && token >= 0
-		    && token < COUNTOF(symb)) {
+		    && token < (int)COUNTOF(symb)) {
 
 			symb[token] = estrdup(name);
 			if (strlen(name) > MAX_TOK_LEN) {


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -3614,7 +3614,7 @@ fast_xmit(
 #ifdef DEBUG
 		if (debug)
 			printf(
-			    "transmit: at %ld %s->%s mode %d len %d\n",
+			    "transmit: at %ld %s->%s mode %d len %zd\n",
 			    current_time, stoa(&rbufp->dstadr->sin),
 			    stoa(&rbufp->recv_srcadr), xmode, sendlen);
 #endif
@@ -3671,7 +3671,7 @@ fast_xmit(
 #ifdef DEBUG
 	if (debug)
 		printf(
-		    "transmit: at %ld %s->%s mode %d keyid %08x len %d\n",
+		    "transmit: at %ld %s->%s mode %d keyid %08x len %zd\n",
 		    current_time, ntoa(&rbufp->dstadr->sin),
 		    ntoa(&rbufp->recv_srcadr), xmode, xkeyid, sendlen);
 #endif


=====================================
ntpd/ntp_scanner.c
=====================================
--- a/ntpd/ntp_scanner.c
+++ b/ntpd/ntp_scanner.c
@@ -743,7 +743,7 @@ yylex(void)
 			}
 
 			i++;
-			if (i >= COUNTOF(yytext))
+			if (i >= (int)COUNTOF(yytext))
 				goto lex_too_long;
 		}
 		/* Pick up all of the string inside between " marks, to
@@ -757,7 +757,7 @@ yylex(void)
 			while (EOF != (ch = lex_getch(lex_stack)) &&
 			       ch != '"' && ch != '\n') {
 				yytext[i++] = (char)ch;
-				if (i >= COUNTOF(yytext))
+				if (i >= (int)COUNTOF(yytext))
 					goto lex_too_long;
 			}
 			/*


=====================================
ntpd/refclock_gpsdjson.c
=====================================
--- a/ntpd/refclock_gpsdjson.c
+++ b/ntpd/refclock_gpsdjson.c
@@ -1191,7 +1191,7 @@ json_object_lookup(
 			tid = json_token_skip(ctx, tid); /* skip val */
 		} else if (strcmp(key, ctx->buf + ctx->tok[tid].start)) {
 			tid = json_token_skip(ctx, tid+1); /* skip key+val */
-		} else if (what < 0 || what == ctx->tok[tid+1].type) {
+		} else if (what < 0 || what == (int)ctx->tok[tid+1].type) {
 			return tid + 1;
 		} else {
 			break;


=====================================
ntpd/refclock_jjy.c
=====================================
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -2692,7 +2692,7 @@ jjy_start_telephone ( int unit, struct peer *peer, struct jjyunit *up )
 	iNumberOfDigitsOfPhoneNumber = iCommaCount = iCommaPosition = iFirstThreeDigitsCount = 0 ;
 	for ( i = 0 ; i < strlen( sys_phone[0] ) ; i ++ ) {
 		if ( isdigit( *(sys_phone[0]+i) ) ) {
-			if ( iFirstThreeDigitsCount < sizeof(sFirstThreeDigits)-1 ) {
+		    if ( iFirstThreeDigitsCount < (int)sizeof(sFirstThreeDigits)-1 ) {
 				sFirstThreeDigits[iFirstThreeDigitsCount++] = *(sys_phone[0]+i) ;
 			}
 			iNumberOfDigitsOfPhoneNumber ++ ;
@@ -3884,7 +3884,7 @@ modem_receive ( struct recvbuf *rbufp )
 	if ( debug ) {
 		char	sResp [ 40 ] ;
 		size_t	iCopyLen ;
-		iCopyLen = ( iLen <= sizeof(sResp)-1 ? iLen : sizeof(sResp)-1 ) ;
+		iCopyLen = ( iLen <= (int)sizeof(sResp)-1 ? iLen : (int)sizeof(sResp)-1 ) ;
 		strlcpy( sResp, pBuf, sizeof(sResp) ) ;
 		printf ( "refclock_jjy.c : modem_receive : iLen=%zd pBuf=[%s] iModemEvent=%d\n", iCopyLen, sResp, up->iModemEvent ) ;
 	}


=====================================
ntpd/refclock_mx4200.c
=====================================
--- a/ntpd/refclock_mx4200.c
+++ b/ntpd/refclock_mx4200.c
@@ -1443,7 +1443,7 @@ mx4200_pps(
 	struct peer *peer
 	)
 {
-	int temp_serial;
+	u_int temp_serial;
 	struct refclockproc *pp;
 	struct mx4200unit *up;
 


=====================================
ntpd/refclock_shm.c
=====================================
--- a/ntpd/refclock_shm.c
+++ b/ntpd/refclock_shm.c
@@ -596,7 +596,7 @@ shm_timer(
 		     cd.year, cd.month, cd.monthday,
 		     cd.hour, cd.minute, cd.second,
 		     (long)shm_stat.tvt.tv_nsec);
-	pp->lencode = (c < sizeof(pp->a_lastcode)) ? c : 0;
+	pp->lencode = (c < (int)sizeof(pp->a_lastcode)) ? c : 0;
 
 	/* check 1: age control of local time stamp */
 	tt = shm_stat.tvc.tv_sec - shm_stat.tvr.tv_sec;


=====================================
ntpq/libntpq.c
=====================================
--- a/ntpq/libntpq.c
+++ b/ntpq/libntpq.c
@@ -308,7 +308,7 @@ int  ntpq_read_associations ( u_short resultbuf[], int max_entries )
 
     if (ntpq_dogetassoc()) {       
         
-        if(numassoc < max_entries)
+        if((int)numassoc < max_entries)
           max_entries = numassoc;
 
         for (i=0;i<max_entries;i++)
@@ -373,7 +373,7 @@ int  ntpq_read_associations ( u_short resultbuf[], int max_entries )
  
 int ntpq_get_assoc_number ( associd_t associd )
 {
-	int i;
+	u_int i;
 
 	for (i=0;i<numassoc;i++) {
 		if (assoc_cache[i].assid == associd)
@@ -712,7 +712,7 @@ ntpq_get_assoc_clocktype(
 	char		dstadr[NI_MAXHOST];
 	char		resultbuf[NTPQ_BUFLEN];
 
-	if (assoc_index < 0 || assoc_index >= numassoc)
+	if (assoc_index < 0 || assoc_index >= (int)numassoc)
 		return -1;
 
 	associd = assoc_cache[assoc_index].assid;


=====================================
pylib/configure.py
=====================================
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -38,7 +38,7 @@ def cmd_configure(ctx):
 		ctx.define("DEBUG", 1)
 		ctx.env.BISONFLAGS += ["--debug"]
 
-	ctx.env.CFLAGS += ["-Wall"]	# Default CFLAGS.
+	ctx.env.CFLAGS += ["-Wall", "-Wextra"]	# Default CFLAGS.
 
 
 	# Check target platform.



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c1804e2899398faa0a897d748d085f99d9ed2a2a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151122/c7a82a31/attachment.html>


More information about the vc mailing list