From 7d0371fa0acbbc5825cee985c332f8be791bf4fd Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Mon, 21 Aug 2006 21:39:01 +0000 Subject: [PATCH] Avoid compiler warnings. --- apps/irc/irc.c | 8 ++++---- apps/irc/ircc.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/irc/irc.c b/apps/irc/irc.c index b549fd638..a0697919f 100644 --- a/apps/irc/irc.c +++ b/apps/irc/irc.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: irc.c,v 1.1 2006/06/17 22:41:11 adamdunkels Exp $ + * $Id: irc.c,v 1.2 2006/08/21 21:39:01 oliverschmidt Exp $ */ #include "contiki-conf.h" @@ -126,7 +126,7 @@ ircc_text_output(struct ircc_state *s, char *text1, char *text2) memcpy(log, &log[LOG_WIDTH], LOG_WIDTH * (LOG_HEIGHT - 1)); ptr = &log[LOG_WIDTH * (LOG_HEIGHT - 1)]; - len = strlen(text1); + len = (int)strlen(text1); memset(ptr, 0, LOG_WIDTH); strncpy(ptr, text1, LOG_WIDTH); @@ -141,7 +141,7 @@ ircc_text_output(struct ircc_state *s, char *text1, char *text2) len = 0; } - if(strlen(text2) > LOG_WIDTH - len) { + if((int)strlen(text2) > LOG_WIDTH - len) { memcpy(log, &log[LOG_WIDTH], LOG_WIDTH * (LOG_HEIGHT - 1)); strncpy(&log[LOG_WIDTH * (LOG_HEIGHT - 1)], text2 + LOG_WIDTH - len, LOG_WIDTH); @@ -154,7 +154,7 @@ static void parse_line(void) { int i; - for(i = 0; i < strlen(line); ++i) { + for(i = 0; i < (int)strlen(line); ++i) { line[i] &= 0x7f; } diff --git a/apps/irc/ircc.c b/apps/irc/ircc.c index 62a74966e..ea59340ed 100644 --- a/apps/irc/ircc.c +++ b/apps/irc/ircc.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: ircc.c,v 1.1 2006/06/17 22:41:11 adamdunkels Exp $ + * $Id: ircc.c,v 1.2 2006/08/21 21:39:49 oliverschmidt Exp $ */ #include "contiki.h" @@ -50,7 +50,7 @@ #define PORT 6667 -#define SEND_STRING(s, str) PSOCK_SEND(s, str, strlen(str)) +#define SEND_STRING(s, str) PSOCK_SEND(s, str, (unsigned int)strlen(str)) #define ISO_space 0x20 #define ISO_bang 0x21 @@ -78,9 +78,9 @@ ircc_init(void) } /*---------------------------------------------------------------------------*/ static char * -copystr(char *dest, const char *src, int n) +copystr(char *dest, const char *src, size_t n) { - int len; + size_t len; len = strlen(src); strncpy(dest, src, n); @@ -102,7 +102,7 @@ PT_THREAD(setup_connection(struct ircc_state *s)) ptr = s->outputbuf; ptr = copystr(ptr, ircc_strings_nick, sizeof(s->outputbuf)); - ptr = copystr(ptr, s->nick, sizeof(s->outputbuf) - (ptr - s->outputbuf)); + ptr = copystr(ptr, s->nick, (int)sizeof(s->outputbuf) - (ptr - s->outputbuf)); ptr = copystr(ptr, ircc_strings_crnl_user, sizeof(s->outputbuf) - (ptr - s->outputbuf)); ptr = copystr(ptr, s->nick, sizeof(s->outputbuf) - (ptr - s->outputbuf)); ptr = copystr(ptr, ircc_strings_contiki, sizeof(s->outputbuf) - (ptr - s->outputbuf)); @@ -481,7 +481,7 @@ struct ircc_state * ircc_connect(struct ircc_state *s, char *servername, u16_t *ipaddr, char *nick) { - s->conn = tcp_connect(ipaddr, HTONS(PORT), s); + s->conn = tcp_connect((uip_ipaddr_t *)ipaddr, HTONS(PORT), s); if(s->conn == NULL) { return NULL; }