Avoid compiler warnings.

This commit is contained in:
oliverschmidt 2006-08-21 21:39:01 +00:00
parent df0bcd5555
commit 7d0371fa0a
2 changed files with 10 additions and 10 deletions

View File

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $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;
}

View File

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $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;
}