From e678e1bdcbd8e3c6d77c7602c5317d726bc8af77 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Mon, 25 Jan 2010 08:24:30 +0000 Subject: [PATCH] bug #28659: Missing casts --- src/api/api_lib.c | 2 +- src/api/api_msg.c | 20 ++++++++++---------- src/api/netbuf.c | 2 +- src/api/tcpip.c | 10 +++++----- src/core/dhcp.c | 6 +++--- src/core/ipv4/icmp.c | 10 +++++----- src/core/ipv4/ip.c | 6 +++--- src/core/mem.c | 2 +- src/core/memp.c | 2 +- src/core/pbuf.c | 8 ++++---- src/core/raw.c | 4 ++-- src/core/tcp.c | 10 +++++----- src/core/tcp_in.c | 2 +- src/core/tcp_out.c | 8 ++++---- src/core/timers.c | 2 +- src/core/udp.c | 6 +++--- src/netif/etharp.c | 12 ++++++------ 17 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/api/api_lib.c b/src/api/api_lib.c index b536c990..3aed38d0 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -349,7 +349,7 @@ netconn_recv(struct netconn *conn, struct netbuf **new_buf) #if LWIP_TCP /* This is not a listening netconn, since recvmbox is set */ - buf = memp_malloc(MEMP_NETBUF); + buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); if (buf == NULL) { NETCONN_SET_SAFE_ERR(conn, ERR_MEM); return ERR_MEM; diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 0a768448..cddd6f93 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -80,7 +80,7 @@ recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p, #endif /* LWIP_SO_RCVBUF */ LWIP_UNUSED_ARG(addr); - conn = arg; + conn = (struct netconn *)arg; #if LWIP_SO_RCVBUF SYS_ARCH_GET(conn->recv_avail, recv_avail); @@ -99,7 +99,7 @@ recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p, } if(q != NULL) { - buf = memp_malloc(MEMP_NETBUF); + buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); if (buf == NULL) { pbuf_free(q); return 0; @@ -145,7 +145,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p, LWIP_UNUSED_ARG(pcb); /* only used for asserts... */ LWIP_ASSERT("recv_udp must have a pcb argument", pcb != NULL); LWIP_ASSERT("recv_udp must have an argument", arg != NULL); - conn = arg; + conn = (struct netconn *)arg; LWIP_ASSERT("recv_udp: recv for wrong pcb!", conn->pcb.udp == pcb); #if LWIP_SO_RCVBUF @@ -159,7 +159,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p, return; } - buf = memp_malloc(MEMP_NETBUF); + buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); if (buf == NULL) { pbuf_free(p); return; @@ -206,7 +206,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) LWIP_UNUSED_ARG(pcb); LWIP_ASSERT("recv_tcp must have a pcb argument", pcb != NULL); LWIP_ASSERT("recv_tcp must have an argument", arg != NULL); - conn = arg; + conn = (struct netconn *)arg; LWIP_ASSERT("recv_tcp: recv for wrong pcb!", conn->pcb.tcp == pcb); if (conn == NULL) { @@ -255,7 +255,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) static err_t poll_tcp(void *arg, struct tcp_pcb *pcb) { - struct netconn *conn = arg; + struct netconn *conn = (struct netconn *)arg; LWIP_UNUSED_ARG(pcb); LWIP_ASSERT("conn != NULL", (conn != NULL)); @@ -279,7 +279,7 @@ poll_tcp(void *arg, struct tcp_pcb *pcb) static err_t sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len) { - struct netconn *conn = arg; + struct netconn *conn = (struct netconn *)arg; LWIP_UNUSED_ARG(pcb); LWIP_ASSERT("conn != NULL", (conn != NULL)); @@ -314,7 +314,7 @@ err_tcp(void *arg, err_t err) enum netconn_state old_state; SYS_ARCH_DECL_PROTECT(lev); - conn = arg; + conn = (struct netconn *)arg; LWIP_ASSERT("conn != NULL", (conn != NULL)); conn->pcb.tcp = NULL; @@ -524,7 +524,7 @@ netconn_alloc(enum netconn_type t, netconn_callback callback) struct netconn *conn; int size; - conn = memp_malloc(MEMP_NETCONN); + conn = (struct netconn *)memp_malloc(MEMP_NETCONN); if (conn == NULL) { return NULL; } @@ -830,7 +830,7 @@ do_connected(void *arg, struct tcp_pcb *pcb, err_t err) LWIP_UNUSED_ARG(pcb); - conn = arg; + conn = (struct netconn *)arg; if (conn == NULL) { return ERR_VAL; diff --git a/src/api/netbuf.c b/src/api/netbuf.c index 57efc4f9..f6c898fd 100644 --- a/src/api/netbuf.c +++ b/src/api/netbuf.c @@ -57,7 +57,7 @@ netbuf *netbuf_new(void) { struct netbuf *buf; - buf = memp_malloc(MEMP_NETBUF); + buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); if (buf != NULL) { buf->p = NULL; buf->ptr = NULL; diff --git a/src/api/tcpip.c b/src/api/tcpip.c index b4692cf3..78531beb 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -149,7 +149,7 @@ tcpip_input(struct pbuf *p, struct netif *inp) struct tcpip_msg *msg; if (mbox != SYS_MBOX_NULL) { - msg = memp_malloc(MEMP_TCPIP_MSG_INPKT); + msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_INPKT); if (msg == NULL) { return ERR_MEM; } @@ -183,7 +183,7 @@ tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block) struct tcpip_msg *msg; if (mbox != SYS_MBOX_NULL) { - msg = memp_malloc(MEMP_TCPIP_MSG_API); + msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); if (msg == NULL) { return ERR_MEM; } @@ -218,7 +218,7 @@ tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg) struct tcpip_msg *msg; if (mbox != SYS_MBOX_NULL) { - msg = memp_malloc(MEMP_TCPIP_MSG_API); + msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); if (msg == NULL) { return ERR_MEM; } @@ -247,7 +247,7 @@ tcpip_untimeout(sys_timeout_handler h, void *arg) struct tcpip_msg *msg; if (mbox != SYS_MBOX_NULL) { - msg = memp_malloc(MEMP_TCPIP_MSG_API); + msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); if (msg == NULL) { return ERR_MEM; } @@ -397,7 +397,7 @@ tcpip_init(tcpip_init_done_fn initfunc, void *arg) static void pbuf_free_int(void *p) { - struct pbuf *q = p; + struct pbuf *q = (struct pbuf *)p; pbuf_free(q); } diff --git a/src/core/dhcp.c b/src/core/dhcp.c index 1f93d2fd..b2bb14c7 100644 --- a/src/core/dhcp.c +++ b/src/core/dhcp.c @@ -603,7 +603,7 @@ dhcp_start(struct netif *netif) /* no DHCP client attached yet? */ if (dhcp == NULL) { LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): starting new DHCP client\n")); - dhcp = mem_malloc(sizeof(struct dhcp)); + dhcp = (struct dhcp *)mem_malloc(sizeof(struct dhcp)); if (dhcp == NULL) { LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): could not allocate dhcp\n")); return ERR_MEM; @@ -667,7 +667,7 @@ dhcp_inform(struct netif *netif) { struct dhcp *dhcp, *old_dhcp; err_t result = ERR_OK; - dhcp = mem_malloc(sizeof(struct dhcp)); + dhcp = (struct dhcp *)mem_malloc(sizeof(struct dhcp)); if (dhcp == NULL) { LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_inform(): could not allocate dhcp\n")); return; @@ -1313,7 +1313,7 @@ dhcp_unfold_reply(struct dhcp *dhcp, struct pbuf *p) return ERR_MEM; } } - dhcp->msg_in = mem_malloc(sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN); + dhcp->msg_in = (struct dhcp_msg *)mem_malloc(sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN); if (dhcp->msg_in == NULL) { LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_unfold_reply(): could not allocate dhcp->msg_in\n")); diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c index b97a587a..27d54028 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -90,7 +90,7 @@ icmp_input(struct pbuf *p, struct netif *inp) snmp_inc_icmpinmsgs(); - iphdr = p->payload; + iphdr = (struct ip_hdr *)p->payload; hlen = IPH_HL(iphdr) * 4; if (pbuf_header(p, -hlen) || (p->tot_len < sizeof(u16_t)*2)) { LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: short ICMP (%"U16_F" bytes) received\n", p->tot_len)); @@ -163,7 +163,7 @@ icmp_input(struct pbuf *p, struct netif *inp) LWIP_ASSERT("icmp_input: copying to new pbuf failed\n", 0); goto memerr; } - iphdr = r->payload; + iphdr = (struct ip_hdr *)r->payload; /* switch r->payload back to icmp header */ if (pbuf_header(r, -hlen)) { LWIP_ASSERT("icmp_input: restoring original p->payload failed\n", 0); @@ -184,7 +184,7 @@ icmp_input(struct pbuf *p, struct netif *inp) /* At this point, all checks are OK. */ /* We generate an answer by switching the dest and src ip addresses, * setting the icmp type to ECHO_RESPONSE and updating the checksum. */ - iecho = p->payload; + iecho = (struct icmp_echo_hdr *)p->payload; tmpaddr.addr = iphdr->src.addr; iphdr->src.addr = iphdr->dest.addr; iphdr->dest.addr = tmpaddr.addr; @@ -299,14 +299,14 @@ icmp_send_response(struct pbuf *p, u8_t type, u8_t code) LWIP_ASSERT("check that first pbuf can hold icmp message", (q->len >= (sizeof(struct icmp_echo_hdr) + IP_HLEN + ICMP_DEST_UNREACH_DATASIZE))); - iphdr = p->payload; + iphdr = (struct ip_hdr *)p->payload; LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from ")); ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src)); LWIP_DEBUGF(ICMP_DEBUG, (" to ")); ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest)); LWIP_DEBUGF(ICMP_DEBUG, ("\n")); - icmphdr = q->payload; + icmphdr = (struct icmp_echo_hdr *)q->payload; icmphdr->type = type; icmphdr->code = code; icmphdr->id = 0; diff --git a/src/core/ipv4/ip.c b/src/core/ipv4/ip.c index 4df0a810..d6950fd6 100644 --- a/src/core/ipv4/ip.c +++ b/src/core/ipv4/ip.c @@ -200,7 +200,7 @@ ip_input(struct pbuf *p, struct netif *inp) snmp_inc_ipinreceives(); /* identify the IP header */ - iphdr = p->payload; + iphdr = (struct ip_hdr *)p->payload; if (IPH_V(iphdr) != 4) { LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_WARNING, ("IP packet dropped due to bad version number %"U16_F"\n", IPH_V(iphdr))); ip_debug_print(p); @@ -549,7 +549,7 @@ err_t ip_output_if_opt(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest return ERR_BUF; } - iphdr = p->payload; + iphdr = (struct ip_hdr *)p->payload; LWIP_ASSERT("check that first pbuf can hold struct ip_hdr", (p->len >= sizeof(struct ip_hdr))); @@ -575,7 +575,7 @@ err_t ip_output_if_opt(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest #endif } else { /* IP header already included in p */ - iphdr = p->payload; + iphdr = (struct ip_hdr *)p->payload; dest = &(iphdr->dest); } diff --git a/src/core/mem.c b/src/core/mem.c index 39ed926f..2ab94745 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -275,7 +275,7 @@ mem_init(void) (SIZEOF_STRUCT_MEM & (MEM_ALIGNMENT-1)) == 0); /* align the heap */ - ram = LWIP_MEM_ALIGN(LWIP_RAM_HEAP_POINTER); + ram = (u8_t *)LWIP_MEM_ALIGN(LWIP_RAM_HEAP_POINTER); /* initialize the start of the heap */ mem = (struct mem *)ram; mem->next = MEM_SIZE_ALIGNED; diff --git a/src/core/memp.c b/src/core/memp.c index cc7b11bd..2439d6f9 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -292,7 +292,7 @@ memp_init(void) } #if !MEMP_SEPARATE_POOLS - memp = LWIP_MEM_ALIGN(memp_memory); + memp = (struct memp *)LWIP_MEM_ALIGN(memp_memory); #endif /* !MEMP_SEPARATE_POOLS */ /* for every pool: */ for (i = 0; i < MEMP_MAX; ++i) { diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 11cc2e67..2557eb37 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -211,7 +211,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type) switch (type) { case PBUF_POOL: /* allocate head of pbuf chain into p */ - p = memp_malloc(MEMP_PBUF_POOL); + p = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL); LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc: allocated pbuf %p\n", (void *)p)); if (p == NULL) { PBUF_POOL_IS_EMPTY(); @@ -244,7 +244,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type) rem_len = length - p->len; /* any remaining pbufs to be allocated? */ while (rem_len > 0) { - q = memp_malloc(MEMP_PBUF_POOL); + q = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL); if (q == NULL) { PBUF_POOL_IS_EMPTY(); /* free chain so far allocated */ @@ -298,7 +298,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type) /* pbuf references existing (externally allocated) RAM payload? */ case PBUF_REF: /* only allocate memory for the pbuf structure */ - p = memp_malloc(MEMP_PBUF); + p = (struct pbuf *)memp_malloc(MEMP_PBUF); if (p == NULL) { LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("pbuf_alloc: Could not allocate MEMP_PBUF for PBUF_%s.\n", @@ -383,7 +383,7 @@ pbuf_realloc(struct pbuf *p, u16_t new_len) /* (other types merely adjust their length fields */ if ((q->type == PBUF_RAM) && (rem_len != q->len)) { /* reallocate and adjust the length of the pbuf that will be split */ - q = mem_realloc(q, (u8_t *)q->payload - (u8_t *)q + rem_len); + q = (struct pbuf *)mem_realloc(q, (u8_t *)q->payload - (u8_t *)q + rem_len); LWIP_ASSERT("mem_realloc give q == NULL", q != NULL); } /* adjust length fields for new last pbuf */ diff --git a/src/core/raw.c b/src/core/raw.c index ab1adf5b..96980a03 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -83,7 +83,7 @@ raw_input(struct pbuf *p, struct netif *inp) LWIP_UNUSED_ARG(inp); - iphdr = p->payload; + iphdr = (struct ip_hdr *)p->payload; proto = IPH_PROTO(iphdr); prev = NULL; @@ -336,7 +336,7 @@ raw_new(u8_t proto) LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_new\n")); - pcb = memp_malloc(MEMP_RAW_PCB); + pcb = (struct raw_pcb *)memp_malloc(MEMP_RAW_PCB); /* could allocate RAW PCB? */ if (pcb != NULL) { /* initialize PCB to all zeroes */ diff --git a/src/core/tcp.c b/src/core/tcp.c index a06a9864..ee19f389 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -376,7 +376,7 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog) if (pcb->state == LISTEN) { return pcb; } - lpcb = memp_malloc(MEMP_TCP_PCB_LISTEN); + lpcb = (struct tcp_pcb_listen *)memp_malloc(MEMP_TCP_PCB_LISTEN); if (lpcb == NULL) { return NULL; } @@ -914,7 +914,7 @@ tcp_seg_copy(struct tcp_seg *seg) { struct tcp_seg *cseg; - cseg = memp_malloc(MEMP_TCP_SEG); + cseg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG); if (cseg == NULL) { return NULL; } @@ -1015,19 +1015,19 @@ tcp_alloc(u8_t prio) struct tcp_pcb *pcb; u32_t iss; - pcb = memp_malloc(MEMP_TCP_PCB); + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); if (pcb == NULL) { /* Try killing oldest connection in TIME-WAIT. */ LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest TIME-WAIT connection\n")); tcp_kill_timewait(); /* Try to allocate a tcp_pcb again. */ - pcb = memp_malloc(MEMP_TCP_PCB); + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); if (pcb == NULL) { /* Try killing active connections with lower priority than the new one. */ LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing connection with prio lower than %d\n", prio)); tcp_kill_prio(prio); /* Try to allocate a tcp_pcb again. */ - pcb = memp_malloc(MEMP_TCP_PCB); + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); if (pcb != NULL) { /* adjust err stats: memp_malloc failed twice before */ MEMP_STATS_DEC(err, MEMP_TCP_PCB); diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index d94a5ed0..742f1ec9 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -102,7 +102,7 @@ tcp_input(struct pbuf *p, struct netif *inp) TCP_STATS_INC(tcp.recv); snmp_inc_tcpinsegs(); - iphdr = p->payload; + iphdr = (struct ip_hdr *)p->payload; tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4); #if TCP_INPUT_DEBUG diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 726d4d60..db9a7af6 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -63,7 +63,7 @@ static struct tcp_hdr * tcp_output_set_header(struct tcp_pcb *pcb, struct pbuf *p, u16_t optlen, u32_t seqno_be /* already in network byte order */) { - struct tcp_hdr *tcphdr = p->payload; + struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload; tcphdr->src = htons(pcb->local_port); tcphdr->dest = htons(pcb->remote_port); tcphdr->seqno = seqno_be; @@ -218,7 +218,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len, seglen = left > (pcb->mss - optlen) ? (pcb->mss - optlen) : left; /* Allocate memory for tcp_seg, and fill in fields. */ - seg = memp_malloc(MEMP_TCP_SEG); + seg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG); if (seg == NULL) { LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_enqueue: could not allocate memory for tcp_seg\n")); @@ -308,7 +308,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len, TCP_STATS_INC(tcp.err); goto memerr; } - seg->tcphdr = seg->p->payload; + seg->tcphdr = (struct tcp_hdr *)seg->p->payload; seg->tcphdr->src = htons(pcb->local_port); seg->tcphdr->dest = htons(pcb->remote_port); seg->tcphdr->seqno = htonl(seqno); @@ -781,7 +781,7 @@ tcp_rst(u32_t seqno, u32_t ackno, LWIP_ASSERT("check that first pbuf can hold struct tcp_hdr", (p->len >= sizeof(struct tcp_hdr))); - tcphdr = p->payload; + tcphdr = (struct tcp_hdr *)p->payload; tcphdr->src = htons(local_port); tcphdr->dest = htons(remote_port); tcphdr->seqno = htonl(seqno); diff --git a/src/core/timers.c b/src/core/timers.c index ff8f4a6b..d437c923 100644 --- a/src/core/timers.c +++ b/src/core/timers.c @@ -263,7 +263,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg) { struct sys_timeo *timeout, *t; - timeout = memp_malloc(MEMP_SYS_TIMEOUT); + timeout = (struct sys_timeo *)memp_malloc(MEMP_SYS_TIMEOUT); if (timeout == NULL) { LWIP_ASSERT("sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty", timeout != NULL); return; diff --git a/src/core/udp.c b/src/core/udp.c index 661d5487..a28c2d07 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -96,7 +96,7 @@ udp_input(struct pbuf *p, struct netif *inp) UDP_STATS_INC(udp.recv); - iphdr = p->payload; + iphdr = (struct ip_hdr *)p->payload; /* Check minimum length (IP header + UDP header) * and move payload pointer to UDP header */ @@ -450,7 +450,7 @@ udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p, LWIP_ASSERT("check that first pbuf can hold struct udp_hdr", (q->len >= sizeof(struct udp_hdr))); /* q now represents the packet to be sent */ - udphdr = q->payload; + udphdr = (struct udp_hdr *)q->payload; udphdr->src = htons(pcb->local_port); udphdr->dest = htons(dst_port); /* in UDP, 0 checksum means 'no checksum' */ @@ -809,7 +809,7 @@ struct udp_pcb * udp_new(void) { struct udp_pcb *pcb; - pcb = memp_malloc(MEMP_UDP_PCB); + pcb = (struct udp_pcb *)memp_malloc(MEMP_UDP_PCB); /* could allocate UDP PCB? */ if (pcb != NULL) { /* UDP Lite: by initializing to all zeroes, chksum_len is set to 0 diff --git a/src/netif/etharp.c b/src/netif/etharp.c index ee4c3800..28c7f7e7 100644 --- a/src/netif/etharp.c +++ b/src/netif/etharp.c @@ -430,7 +430,7 @@ find_entry(struct ip_addr *ipaddr, u8_t flags) static err_t etharp_send_ip(struct netif *netif, struct pbuf *p, struct eth_addr *src, struct eth_addr *dst) { - struct eth_hdr *ethhdr = p->payload; + struct eth_hdr *ethhdr = (struct eth_hdr *)p->payload; u8_t k; LWIP_ASSERT("netif->hwaddr_len must be the same as ETHARP_HWADDR_LEN for etharp!", @@ -587,7 +587,7 @@ etharp_ip_input(struct netif *netif, struct pbuf *p) LWIP_ERROR("netif != NULL", (netif != NULL), return;); /* Only insert an entry if the source IP address of the incoming IP packet comes from a host on the local network. */ - ethhdr = p->payload; + ethhdr = (struct eth_hdr *)p->payload; iphdr = (struct ip_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR); #if ETHARP_SUPPORT_VLAN if (ethhdr->type == ETHTYPE_VLAN) { @@ -651,7 +651,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p) return; } - ethhdr = p->payload; + ethhdr = (struct eth_hdr *)p->payload; hdr = (struct etharp_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR); #if ETHARP_SUPPORT_VLAN if (ethhdr->type == ETHTYPE_VLAN) { @@ -988,7 +988,7 @@ etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q) /* queue packet ... */ struct etharp_q_entry *new_entry; /* allocate a new arp queue entry */ - new_entry = memp_malloc(MEMP_ARP_QUEUE); + new_entry = (struct etharp_q_entry *)memp_malloc(MEMP_ARP_QUEUE); if (new_entry != NULL) { new_entry->next = 0; new_entry->p = p; @@ -1073,7 +1073,7 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr, LWIP_ASSERT("check that first pbuf can hold struct etharp_hdr", (p->len >= SIZEOF_ETHARP_PACKET)); - ethhdr = p->payload; + ethhdr = (struct eth_hdr *)p->payload; hdr = (struct etharp_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR); LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_raw: sending raw ARP packet.\n")); hdr->opcode = htons(opcode); @@ -1154,7 +1154,7 @@ ethernet_input(struct pbuf *p, struct netif *netif) u16_t type; /* points to packet payload, which starts with an Ethernet header */ - ethhdr = p->payload; + ethhdr = (struct eth_hdr *)p->payload; LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("ethernet_input: dest:%02x:%02x:%02x:%02x:%02x:%02x, src:%02x:%02x:%02x:%02x:%02x:%02x, type:%2hx\n", (unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2],