diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 444f83a9..f5a16e8f 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -71,7 +71,7 @@ netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto, struct netconn *conn; struct api_msg msg; - conn = netconn_alloc_with_proto_and_callback(t, proto, callback); + conn = netconn_alloc(t, callback); if (conn != NULL ) { msg.function = do_newconn; msg.msg.msg.n.proto = proto; diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 0a48fd4d..4add74b9 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -338,7 +338,7 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err) /* We have to set the callback here even though * the new socket is unknown. conn->socket is marked as -1. */ - newconn = netconn_alloc_with_proto_and_callback(conn->type, 0, conn->callback); + newconn = netconn_alloc(conn->type, conn->callback); if (newconn == NULL) { return ERR_MEM; } @@ -446,7 +446,7 @@ do_newconn(struct api_msg_msg *msg) * NULL on memory error */ struct netconn* -netconn_alloc_with_proto_and_callback(enum netconn_type t, u8_t proto, +netconn_alloc(enum netconn_type t, void (*callback)(struct netconn *, enum netconn_evt, u16_t len)) { struct netconn *conn; @@ -469,7 +469,7 @@ netconn_alloc_with_proto_and_callback(enum netconn_type t, u8_t proto, memp_free(MEMP_NETCONN, conn); return NULL; } - conn->acceptmbox = SYS_MBOX_NULL; + conn->acceptmbox = SYS_MBOX_NULL; conn->state = NETCONN_NONE; /* initialize socket to -1 since 0 is a valid socket */ conn->socket = -1; diff --git a/src/api/netdb.c b/src/api/netdb.c index ea891a62..a0096f85 100644 --- a/src/api/netdb.c +++ b/src/api/netdb.c @@ -269,7 +269,7 @@ lwip_getaddrinfo(const char *nodename, const char *servname, err_t err; struct ip_addr addr; struct addrinfo *ai; - struct sockaddr_in *sa; + struct sockaddr_in *sa = NULL; int port_nr = 0; if (res == NULL) { diff --git a/src/core/dns.c b/src/core/dns.c index f1499950..34bd8dcf 100644 --- a/src/core/dns.c +++ b/src/core/dns.c @@ -563,7 +563,7 @@ dns_check_entries(void) * @params see udp.h */ static void -dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port) +dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port) { u8_t i; char *pHostname; @@ -578,6 +578,11 @@ dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16 u8_t* dns_payload; #endif /* (DNS_USES_STATIC_BUF == 2) */ + LWIP_UNUSED_ARG(arg); + LWIP_UNUSED_ARG(pcb); + LWIP_UNUSED_ARG(addr); + LWIP_UNUSED_ARG(port); + /* is the dns message too big ? */ if (p->tot_len > DNS_MSG_SIZE) { LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: pbuf too big\n")); @@ -627,7 +632,7 @@ dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16 #if DNS_DOES_NAME_CHECK /* Check if the name in the "question" part match with the name in the entry. */ - if (dns_compare_name(pEntry->name, (unsigned char *)dns_payload + sizeof(struct dns_hdr)) != 0) { + if (dns_compare_name((unsigned char *)(pEntry->name), (unsigned char *)dns_payload + sizeof(struct dns_hdr)) != 0) { LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": response not match to query\n", pEntry->name)); /* call callback to indicate error, clean up memory and return */ goto responseerr; @@ -709,7 +714,7 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg) { u8_t i; u8_t lseq, lseqi; - struct dns_table_entry *pEntry; + struct dns_table_entry *pEntry = NULL; /* search an unused entry, or the oldest one */ lseq = lseqi = 0; diff --git a/src/core/init.c b/src/core/init.c index ee073daf..5e0b522c 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -103,7 +103,7 @@ #if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12))) #error "If you want to use TCP, TCP_MAXRTX and TCP_SYNMAXRTX must less or equal to 12 (due to tcp_backoff table), so, you have to reduce them in your lwipopts.h" #endif -#if (LWIP_TCP && TCP_LISTEN_BACKLOG && (TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 255)) +#if (LWIP_TCP && TCP_LISTEN_BACKLOG && (TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xff)) #error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u8_t" #endif #if (LWIP_IGMP && (MEMP_NUM_IGMP_GROUP<=1)) diff --git a/src/core/mem.c b/src/core/mem.c index 61139e6e..68d3ab3d 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -12,7 +12,7 @@ * MEM_USE_CUSTOM_POOLS to 1 and create a file "lwippools.h" that includes a list * of pools like the this (more pools can be added between _START and _END): * - * /* Define three pools with sizes 256, 512, and 1512 bytes + * Define three pools with sizes 256, 512, and 1512 bytes * LWIP_MALLOC_MEMPOOL_START * LWIP_MALLOC_MEMPOOL(20, 256) * LWIP_MALLOC_MEMPOOL(10, 512) diff --git a/src/core/tcp.c b/src/core/tcp.c index dbaa8d4f..d8863323 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -347,6 +347,7 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog) { struct tcp_pcb_listen *lpcb; + LWIP_UNUSED_ARG(backlog); LWIP_ERROR("tcp_listen: pcb already connected", pcb->state == CLOSED, return NULL); /* already listening? */ diff --git a/src/include/lwip/api_msg.h b/src/include/lwip/api_msg.h index e755d735..1691a889 100644 --- a/src/include/lwip/api_msg.h +++ b/src/include/lwip/api_msg.h @@ -148,8 +148,8 @@ void do_join_leave_group( struct api_msg_msg *msg); void do_gethostbyname(void *arg); #endif /* LWIP_DNS */ -struct netconn* netconn_alloc_with_proto_and_callback( - enum netconn_type t, u8_t proto, +struct netconn* netconn_alloc( + enum netconn_type t, void (*callback)(struct netconn *, enum netconn_evt, u16_t len)); #ifdef __cplusplus