[Git][NTPsec/ntpsec][master] 3 commits: Fix conversion warnings in recvbuff.c

Hal Murray gitlab at mg.gitlab.com
Wed Apr 5 08:33:20 UTC 2017


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
67abe3d9 by Hal Murray at 2017-04-05T00:34:49-07:00
Fix conversion warnings in recvbuff.c

- - - - -
598e614d by Hal Murray at 2017-04-05T00:58:09-07:00
Squash a few more sign conversion warnings: ntp_signd.c

- - - - -
7de3fc54 by Hal Murray at 2017-04-05T00:59:36-07:00
Fix sign conversion warnings: leap_smear_intv

- - - - -


6 changed files:

- include/ntpd.h
- include/recvbuff.h
- libntp/recvbuff.c
- ntpd/ntp_config.c
- ntpd/ntp_signd.c
- ntpd/ntp_timer.c


Changes:

=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -454,7 +454,7 @@ extern u_long	timer_xmtcalls;
 extern bool	leap_sec_in_progress;
 #ifdef ENABLE_LEAP_SMEAR
 extern struct leap_smear_info leap_smear;
-extern int	leap_smear_intv;
+extern u_int	leap_smear_intv;
 #endif
 
 /* ntp_util.c */


=====================================
include/recvbuff.h
=====================================
--- a/include/recvbuff.h
+++ b/include/recvbuff.h
@@ -60,7 +60,7 @@ struct recvbuf {
 #endif /* REFCLOCK */
 };
 
-extern	void	init_recvbuff(int);
+extern	void	init_recvbuff(u_int);
 
 /* freerecvbuf - make a single recvbuf available for reuse
  */


=====================================
libntp/recvbuff.c
=====================================
--- a/libntp/recvbuff.c
+++ b/libntp/recvbuff.c
@@ -58,12 +58,12 @@ initialise_buffer(recvbuf_t *buff)
 }
 
 static void
-create_buffers(int nbufs)
+create_buffers(u_int nbufs)
 {
 	register recvbuf_t *bufp;
-	int i, abuf;
+	unsigned int i, abuf;
 
-	abuf = nbufs + (int)buffer_shortfall;
+	abuf = nbufs + buffer_shortfall;
 	buffer_shortfall = 0;
 
 #ifndef DEBUG
@@ -89,7 +89,7 @@ create_buffers(int nbufs)
 }
 
 void
-init_recvbuff(int nbufs)
+init_recvbuff(u_int nbufs)
 {
 
 	/*


=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -2525,8 +2525,11 @@ config_vars(
 
 #ifdef ENABLE_LEAP_SMEAR
 		case T_Leapsmearinterval:
-			leap_smear_intv = curr_var->value.i;
-			msyslog(LOG_INFO, "config: leap smear interval %i s", leap_smear_intv);
+			if (curr_var->value.i < 0)
+				msyslog(LOG_ERR, "config: negative leap smear interval ignored: %i", curr_var->value.i);
+				break;
+			leap_smear_intv = curr_var->value.u;
+			msyslog(LOG_INFO, "config: leap smear interval %u sec", leap_smear_intv);
 			break;
 #endif
 


=====================================
ntpd/ntp_signd.c
=====================================
--- a/ntpd/ntp_signd.c
+++ b/ntpd/ntp_signd.c
@@ -59,8 +59,8 @@ write_all(int fd, const void *buf, size_t len)
 		int n = write(fd, buf, len);
 		if (n <= 0) return total;
 		buf = n + (char *)buf;
-		len -= n;
-		total += n;
+		len -= (u_int)n;
+		total += (u_int)n;
 	}
 	return total;
 }
@@ -76,8 +76,8 @@ read_all(int fd, void *buf, size_t len)
 		int n = read(fd, buf, len);
 		if (n <= 0) return total;
 		buf = n + (char *)buf;
-		len -= n;
-		total += n;
+		len -= (u_int)n;
+		total += (u_int)n;
 	}
 	return total;
 }


=====================================
ntpd/ntp_timer.c
=====================================
--- a/ntpd/ntp_timer.c
+++ b/ntpd/ntp_timer.c
@@ -47,7 +47,7 @@ static	u_long leapf_timer;	/* Report leapfile problems once/day */
 static	u_long huffpuff_timer;	/* huff-n'-puff timer */
 static	u_long worker_idle_timer;/* next check for idle intres */
 u_long	leapsec;	        /* seconds to next leap (proximity class) */
-int	leap_smear_intv;	/* Duration of smear.  Enables smear mode. */
+u_int	leap_smear_intv;	/* Duration of smear.  Enables smear mode. */
 int	leapdif;		/* TAI difference step at next leap second*/
 u_long	orphwait; 		/* orphan wait time */
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/b4e8f20b32f7647dc07be8d653128dfe23059e6d...7de3fc541cf80b0288b1ac5c8ca4de578fd162fd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170405/5f380f82/attachment.html>


More information about the vc mailing list