From 4f9bcc5ecc431d7a4d7b09bbe2f72df60a02c943 Mon Sep 17 00:00:00 2001 From: sg Date: Thu, 17 Sep 2015 22:00:16 +0200 Subject: [PATCH] fixed compiler warnings reported by mingw-64 --- src/api/netdb.c | 4 ++-- src/api/sockets.c | 4 ++-- src/core/dns.c | 2 +- src/core/netif.c | 4 +++- src/include/lwip/ip_addr.h | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/api/netdb.c b/src/api/netdb.c index fd0a1497..55a18b96 100644 --- a/src/api/netdb.c +++ b/src/api/netdb.c @@ -118,11 +118,11 @@ lwip_gethostbyname(const char *name) #if DNS_DEBUG /* dump hostent */ LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_name == %s\n", s_hostent.h_name)); - LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_aliases == %p\n", s_hostent.h_aliases)); + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_aliases == %p\n", (void*)s_hostent.h_aliases)); /* h_aliases are always empty */ LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addrtype == %d\n", s_hostent.h_addrtype)); LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_length == %d\n", s_hostent.h_length)); - LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list == %p\n", s_hostent.h_addr_list)); + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list == %p\n", (void*)s_hostent.h_addr_list)); if (s_hostent.h_addr_list != NULL) { u8_t idx; for (idx=0; s_hostent.h_addr_list[idx]; idx++) { diff --git a/src/api/sockets.c b/src/api/sockets.c index 63a1d549..f1187f22 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -171,14 +171,14 @@ static void sockaddr_to_ipaddr_port(const struct sockaddr* sockaddr, ip_addr_t* #if LWIP_SO_SNDRCVTIMEO_NONSTANDARD #define LWIP_SO_SNDRCVTIMEO_OPTTYPE int #define LWIP_SO_SNDRCVTIMEO_SET(optval, val) (*(int *)(optval) = (val)) -#define LWIP_SO_SNDRCVTIMEO_GET_MS(optval) ((s32_t)*(int*)(optval)) +#define LWIP_SO_SNDRCVTIMEO_GET_MS(optval) ((s32_t)*(const int*)(optval)) #else #define LWIP_SO_SNDRCVTIMEO_OPTTYPE struct timeval #define LWIP_SO_SNDRCVTIMEO_SET(optval, val) do { \ s32_t loc = (val); \ ((struct timeval *)(optval))->tv_sec = (loc) / 1000U; \ ((struct timeval *)(optval))->tv_usec = ((loc) % 1000U) * 1000U; }while(0) -#define LWIP_SO_SNDRCVTIMEO_GET_MS(optval) ((((struct timeval *)(optval))->tv_sec * 1000U) + (((struct timeval *)(optval))->tv_usec / 1000U)) +#define LWIP_SO_SNDRCVTIMEO_GET_MS(optval) ((((const struct timeval *)(optval))->tv_sec * 1000U) + (((const struct timeval *)(optval))->tv_usec / 1000U)) #endif #define NUM_SOCKETS MEMP_NUM_NETCONN diff --git a/src/core/dns.c b/src/core/dns.c index ef02cbad..484392a7 100644 --- a/src/core/dns.c +++ b/src/core/dns.c @@ -524,7 +524,7 @@ dns_lookup_local(const char *hostname, ip_addr_t *addr LWIP_DNS_ADDRTYPE_ARG(u8_ entry = entry->next; } #else /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ - int i; + size_t i; for (i = 0; i < sizeof(local_hostlist_static) / sizeof(struct local_hostlist_entry); i++) { if ((LWIP_DNS_STRICMP(local_hostlist_static[i].name, hostname) == 0) && LWIP_DNS_ADDRTYPE_MATCH_IP(dns_addrtype, local_hostlist_static[i].addr)) { diff --git a/src/core/netif.c b/src/core/netif.c index 4b9f00a6..fff58937 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -772,6 +772,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p) return ERR_OK; } +#if LWIP_HAVE_LOOPIF #if LWIP_IPV4 static err_t netif_loop_output_ipv4(struct netif *netif, struct pbuf *p, const ip4_addr_t* addr) @@ -788,7 +789,8 @@ netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const ip6_addr_t* ad LWIP_UNUSED_ARG(addr); return netif_loop_output(netif, p); } -#endif +#endif /* LWIP_IPV6 */ +#endif /* LWIP_HAVE_LOOPIF */ /** diff --git a/src/include/lwip/ip_addr.h b/src/include/lwip/ip_addr.h index c7bdda36..d86926b3 100644 --- a/src/include/lwip/ip_addr.h +++ b/src/include/lwip/ip_addr.h @@ -141,7 +141,7 @@ static const ip4_addr_t* ip_2_ip4_c(const ip_addr_t *ipaddr) ip4_addr_isany_val(*ip_2_ip4(&(ipaddr)))) #define ip_addr_isbroadcast(ipaddr, netif) ((IP_IS_V6(ipaddr)) ? \ 0 : \ - ip4_addr_isbroadcast(ip_2_ip4(ipaddr), netif)) + ip4_addr_isbroadcast(ip_2_ip4_c(ipaddr), netif)) #define ip_addr_ismulticast(ipaddr) ((IP_IS_V6(ipaddr)) ? \ ip6_addr_ismulticast(ip_2_ip6_c(ipaddr)) : \ ip4_addr_ismulticast(ip_2_ip4_c(ipaddr)))