fixed compiler warnings (as suggested by Niclas Finne)
This commit is contained in:
parent
da33cb5e61
commit
8f66601a5a
1 changed files with 23 additions and 25 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: shell-download.c,v 1.1 2009/04/16 14:33:47 fros4943 Exp $
|
||||
* $Id: shell-download.c,v 1.2 2009/04/20 13:18:07 fros4943 Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -88,8 +88,7 @@ write_chunk(struct rucb_conn *c, int offset, int flag, char *data, int datalen)
|
|||
|
||||
if(flag == RUCB_FLAG_NEWFILE) {
|
||||
PRINTF("RUCB_FLAG_NEWFILE\n");
|
||||
}
|
||||
if (flag == RUCB_FLAG_NONE) {
|
||||
} else if(flag == RUCB_FLAG_NONE) {
|
||||
PRINTF("RUCB_FLAG_NONE\n");
|
||||
}
|
||||
if(flag == RUCB_FLAG_LASTCHUNK) {
|
||||
|
@ -122,12 +121,12 @@ read_chunk(struct rucb_conn *c, int offset, char *to, int maxsize)
|
|||
return ret;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
static void
|
||||
timedout(struct rucb_conn *c)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const static struct rucb_callbacks rucb_call = {write_chunk, read_chunk, timedout};
|
||||
static const struct rucb_callbacks rucb_call = { write_chunk, read_chunk, timedout };
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_download_process, ev, data)
|
||||
{
|
||||
|
@ -149,12 +148,12 @@ PROCESS_THREAD(shell_download_process, ev, data)
|
|||
addr.u8[1] = shell_strtolong(nextptr, &nextptr);
|
||||
|
||||
/* Get the length of the file, excluding a terminating NUL character. */
|
||||
while ((uint8_t)nextptr[0] == ' ') {
|
||||
while(nextptr[0] == ' ') {
|
||||
nextptr++;
|
||||
}
|
||||
len = strlen((char *)nextptr);
|
||||
len = strlen(nextptr);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%d.%d", addr.u8[0], addr.u8[1]);
|
||||
/*snprintf(buf, sizeof(buf), "%d.%d", addr.u8[0], addr.u8[1]);*/
|
||||
/*shell_output_str(&download_command, "Downloading from: ", buf);*/
|
||||
|
||||
if(len > PACKETBUF_SIZE - 32) {
|
||||
|
@ -168,10 +167,10 @@ PROCESS_THREAD(shell_download_process, ev, data)
|
|||
/* Send file request */
|
||||
downloading = 1;
|
||||
rucb_open(&rucb, RUCB_CHANNEL, &rucb_call);
|
||||
nextptr--;
|
||||
req_seq_counter++;
|
||||
nextptr[0] = req_seq_counter;
|
||||
packetbuf_copyfrom(nextptr, len+2);
|
||||
packetbuf_clear();
|
||||
*((uint8_t *)packetbuf_dataptr()) = ++req_seq_counter;
|
||||
memcpy(((char *)packetbuf_dataptr()) + 1, nextptr, len + 1);
|
||||
packetbuf_set_datalen(len + 2);
|
||||
PRINTF("requesting '%s'\n", nextptr);
|
||||
runicast_send(&runicast, &addr, MAX_RETRANSMISSIONS);
|
||||
|
||||
|
@ -198,7 +197,7 @@ request_recv(struct runicast_conn *c, rimeaddr_t *from, uint8_t seqno)
|
|||
return;
|
||||
}
|
||||
|
||||
seq = ((char*)packetbuf_dataptr())[0];
|
||||
seq = ((uint8_t *)packetbuf_dataptr())[0];
|
||||
if(seq == req_last_seq) {
|
||||
PRINTF("download: ignoring duplicate request\n");
|
||||
return;
|
||||
|
@ -234,8 +233,7 @@ request_sent(struct runicast_conn *c, rimeaddr_t *to, uint8_t retransmissions)
|
|||
static void
|
||||
request_timedout(struct runicast_conn *c, rimeaddr_t *to, uint8_t retransmissions)
|
||||
{
|
||||
shell_output_str(&download_command,
|
||||
"download: request timed out", "");
|
||||
shell_output_str(&download_command, "download: request timed out", "");
|
||||
downloading = 0;
|
||||
process_poll(&shell_download_process);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue