[Git][NTPsec/ntpsec][master] Squash a few more compiler warnings.

Hal Murray gitlab at mg.gitlab.com
Sat Dec 5 07:36:47 UTC 2015


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
dec8c322 by Hal Murray at 2015-12-04T23:36:14Z
Squash a few more compiler warnings.

- - - - -


2 changed files:

- tests/ntpd/leapsec.c
- util/tg2.c


Changes:

=====================================
tests/ntpd/leapsec.c
=====================================
--- a/tests/ntpd/leapsec.c
+++ b/tests/ntpd/leapsec.c
@@ -393,9 +393,9 @@ TEST(leapsec, loadFileExpire) {
 	rc =   leapsec_load(pt, stringreader, &cp, false)
 	    && leapsec_set_table(pt);
 	TEST_ASSERT_EQUAL(1, rc);
-	rc = leapsec_expired(3439756800, NULL);
+	rc = leapsec_expired(3439756800u, NULL);
 	TEST_ASSERT_EQUAL(0, rc);
-	rc = leapsec_expired(3610569601, NULL);
+	rc = leapsec_expired(3610569601u, NULL);
 	TEST_ASSERT_EQUAL(1, rc);
 }
 
@@ -565,13 +565,13 @@ TEST(leapsec, addDynamic) {
 	int            idx;
 
 	static const uint32_t insns[] = {
-		2982009600,	//	29	# 1 Jul 1994
-		3029443200,	//	30	# 1 Jan 1996
-		3076704000,	//	31	# 1 Jul 1997
-		3124137600,	//	32	# 1 Jan 1999
-		3345062400,	//	33	# 1 Jan 2006
-		3439756800,	//	34	# 1 Jan 2009
-		3550089600,	//	35	# 1 Jul 2012
+		2982009600u,	//	29	# 1 Jul 1994
+		3029443200u,	//	30	# 1 Jan 1996
+		3076704000u,	//	31	# 1 Jul 1997
+		3124137600u,	//	32	# 1 Jan 1999
+		3345062400u,	//	33	# 1 Jan 2006
+		3439756800u,	//	34	# 1 Jan 2009
+		3550089600u,	//	35	# 1 Jul 2012
 		0 // sentinel
 	};
 
@@ -595,13 +595,13 @@ TEST(leapsec, addFixed) {
     int            idx;
 
 	static const struct { uint32_t tt; int of; } insns[] = {
-		{2982009600, 29},//	# 1 Jul 1994
-		{3029443200, 30},//	# 1 Jan 1996
-		{3076704000, 31},//	# 1 Jul 1997
-		{3124137600, 32},//	# 1 Jan 1999
-		{3345062400, 33},//	# 1 Jan 2006
-		{3439756800, 34},//	# 1 Jan 2009
-		{3550089600, 35},//	# 1 Jul 2012
+		{2982009600u, 29},//	# 1 Jul 1994
+		{3029443200u, 30},//	# 1 Jan 1996
+		{3076704000u, 31},//	# 1 Jul 1997
+		{3124137600u, 32},//	# 1 Jan 1999
+		{3345062400u, 33},//	# 1 Jan 2006
+		{3439756800u, 34},//	# 1 Jan 2009
+		{3550089600u, 35},//	# 1 Jul 2012
 		{0,0} // sentinel
 	};
 
@@ -938,8 +938,8 @@ TEST(leapsec, lsEmptyTableElectric) {
 	TEST_ASSERT_TRUE(leapsec_electric(-1));
 
 	const time_t   pivot = lsec2012;
-	const uint32_t t0 = lsec2012 - 10;
-	const uint32_t tE = lsec2012 + 10;
+	const time_t   t0 = lsec2012 - 10;
+	const time_t   tE = lsec2012 + 10;
 
 	for (t = t0; t != tE; ++t) {
 		rc = leapsec_query(&qr, t, &pivot);


=====================================
util/tg2.c
=====================================
--- a/util/tg2.c
+++ b/util/tg2.c
@@ -916,8 +916,8 @@ main(
 			}
 		}
 
-	switch (tolower(FormatCharacter)) {
-	case 'i':
+	switch (FormatCharacter) {
+	case 'i': case 'I':
 		printf ("\nFormat is IRIG-1998 (no year coded)...\n\n");
 		encode = IRIG;
 		IrigIncludeYear = false;
@@ -958,7 +958,7 @@ main(
 		UnmodulatedInverted = true;
 		break;
 
-	case 'w':
+	case 'w': case 'W':
 		printf ("\nFormat is WWV(H)...\n\n");
 		encode = WWV;
 		break;
@@ -1464,7 +1464,7 @@ main(
 				ParitySum = 0;
 				for (StringPointer=ParityString; *StringPointer!=NUL; StringPointer++)
 					{
-					switch (toupper(*StringPointer))
+					switch (*StringPointer)
 						{
 						case '1':
 						case '2':
@@ -1477,19 +1477,19 @@ main(
 						case '5':
 						case '6':
 						case '9':
-						case 'A':
-						case 'C':
+						case 'A': case 'a':
+						case 'C': case 'c':
 							ParitySum += 2;
 							break;
 
 						case '7':
-						case 'B':
-						case 'D':
-						case 'E':
+						case 'B': case 'b':
+						case 'D': case 'd':
+						case 'E': case 'e':
 							ParitySum += 3;
 							break;
 
-						case 'F':
+						case 'F': case 'f':
 							ParitySum += 4;
 							break;
 						}
@@ -1597,8 +1597,8 @@ main(
 				case DECC:	/* decrement pointer and send bit. */
 					ptr--;
 				case COEF:	/* send BCD bit */
-					AsciiValue = toupper(code[ptr]);
-					HexValue   = isdigit(AsciiValue) ? AsciiValue - '0' : (AsciiValue - 'A')+10;
+					AsciiValue = toupper((int)code[ptr]);
+					HexValue   = isdigit((int)AsciiValue) ? AsciiValue - '0' : (AsciiValue - 'A')+10;
 					/* if  (Debug) {
 						if  (ptr != OldPtr) {
 						if  (Verbose)



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


More information about the vc mailing list