From 478d91ac53a06645d4bf02c700ec2aada51ebe93 Mon Sep 17 00:00:00 2001 From: Ralf Schlatterbeck Date: Sat, 31 May 2014 15:52:33 +0200 Subject: [PATCH] Fix lots of compiler warnings --- core/lib/petsciiconv.c | 4 ++-- core/net/ip/resolv.c | 5 +---- core/net/ip/slipdev.c | 2 +- core/net/ip/tcpip.c | 2 ++ core/net/ipv4/uaodv-rt.c | 1 + core/net/ipv4/uaodv.c | 1 + core/net/mac/contikimac/contikimac.c | 8 ++------ core/net/mac/nullrdc.c | 2 ++ core/net/rime/collect-neighbor.c | 2 -- 9 files changed, 12 insertions(+), 15 deletions(-) diff --git a/core/lib/petsciiconv.c b/core/lib/petsciiconv.c index 873c7c2c7..348ee4f03 100644 --- a/core/lib/petsciiconv.c +++ b/core/lib/petsciiconv.c @@ -81,7 +81,7 @@ petsciiconv_toascii(char *buf, unsigned int len) { static char c; - ptr = buf; + ptr = (unsigned char*)buf; for(i = len; i > 0; --i) { c = *ptr; if(c == 0x0a) { @@ -108,7 +108,7 @@ petsciiconv_toascii(char *buf, unsigned int len) void petsciiconv_topetscii(char *buf, unsigned int len) { - ptr = buf; + ptr = (unsigned char *)buf; for(i = len; i > 0; --i) { *ptr = ascii2petscii[*ptr & 0x7f]; ++ptr; diff --git a/core/net/ip/resolv.c b/core/net/ip/resolv.c index b339b03d6..3480c561b 100644 --- a/core/net/ip/resolv.c +++ b/core/net/ip/resolv.c @@ -506,7 +506,6 @@ start_name_collision_check(clock_time_t after) static unsigned char * mdns_write_announce_records(unsigned char *queryptr, uint8_t *count) { - struct dns_answer *ans; #if UIP_CONF_IPV6 uint8_t i; @@ -524,7 +523,6 @@ mdns_write_announce_records(unsigned char *queryptr, uint8_t *count) *queryptr++ = 0xc0; *queryptr++ = sizeof(struct dns_hdr); } - ans = (struct dns_answer *)queryptr; *queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE) >> 8); *queryptr++ = (uint8_t) ((NATIVE_DNS_TYPE)); @@ -546,6 +544,7 @@ mdns_write_announce_records(unsigned char *queryptr, uint8_t *count) } } #else /* UIP_CONF_IPV6 */ + struct dns_answer *ans; queryptr = encode_name(queryptr, resolv_hostname); ans = (struct dns_answer *)queryptr; ans->type = UIP_HTONS(NATIVE_DNS_TYPE); @@ -603,8 +602,6 @@ mdns_prep_host_announce_packet(void) uint8_t total_answers = 0; - struct dns_answer *ans; - /* Be aware that, unless `ARCH_DOESNT_NEED_ALIGNED_STRUCTS` is set, * writing directly to the uint16_t members of this struct is an error. */ struct dns_hdr *hdr = (struct dns_hdr *)uip_appdata; diff --git a/core/net/ip/slipdev.c b/core/net/ip/slipdev.c index a75f524bf..670126632 100644 --- a/core/net/ip/slipdev.c +++ b/core/net/ip/slipdev.c @@ -103,7 +103,7 @@ slipdev_send(void) ptr = &uip_buf[UIP_LLH_LEN]; for(i = 0; i < uip_len; ++i) { if(i == UIP_TCPIP_HLEN) { - ptr = (char *)uip_appdata; + ptr = uip_appdata; } c = *ptr++; switch(c) { diff --git a/core/net/ip/tcpip.c b/core/net/ip/tcpip.c index 7a889c84c..e6beae7fd 100644 --- a/core/net/ip/tcpip.c +++ b/core/net/ip/tcpip.c @@ -155,6 +155,7 @@ unsigned char tcpip_is_forwarding; /* Forwarding right now? */ PROCESS(tcpip_process, "TCP/IP stack"); /*---------------------------------------------------------------------------*/ +#if UIP_TCP static void start_periodic_tcp_timer(void) { @@ -162,6 +163,7 @@ start_periodic_tcp_timer(void) etimer_restart(&periodic); } } +#endif /*---------------------------------------------------------------------------*/ static void check_for_tcp_syn(void) diff --git a/core/net/ipv4/uaodv-rt.c b/core/net/ipv4/uaodv-rt.c index cad7db73f..b07d3d636 100644 --- a/core/net/ipv4/uaodv-rt.c +++ b/core/net/ipv4/uaodv-rt.c @@ -38,6 +38,7 @@ */ +#include #include "net/ipv4/uaodv-rt.h" #include "contiki-net.h" diff --git a/core/net/ipv4/uaodv.c b/core/net/ipv4/uaodv.c index 230709a61..a95b8cf28 100644 --- a/core/net/ipv4/uaodv.c +++ b/core/net/ipv4/uaodv.c @@ -39,6 +39,7 @@ #include #include +#include #include "contiki.h" #include "net/ipv4/uaodv-def.h" diff --git a/core/net/mac/contikimac/contikimac.c b/core/net/mac/contikimac/contikimac.c index ba20efbb1..7c27d7fb5 100644 --- a/core/net/mac/contikimac/contikimac.c +++ b/core/net/mac/contikimac/contikimac.c @@ -372,7 +372,6 @@ powercycle(struct rtimer *t, void *ptr) while(1) { static uint8_t packet_seen; - static rtimer_clock_t t0; static uint8_t count; #if SYNC_CYCLE_STARTS @@ -396,7 +395,6 @@ powercycle(struct rtimer *t, void *ptr) packet_seen = 0; for(count = 0; count < CCA_COUNT_MAX; ++count) { - t0 = RTIMER_NOW(); if(we_are_sending == 0 && we_are_receiving_burst == 0) { powercycle_turn_radio_on(); /* Check if a packet is seen in the air. If so, we keep the @@ -530,8 +528,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, uint8_t got_strobe_ack = 0; int hdrlen, len; uint8_t is_broadcast = 0; - uint8_t is_reliable = 0; +#if WITH_PHASE_OPTIMIZATION uint8_t is_known_receiver = 0; +#endif uint8_t collisions; int transmit_len; int ret; @@ -580,9 +579,6 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]); #endif /* UIP_CONF_IPV6 */ } - is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) || - packetbuf_attr(PACKETBUF_ATTR_ERELIABLE); - packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); #if WITH_CONTIKIMAC_HEADER diff --git a/core/net/mac/nullrdc.c b/core/net/mac/nullrdc.c index 7e7be6004..c30b1ba1f 100644 --- a/core/net/mac/nullrdc.c +++ b/core/net/mac/nullrdc.c @@ -270,11 +270,13 @@ send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list) static void packet_input(void) { +#if NULLRDC_SEND_802154_ACK int original_datalen; uint8_t *original_dataptr; original_datalen = packetbuf_datalen(); original_dataptr = packetbuf_dataptr(); +#endif #ifdef NETSTACK_DECRYPT NETSTACK_DECRYPT(); #endif /* NETSTACK_DECRYPT */ diff --git a/core/net/rime/collect-neighbor.c b/core/net/rime/collect-neighbor.c index 2e105fca8..ecd5e2967 100644 --- a/core/net/rime/collect-neighbor.c +++ b/core/net/rime/collect-neighbor.c @@ -254,13 +254,11 @@ collect_neighbor_list_remove(struct collect_neighbor_list *neighbors_list, struct collect_neighbor * collect_neighbor_list_best(struct collect_neighbor_list *neighbors_list) { - int found; struct collect_neighbor *n, *best; uint16_t rtmetric; rtmetric = RTMETRIC_MAX; best = NULL; - found = 0; if(neighbors_list == NULL) { return NULL;