added more missing casts

This commit is contained in:
goldsimon 2015-04-23 07:24:45 +02:00
parent fbadb8354f
commit e60bc69515
5 changed files with 17 additions and 15 deletions

View File

@ -2347,7 +2347,7 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
return EINVAL;
} else {
sock->conn->pcb.raw->chksum_reqd = 1;
sock->conn->pcb.raw->chksum_offset = *(const int *)optval;
sock->conn->pcb.raw->chksum_offset = (u16_t)*(const int *)optval;
}
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_RAW, IPV6_CHECKSUM, ..) -> %d\n",
s, sock->conn->pcb.raw->chksum_reqd));

View File

@ -276,7 +276,7 @@ DNS_LOCAL_HOSTLIST_STORAGE_PRE struct local_hostlist_entry local_hostlist_static
#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
static void dns_init_local();
static void dns_init_local(void);
#endif /* DNS_LOCAL_HOSTLIST */
@ -422,7 +422,7 @@ dns_tmr(void)
#if DNS_LOCAL_HOSTLIST
static void
dns_init_local()
dns_init_local(void)
{
#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC && defined(DNS_LOCAL_HOSTLIST_INIT)
int i;

View File

@ -150,7 +150,7 @@ ip6_reass_free_complete_datagram(struct ip6_reassdata *ipr)
p = ipr->p;
ipr->p = iprh->next_pbuf;
/* Then, move back to the original header (we are now pointing to Fragment header). */
if (pbuf_header(p, (u8_t*)p->payload - (u8_t*)ipr->iphdr)) {
if (pbuf_header(p, (s16_t)((u8_t*)p->payload - (u8_t*)ipr->iphdr))) {
LWIP_ASSERT("ip6_reass_free: moving p->payload to ip6 header failed\n", 0);
}
else {
@ -264,7 +264,7 @@ ip6_reass(struct pbuf *p)
* Adjust for headers before Fragment Header.
* And finally adjust by Fragment Header length. */
len = ntohs(ip6_current_header()->_plen);
len -= ((u8_t*)p->payload - (u8_t*)ip6_current_header()) - IP6_HLEN;
len -= (u16_t)(((u8_t*)p->payload - (u8_t*)ip6_current_header()) - IP6_HLEN);
len -= IP6_FRAG_HLEN;
/* Look for the datagram the fragment belongs to in the current datagram queue,
@ -494,9 +494,9 @@ ip6_reass(struct pbuf *p)
}
/* Adjust datagram length by adding header lengths. */
ipr->datagram_len += ((u8_t*)ipr->p->payload - (u8_t*)ipr->iphdr)
ipr->datagram_len += (u16_t)(((u8_t*)ipr->p->payload - (u8_t*)ipr->iphdr)
+ IP6_FRAG_HLEN
- IP6_HLEN ;
- IP6_HLEN);
/* Set payload length in ip header. */
ipr->iphdr->_plen = htons(ipr->datagram_len);
@ -528,7 +528,7 @@ ip6_reass(struct pbuf *p)
ip6_reass_pbufcount -= pbuf_clen(p);
/* Move pbuf back to IPv6 header. */
if (pbuf_header(p, (u8_t*)p->payload - iphdr_ptr)) {
if (pbuf_header(p, (s16_t)((u8_t*)p->payload - iphdr_ptr))) {
LWIP_ASSERT("ip6_reass: moving p->payload to ip6 header failed\n", 0);
pbuf_free(p);
return NULL;

View File

@ -470,7 +470,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
mtu_opt = (struct mtu_option *)buffer;
if (htonl(mtu_opt->mtu) >= 1280) {
#if LWIP_ND6_ALLOW_RA_UPDATES
inp->mtu = htonl(mtu_opt->mtu);
inp->mtu = (u16_t)htonl(mtu_opt->mtu);
#endif /* LWIP_ND6_ALLOW_RA_UPDATES */
}
break;
@ -603,6 +603,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
{
struct icmp6_hdr *icmp6hdr; /* Packet too big message */
struct ip6_hdr * ip6hdr; /* IPv6 header of the packet which caused the error */
u32_t pmtu;
/* Check that ICMPv6 header + IPv6 header fit in payload */
if (p->len < (sizeof(struct icmp6_hdr) + IP6_HLEN)) {
@ -628,7 +629,8 @@ nd6_input(struct pbuf *p, struct netif *inp)
}
/* Change the Path MTU. */
destination_cache[i].pmtu = htonl(icmp6hdr->data);
pmtu = htonl(icmp6hdr->data);
destination_cache[i].pmtu = (u16_t)LWIP_MIN(pmtu, 0xFFFF);
break; /* ICMP6_TYPE_PTB */
}
@ -866,7 +868,7 @@ nd6_send_ns(struct netif * netif, const ip6_addr_t * target_addr, u8_t flags)
ip6_addr_set(&(ns_hdr->target_address), target_addr);
lladdr_opt->type = ND6_OPTION_TYPE_SOURCE_LLADDR;
lladdr_opt->length = lladdr_opt_len;
lladdr_opt->length = (u8_t)lladdr_opt_len;
SMEMCPY(lladdr_opt->addr, netif->hwaddr, netif->hwaddr_len);
/* Generate the solicited node address for the target address. */
@ -935,7 +937,7 @@ nd6_send_na(struct netif * netif, const ip6_addr_t * target_addr, u8_t flags)
ip6_addr_set(&(na_hdr->target_address), target_addr);
lladdr_opt->type = ND6_OPTION_TYPE_TARGET_LLADDR;
lladdr_opt->length = lladdr_opt_len;
lladdr_opt->length = (u8_t)lladdr_opt_len;
SMEMCPY(lladdr_opt->addr, netif->hwaddr, netif->hwaddr_len);
/* Generate the solicited node address for the target address. */
@ -1016,7 +1018,7 @@ nd6_send_rs(struct netif * netif)
/* Include our hw address. */
lladdr_opt = (struct lladdr_option *)((u8_t*)p->payload + sizeof(struct rs_header));
lladdr_opt->type = ND6_OPTION_TYPE_SOURCE_LLADDR;
lladdr_opt->length = lladdr_opt_len;
lladdr_opt->length = (u8_t)lladdr_opt_len;
SMEMCPY(lladdr_opt->addr, netif->hwaddr, netif->hwaddr_len);
}

View File

@ -72,7 +72,7 @@
"The Dynamic and/or Private Ports are those from 49152 through 65535" */
#define UDP_LOCAL_PORT_RANGE_START 0xc000
#define UDP_LOCAL_PORT_RANGE_END 0xffff
#define UDP_ENSURE_LOCAL_PORT_RANGE(port) (((port) & ~UDP_LOCAL_PORT_RANGE_START) + UDP_LOCAL_PORT_RANGE_START)
#define UDP_ENSURE_LOCAL_PORT_RANGE(port) ((u16_t)(((port) & ~UDP_LOCAL_PORT_RANGE_START) + UDP_LOCAL_PORT_RANGE_START))
#endif
/* last local UDP port */
@ -1161,7 +1161,7 @@ void udp_netif_ipv4_addr_changed(const ip4_addr_t* old_addr, const ip4_addr_t* n
if (!ip4_addr_isany(new_addr)) {
for (upcb = udp_pcbs; upcb != NULL; upcb = upcb->next) {
/* Is this an IPv4 pcb? */
if (!IP_IS_V6_VAL(&upcb->local_ip)) {
if (!IP_IS_V6_VAL(upcb->local_ip)) {
/* PCB bound to current local interface address? */
if (!ip4_addr_isany(ip_2_ip4(&upcb->local_ip)) &&
ip4_addr_cmp(ip_2_ip4(&upcb->local_ip), old_addr)) {