win32: Fix duplicate definitions in arpa-inet.h, arpa-inet.c, and poll.h
authorPatrick Gaskin <patrick@pgaskin.net>
Sun, 3 Jan 2021 09:07:05 +0000 (04:07 -0500)
committerPulseAudio Marge Bot <pulseaudio-maintainers@lists.freedesktop.org>
Wed, 13 Jan 2021 03:42:24 +0000 (03:42 +0000)
When _WIN32_WINNT >= 0x6000 (Vista), ws2tcpip.h provides inet_ntop and
inet_pton, and winsock2.h provides the equivalent of poll.h.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/458>

src/pulsecore/arpa-inet.c
src/pulsecore/arpa-inet.h
src/pulsecore/poll.h

index afea397..3090098 100644 (file)
@@ -21,7 +21,7 @@
 #include <config.h>
 #endif
 
-#if !defined(HAVE_ARPA_INET_H) && defined(OS_IS_WIN32)
+#if !defined(HAVE_ARPA_INET_H) && defined(OS_IS_WIN32) && NTDDI_VERSION < NTDDI_VISTA
 
 #include <errno.h>
 
index d940f70..775c226 100644 (file)
@@ -8,10 +8,12 @@
 #elif defined(OS_IS_WIN32)
 
 /* On Windows winsock2.h (here included via pulsecore/socket.h) provides most of the functionality of arpa/inet.h, except for
- * the inet_ntop and inet_pton functions, which are implemented here. */
+ * the inet_ntop and inet_pton functions, which are implemented here on versions earlier than Vista. */
 
 #include <pulsecore/socket.h>
 
+#if NTDDI_VERSION < NTDDI_VISTA
+
 const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
 
 int inet_pton(int af, const char *src, void *dst);
@@ -19,3 +21,5 @@ int inet_pton(int af, const char *src, void *dst);
 #endif
 
 #endif
+
+#endif
index 4af1b99..af34506 100644 (file)
@@ -24,6 +24,8 @@
 
 #if defined(HAVE_POLL_H)
 #include <poll.h>
+#elif OS_IS_WIN32 && HAVE_WINSOCK2_H && NTDDI_VERSION >= NTDDI_VISTA
+#include <winsock2.h>
 #else
 
 /* Event types that can be polled for.  These bits may be set in `events'