]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Windows: auto-detect InetNtopA and InetPtonA
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 13 Jan 2015 04:53:25 +0000 (20:53 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 13 Jan 2015 04:53:25 +0000 (20:53 -0800)
Also, add missing wrapper definition for inet_pton()

compat/os/mswindows.h
configure.ac

index 0f31a2d52a7215982361b790b485d105fd535a92..ab822ab92e6c19037f043302ce4d50c8be5b50ec 100644 (file)
@@ -624,10 +624,25 @@ getsockopt(int s, int l, int o, void * v, socklen_t * n)
 inline char *
 inet_ntop(int af, const void *src, char *dst, size_t size)
 {
+#if HAVE_DECL_INETNTOPA
     return (char*)InetNtopA(af, const_cast<void*>(src), dst, size);
+#else
+    return xinet_ntop(af, src, dst, size);
+#endif
 }
 #define inet_ntop(a,s,d,l) Squid::inet_ntop(a,s,d,l)
 
+inline char *
+inet_pton(int af, const void *src, char *dst)
+{
+#if HAVE_DECL_INETPTONA
+    return (char*)InetPtonA(af, const_cast<void*>(src), dst);
+#else
+    return xinet_pton(af, src, dst);
+#endif
+}
+#define inet_pton(a,s,d) Squid::inet_pton(a,s,d)
+
 /* Simple ioctl() emulation */
 inline int
 ioctl(int s, int c, void * a)
index 491c12bf0269a0b0b4ba0b90ab6f3a3736232d08..ced38829531d482fd59983e63a2422663fc17622 100644 (file)
@@ -3375,7 +3375,7 @@ AC_REPLACE_FUNCS(\
        tempnam \
 )
 
-AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton],,,[
+AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton,InetNtopA,InetPtonA],,,[
 /*
  * BSD requires sys/types.h, sys/socket.h, netinet/in.h, netdb.h, arpa/inet.h
  * Linux requires sys/types.h, sys/socket.h, arpa/inet.h