Windows build targets have socklen_t definition in ws2tcpip.h but some
authorYang Tse <yangsita@gmail.com>
Wed, 24 Oct 2007 14:39:07 +0000 (14:39 +0000)
committerYang Tse <yangsita@gmail.com>
Wed, 24 Oct 2007 14:39:07 +0000 (14:39 +0000)
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.

ares/config-win32.h
ares/setup.h
ares/setup_once.h
lib/config-win32.h
lib/config-win32ce.h
lib/setup_once.h
src/config-win32.h

index a445632..94ffe53 100644 (file)
 #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                          */
 /* ---------------------------------------------------------------- */
index a20b8f1..29e5d0f 100644 (file)
 #define ssize_t int
 #endif
 
-#ifndef HAVE_WS2TCPIP_H
-#define socklen_t int
-#endif
-
 #endif /* HAVE_CONFIG_H */
 
 /*
index d9b0f86..20969d4 100644 (file)
@@ -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), \
index 0bc7364..6102f93 100644 (file)
 #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                            */
 /* ---------------------------------------------------------------- */
index e7d1572..4d40160 100644 (file)
 #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                            */
 /* ---------------------------------------------------------------- */
index ba56412..83ee95c 100644 (file)
@@ -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), \
index 3884970..f3fb620 100644 (file)
 #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                          */
 /* ---------------------------------------------------------------- */