diff --git a/src/auth.c b/src/auth.c index 3c3b155b..83224685 100644 --- a/src/auth.c +++ b/src/auth.c @@ -753,5 +753,5 @@ dhcp_auth_encode(struct dhcpcd_ctx *ctx, struct auth *auth, } /* Done! */ - return (int)(dlen - sizeof(hmac_code)); /* should be zero */ + return (ssize_t)(dlen - sizeof(hmac_code)); /* should be zero */ } diff --git a/src/dhcp.c b/src/dhcp.c index c6267d78..c5b2e778 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -1446,7 +1446,7 @@ dhcp_env(FILE *fenv, const char *prefix, const struct interface *ifp, dhcp_envoption(ifp->ctx, fenv, prefix, ifp->name, opt, dhcp_getoption, p, pl); - if (opt->option != DHO_VIVSO || pl <= (int)sizeof(uint32_t)) + if (opt->option != DHO_VIVSO || pl <= sizeof(uint32_t)) continue; memcpy(&en, p, sizeof(en)); en = ntohl(en); diff --git a/src/dhcpcd.h b/src/dhcpcd.h index 718ac1e4..2e9525c2 100644 --- a/src/dhcpcd.h +++ b/src/dhcpcd.h @@ -33,6 +33,7 @@ #include +#include #include #include "config.h" @@ -109,7 +110,7 @@ TAILQ_HEAD(if_head, interface); #define ALIGNBYTES (sizeof(int) - 1) #endif #ifndef ALIGN -#define ALIGN(p) (((unsigned int)(p) + ALIGNBYTES) & ~ALIGNBYTES) +#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) & ~(uintptr_t)ALIGNBYTES) #endif #ifndef CMSG_SPACE #define CMSG_SPACE(len) (ALIGN(sizeof(struct cmsghdr)) + ALIGN(len)) diff --git a/src/if-options.c b/src/if-options.c index 0ec71a43..d0e79f3a 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -671,7 +671,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, { int e, i, t; long l; - unsigned long u; + uint32_t u; char *p = NULL, *bp, *fp, *np; ssize_t s; struct in_addr addr, addr2; @@ -1043,7 +1043,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, } for (sl = 0, vsio = *vsiop; sl < *vsio_lenp; sl++, vsio++) { - if (vsio->en == (uint32_t)u) + if (vsio->en == u) break; } if (sl == *vsio_lenp) { @@ -1056,7 +1056,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, } *vsiop = vsio; vsio = &(*vsiop)[(*vsio_lenp)++]; - vsio->en = (uint32_t)u; + vsio->en = u; vsio->so = NULL; vsio->so_len = 0; } @@ -2165,7 +2165,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, ndop->encopts_len = 0; } else free_dhcp_opt_embenc(ndop); - ndop->option = (uint32_t)u; /* could have been 0 */ + ndop->option = u; /* could have been 0 */ ndop->type = t; ndop->len = (size_t)l; ndop->var = np; @@ -2208,7 +2208,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, return -1; } for (vivco = ifo->vivco; vivco != vivco_endp; vivco++) { - if (vivco->en == (uint32_t)u) { + if (vivco->en == u) { logerrx( "vendor class option for enterprise number %u already defined", vivco->en); @@ -2246,7 +2246,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, } ifo->vivco = vivco; vivco = &ifo->vivco[ifo->vivco_len++]; - vivco->en = (uint32_t)u; + vivco->en = u; vivco->len = dl; vivco->data = (uint8_t *)np; break;