Merge pull request #1097 from bthebaudeau/cc2538-examples-fix-warnings

cc2538: examples: Fix build warnings
This commit is contained in:
Antonio Lignan 2015-06-24 11:39:24 +02:00
commit 8cc0a12a9f
5 changed files with 15 additions and 7 deletions

View file

@ -394,7 +394,7 @@ dns_name_isequal(const unsigned char *queryptr, const char *name,
return 0; return 0;
} }
if(tolower(*name++) != tolower(*queryptr++)) { if(tolower((unsigned int)*name++) != tolower((unsigned int)*queryptr++)) {
return 0; return 0;
} }
} }

View file

@ -488,7 +488,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
int is_receiver_awake) int is_receiver_awake)
{ {
rtimer_clock_t t0; rtimer_clock_t t0;
#if WITH_PHASE_OPTIMIZATION
rtimer_clock_t encounter_time = 0; rtimer_clock_t encounter_time = 0;
#endif
int strobes; int strobes;
uint8_t got_strobe_ack = 0; uint8_t got_strobe_ack = 0;
int len; int len;
@ -660,7 +662,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
{ {
rtimer_clock_t wt; rtimer_clock_t wt;
#if WITH_PHASE_OPTIMIZATION
rtimer_clock_t txtime = RTIMER_NOW(); rtimer_clock_t txtime = RTIMER_NOW();
#endif
#if RDC_CONF_HARDWARE_ACK #if RDC_CONF_HARDWARE_ACK
int ret = NETSTACK_RADIO.transmit(transmit_len); int ret = NETSTACK_RADIO.transmit(transmit_len);
#else #else
@ -673,7 +677,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
if(ret == RADIO_TX_OK) { if(ret == RADIO_TX_OK) {
if(!is_broadcast) { if(!is_broadcast) {
got_strobe_ack = 1; got_strobe_ack = 1;
#if WITH_PHASE_OPTIMIZATION
encounter_time = txtime; encounter_time = txtime;
#endif
break; break;
} }
} else if (ret == RADIO_TX_NOACK) { } else if (ret == RADIO_TX_NOACK) {
@ -698,7 +704,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
len = NETSTACK_RADIO.read(ackbuf, ACK_LEN); len = NETSTACK_RADIO.read(ackbuf, ACK_LEN);
if(len == ACK_LEN && seqno == ackbuf[ACK_LEN - 1]) { if(len == ACK_LEN && seqno == ackbuf[ACK_LEN - 1]) {
got_strobe_ack = 1; got_strobe_ack = 1;
#if WITH_PHASE_OPTIMIZATION
encounter_time = txtime; encounter_time = txtime;
#endif
break; break;
} else { } else {
PRINTF("contikimac: collisions while sending\n"); PRINTF("contikimac: collisions while sending\n");

View file

@ -254,13 +254,11 @@ collect_neighbor_list_remove(struct collect_neighbor_list *neighbors_list,
struct collect_neighbor * struct collect_neighbor *
collect_neighbor_list_best(struct collect_neighbor_list *neighbors_list) collect_neighbor_list_best(struct collect_neighbor_list *neighbors_list)
{ {
int found;
struct collect_neighbor *n, *best; struct collect_neighbor *n, *best;
uint16_t rtmetric; uint16_t rtmetric;
rtmetric = RTMETRIC_MAX; rtmetric = RTMETRIC_MAX;
best = NULL; best = NULL;
found = 0;
if(neighbors_list == NULL) { if(neighbors_list == NULL) {
return NULL; return NULL;

View file

@ -950,14 +950,18 @@ node_packet_received(struct unicast_conn *c, const linkaddr_t *from)
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
PACKETBUF_ATTR_PACKET_TYPE_DATA) { PACKETBUF_ATTR_PACKET_TYPE_DATA) {
linkaddr_t ack_to; linkaddr_t ack_to;
#if DEBUG
uint8_t packet_seqno; uint8_t packet_seqno;
#endif
stats.datarecv++; stats.datarecv++;
/* Remember to whom we should send the ACK, since we reuse the /* Remember to whom we should send the ACK, since we reuse the
packet buffer and its attributes when sending the ACK. */ packet buffer and its attributes when sending the ACK. */
linkaddr_copy(&ack_to, packetbuf_addr(PACKETBUF_ADDR_SENDER)); linkaddr_copy(&ack_to, packetbuf_addr(PACKETBUF_ADDR_SENDER));
#if DEBUG
packet_seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); packet_seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID);
#endif
/* If the queue is more than half filled, we add the CONGESTED /* If the queue is more than half filled, we add the CONGESTED
flag to our outgoing acks. */ flag to our outgoing acks. */

View file

@ -872,7 +872,7 @@ fill_buffers(usb_buffer *buffer, uint8_t hw_ep, unsigned int len,
static uint8_t static uint8_t
ep0_get_setup_pkt(void) ep0_get_setup_pkt(void)
{ {
uint8_t res; uint8_t res = 0;
usb_buffer *buffer = usb_buffer *buffer =
skip_buffers_until(usb_endpoints[0].buffer, USB_BUFFER_SETUP, skip_buffers_until(usb_endpoints[0].buffer, USB_BUFFER_SETUP,
USB_BUFFER_SETUP, &res); USB_BUFFER_SETUP, &res);
@ -916,8 +916,6 @@ ep0_get_data_pkt(void)
} }
if(buffer->flags & (USB_BUFFER_SETUP | USB_BUFFER_IN)) { if(buffer->flags & (USB_BUFFER_SETUP | USB_BUFFER_IN)) {
uint8_t temp;
buffer->flags |= USB_BUFFER_FAILED; buffer->flags |= USB_BUFFER_FAILED;
buffer->flags &= ~USB_BUFFER_SUBMITTED; buffer->flags &= ~USB_BUFFER_SUBMITTED;
if(buffer->flags & USB_BUFFER_NOTIFY) { if(buffer->flags & USB_BUFFER_NOTIFY) {
@ -925,7 +923,7 @@ ep0_get_data_pkt(void)
} }
/* Flush the fifo */ /* Flush the fifo */
while(len--) { while(len--) {
temp = REG(USB_F0); REG(USB_F0);
} }
usb_endpoints[0].buffer = buffer->next; usb_endpoints[0].buffer = buffer->next;
/* Force data stage end */ /* Force data stage end */