some more compiler warning fixes

This commit is contained in:
goldsimon 2015-04-23 08:44:44 +02:00
parent 0de0942f9c
commit f9965b4967
2 changed files with 33 additions and 34 deletions

View File

@ -499,28 +499,6 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
/* Prevent automatic window updates, we do this on our own! */
netconn_set_noautorecved(newconn, 1);
/* Note that POSIX only requires us to check addr is non-NULL. addrlen must
* not be NULL if addr is valid.
*/
if (addr != NULL) {
union sockaddr_aligned tempaddr;
/* get the IP address and port of the remote host */
err = netconn_peer(newconn, &naddr, &port);
if (err != ERR_OK) {
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
netconn_delete(newconn);
sock_set_errno(sock, err_to_errno(err));
return -1;
}
LWIP_ASSERT("addr valid but addrlen NULL", addrlen != NULL);
IPADDR_PORT_TO_SOCKADDR(&tempaddr, &naddr, port);
if (*addrlen > tempaddr.sa.sa_len) {
*addrlen = tempaddr.sa.sa_len;
}
MEMCPY(addr, &tempaddr, *addrlen);
}
newsock = alloc_socket(newconn, 1);
if (newsock == -1) {
netconn_delete(newconn);
@ -541,11 +519,32 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
newconn->socket = newsock;
SYS_ARCH_UNPROTECT(lev);
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d", s, newsock));
/* Note that POSIX only requires us to check addr is non-NULL. addrlen must
* not be NULL if addr is valid.
*/
if (addr != NULL) {
LWIP_DEBUGF(SOCKETS_DEBUG, (" addr="));
union sockaddr_aligned tempaddr;
/* get the IP address and port of the remote host */
err = netconn_peer(newconn, &naddr, &port);
if (err != ERR_OK) {
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
netconn_delete(newconn);
sock_set_errno(sock, err_to_errno(err));
return -1;
}
LWIP_ASSERT("addr valid but addrlen NULL", addrlen != NULL);
IPADDR_PORT_TO_SOCKADDR(&tempaddr, &naddr, port);
if (*addrlen > tempaddr.sa.sa_len) {
*addrlen = tempaddr.sa.sa_len;
}
MEMCPY(addr, &tempaddr, *addrlen);
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d addr=", s, newsock));
ip_addr_debug_print_val(SOCKETS_DEBUG, naddr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F"\n", port));
} else {
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d", s, newsock));
}
sock_set_errno(sock, 0);

View File

@ -123,6 +123,16 @@ PACK_STRUCT_END
#define ETHTYPE_PTP 0x88F7U /* Precision time protocol */
#define ETHTYPE_QINQ 0x9100U /* Q-in-Q, 802.1ad */
/** Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type)
* to a filter function that returns the correct netif when using multiple
* netifs on one hardware interface where the netif's low-level receive
* routine cannot decide for the correct netif (e.g. when mapping multiple
* IP addresses to one hardware interface).
*/
#ifndef LWIP_ARP_FILTER_NETIF
#define LWIP_ARP_FILTER_NETIF 0
#endif
#if LWIP_IPV4 && LWIP_ARP /* don't build if not configured for use in lwipopts.h */
#ifdef PACK_STRUCT_USE_INCLUDES
@ -174,16 +184,6 @@ PACK_STRUCT_END
#define ARP_REQUEST 1
#define ARP_REPLY 2
/** Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type)
* to a filter function that returns the correct netif when using multiple
* netifs on one hardware interface where the netif's low-level receive
* routine cannot decide for the correct netif (e.g. when mapping multiple
* IP addresses to one hardware interface).
*/
#ifndef LWIP_ARP_FILTER_NETIF
#define LWIP_ARP_FILTER_NETIF 0
#endif
#if ARP_QUEUEING
/** struct for queueing outgoing packets for unknown address
* defined here to be accessed by memp.h