removed warnings

This commit is contained in:
fros4943 2007-11-25 22:45:04 +00:00
parent 4436819336
commit 6f862c4506
2 changed files with 20 additions and 24 deletions

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* @(#)$Id: radio-uip-uaodv.c,v 1.7 2007/10/23 12:16:13 fros4943 Exp $ * @(#)$Id: radio-uip-uaodv.c,v 1.8 2007/11/25 22:45:04 fros4943 Exp $
*/ */
#include "radio-uip-uaodv.h" #include "radio-uip-uaodv.h"
@ -189,14 +189,12 @@ receiver(const struct radio_driver *d)
/* Send ack as soon as possible */ /* Send ack as soon as possible */
u16_t crc; u16_t crc;
crc = radio_uip_calc_crc(&uip_buf[UIP_LLH_LEN], uip_len); crc = radio_uip_calc_crc(&uip_buf[UIP_LLH_LEN], uip_len);
process_post(&radio_uip_process, EVENT_SEND_ACK, crc); process_post(&radio_uip_process, EVENT_SEND_ACK, (void*) (u32_t) crc);
} }
/* Strip header and receive packet */ /* Strip header and receive packet */
uip_len = radio_uip_uaodv_remove_header(&uip_buf[UIP_LLH_LEN], uip_len); uip_len = radio_uip_uaodv_remove_header(&uip_buf[UIP_LLH_LEN], uip_len);
tcpip_input(); tcpip_input();
return;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
u8_t u8_t
@ -206,7 +204,7 @@ radio_uip_uaodv_send(void)
/* Transmit broadcast packets without header */ /* Transmit broadcast packets without header */
if (radio_uip_uaodv_is_broadcast(&((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])->destipaddr)) { if (radio_uip_uaodv_is_broadcast(&((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])->destipaddr)) {
return radio_uip_buffer_outgoing_packet(&uip_buf[UIP_LLH_LEN], uip_len, &uip_broadcast_addr, 1); return radio_uip_buffer_outgoing_packet(&uip_buf[UIP_LLH_LEN], uip_len, (void*) &uip_broadcast_addr, 1);
} }
/* Transmit uAODV packets with headers but without using route table */ /* Transmit uAODV packets with headers but without using route table */

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: log.c,v 1.3 2007/05/18 13:50:08 fros4943 Exp $ * $Id: log.c,v 1.4 2007/11/25 22:45:32 fros4943 Exp $
*/ */
#include <stdio.h> #include <stdio.h>
@ -42,8 +42,20 @@ char simLoggedData[MAX_LOG_LENGTH];
int simLoggedLength; int simLoggedLength;
char simLoggedFlag; char simLoggedFlag;
void simlog(const char *message); /*-----------------------------------------------------------------------------------*/
void
simlog(const char *message)
{
if (simLoggedLength + strlen(message) > MAX_LOG_LENGTH) {
/* Dropping message due to buffer overflow */
printf("Warning. Dropping log message due to buffer overflow\n");
return;
}
memcpy(&simLoggedData[0] + simLoggedLength, &message[0], strlen(message));
simLoggedLength += strlen(message);
simLoggedFlag = 1;
}
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void void
log_message(const char *part1, const char *part2) log_message(const char *part1, const char *part2)
@ -52,20 +64,6 @@ log_message(const char *part1, const char *part2)
simlog(part2); simlog(part2);
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void
simlog(const char *message)
{
if (simLoggedLength + strlen(message) > MAX_LOG_LENGTH) {
/* Dropping message due to buffer overflow */
printf("Warning. Dropping log message due to buffer overflow\n");
return;
}
memcpy(&simLoggedData[0] + simLoggedLength, &message[0], strlen(message));
simLoggedLength += strlen(message);
simLoggedFlag = 1;
}
/*-----------------------------------------------------------------------------------*/
static void static void
doInterfaceActionsBeforeTick(void) doInterfaceActionsBeforeTick(void)
{ {
@ -78,5 +76,5 @@ doInterfaceActionsAfterTick(void)
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
SIM_INTERFACE(simlog_interface, SIM_INTERFACE(simlog_interface,
doInterfaceActionsBeforeTick, doInterfaceActionsBeforeTick,
doInterfaceActionsAfterTick); doInterfaceActionsAfterTick);