From e0160596b1c3ca965f653aadf882dc3b9dc02477 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 20 Jun 2014 22:19:19 -0600 Subject: [PATCH] Windows: fix various libip build issues * Missing include ws2tcpip.h for IPv6 definitions * Alternative IN6_ARE_ADDR_EQUAL definition required * 'byte' is a reserved / system defined type on Windows, resolve variable shadowing by renaming to ipbyte. --- src/ip/Address.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ip/Address.cc b/src/ip/Address.cc index 3f7a72ea4c..ba3cff5a2c 100644 --- a/src/ip/Address.cc +++ b/src/ip/Address.cc @@ -21,6 +21,15 @@ /* for inet_ntoa() */ #include #endif +#if HAVE_WS2TCPIP_H +// Windows IPv6 definitions +#include +#endif + +// some OS (ie WIndows) define IN6_ADDR_EQUAL instead +#if !defined(IN6_ARE_ADDR_EQUAL) && _SQUID_WINDOWS_ +#define IN6_ARE_ADDR_EQUAL IN6_ADDR_EQUAL +#endif /* Debugging only. Dump the address content when a fatal assert is encountered. */ #define IASSERT(a,b) \ @@ -35,7 +44,7 @@ int Ip::Address::cidr() const { - uint8_t shift,byte; + uint8_t shift,ipbyte; uint8_t bit,caught; int len = 0; const uint8_t *ptr= mSocketAddr_.sin6_addr.s6_addr; @@ -52,20 +61,20 @@ Ip::Address::cidr() const } for (; shift