Fixed warnings about NULL check not required (ip_addr_isany) and implicit conversion (~)

This commit is contained in:
goldsimon 2015-08-03 08:35:01 +02:00
parent d106053e4c
commit 4dc3c7a6a0
10 changed files with 21 additions and 21 deletions

View File

@ -1356,7 +1356,7 @@ lwip_netconn_do_send(struct api_msg_msg *msg)
msg->msg.b->flags & NETBUF_FLAG_CHKSUM, msg->msg.b->toport_chksum);
}
#else /* LWIP_CHECKSUM_ON_COPY */
if (ip_addr_isany(&msg->msg.b->addr)) {
if (ip_addr_isany_val(msg->msg.b->addr)) {
msg->err = udp_send(msg->conn->pcb.udp, msg->msg.b->p);
} else {
msg->err = udp_sendto(msg->conn->pcb.udp, msg->msg.b->p, &msg->msg.b->addr, msg->msg.b->port);

View File

@ -558,7 +558,7 @@ ip_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
u16_t
inet_chksum(const void *dataptr, u16_t len)
{
return ~LWIP_CHKSUM(dataptr, len);
return (u16_t)~(unsigned int)LWIP_CHKSUM(dataptr, len);
}
/**

View File

@ -144,7 +144,7 @@ ip4_route(const ip4_addr_t *dest)
/* iterate through netifs */
for (netif = netif_list; netif != NULL; netif = netif->next) {
/* is the netif up, does it have a link and a valid address? */
if (netif_is_up(netif) && netif_is_link_up(netif) && !ip4_addr_isany(&(netif->ip_addr))) {
if (netif_is_up(netif) && netif_is_link_up(netif) && !ip4_addr_isany_val(netif->ip_addr)) {
/* network mask matches? */
if (ip4_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
/* return netif on which to forward IP packet */
@ -154,7 +154,7 @@ ip4_route(const ip4_addr_t *dest)
}
if ((netif_default == NULL) || !netif_is_up(netif_default) || !netif_is_link_up(netif_default) ||
ip4_addr_isany(&netif_default->ip_addr)) {
ip4_addr_isany_val(netif_default->ip_addr)) {
/* No matching netif found an default netif is not usable.
If this is not good enough for you, use LWIP_HOOK_IP4_ROUTE() */
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip_route: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
@ -468,7 +468,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
ip4_addr_get_u32(&iphdr->dest) & ~ip4_addr_get_u32(&netif->netmask)));
/* interface is up and configured? */
if ((netif_is_up(netif)) && (!ip4_addr_isany(&(netif->ip_addr)))) {
if ((netif_is_up(netif)) && (!ip4_addr_isany_val(netif->ip_addr))) {
/* unicast to this interface address? */
if (ip4_addr_cmp(ip4_current_dest_addr(), &(netif->ip_addr)) ||
/* or broadcast on this interface network address? */
@ -536,7 +536,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
if (check_ip_src
#if IP_ACCEPT_LINK_LAYER_ADDRESSING
/* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */
&& !ip_addr_isany(ip_current_src_addr())
&& !ip_addr_isany_val(*ip_current_src_addr())
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
)
#endif /* LWIP_IGMP || IP_ACCEPT_LINK_LAYER_ADDRESSING */

View File

@ -320,7 +320,7 @@ netif_remove(struct netif *netif)
}
#if LWIP_IPV4
if (!ip4_addr_isany(&netif->ip_addr)) {
if (!ip4_addr_isany_val(netif->ip_addr)) {
#if LWIP_TCP
tcp_netif_ipv4_addr_changed(&netif->ip_addr, NULL);
#endif /* LWIP_TCP */
@ -549,7 +549,7 @@ netif_issue_reports(struct netif* netif, u8_t report_type)
{
#if LWIP_IPV4
if ((report_type & NETIF_REPORT_TYPE_IPV4) &&
!ip4_addr_isany(&netif->ip_addr)) {
!ip4_addr_isany_val(netif->ip_addr)) {
#if LWIP_ARP
/* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */
if (netif->flags & (NETIF_FLAG_ETHARP)) {

View File

@ -694,7 +694,7 @@ tcp_process(struct tcp_pcb *pcb)
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_process: Connection RESET\n"));
LWIP_ASSERT("tcp_input: pcb->state != CLOSED", pcb->state != CLOSED);
recv_flags |= TF_RESET;
pcb->flags &= ~TF_ACK_DELAY;
pcb->flags &= (tcpflags_t)~(unsigned int)TF_ACK_DELAY;
return ERR_RST;
} else {
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_process: unacceptable reset seqno %"U32_F" rcv_nxt %"U32_F"\n",
@ -1062,7 +1062,7 @@ tcp_receive(struct tcp_pcb *pcb)
in fast retransmit. Also reset the congestion window to the
slow start threshold. */
if (pcb->flags & TF_INFR) {
pcb->flags &= ~TF_INFR;
pcb->flags &= (tcpflags_t)~(unsigned int)TF_INFR;
pcb->cwnd = pcb->ssthresh;
}
@ -1338,7 +1338,7 @@ tcp_receive(struct tcp_pcb *pcb)
if (TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) {
/* Must remove the FIN from the header as we're trimming
* that byte of sequence-space from the packet */
TCPH_FLAGS_SET(inseg.tcphdr, TCPH_FLAGS(inseg.tcphdr) &~ TCP_FIN);
TCPH_FLAGS_SET(inseg.tcphdr, TCPH_FLAGS(inseg.tcphdr) & (tcpflags_t)~(unsigned int)TCP_FIN);
}
/* Adjust length of segment to fit in the window. */
inseg.len = pcb->rcv_wnd;
@ -1593,7 +1593,7 @@ tcp_receive(struct tcp_pcb *pcb)
if (TCPH_FLAGS(next->next->tcphdr) & TCP_FIN) {
/* Must remove the FIN from the header as we're trimming
* that byte of sequence-space from the packet */
TCPH_FLAGS_SET(next->next->tcphdr, TCPH_FLAGS(next->next->tcphdr) &~ TCP_FIN);
TCPH_FLAGS_SET(next->next->tcphdr, TCPH_FLAGS(next->next->tcphdr) & (tcpflags_t)~(unsigned int)TCP_FIN);
}
/* Adjust length of segment to fit in the window. */
next->next->len = (u16_t)(pcb->rcv_nxt + pcb->rcv_wnd - seqno);

View File

@ -1112,7 +1112,7 @@ tcp_output(struct tcp_pcb *pcb)
}
#endif /* TCP_OVERSIZE */
pcb->flags &= ~TF_NAGLEMEMERR;
pcb->flags &= (tcpflags_t)~(unsigned int)TF_NAGLEMEMERR;
return ERR_OK;
}

View File

@ -209,7 +209,7 @@ udp_input(struct pbuf *p, struct netif *inp)
(- broadcast or directed to us) -> DHCP is link-layer-addressed, local ip is always ANY!
- inp->dhcp->pcb->remote == ANY or iphdr->src
(no need to check for IPv6 since the dhcp struct always uses IPv4) */
if (ip_addr_isany(&inp->dhcp->pcb->remote_ip) ||
if (ip_addr_isany_val(inp->dhcp->pcb->remote_ip) ||
ip_addr_cmp(&inp->dhcp->pcb->remote_ip, ip_current_src_addr())) {
pcb = inp->dhcp->pcb;
}
@ -280,7 +280,7 @@ udp_input(struct pbuf *p, struct netif *inp)
/* compare PCB remote addr+port to UDP source addr+port */
if ((local_match != 0) &&
(pcb->remote_port == src) && IP_PCB_IPVER_INPUT_MATCH(pcb) &&
(ip_addr_isany(&pcb->remote_ip) ||
(ip_addr_isany_val(pcb->remote_ip) ||
ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()))) {
/* the first fully matching PCB */
if (prev != NULL) {

View File

@ -351,7 +351,7 @@ void tcp_err (struct tcp_pcb *pcb, tcp_err_fn err);
#define tcp_sndbuf(pcb) ((pcb)->snd_buf)
#define tcp_sndqueuelen(pcb) ((pcb)->snd_queuelen)
#define tcp_nagle_disable(pcb) ((pcb)->flags |= TF_NODELAY)
#define tcp_nagle_enable(pcb) ((pcb)->flags &= (tcpflags_t)~TF_NODELAY)
#define tcp_nagle_enable(pcb) ((pcb)->flags &= (tcpflags_t)~(unsigned int)TF_NODELAY)
#define tcp_nagle_disabled(pcb) (((pcb)->flags & TF_NODELAY) != 0)
#if TCP_LISTEN_BACKLOG

View File

@ -182,7 +182,7 @@ PACK_STRUCT_END
#define TCPH_FLAGS(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS)
#define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | TCPH_FLAGS(phdr))
#define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (((phdr)->_hdrlen_rsvd_flags & PP_HTONS((u16_t)(~(u16_t)(TCP_FLAGS)))) | htons(flags))
#define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (((phdr)->_hdrlen_rsvd_flags & PP_HTONS((u16_t)(~(unsigned int)(TCP_FLAGS)))) | htons(flags))
#define TCPH_HDRLEN_FLAGS_SET(phdr, len, flags) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | (flags))
#define TCPH_SET_FLAG(phdr, flags ) (phdr)->_hdrlen_rsvd_flags = ((phdr)->_hdrlen_rsvd_flags | htons(flags))
@ -460,7 +460,7 @@ struct tcp_seg *tcp_seg_copy(struct tcp_seg *seg);
#define tcp_ack(pcb) \
do { \
if((pcb)->flags & TF_ACK_DELAY) { \
(pcb)->flags &= ~TF_ACK_DELAY; \
(pcb)->flags &= (tcpflags_t)~(unsigned int)TF_ACK_DELAY; \
(pcb)->flags |= TF_ACK_NOW; \
} \
else { \

View File

@ -777,7 +777,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
IPADDR2_COPY(&dipaddr, &hdr->dipaddr);
/* this interface is not configured? */
if (ip4_addr_isany(&netif->ip_addr)) {
if (ip4_addr_isany_val(netif->ip_addr)) {
for_us = 0;
} else {
/* ARP packet directed to us? */
@ -837,7 +837,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
/* return ARP reply */
netif->linkoutput(netif, p);
/* we are not configured? */
} else if (ip4_addr_isany(&netif->ip_addr)) {
} else if (ip4_addr_isany_val(netif->ip_addr)) {
/* { for_us == 0 and netif->ip_addr.addr == 0 } */
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_arp_input: we are unconfigured, ARP request ignored.\n"));
/* request was not directed to us */
@ -983,7 +983,7 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
#endif /* LWIP_HOOK_ETHARP_GET_GW */
{
/* interface has default gateway? */
if (!ip4_addr_isany(&netif->gw)) {
if (!ip4_addr_isany_val(netif->gw)) {
/* send to hardware address of default gateway IP address */
dst_addr = &(netif->gw);
/* no default gateway available */