From fc002e4dc6a365551b5a665cf0baba03e53577ab Mon Sep 17 00:00:00 2001 From: Patrick Gaskin Date: Sun, 3 Jan 2021 04:07:05 -0500 Subject: [PATCH] win32: Fix duplicate definitions in arpa-inet.h, arpa-inet.c, and poll.h When _WIN32_WINNT >= 0x6000 (Vista), ws2tcpip.h provides inet_ntop and inet_pton, and winsock2.h provides the equivalent of poll.h. Part-of: --- src/pulsecore/arpa-inet.c | 2 +- src/pulsecore/arpa-inet.h | 6 +++++- src/pulsecore/poll.h | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pulsecore/arpa-inet.c b/src/pulsecore/arpa-inet.c index afea3971a..309009876 100644 --- a/src/pulsecore/arpa-inet.c +++ b/src/pulsecore/arpa-inet.c @@ -21,7 +21,7 @@ #include #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 diff --git a/src/pulsecore/arpa-inet.h b/src/pulsecore/arpa-inet.h index d940f704f..775c2269d 100644 --- a/src/pulsecore/arpa-inet.h +++ b/src/pulsecore/arpa-inet.h @@ -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 +#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 diff --git a/src/pulsecore/poll.h b/src/pulsecore/poll.h index 4af1b9946..af34506c5 100644 --- a/src/pulsecore/poll.h +++ b/src/pulsecore/poll.h @@ -24,6 +24,8 @@ #if defined(HAVE_POLL_H) #include +#elif OS_IS_WIN32 && HAVE_WINSOCK2_H && NTDDI_VERSION >= NTDDI_VISTA +#include #else /* Event types that can be polled for. These bits may be set in `events'