Applied patch #1596 fixing wrongly cast LWIP_DEBUGF arguments.

(printf expects integers on the var args stack)
This commit is contained in:
likewise 2003-06-11 22:11:42 +00:00
parent af384440f8
commit ba786dc49b
9 changed files with 202 additions and 201 deletions

View File

@ -199,7 +199,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
#if SOCKETS_DEBUG
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d addr=", s, newsock));
ip_addr_debug_print(&naddr);
ip_addr_debug_print(SOCKETS_DEBUG, &naddr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u\n", port));
#endif
@ -225,7 +225,7 @@ lwip_bind(int s, struct sockaddr *name, socklen_t namelen)
#if SOCKETS_DEBUG
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d, addr=", s));
ip_addr_debug_print(&local_addr);
ip_addr_debug_print(SOCKETS_DEBUG, &local_addr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(local_port)));
#endif
@ -295,7 +295,7 @@ lwip_connect(int s, struct sockaddr *name, socklen_t namelen)
#if SOCKETS_DEBUG
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d, addr=", s));
ip_addr_debug_print(&remote_addr);
ip_addr_debug_print(SOCKETS_DEBUG, &remote_addr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(remote_port)));
#endif
@ -413,7 +413,7 @@ lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
#if SOCKETS_DEBUG
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): addr=", s));
ip_addr_debug_print(addr);
ip_addr_debug_print(SOCKETS_DEBUG, addr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u len=%u\n", port, copylen));
#endif
} else {
@ -422,7 +422,7 @@ lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
port = netbuf_fromport(buf);
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): addr=", s));
ip_addr_debug_print(addr);
ip_addr_debug_print(SOCKETS_DEBUG, addr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u len=%u\n", port, copylen));
#endif
@ -532,7 +532,7 @@ lwip_sendto(int s, void *data, int size, unsigned int flags,
#if SOCKETS_DEBUG
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_sendto(%d, data=%p, size=%d, flags=0x%x to=", s, data, size, flags));
ip_addr_debug_print(&remote_addr);
ip_addr_debug_print(SOCKETS_DEBUG, &remote_addr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u\n", ntohs(remote_port)));
#endif
@ -907,7 +907,7 @@ int lwip_getpeername (int s, struct sockaddr *name, socklen_t *namelen)
#if SOCKETS_DEBUG
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getpeername(%d, addr=", s));
ip_addr_debug_print(&naddr);
ip_addr_debug_print(SOCKETS_DEBUG, &naddr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%d)\n", sin.sin_port));
#endif
@ -942,7 +942,7 @@ int lwip_getsockname (int s, struct sockaddr *name, socklen_t *namelen)
#if SOCKETS_DEBUG
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockname(%d, addr=", s));
ip_addr_debug_print(naddr);
ip_addr_debug_print(SOCKETS_DEBUG, naddr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%d)\n", sin.sin_port));
#endif

View File

@ -1119,8 +1119,8 @@ static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_
u8_t msg_type;
u8_t i;
LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_recv(pbuf = %p) from DHCP server %u.%u.%u.%u port %u\n", p,
(u8_t)(ntohl(addr->addr) >> 24 & 0xff), (u8_t)(ntohl(addr->addr) >> 16 & 0xff),
(u8_t)(ntohl(addr->addr) >> 8 & 0xff), (u8_t)(ntohl(addr->addr) & 0xff), port));
(unsigned int)(ntohl(addr->addr) >> 24 & 0xff), (unsigned int)(ntohl(addr->addr) >> 16 & 0xff),
(unsigned int)(ntohl(addr->addr) >> 8 & 0xff), (unsigned int)(ntohl(addr->addr) & 0xff), port));
LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("pbuf->len = %u\n", p->len));
LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("pbuf->tot_len = %u\n", p->tot_len));
/* prevent warnings about unused arguments */

View File

@ -186,9 +186,9 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
iphdr = p->payload;
#if ICMP_DEBUG
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from "));
ip_addr_debug_print(&(iphdr->src));
ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src));
LWIP_DEBUGF(ICMP_DEBUG, (" to "));
ip_addr_debug_print(&(iphdr->dest));
ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest));
LWIP_DEBUGF(ICMP_DEBUG, ("\n"));
#endif /* ICMP_DEBNUG */

View File

@ -103,7 +103,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
LWIP_DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for "));
#if IP_DEBUG
ip_addr_debug_print(&(iphdr->dest));
ip_addr_debug_print(IP_DEBUG, &(iphdr->dest));
#endif /* IP_DEBUG */
LWIP_DEBUGF(IP_DEBUG, ("\n"));
pbuf_free(p);
@ -129,7 +129,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to "));
#if IP_DEBUG
ip_addr_debug_print(&(iphdr->dest));
ip_addr_debug_print(IP_DEBUG, &(iphdr->dest));
#endif /* IP_DEBUG */
LWIP_DEBUGF(IP_DEBUG, ("\n"));
@ -191,9 +191,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
for(netif = netif_list; netif != NULL; netif = netif->next) {
#if IP_DEBUG
LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest "));
ip_addr_debug_print(&(iphdr->dest));
ip_addr_debug_print(IP_DEBUG, &(iphdr->dest));
LWIP_DEBUGF(IP_DEBUG, ("netif->ip_addr "));
ip_addr_debug_print(&(netif->ip_addr));
ip_addr_debug_print(IP_DEBUG, &(netif->ip_addr));
LWIP_DEBUGF(IP_DEBUG, ("\n"));
#endif /* IP_DEBUG */
if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) {

View File

@ -100,11 +100,11 @@ netif_add(struct ip_addr *ipaddr, struct ip_addr *netmask,
#if NETIF_DEBUG
LWIP_DEBUGF(NETIF_DEBUG, ("netif: added interface %c%c IP addr ",
netif->name[0], netif->name[1]));
ip_addr_debug_print(ipaddr);
ip_addr_debug_print(NETIF_DEBUG, ipaddr);
LWIP_DEBUGF(NETIF_DEBUG, (" netmask "));
ip_addr_debug_print(netmask);
ip_addr_debug_print(NETIF_DEBUG, netmask);
LWIP_DEBUGF(NETIF_DEBUG, (" gw "));
ip_addr_debug_print(gw);
ip_addr_debug_print(NETIF_DEBUG, gw);
LWIP_DEBUGF(NETIF_DEBUG, ("\n"));
#endif /* NETIF_DEBUG */
return netif;
@ -212,10 +212,10 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
ip_addr_set(&(netif->ip_addr), ipaddr);
LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: IP address of interface %c%c set to %u.%u.%u.%u\n",
netif->name[0], netif->name[1],
(u8_t)(ntohl(netif->ip_addr.addr) >> 24 & 0xff),
(u8_t)(ntohl(netif->ip_addr.addr) >> 16 & 0xff),
(u8_t)(ntohl(netif->ip_addr.addr) >> 8 & 0xff),
(u8_t)(ntohl(netif->ip_addr.addr) & 0xff)));
(unsigned int)(ntohl(netif->ip_addr.addr) >> 24 & 0xff),
(unsigned int)(ntohl(netif->ip_addr.addr) >> 16 & 0xff),
(unsigned int)(ntohl(netif->ip_addr.addr) >> 8 & 0xff),
(unsigned int)(ntohl(netif->ip_addr.addr) & 0xff)));
}
/*-----------------------------------------------------------------------------------*/
void
@ -224,10 +224,10 @@ netif_set_gw(struct netif *netif, struct ip_addr *gw)
ip_addr_set(&(netif->gw), gw);
LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: GW address of interface %c%c set to %u.%u.%u.%u\n",
netif->name[0], netif->name[1],
(u8_t)(ntohl(netif->gw.addr) >> 24 & 0xff),
(u8_t)(ntohl(netif->gw.addr) >> 16 & 0xff),
(u8_t)(ntohl(netif->gw.addr) >> 8 & 0xff),
(u8_t)(ntohl(netif->gw.addr) & 0xff)));
(unsigned int)(ntohl(netif->gw.addr) >> 24 & 0xff),
(unsigned int)(ntohl(netif->gw.addr) >> 16 & 0xff),
(unsigned int)(ntohl(netif->gw.addr) >> 8 & 0xff),
(unsigned int)(ntohl(netif->gw.addr) & 0xff)));
}
/*-----------------------------------------------------------------------------------*/
void
@ -236,10 +236,10 @@ netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
ip_addr_set(&(netif->netmask), netmask);
LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: netmask of interface %c%c set to %u.%u.%u.%u\n",
netif->name[0], netif->name[1],
(u8_t)(ntohl(netif->netmask.addr) >> 24 & 0xff),
(u8_t)(ntohl(netif->netmask.addr) >> 16 & 0xff),
(u8_t)(ntohl(netif->netmask.addr) >> 8 & 0xff),
(u8_t)(ntohl(netif->netmask.addr) & 0xff)));
(unsigned int)(ntohl(netif->netmask.addr) >> 24 & 0xff),
(unsigned int)(ntohl(netif->netmask.addr) >> 16 & 0xff),
(unsigned int)(ntohl(netif->netmask.addr) >> 8 & 0xff),
(unsigned int)(ntohl(netif->netmask.addr) & 0xff)));
}
/*-----------------------------------------------------------------------------------*/
void

View File

@ -291,7 +291,10 @@ tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
static err_t
tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
{
if (arg || pcb || err);
(void)arg;
(void)pcb;
(void)err;
return ERR_ABRT;
}
#endif /* LWIP_CALLBACK_API */

View File

@ -516,10 +516,10 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
udp_pcbs = pcb;
}
LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE, ("udp_bind: bound to %u.%u.%u.%u, port %u\n",
(u8_t)(ntohl(pcb->local_ip.addr) >> 24 & 0xff),
(u8_t)(ntohl(pcb->local_ip.addr) >> 16 & 0xff),
(u8_t)(ntohl(pcb->local_ip.addr) >> 8 & 0xff),
(u8_t)(ntohl(pcb->local_ip.addr) & 0xff), pcb->local_port));
(unsigned int)(ntohl(pcb->local_ip.addr) >> 24 & 0xff),
(unsigned int)(ntohl(pcb->local_ip.addr) >> 16 & 0xff),
(unsigned int)(ntohl(pcb->local_ip.addr) >> 8 & 0xff),
(unsigned int)(ntohl(pcb->local_ip.addr) & 0xff), pcb->local_port));
return ERR_OK;
}
/**
@ -571,10 +571,10 @@ udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
}
#endif
LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE, ("udp_connect: connected to %u.%u.%u.%u, port %u\n",
(u8_t)(ntohl(pcb->remote_ip.addr) >> 24 & 0xff),
(u8_t)(ntohl(pcb->remote_ip.addr) >> 16 & 0xff),
(u8_t)(ntohl(pcb->remote_ip.addr) >> 8 & 0xff),
(u8_t)(ntohl(pcb->remote_ip.addr) & 0xff), pcb->remote_port));
(unsigned int)(ntohl(pcb->remote_ip.addr) >> 24 & 0xff),
(unsigned int)(ntohl(pcb->remote_ip.addr) >> 16 & 0xff),
(unsigned int)(ntohl(pcb->remote_ip.addr) >> 8 & 0xff),
(unsigned int)(ntohl(pcb->remote_ip.addr) & 0xff), pcb->remote_port));
/* Insert UDP PCB into the list of active UDP PCBs. */
for(ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) {

View File

@ -115,21 +115,21 @@ extern const struct ip_addr ip_addr_broadcast;
((addr1)->addr == 0xffffffff) || \
((addr1)->addr == 0x00000000))
#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000))
#define ip_addr_debug_print(ipaddr) LWIP_DEBUGF(LWIP_DEBUG, ("%d.%d.%d.%d", \
(u8_t)(ntohl((ipaddr)->addr) >> 24) & 0xff, \
(u8_t)(ntohl((ipaddr)->addr) >> 16) & 0xff, \
(u8_t)(ntohl((ipaddr)->addr) >> 8) & 0xff, \
(u8_t)ntohl((ipaddr)->addr) & 0xff))
(unsigned int)(ntohl((ipaddr)->addr) >> 24) & 0xff, \
(unsigned int)(ntohl((ipaddr)->addr) >> 16) & 0xff, \
(unsigned int)(ntohl((ipaddr)->addr) >> 8) & 0xff, \
(unsigned int)ntohl((ipaddr)->addr) & 0xff))
#define ip4_addr1(ipaddr) ((u8_t)(ntohl((ipaddr)->addr) >> 24) & 0xff)
#define ip4_addr2(ipaddr) ((u8_t)(ntohl((ipaddr)->addr) >> 16) & 0xff)
#define ip4_addr3(ipaddr) ((u8_t)(ntohl((ipaddr)->addr) >> 8) & 0xff)
#define ip4_addr4(ipaddr) ((u8_t)(ntohl((ipaddr)->addr)) & 0xff)
/* cast to unsigned int, as it is used as argument to printf functions
* which expect integer arguments */
#define ip4_addr1(ipaddr) ((unsigned int)(ntohl((ipaddr)->addr) >> 24) & 0xff)
#define ip4_addr2(ipaddr) ((unsigned int)(ntohl((ipaddr)->addr) >> 16) & 0xff)
#define ip4_addr3(ipaddr) ((unsigned int)(ntohl((ipaddr)->addr) >> 8) & 0xff)
#define ip4_addr4(ipaddr) ((unsigned int)(ntohl((ipaddr)->addr)) & 0xff)
#endif /* __LWIP_IP_ADDR_H__ */

View File

@ -39,8 +39,6 @@
* THIS CODE NEEDS TO BE FIXED - IT IS NOT In SYNC WITH CURRENT ETHARP API
*/
#include "lwip/debug.h"
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/mem.h"