[Git][NTPsec/ntpsec][master] Replace "uint" with "unsigned int"

Matt Selsky gitlab at mg.gitlab.com
Fri Jun 9 03:48:15 UTC 2017


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
0430e6a7 by Matt Selsky at 2017-06-08T23:42:39-04:00
Replace "uint" with "unsigned int"

The former is a SysV compatibility typedef on many systems and we need to set
fewer magic defines per standards(5) on Solaris if we just do a global search
and replace.

- - - - -


6 changed files:

- attic/sht.c
- libntp/clocktime.c
- ntpd/ntp_proto.c
- ntpd/refclock_neoclock.c
- tests/libntp/macencrypt.c
- tests/libparse/binio.c


Changes:

=====================================
attic/sht.c
=====================================
--- a/attic/sht.c
+++ b/attic/sht.c
@@ -150,7 +150,7 @@ again:
 		 * certain jitter!)
 		 */
 		time_t clk_sec, rcv_sec;
-		uint   clk_frc, rcv_frc;
+		unsigned int clk_frc, rcv_frc;
 
 		/* Here we have a high-resolution system clock, and
 		 * we're not afraid to use it!
@@ -158,16 +158,16 @@ again:
 		struct timespec tmptime;
 		if (0 == clock_gettime(CLOCK_REALTIME, &tmptime)) {
 			rcv_sec = tmptime.tv_sec;
-			rcv_frc = (uint)tmptime.tv_nsec;
+			rcv_frc = (unsigned int)tmptime.tv_nsec;
 		}
 		else
 		{
 			time(&rcv_sec);
-			rcv_frc = (uint)ntp_random() % 1000000000u;
+			rcv_frc = (unsigned int)ntp_random() % 1000000000u;
 		}
 		/* add a wobble of ~3.5msec to the clock time */
 		clk_sec = rcv_sec;
-		clk_frc = rcv_frc + (uint)(ntp_random()%7094713 - 3547356);
+		clk_frc = rcv_frc + (unsigned int)(ntp_random()%7094713 - 3547356);
 		/* normalise result -- the SHM driver is picky! */
 		while ((int)clk_frc < 0) {
 			clk_frc += 1000000000;


=====================================
libntp/clocktime.c
=====================================
--- a/libntp/clocktime.c
+++ b/libntp/clocktime.c
@@ -80,7 +80,7 @@ clocktime(
 	 */
 	if (*yearstart) {
 		/* -- get time stamp of potential solution */
-		test[0] = (uint32_t)(*yearstart) + (uint)tmp;
+		test[0] = (uint32_t)(*yearstart) + (unsigned int)tmp;
 		/* -- calc absolute difference to receive time */
 		diff[0] = test[0] - rec_ui;
 		if (diff[0] >= 0x80000000u)
@@ -102,12 +102,12 @@ clocktime(
 	 * around the guess and select the entry with the minimum
 	 * absolute difference to the receive time stamp.
 	 */
-	y = ntp_to_year(rec_ui - (uint)tmp);
+	y = ntp_to_year(rec_ui - (unsigned int)tmp);
 	for (idx = 0; idx < 3; idx++) {
 		/* -- get year start of potential solution */
 		ystt[idx] = year_to_ntp(y + idx - 1);
 		/* -- get time stamp of potential solution */
-		test[idx] = ystt[idx] + (uint)tmp;
+		test[idx] = ystt[idx] + (unsigned int)tmp;
 		/* -- calc absolute difference to receive time */
 		diff[idx] = test[idx] - rec_ui;
 		if (diff[idx] >= 0x80000000u)


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -1606,9 +1606,9 @@ clock_select(void)
 	nlist = 1;
 	for (peer = peer_list; peer != NULL; peer = peer->p_link)
 		nlist++;
-	endpoint_size = ALIGNED_SIZE((uint)nlist * 2 * sizeof(*endpoint));
-	peers_size = ALIGNED_SIZE((uint)nlist * sizeof(*peers));
-	indx_size = ALIGNED_SIZE((uint)nlist * 2 * sizeof(*indx));
+	endpoint_size = ALIGNED_SIZE((unsigned int)nlist * 2 * sizeof(*endpoint));
+	peers_size = ALIGNED_SIZE((unsigned int)nlist * sizeof(*peers));
+	indx_size = ALIGNED_SIZE((unsigned int)nlist * 2 * sizeof(*indx));
 	octets = endpoint_size + peers_size + indx_size;
 	endpoint = erealloc(endpoint, octets);
 	peers = INC_ALIGNED_PTR(endpoint, endpoint_size);


=====================================
ntpd/refclock_neoclock.c
=====================================
--- a/ntpd/refclock_neoclock.c
+++ b/ntpd/refclock_neoclock.c
@@ -784,10 +784,10 @@ neol_mktime(int year,
   }
   return (((
             (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) +
-            (uint)year*365 - 719499
-            )*24 + (uint)hour /* now have hours */
-           )*60 + (uint)min /* now have minutes */
-          )*60 + (uint)sec; /* finally seconds */
+            (unsigned int)year*365 - 719499
+            )*24 + (unsigned int)hour /* now have hours */
+           )*60 + (unsigned int)min /* now have minutes */
+          )*60 + (unsigned int)sec; /* finally seconds */
 }
 
 static void


=====================================
tests/libntp/macencrypt.c
=====================================
--- a/tests/libntp/macencrypt.c
+++ b/tests/libntp/macencrypt.c
@@ -83,7 +83,7 @@ TEST(macencrypt, IPv6AddressToRefId) {
 	SET_AF(&addr, AF_INET6);
 	SET_SOCK_ADDR6(&addr, address);
 
-	const uint expected = htonl(0x52fdcf75);
+	const unsigned int expected = htonl(0x52fdcf75);
 
 	TEST_ASSERT_EQUAL(expected, addr2refid(&addr));
 }


=====================================
tests/libparse/binio.c
=====================================
--- a/tests/libparse/binio.c
+++ b/tests/libparse/binio.c
@@ -176,7 +176,7 @@ TEST(binio, put_lsb_uint164) {
 }
 
 
-/* LSB uint tests */
+/* LSB unsigned int tests */
 
 TEST(binio, get_lsb_uint160) {
         long ret;
@@ -445,7 +445,7 @@ TEST_GROUP_RUNNER(binio) {
         RUN_TEST_CASE(binio, put_lsb_uint163);
         RUN_TEST_CASE(binio, put_lsb_uint164);
 
-        /* LSB uint tests */
+        /* LSB unsigned int tests */
         RUN_TEST_CASE(binio, get_lsb_uint160);
         RUN_TEST_CASE(binio, get_lsb_uint161);
         RUN_TEST_CASE(binio, get_lsb_uint162);



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0430e6a7d32668cfaf7440cc729b7f0b5815a74a

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0430e6a7d32668cfaf7440cc729b7f0b5815a74a
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/20170609/503a017c/attachment.html>


More information about the vc mailing list