From: Roy Marples Date: Fri, 13 Mar 2015 21:26:20 +0000 (+0000) Subject: Cast away more gcc errors. X-Git-Tag: v6.8.0~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3075c02c56b23e04f597e35d0e013bcab930cb9;p=thirdparty%2Fdhcpcd.git Cast away more gcc errors. --- diff --git a/ipv6.c b/ipv6.c index b5f836a1..7969c410 100644 --- a/ipv6.c +++ b/ipv6.c @@ -454,7 +454,8 @@ ipv6_makeprefix(struct in6_addr *prefix, const struct in6_addr *addr, int len) bitlen = len % NBBY; memcpy(&prefix->s6_addr, &addr->s6_addr, (size_t)bytelen); if (bitlen != 0) - prefix->s6_addr[bytelen] >>= NBBY - bitlen; + prefix->s6_addr[bytelen] = + (uint8_t)(prefix->s6_addr[bytelen] >> (NBBY - bitlen)); memset((char *)prefix->s6_addr + bytelen, 0, sizeof(prefix->s6_addr) - (size_t)bytelen); return 0; @@ -1406,7 +1407,7 @@ again: /* RFC4941 Section 3.2.1.1 * Take the left-most 64bits and set bit 6 to zero */ memcpy(state->randomid, digest, sizeof(state->randomid)); - state->randomid[0] &= ~EUI64_UBIT; + state->randomid[0] = (uint8_t)(state->randomid[0] & ~EUI64_UBIT); /* RFC4941 Section 3.2.1.4 * Reject reserved or existing id's */ diff --git a/ipv6nd.c b/ipv6nd.c index 140ba184..e11b86a3 100644 --- a/ipv6nd.c +++ b/ipv6nd.c @@ -237,7 +237,7 @@ ipv6nd_makersprobe(struct interface *ifp) state = RS_STATE(ifp); free(state->rs); - state->rslen = sizeof(*rs) + ROUNDUP8(ifp->hwlen + 2); + state->rslen = sizeof(*rs) + (size_t)ROUNDUP8(ifp->hwlen + 2); state->rs = calloc(1, state->rslen); if (state->rs == NULL) return -1; @@ -816,7 +816,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp, break; } ndo = (struct nd_opt_hdr *)p; - olen = ndo->nd_opt_len * 8 ; + olen = (size_t)ndo->nd_opt_len * 8; if (olen == 0) { syslog(LOG_ERR, "%s: zero length option", ifp->name); break; @@ -988,7 +988,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp, nd_opt_rdnss_lifetime); op += sizeof(rdnss->nd_opt_rdnss_lifetime); l = 0; - for (n = ndo->nd_opt_len - 1; n > 1; n -= 2, + for (n = (size_t)ndo->nd_opt_len - 1; n > 1; n -= 2, op += sizeof(addr)) { r = ipv6_printaddr(NULL, 0, op, ifp->name); @@ -1002,7 +1002,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp, tmp = opt = malloc(l); if (opt == NULL) continue; - for (n = ndo->nd_opt_len - 1; n > 1; n -= 2, + for (n = (size_t)ndo->nd_opt_len - 1; n > 1; n -= 2, op += sizeof(addr)) { r = ipv6_printaddr(tmp, l, op, @@ -1025,7 +1025,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp, op = p + offsetof(struct nd_opt_dnssl, nd_opt_dnssl_lifetime); op += sizeof(dnssl->nd_opt_dnssl_lifetime); - n = (dnssl->nd_opt_dnssl_len - 1) * 8; + n = (size_t)(dnssl->nd_opt_dnssl_len - 1) * 8; r = decode_rfc3397(NULL, 0, op, n); if (r < 1) { syslog(new_data ? LOG_ERR : LOG_DEBUG,