From 4e6508b5788dafcb2ca7c05227aae6f89650c852 Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Sun, 10 Feb 2008 12:24:43 +0000 Subject: [PATCH] Avoided compiler warnings by adding casts. However it might make sense to start taking into account that C pointer differences do not have the type 'int'... --- apps/shell/gui-shell.c | 4 ++-- apps/shell/shell-time.c | 18 +++++++++--------- apps/shell/shell.c | 14 +++++++------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/shell/gui-shell.c b/apps/shell/gui-shell.c index 99565976f..b57a80c59 100644 --- a/apps/shell/gui-shell.c +++ b/apps/shell/gui-shell.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki desktop OS. * - * $Id: gui-shell.c,v 1.3 2008/02/08 22:52:18 oliverschmidt Exp $ + * $Id: gui-shell.c,v 1.4 2008/02/10 12:24:43 oliverschmidt Exp $ * */ @@ -136,7 +136,7 @@ PROCESS_THREAD(shell_gui_process, ev, data) if(ev == ctk_signal_widget_activate && data == (process_data_t)&commandentry) { - int command_len = strlen(command); + int command_len = (int)strlen(command); shell_default_output("> ", 2, command, command_len); shell_input(command, command_len); if(shell_gui_process.state) { diff --git a/apps/shell/shell-time.c b/apps/shell/shell-time.c index d0eeeea58..6e0b28560 100644 --- a/apps/shell/shell-time.c +++ b/apps/shell/shell-time.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell-time.c,v 1.2 2008/02/08 20:40:10 adamdunkels Exp $ + * $Id: shell-time.c,v 1.3 2008/02/10 12:24:43 oliverschmidt Exp $ */ /** @@ -96,8 +96,8 @@ PROCESS_THREAD(shell_time_process, ev, data) } } - msg.clock = clock_time(); - msg.rtimer = rtimer_arch_now(); + msg.clock = (uint16_t)clock_time(); + msg.rtimer = (uint16_t)rtimer_arch_now(); #if TIMESYNCH_CONF_ENABLED msg.timesynch = timesynch_time(); msg.timesynch_authority = timesynch_authority_level(); @@ -105,8 +105,8 @@ PROCESS_THREAD(shell_time_process, ev, data) msg.timesynch = 0; msg.timesynch_authority = -1; #endif - msg.time[0] = shell_time() >> 16; - msg.time[1] = shell_time(); + msg.time[0] = (uint16_t)(shell_time() >> 16); + msg.time[1] = (uint16_t)(shell_time()); msg.len = 6; shell_output(&time_command, &msg, sizeof(msg), "", 0); @@ -134,8 +134,8 @@ PROCESS_THREAD(shell_timestamp_process, ev, data) } msg.len = 3 + *(uint16_t *)input->data1; - msg.time[0] = shell_time() >> 16; - msg.time[1] = shell_time(); + msg.time[0] = (uint16_t)(shell_time() >> 16); + msg.time[1] = (uint16_t)(shell_time()); #if TIMESYNCH_CONF_ENABLED msg.timesynch = timesynch_time(); #else /* TIMESYNCH_CONF_ENABLED */ @@ -171,7 +171,7 @@ PROCESS_THREAD(shell_repeat_server_process, ev, data) int ret; static struct process *started_process; strncpy(command_copy, command, MAX_COMMANDLENGTH); - ret = shell_start_command(command_copy, strlen(command_copy), + ret = shell_start_command(command_copy, (int)strlen(command_copy), &repeat_command, &started_process); if(started_process != NULL && @@ -324,7 +324,7 @@ PROCESS_THREAD(shell_randwait_process, ev, data) /* printf("Starting '%s' child %p (%s)\n", command, randwait_command.child, */ /* randwait_command.child == NULL? "null": randwait_command.child->command); */ - ret = shell_start_command(command, strlen(command), + ret = shell_start_command(command, (int)strlen(command), randwait_command.child, &started_process); if(started_process != NULL && diff --git a/apps/shell/shell.c b/apps/shell/shell.c index 54e1a2efc..db1768c12 100644 --- a/apps/shell/shell.c +++ b/apps/shell/shell.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: shell.c,v 1.6 2008/02/04 23:42:17 adamdunkels Exp $ + * $Id: shell.c,v 1.7 2008/02/10 12:24:43 oliverschmidt Exp $ */ /** @@ -225,10 +225,10 @@ start_command(char *commandline, struct shell_command *child) } if(args == NULL) { - command_len = strlen(commandline); + command_len = (int)strlen(commandline); args = &commandline[command_len]; } else { - command_len = args - commandline - 1; + command_len = (int)(args - commandline - 1); } @@ -338,11 +338,11 @@ void shell_output_str(struct shell_command *c, char *text1, const char *text2) { if(c != NULL && c->child != NULL) { - input_to_child_command(c->child, text1, strlen(text1), - text2, strlen(text2)); + input_to_child_command(c->child, text1, (int)strlen(text1), + text2, (int)strlen(text2)); } else { - shell_default_output(text1, strlen(text1), - text2, strlen(text2)); + shell_default_output(text1, (int)strlen(text1), + text2, (int)strlen(text2)); } } /*---------------------------------------------------------------------------*/