Merge pull request #1051 from simonduq/fix-warning

Fixed a number of compiler warnings
This commit is contained in:
George Oikonomou 2015-05-13 00:52:40 +01:00
commit 11a5e0a49a
8 changed files with 30 additions and 21 deletions

View File

@ -72,14 +72,13 @@ static unsigned char ascii2petscii[128] = {
0x58,0x59,0x5a,0xdb,0xdd,0xdd,0x5e,0xdf, 0x58,0x59,0x5a,0xdb,0xdd,0xdd,0x5e,0xdf,
}; };
static unsigned int i;
static unsigned char *ptr;
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void void
petsciiconv_toascii(char *buf, unsigned int len) petsciiconv_toascii(char *buf, unsigned int len)
{ {
static char c; unsigned int i;
char *ptr;
char c;
ptr = buf; ptr = buf;
for(i = len; i > 0; --i) { for(i = len; i > 0; --i) {
@ -108,6 +107,9 @@ petsciiconv_toascii(char *buf, unsigned int len)
void void
petsciiconv_topetscii(char *buf, unsigned int len) petsciiconv_topetscii(char *buf, unsigned int len)
{ {
unsigned int i;
char *ptr;
ptr = buf; ptr = buf;
for(i = len; i > 0; --i) { for(i = len; i > 0; --i) {
*ptr = ascii2petscii[*ptr & 0x7f]; *ptr = ascii2petscii[*ptr & 0x7f];

View File

@ -787,7 +787,7 @@ newdata(void)
static int8_t i; static int8_t i;
register struct namemap *namemapptr; register struct namemap *namemapptr = NULL;
struct dns_answer *ans; struct dns_answer *ans;

View File

@ -103,7 +103,7 @@ slipdev_send(void)
ptr = &uip_buf[UIP_LLH_LEN]; ptr = &uip_buf[UIP_LLH_LEN];
for(i = 0; i < uip_len; ++i) { for(i = 0; i < uip_len; ++i) {
if(i == UIP_TCPIP_HLEN) { if(i == UIP_TCPIP_HLEN) {
ptr = (char *)uip_appdata; ptr = (uint8_t *)uip_appdata;
} }
c = *ptr++; c = *ptr++;
switch(c) { switch(c) {

View File

@ -56,8 +56,10 @@ typedef struct uip_nameserver_record {
uint32_t lifetime; uint32_t lifetime;
} uip_nameserver_record; } uip_nameserver_record;
#if UIP_NAMESERVER_POOL_SIZE > 1
/** \brief Initialization flag */ /** \brief Initialization flag */
static uint8_t initialized = 0; static uint8_t initialized = 0;
#endif
/** \name List and memory block /** \name List and memory block
* @{ * @{

View File

@ -116,17 +116,20 @@ void uip_log(char *msg);
#define UIP_ND6_OPT_RDNSS_BUF ((uip_nd6_opt_dns *)&uip_buf[uip_l2_l3_icmp_hdr_len + nd6_opt_offset]) #define UIP_ND6_OPT_RDNSS_BUF ((uip_nd6_opt_dns *)&uip_buf[uip_l2_l3_icmp_hdr_len + nd6_opt_offset])
/** @} */ /** @} */
#if UIP_ND6_SEND_NA || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER
static uint8_t nd6_opt_offset; /** Offset from the end of the icmpv6 header to the option in uip_buf*/ static uint8_t nd6_opt_offset; /** Offset from the end of the icmpv6 header to the option in uip_buf*/
static uint8_t *nd6_opt_llao; /** Pointer to llao option in uip_buf */ static uint8_t *nd6_opt_llao; /** Pointer to llao option in uip_buf */
static uip_ds6_nbr_t *nbr; /** Pointer to a nbr cache entry*/
static uip_ds6_defrt_t *defrt; /** Pointer to a router list entry */
static uip_ds6_addr_t *addr; /** Pointer to an interface address */
#endif /* UIP_ND6_SEND_NA || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER */
#if !UIP_CONF_ROUTER // TBD see if we move it to ra_input #if !UIP_CONF_ROUTER // TBD see if we move it to ra_input
static uip_nd6_opt_prefix_info *nd6_opt_prefix_info; /** Pointer to prefix information option in uip_buf */ static uip_nd6_opt_prefix_info *nd6_opt_prefix_info; /** Pointer to prefix information option in uip_buf */
static uip_ipaddr_t ipaddr; static uip_ipaddr_t ipaddr;
static uip_ds6_prefix_t *prefix; /** Pointer to a prefix list entry */ static uip_ds6_prefix_t *prefix; /** Pointer to a prefix list entry */
#endif #endif
static uip_ds6_nbr_t *nbr; /** Pointer to a nbr cache entry*/
static uip_ds6_defrt_t *defrt; /** Pointer to a router list entry */
static uip_ds6_addr_t *addr; /** Pointer to an interface address */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* create a llao */ /* create a llao */
static void static void
@ -141,7 +144,7 @@ create_llao(uint8_t *llao, uint8_t type) {
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
#if UIP_ND6_SEND_NA
static void static void
ns_input(void) ns_input(void)
{ {
@ -321,7 +324,7 @@ discard:
uip_len = 0; uip_len = 0;
return; return;
} }
#endif /* UIP_ND6_SEND_NA */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
@ -387,6 +390,7 @@ uip_nd6_ns_output(uip_ipaddr_t * src, uip_ipaddr_t * dest, uip_ipaddr_t * tgt)
PRINTF("\n"); PRINTF("\n");
return; return;
} }
#if UIP_ND6_SEND_NA
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/** /**
* Neighbor Advertisement Processing * Neighbor Advertisement Processing
@ -556,7 +560,7 @@ discard:
uip_len = 0; uip_len = 0;
return; return;
} }
#endif /* UIP_ND6_SEND_NA */
#if UIP_CONF_ROUTER #if UIP_CONF_ROUTER
#if UIP_ND6_SEND_RA #if UIP_ND6_SEND_RA
@ -859,7 +863,7 @@ ra_input(void)
(uip_lladdr_t *)&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], (uip_lladdr_t *)&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET],
1, NBR_STALE); 1, NBR_STALE);
} else { } else {
uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(nbr); uip_lladdr_t *lladdr = (uip_lladdr_t *)uip_ds6_nbr_get_ll(nbr);
if(nbr->state == NBR_INCOMPLETE) { if(nbr->state == NBR_INCOMPLETE) {
nbr->state = NBR_STALE; nbr->state = NBR_STALE;
} }

View File

@ -341,7 +341,6 @@ powercycle(struct rtimer *t, void *ptr)
while(1) { while(1) {
static uint8_t packet_seen; static uint8_t packet_seen;
static rtimer_clock_t t0;
static uint8_t count; static uint8_t count;
#if SYNC_CYCLE_STARTS #if SYNC_CYCLE_STARTS
@ -365,7 +364,6 @@ powercycle(struct rtimer *t, void *ptr)
packet_seen = 0; packet_seen = 0;
for(count = 0; count < CCA_COUNT_MAX; ++count) { for(count = 0; count < CCA_COUNT_MAX; ++count) {
t0 = RTIMER_NOW();
if(we_are_sending == 0 && we_are_receiving_burst == 0) { if(we_are_sending == 0 && we_are_receiving_burst == 0) {
powercycle_turn_radio_on(); powercycle_turn_radio_on();
/* Check if a packet is seen in the air. If so, we keep the /* Check if a packet is seen in the air. If so, we keep the
@ -666,11 +664,12 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
{ {
rtimer_clock_t wt; rtimer_clock_t wt;
rtimer_clock_t txtime; rtimer_clock_t txtime = RTIMER_NOW();
int ret; #if RDC_CONF_HARDWARE_ACK
int ret = NETSTACK_RADIO.transmit(transmit_len);
txtime = RTIMER_NOW(); #else
ret = NETSTACK_RADIO.transmit(transmit_len); NETSTACK_RADIO.transmit(transmit_len);
#endif
#if RDC_CONF_HARDWARE_ACK #if RDC_CONF_HARDWARE_ACK
/* For radios that block in the transmit routine and detect the /* For radios that block in the transmit routine and detect the

View File

@ -264,11 +264,13 @@ send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
static void static void
packet_input(void) packet_input(void)
{ {
#if NULLRDC_SEND_802154_ACK
int original_datalen; int original_datalen;
uint8_t *original_dataptr; uint8_t *original_dataptr;
original_datalen = packetbuf_datalen(); original_datalen = packetbuf_datalen();
original_dataptr = packetbuf_dataptr(); original_dataptr = packetbuf_dataptr();
#endif
#if NULLRDC_802154_AUTOACK #if NULLRDC_802154_AUTOACK
if(packetbuf_datalen() == ACK_LEN) { if(packetbuf_datalen() == ACK_LEN) {

View File

@ -137,7 +137,7 @@ collect_common_send(void)
/* Use parts of the IPv6 address as the parent address, in reversed byte order. */ /* Use parts of the IPv6 address as the parent address, in reversed byte order. */
parent.u8[LINKADDR_SIZE - 1] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 2]; parent.u8[LINKADDR_SIZE - 1] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 2];
parent.u8[LINKADDR_SIZE - 2] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 1]; parent.u8[LINKADDR_SIZE - 2] = nbr->ipaddr.u8[sizeof(uip_ipaddr_t) - 1];
parent_etx = rpl_get_parent_rank((linkaddr_t *) uip_ds6_nbr_get_ll(nbr)) / 2; parent_etx = rpl_get_parent_rank((uip_lladdr_t *) uip_ds6_nbr_get_ll(nbr)) / 2;
} }
} }
rtmetric = dag->rank; rtmetric = dag->rank;