[Git][NTPsec/ntpsec][master] 2 commits: missing casts wanted by clang

Gary E. Miller gitlab at mg.gitlab.com
Tue Feb 14 05:12:37 UTC 2017


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


Commits:
c41c0b7d by Gary E. Miller at 2017-02-13T21:05:49-08:00
missing casts wanted by clang

- - - - -
1cb90371 by Gary E. Miller at 2017-02-13T21:12:19-08:00
static found by clang

- - - - -


5 changed files:

- libisc/backtrace.c
- libisc/errno2result.c
- libisc/ifiter_getifaddrs.c
- libisc/netaddr.c
- tests/ntpd/leapsec.c


Changes:

=====================================
libisc/backtrace.c
=====================================
--- a/libisc/backtrace.c
+++ b/libisc/backtrace.c
@@ -260,13 +260,15 @@ isc_backtrace_getsymbol(const void *addr, const char **symbolp,
 	 * Search the table for the entry that meets:
 	 * entry.addr <= addr < next_entry.addr.
 	 */
-	found = bsearch(addr, isc__backtrace_symtable, isc__backtrace_nsymbols,
+	found = bsearch(addr, isc__backtrace_symtable,
+                        (size_t) isc__backtrace_nsymbols,
 			sizeof(isc__backtrace_symtable[0]), symtbl_compare);
 	if (found == NULL)
 		result = ISC_R_NOTFOUND;
 	else {
 		*symbolp = found->symbol;
-		*offsetp = (const char *)addr - (char *)found->addr;
+		*offsetp = (unsigned long)((const char *)addr \
+                                           - (char *)found->addr);
 	}
 
 	return (result);


=====================================
libisc/errno2result.c
=====================================
--- a/libisc/errno2result.c
+++ b/libisc/errno2result.c
@@ -98,7 +98,7 @@ isc___errno2result(int posixerrno, const char *file, unsigned int line) {
 		return (ISC_R_CONNREFUSED);
 	default:
 		ISC_IGNORE(strerror_r(posixerrno, strbuf, sizeof(strbuf)));
-		UNEXPECTED_ERROR(file, line, "unable to convert errno "
+		UNEXPECTED_ERROR(file, (int)line, "unable to convert errno "
 				 "to isc_result: %d: %s",
 				 posixerrno, strbuf);
 		/*


=====================================
libisc/ifiter_getifaddrs.c
=====================================
--- a/libisc/ifiter_getifaddrs.c
+++ b/libisc/ifiter_getifaddrs.c
@@ -200,22 +200,25 @@ internal_current(isc_interfaceiter_t *iter) {
 		iter->current.flags |= INTERFACE_F_MULTICAST;
 #endif
 
-	iter->current.af = family;
+	iter->current.af = (unsigned int)family;
 
-	get_addr(family, &iter->current.address, ifa->ifa_addr, ifa->ifa_name);
+	get_addr((unsigned int)family, &iter->current.address,
+                  ifa->ifa_addr, ifa->ifa_name);
 
 	if (ifa->ifa_netmask != NULL)
-		get_addr(family, &iter->current.netmask, ifa->ifa_netmask,
+		get_addr((unsigned int)family, &iter->current.netmask, ifa->ifa_netmask,
 			 ifa->ifa_name);
 
 	if (ifa->ifa_dstaddr != NULL &&
 	    (iter->current.flags & INTERFACE_F_POINTTOPOINT) != 0)
-		get_addr(family, &iter->current.dstaddress, ifa->ifa_dstaddr,
+		get_addr((unsigned int)family, &iter->current.dstaddress,
+                         ifa->ifa_dstaddr,
 			 ifa->ifa_name);
 
 	if (ifa->ifa_broadaddr != NULL &&
 	    (iter->current.flags & INTERFACE_F_BROADCAST) != 0)
-		get_addr(family, &iter->current.broadcast, ifa->ifa_broadaddr,
+		get_addr((unsigned int)family, &iter->current.broadcast,
+                         ifa->ifa_broadaddr,
 			 ifa->ifa_name);
 
 	iter->current.ifindex = if_nametoindex(iter->current.name);


=====================================
libisc/netaddr.c
=====================================
--- a/libisc/netaddr.c
+++ b/libisc/netaddr.c
@@ -150,7 +150,7 @@ isc_netaddr_getzone(const isc_netaddr_t *netaddr) {
 void
 isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) {
 	int family = s->type.sa.sa_family;
-	t->family = family;
+	t->family = (unsigned int)family;
 	switch (family) {
 	case AF_INET:
 		t->type.in = s->type.sin.sin_addr;


=====================================
tests/ntpd/leapsec.c
=====================================
--- a/tests/ntpd/leapsec.c
+++ b/tests/ntpd/leapsec.c
@@ -239,7 +239,7 @@ static const char leap_gthash [] = {
 static uint32_t lsec2009 = 3439756800u; // 1 Jan 2009, 00:00:00 utc
 static uint32_t lsec2012 = 3550089600u; // 1 Jul 2012, 00:00:00 utc
 
-int stringreader(void* farg)
+static int stringreader(void* farg)
 {
 	const char ** cpp = (const char**)farg;
 	if (**cpp)
@@ -942,7 +942,7 @@ TEST(leapsec, lsEmptyTableElectric) {
 	const time_t   tE = lsec2012 + 10;
 
 	for (t = t0; t != tE; ++t) {
-		rc = leapsec_query(&qr, t, &pivot);
+		rc = leapsec_query(&qr, (uint32_t)t, &pivot);
 		TEST_ASSERT_FALSE(rc);
 		TEST_ASSERT_EQUAL(0,             qr.warped   );
 		TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/16345cf25087b6bf45156ea5e75b122db832fb5f...1cb9037188a489df9bbbefbbfae0ca3a17989fe4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170214/5e7dcea7/attachment.html>


More information about the vc mailing list