From b83a115953cd0f0367394ab75ebd9991390ed013 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 10 Mar 2010 11:27:11 +0000 Subject: [PATCH] Fixed compilation warnings (missing casts, includes, etc.) --- apps/chargen/chargen.c | 2 +- apps/httpserver_raw/httpd.c | 2 +- apps/ping/ping.c | 4 ++-- apps/shell/shell.c | 4 +++- apps/snmp_private_mib/lwip_prvmib.c | 10 +++++----- apps/sntp/sntp.c | 6 ++++-- apps/socket_examples/socket_examples.c | 1 + apps/tcpecho_raw/echo.c | 10 +++++----- apps/udpecho/udpecho.c | 2 +- 9 files changed, 23 insertions(+), 18 deletions(-) diff --git a/apps/chargen/chargen.c b/apps/chargen/chargen.c index fb9adc6..1f4f257 100644 --- a/apps/chargen/chargen.c +++ b/apps/chargen/chargen.c @@ -266,4 +266,4 @@ void chargen_init(void) } -#endif /* LWIP_SOCKET */ \ No newline at end of file +#endif /* LWIP_SOCKET */ diff --git a/apps/httpserver_raw/httpd.c b/apps/httpserver_raw/httpd.c index 0376387..cd0e0bf 100644 --- a/apps/httpserver_raw/httpd.c +++ b/apps/httpserver_raw/httpd.c @@ -1110,7 +1110,7 @@ http_parse_request(struct pbuf *p, struct http_state *hs) int i; /* default is request not supported, until it can be parsed */ err_t request_supported = ERR_ARG; - int loop; + size_t loop; char *data; char *uri; struct fs_file *file = NULL; diff --git a/apps/ping/ping.c b/apps/ping/ping.c index 9efb01b..474cc4f 100644 --- a/apps/ping/ping.c +++ b/apps/ping/ping.c @@ -135,7 +135,7 @@ ping_send(int s, ip_addr_t *addr) size_t ping_size = sizeof(struct icmp_echo_hdr) + PING_DATA_SIZE; LWIP_ASSERT("ping_size is too big", ping_size <= 0xffff); - iecho = mem_malloc((mem_size_t)ping_size); + iecho = (struct icmp_echo_hdr *)mem_malloc((mem_size_t)ping_size); if (!iecho) { return ERR_MEM; } @@ -163,7 +163,7 @@ ping_recv(int s) struct icmp_echo_hdr *iecho; while((len = lwip_recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr*)&from, (socklen_t*)&fromlen)) > 0) { - if (len >= (sizeof(struct ip_hdr)+sizeof(struct icmp_echo_hdr))) { + if (len >= (int)(sizeof(struct ip_hdr)+sizeof(struct icmp_echo_hdr))) { ip_addr_t fromaddr; inet_addr_to_ipaddr(&fromaddr, &from.sin_addr); LWIP_DEBUGF( PING_DEBUG, ("ping: recv ")); diff --git a/apps/shell/shell.c b/apps/shell/shell.c index 5882067..ad8a346 100644 --- a/apps/shell/shell.c +++ b/apps/shell/shell.c @@ -397,6 +397,7 @@ static void *stat_ptrs[STAT_NUM] = { &lwip_stats.link.err, &lwip_stats.link.cachehit, +#if IPFRAG_STATS &lwip_stats.ip_frag.xmit, &lwip_stats.ip_frag.recv, &lwip_stats.ip_frag.fw, @@ -409,6 +410,7 @@ static void *stat_ptrs[STAT_NUM] = { &lwip_stats.ip_frag.opterr, &lwip_stats.ip_frag.err, &lwip_stats.ip_frag.cachehit, +#endif /* IPFRAG_STATS */ &lwip_stats.ip.xmit, &lwip_stats.ip.recv, @@ -1224,7 +1226,7 @@ com_usnd(struct command *com) len = (u16_t)tmp; buf = netbuf_new(); - mem = netbuf_alloc(buf, len); + mem = (char *)netbuf_alloc(buf, len); if (mem == NULL) { sendstr("Could not allocate memory for sending."NEWLINE, com->conn); return ESUCCESS; diff --git a/apps/snmp_private_mib/lwip_prvmib.c b/apps/snmp_private_mib/lwip_prvmib.c index 2203f7b..3541b9d 100644 --- a/apps/snmp_private_mib/lwip_prvmib.c +++ b/apps/snmp_private_mib/lwip_prvmib.c @@ -345,7 +345,7 @@ lwip_privmib_init(void) static u16_t sensorentry_length(void* addr_inf, u8_t level) { - struct sensor_inf* sensors = addr_inf; + struct sensor_inf *sensors = (struct sensor_inf *)addr_inf; if (level == 0) { @@ -366,7 +366,7 @@ sensorentry_length(void* addr_inf, u8_t level) static s32_t sensorentry_idcmp(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id) { - struct sensor_inf* sensors = addr_inf; + struct sensor_inf *sensors = (struct sensor_inf *)addr_inf; if (level == 0) { @@ -396,7 +396,7 @@ sensorentry_idcmp(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id) static void sensorentry_get_subid(void* addr_inf, u8_t level, u16_t idx, s32_t *sub_id) { - struct sensor_inf* sensors = addr_inf; + struct sensor_inf *sensors = (struct sensor_inf *)addr_inf; if (level == 0) { @@ -489,7 +489,7 @@ static void sensorentry_get_value_a(u8_t rid, struct obj_def *od, u16_t len, void *value) { s32_t i; - s32_t *temperature = value; + s32_t *temperature = (s32_t *)value; #if SENSORS_USE_FILES FILE* sensf; char senspath[sizeof(SENSORS_DIR)+1+SENSOR_NAME_LEN+1] = SENSORS_DIR"/"; @@ -566,7 +566,7 @@ static void sensorentry_set_value_a(u8_t rid, struct obj_def *od, u16_t len, void *value) { s32_t i; - s32_t *temperature = value; + s32_t *temperature = (s32_t *)value; #if SENSORS_USE_FILES FILE* sensf; char senspath[sizeof(SENSORS_DIR)+1+SENSOR_NAME_LEN+1] = SENSORS_DIR"/"; diff --git a/apps/sntp/sntp.c b/apps/sntp/sntp.c index 3dac68f..c319f77 100644 --- a/apps/sntp/sntp.c +++ b/apps/sntp/sntp.c @@ -225,7 +225,7 @@ #define SNTP_OFFSET_TRANSMIT_TIME 40 /* number of seconds between 1900 and 1970 */ -#define DIFF_SEC_1900_1970 (2208988800) +#define DIFF_SEC_1900_1970 (2208988800UL) /** * SNTP packet format (without optional fields) @@ -594,7 +594,7 @@ sntp_send_request(ip_addr_t *server_addr) struct pbuf* p; p = pbuf_alloc(PBUF_TRANSPORT, SNTP_MSG_LEN, PBUF_RAM); if (p != NULL) { - struct sntp_msg *sntpmsg = p->payload; + struct sntp_msg *sntpmsg = (struct sntp_msg *)p->payload; LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_send_request: Sending request to server\n")); /* initialize request message */ sntp_initialize_request(sntpmsg); @@ -614,6 +614,7 @@ sntp_send_request(ip_addr_t *server_addr) } } +#if SNTP_SERVER_DNS /** * DNS found callback when using DNS names as server address. */ @@ -633,6 +634,7 @@ sntp_dns_found(const char* hostname, ip_addr_t *ipaddr, void *arg) sntp_try_next_server(NULL); } } +#endif /* SNTP_SERVER_DNS */ /** * Send out an sntp request via raw API. diff --git a/apps/socket_examples/socket_examples.c b/apps/socket_examples/socket_examples.c index 86e741a..53e177b 100644 --- a/apps/socket_examples/socket_examples.c +++ b/apps/socket_examples/socket_examples.c @@ -9,6 +9,7 @@ #include "lwip/sys.h" #include +#include #ifndef SOCK_TARGET_HOST #define SOCK_TARGET_HOST "192.168.1.1" diff --git a/apps/tcpecho_raw/echo.c b/apps/tcpecho_raw/echo.c index 3c21e0c..a860fa9 100644 --- a/apps/tcpecho_raw/echo.c +++ b/apps/tcpecho_raw/echo.c @@ -110,7 +110,7 @@ echo_accept(void *arg, struct tcp_pcb *newpcb, err_t err) /* commonly observed practive to call tcp_setprio(), why? */ tcp_setprio(newpcb, TCP_PRIO_MIN); - es = mem_malloc(sizeof(struct echo_state)); + es = (struct echo_state *)mem_malloc(sizeof(struct echo_state)); if (es != NULL) { es->state = ES_ACCEPTED; @@ -138,7 +138,7 @@ echo_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) err_t ret_err; LWIP_ASSERT("arg != NULL",arg != NULL); - es = arg; + es = (struct echo_state *)arg; if (p == NULL) { /* remote host closed connection */ @@ -222,7 +222,7 @@ echo_error(void *arg, err_t err) LWIP_UNUSED_ARG(err); - es = arg; + es = (struct echo_state *)arg; if (es != NULL) { mem_free(es); @@ -235,7 +235,7 @@ echo_poll(void *arg, struct tcp_pcb *tpcb) err_t ret_err; struct echo_state *es; - es = arg; + es = (struct echo_state *)arg; if (es != NULL) { if (es->p != NULL) @@ -270,7 +270,7 @@ echo_sent(void *arg, struct tcp_pcb *tpcb, u16_t len) LWIP_UNUSED_ARG(len); - es = arg; + es = (struct echo_state *)arg; es->retries = 0; if(es->p != NULL) diff --git a/apps/udpecho/udpecho.c b/apps/udpecho/udpecho.c index 70c9bd0..d79f213 100644 --- a/apps/udpecho/udpecho.c +++ b/apps/udpecho/udpecho.c @@ -64,7 +64,7 @@ udpecho_thread(void *arg) netbuf_copy(buf, buffer, buf->p->tot_len); buffer[buf->p->tot_len] = '\0'; netconn_send(conn, buf); - printf("got %s\n", buffer); + LWIP_DEBUGF(LWIP_DBG_ON, ("got %s\n", buffer)); netbuf_delete(buf); } }