aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ares/config-win32.h5
-rw-r--r--ares/setup.h4
-rw-r--r--ares/setup_once.h18
-rw-r--r--lib/config-win32.h5
-rw-r--r--lib/config-win32ce.h5
-rw-r--r--lib/setup_once.h18
-rw-r--r--src/config-win32.h5
7 files changed, 36 insertions, 24 deletions
diff --git a/ares/config-win32.h b/ares/config-win32.h
index a44563204..94ffe5389 100644
--- a/ares/config-win32.h
+++ b/ares/config-win32.h
@@ -146,11 +146,6 @@
#define ssize_t int
#endif
-/* Define to 'int' if socklen_t is not an available 'typedefed' type */
-#ifndef HAVE_WS2TCPIP_H
-#define socklen_t int
-#endif
-
/* ---------------------------------------------------------------- */
/* STRUCT RELATED */
/* ---------------------------------------------------------------- */
diff --git a/ares/setup.h b/ares/setup.h
index a20b8f1b7..29e5d0f1f 100644
--- a/ares/setup.h
+++ b/ares/setup.h
@@ -97,10 +97,6 @@
#define ssize_t int
#endif
-#ifndef HAVE_WS2TCPIP_H
-#define socklen_t int
-#endif
-
#endif /* HAVE_CONFIG_H */
/*
diff --git a/ares/setup_once.h b/ares/setup_once.h
index d9b0f86ea..20969d448 100644
--- a/ares/setup_once.h
+++ b/ares/setup_once.h
@@ -91,6 +91,24 @@ struct timeval {
#endif
+/*
+ * Windows build targets have socklen_t definition in
+ * ws2tcpip.h but some versions of ws2tcpip.h do not
+ * have the definition. It seems that when the socklen_t
+ * definition is missing from ws2tcpip.h the definition
+ * for INET_ADDRSTRLEN is also missing, and that when one
+ * definition is present the other one also is available.
+ */
+
+#if defined(WIN32) && !defined(HAVE_SOCKLEN_T)
+# if ( defined(_MSC_VER) && !defined(INET_ADDRSTRLEN) ) || \
+ (!defined(_MSC_VER) && !defined(HAVE_WS2TCPIP_H) )
+# define socklen_t int
+# define HAVE_SOCKLEN_T
+# endif
+#endif
+
+
#if defined(__minix)
/* Minix doesn't support recv on TCP sockets */
#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
diff --git a/lib/config-win32.h b/lib/config-win32.h
index 0bc736431..6102f9386 100644
--- a/lib/config-win32.h
+++ b/lib/config-win32.h
@@ -290,11 +290,6 @@
#define _SSIZE_T_DEFINED
#endif
-/* Define to 'int' if socklen_t is not an available 'typedefed' type */
-#if defined(_MSC_VER) && (_MSC_VER <= 1400)
-#define socklen_t int
-#endif
-
/* ---------------------------------------------------------------- */
/* TYPE SIZES */
/* ---------------------------------------------------------------- */
diff --git a/lib/config-win32ce.h b/lib/config-win32ce.h
index e7d157202..4d4016079 100644
--- a/lib/config-win32ce.h
+++ b/lib/config-win32ce.h
@@ -273,11 +273,6 @@
#define ssize_t int
#endif
-/* Define to 'int' if socklen_t is not an available 'typedefed' type */
-#ifndef HAVE_WS2TCPIP_H
-#define socklen_t int
-#endif
-
/* ---------------------------------------------------------------- */
/* TYPE SIZES */
/* ---------------------------------------------------------------- */
diff --git a/lib/setup_once.h b/lib/setup_once.h
index ba564120a..83ee95cf4 100644
--- a/lib/setup_once.h
+++ b/lib/setup_once.h
@@ -98,6 +98,24 @@ struct timeval {
#endif
+/*
+ * Windows build targets have socklen_t definition in
+ * ws2tcpip.h but some versions of ws2tcpip.h do not
+ * have the definition. It seems that when the socklen_t
+ * definition is missing from ws2tcpip.h the definition
+ * for INET_ADDRSTRLEN is also missing, and that when one
+ * definition is present the other one also is available.
+ */
+
+#if defined(WIN32) && !defined(HAVE_SOCKLEN_T)
+# if ( defined(_MSC_VER) && !defined(INET_ADDRSTRLEN) ) || \
+ (!defined(_MSC_VER) && !defined(HAVE_WS2TCPIP_H) )
+# define socklen_t int
+# define HAVE_SOCKLEN_T
+# endif
+#endif
+
+
#if defined(__minix)
/* Minix doesn't support recv on TCP sockets */
#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
diff --git a/src/config-win32.h b/src/config-win32.h
index 388497078..f3fb6201c 100644
--- a/src/config-win32.h
+++ b/src/config-win32.h
@@ -149,11 +149,6 @@
#define ssize_t int
#endif
-/* Define to 'int' if socklen_t is not an available 'typedefed' type */
-#ifndef HAVE_WS2TCPIP_H
-#define socklen_t int
-#endif
-
/* ---------------------------------------------------------------- */
/* STRUCT RELATED */
/* ---------------------------------------------------------------- */