From a026c944670c0efe8f1a6bab4face33d2e3882b3 Mon Sep 17 00:00:00 2001 From: dak664 Date: Tue, 14 Dec 2010 22:45:22 +0000 Subject: [PATCH] Fix compiler warnings --- apps/webserver/httpd.c | 4 ++-- core/net/uip_arp.c | 14 ++++++++------ core/net/uiplib.c | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/webserver/httpd.c b/apps/webserver/httpd.c index 464496e5b..fc80b5b05 100644 --- a/apps/webserver/httpd.c +++ b/apps/webserver/httpd.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: httpd.c,v 1.19 2010/10/19 18:29:03 adamdunkels Exp $ + * $Id: httpd.c,v 1.20 2010/12/14 22:45:22 dak664 Exp $ */ #include @@ -185,7 +185,7 @@ PT_THREAD(handle_script(struct httpd_state *s)) static PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr)) { - const char *ptr; + const char *ptr = NULL; //gcc warning if not initialized PSOCK_BEGIN(&s->sout); diff --git a/core/net/uip_arp.c b/core/net/uip_arp.c index e8a65efd5..d3f656df4 100644 --- a/core/net/uip_arp.c +++ b/core/net/uip_arp.c @@ -54,7 +54,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: uip_arp.c,v 1.7 2010/10/24 22:29:39 adamdunkels Exp $ + * $Id: uip_arp.c,v 1.8 2010/12/14 22:45:22 dak664 Exp $ * */ @@ -161,17 +161,19 @@ uip_arp_timer(void) } } + /*-----------------------------------------------------------------------------------*/ static void uip_arp_update(uip_ipaddr_t *ipaddr, struct uip_eth_addr *ethaddr) { - register struct arp_entry *tabptr; + register struct arp_entry *tabptr = arp_table; + /* Walk through the ARP mapping table and try to find an entry to update. If none is found, the IP -> MAC address mapping is inserted in the ARP table. */ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; + /* Only check those entries that are actually in use. */ if(!uip_ipaddr_cmp(&tabptr->ipaddr, &uip_all_zeroes_addr)) { @@ -186,6 +188,7 @@ uip_arp_update(uip_ipaddr_t *ipaddr, struct uip_eth_addr *ethaddr) return; } } + tabptr++; } /* If we get here, no existing ARP table entry was found, so we @@ -362,7 +365,7 @@ uip_arp_arpin(void) void uip_arp_out(void) { - struct arp_entry *tabptr; + struct arp_entry *tabptr = arp_table; /* Find the destination IP address in the ARP table and construct the Ethernet header. If the destination IP addres isn't on the @@ -393,12 +396,11 @@ uip_arp_out(void) /* Else, we use the destination IP address. */ uip_ipaddr_copy(&ipaddr, &IPBUF->destipaddr); } - for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { - tabptr = &arp_table[i]; if(uip_ipaddr_cmp(&ipaddr, &tabptr->ipaddr)) { break; } + tabptr++; } if(i == UIP_ARPTAB_SIZE) { diff --git a/core/net/uiplib.c b/core/net/uiplib.c index af86a8708..3add7dd2c 100644 --- a/core/net/uiplib.c +++ b/core/net/uiplib.c @@ -29,7 +29,7 @@ * * This file is part of the uIP TCP/IP stack and the Contiki operating system. * - * $Id: uiplib.c,v 1.2 2010/05/31 15:22:08 nifi Exp $ + * $Id: uiplib.c,v 1.3 2010/12/14 22:45:22 dak664 Exp $ * */ @@ -48,7 +48,7 @@ uiplib_ipaddrconv(const char *addrstr, uip_ipaddr_t *ipaddr) #if UIP_CONF_IPV6 uint16_t value; int tmp, len, zero; - char c; + char c = 0; //gcc warning if not initialized value = 0; zero = -1;