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

@@ -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) {