Fixed compilation warnings (missing casts, includes, etc.)

This commit is contained in:
goldsimon 2010-03-10 11:27:11 +00:00
parent 5cb0d5848a
commit b83a115953
9 changed files with 23 additions and 18 deletions

View File

@ -266,4 +266,4 @@ void chargen_init(void)
} }
#endif /* LWIP_SOCKET */ #endif /* LWIP_SOCKET */

View File

@ -1110,7 +1110,7 @@ http_parse_request(struct pbuf *p, struct http_state *hs)
int i; int i;
/* default is request not supported, until it can be parsed */ /* default is request not supported, until it can be parsed */
err_t request_supported = ERR_ARG; err_t request_supported = ERR_ARG;
int loop; size_t loop;
char *data; char *data;
char *uri; char *uri;
struct fs_file *file = NULL; struct fs_file *file = NULL;

View File

@ -135,7 +135,7 @@ ping_send(int s, ip_addr_t *addr)
size_t ping_size = sizeof(struct icmp_echo_hdr) + PING_DATA_SIZE; size_t ping_size = sizeof(struct icmp_echo_hdr) + PING_DATA_SIZE;
LWIP_ASSERT("ping_size is too big", ping_size <= 0xffff); 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) { if (!iecho) {
return ERR_MEM; return ERR_MEM;
} }
@ -163,7 +163,7 @@ ping_recv(int s)
struct icmp_echo_hdr *iecho; struct icmp_echo_hdr *iecho;
while((len = lwip_recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr*)&from, (socklen_t*)&fromlen)) > 0) { 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; ip_addr_t fromaddr;
inet_addr_to_ipaddr(&fromaddr, &from.sin_addr); inet_addr_to_ipaddr(&fromaddr, &from.sin_addr);
LWIP_DEBUGF( PING_DEBUG, ("ping: recv ")); LWIP_DEBUGF( PING_DEBUG, ("ping: recv "));

View File

@ -397,6 +397,7 @@ static void *stat_ptrs[STAT_NUM] = {
&lwip_stats.link.err, &lwip_stats.link.err,
&lwip_stats.link.cachehit, &lwip_stats.link.cachehit,
#if IPFRAG_STATS
&lwip_stats.ip_frag.xmit, &lwip_stats.ip_frag.xmit,
&lwip_stats.ip_frag.recv, &lwip_stats.ip_frag.recv,
&lwip_stats.ip_frag.fw, &lwip_stats.ip_frag.fw,
@ -409,6 +410,7 @@ static void *stat_ptrs[STAT_NUM] = {
&lwip_stats.ip_frag.opterr, &lwip_stats.ip_frag.opterr,
&lwip_stats.ip_frag.err, &lwip_stats.ip_frag.err,
&lwip_stats.ip_frag.cachehit, &lwip_stats.ip_frag.cachehit,
#endif /* IPFRAG_STATS */
&lwip_stats.ip.xmit, &lwip_stats.ip.xmit,
&lwip_stats.ip.recv, &lwip_stats.ip.recv,
@ -1224,7 +1226,7 @@ com_usnd(struct command *com)
len = (u16_t)tmp; len = (u16_t)tmp;
buf = netbuf_new(); buf = netbuf_new();
mem = netbuf_alloc(buf, len); mem = (char *)netbuf_alloc(buf, len);
if (mem == NULL) { if (mem == NULL) {
sendstr("Could not allocate memory for sending."NEWLINE, com->conn); sendstr("Could not allocate memory for sending."NEWLINE, com->conn);
return ESUCCESS; return ESUCCESS;

View File

@ -345,7 +345,7 @@ lwip_privmib_init(void)
static u16_t static u16_t
sensorentry_length(void* addr_inf, u8_t level) 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) if (level == 0)
{ {
@ -366,7 +366,7 @@ sensorentry_length(void* addr_inf, u8_t level)
static s32_t static s32_t
sensorentry_idcmp(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id) 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) if (level == 0)
{ {
@ -396,7 +396,7 @@ sensorentry_idcmp(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id)
static void static void
sensorentry_get_subid(void* addr_inf, u8_t level, u16_t idx, s32_t *sub_id) 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) 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) sensorentry_get_value_a(u8_t rid, struct obj_def *od, u16_t len, void *value)
{ {
s32_t i; s32_t i;
s32_t *temperature = value; s32_t *temperature = (s32_t *)value;
#if SENSORS_USE_FILES #if SENSORS_USE_FILES
FILE* sensf; FILE* sensf;
char senspath[sizeof(SENSORS_DIR)+1+SENSOR_NAME_LEN+1] = SENSORS_DIR"/"; 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) sensorentry_set_value_a(u8_t rid, struct obj_def *od, u16_t len, void *value)
{ {
s32_t i; s32_t i;
s32_t *temperature = value; s32_t *temperature = (s32_t *)value;
#if SENSORS_USE_FILES #if SENSORS_USE_FILES
FILE* sensf; FILE* sensf;
char senspath[sizeof(SENSORS_DIR)+1+SENSOR_NAME_LEN+1] = SENSORS_DIR"/"; char senspath[sizeof(SENSORS_DIR)+1+SENSOR_NAME_LEN+1] = SENSORS_DIR"/";

View File

@ -225,7 +225,7 @@
#define SNTP_OFFSET_TRANSMIT_TIME 40 #define SNTP_OFFSET_TRANSMIT_TIME 40
/* number of seconds between 1900 and 1970 */ /* 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) * SNTP packet format (without optional fields)
@ -594,7 +594,7 @@ sntp_send_request(ip_addr_t *server_addr)
struct pbuf* p; struct pbuf* p;
p = pbuf_alloc(PBUF_TRANSPORT, SNTP_MSG_LEN, PBUF_RAM); p = pbuf_alloc(PBUF_TRANSPORT, SNTP_MSG_LEN, PBUF_RAM);
if (p != NULL) { 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")); LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_send_request: Sending request to server\n"));
/* initialize request message */ /* initialize request message */
sntp_initialize_request(sntpmsg); 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. * 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); sntp_try_next_server(NULL);
} }
} }
#endif /* SNTP_SERVER_DNS */
/** /**
* Send out an sntp request via raw API. * Send out an sntp request via raw API.

View File

@ -9,6 +9,7 @@
#include "lwip/sys.h" #include "lwip/sys.h"
#include <string.h> #include <string.h>
#include <stdio.h>
#ifndef SOCK_TARGET_HOST #ifndef SOCK_TARGET_HOST
#define SOCK_TARGET_HOST "192.168.1.1" #define SOCK_TARGET_HOST "192.168.1.1"

View File

@ -110,7 +110,7 @@ echo_accept(void *arg, struct tcp_pcb *newpcb, err_t err)
/* commonly observed practive to call tcp_setprio(), why? */ /* commonly observed practive to call tcp_setprio(), why? */
tcp_setprio(newpcb, TCP_PRIO_MIN); 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) if (es != NULL)
{ {
es->state = ES_ACCEPTED; 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; err_t ret_err;
LWIP_ASSERT("arg != NULL",arg != NULL); LWIP_ASSERT("arg != NULL",arg != NULL);
es = arg; es = (struct echo_state *)arg;
if (p == NULL) if (p == NULL)
{ {
/* remote host closed connection */ /* remote host closed connection */
@ -222,7 +222,7 @@ echo_error(void *arg, err_t err)
LWIP_UNUSED_ARG(err); LWIP_UNUSED_ARG(err);
es = arg; es = (struct echo_state *)arg;
if (es != NULL) if (es != NULL)
{ {
mem_free(es); mem_free(es);
@ -235,7 +235,7 @@ echo_poll(void *arg, struct tcp_pcb *tpcb)
err_t ret_err; err_t ret_err;
struct echo_state *es; struct echo_state *es;
es = arg; es = (struct echo_state *)arg;
if (es != NULL) if (es != NULL)
{ {
if (es->p != NULL) if (es->p != NULL)
@ -270,7 +270,7 @@ echo_sent(void *arg, struct tcp_pcb *tpcb, u16_t len)
LWIP_UNUSED_ARG(len); LWIP_UNUSED_ARG(len);
es = arg; es = (struct echo_state *)arg;
es->retries = 0; es->retries = 0;
if(es->p != NULL) if(es->p != NULL)

View File

@ -64,7 +64,7 @@ udpecho_thread(void *arg)
netbuf_copy(buf, buffer, buf->p->tot_len); netbuf_copy(buf, buffer, buf->p->tot_len);
buffer[buf->p->tot_len] = '\0'; buffer[buf->p->tot_len] = '\0';
netconn_send(conn, buf); netconn_send(conn, buf);
printf("got %s\n", buffer); LWIP_DEBUGF(LWIP_DBG_ON, ("got %s\n", buffer));
netbuf_delete(buf); netbuf_delete(buf);
} }
} }