From e7eee1059daa2e1b007d5e8cd161bfcceb48076a Mon Sep 17 00:00:00 2001
From: Patrick Gaskin <patrick@pgaskin.net>
Date: Tue, 12 Jan 2021 23:46:48 -0500
Subject: [PATCH] pulseaudio: Update to
 freedesktop/pulseaudio@613b3ebc2ccc3a39b49d033850e39d760d22b5aa

Merged patches:
- win32: Fix duplicate definitions in arpa-inet.h, arpa-inet.c, and poll.h
- win32: Use __MINGW_PRINTF_FORMAT instead of __printf__ for MinGW builds
- win32: Fix format specifiers for DWORD values
- win32: Fix privlibdir for running on Windows
- waveout: Fix compile warnings
- win32: Fix WSAStartup issues
- cli: Fix crash when using .include with an empty directory
- client: Make auto_connect_localhost respect HAVE_IPv6 and OS_IS_WIN32
---
 src/Dockerfile                                |   2 +-
 ...e-auto-connect-localhost-by-default.patch} |   4 +-
 ...ate-definitions-in-arpa-inet.h-arpa-.patch |  73 ---------
 ...2-system.pa-Tweaks-for-custom-build.patch} |   4 +-
 ...W_PRINTF_FORMAT-instead-of-__printf_.patch |  30 ----
 ...x-format-specifiers-for-DWORD-values.patch |  71 ---------
 ...ix-privlibdir-for-running-on-Windows.patch |  28 ----
 .../0007-waveout-Fix-compile-warnings.patch   |  44 ------
 ...EADY-error-for-pacat-and-pactl-o.patch.old |  76 ---------
 .../0008-win32-Fix-WSAStartup-issues.patch    | 147 ------------------
 ...en-using-.include-with-an-empty-dire.patch |  75 ---------
 ..._connect_localhost-respect-HAVE_IPv6.patch |  28 ----
 12 files changed, 5 insertions(+), 577 deletions(-)
 rename src/pulseaudio/{0005-client-conf-Enable-auto-connect-localhost-by-default.patch => 0001-client-conf-Enable-auto-connect-localhost-by-default.patch} (96%)
 delete mode 100644 src/pulseaudio/0001-win32-Fix-duplicate-definitions-in-arpa-inet.h-arpa-.patch
 rename src/pulseaudio/{0006-system.pa-Tweaks-for-custom-build.patch => 0002-system.pa-Tweaks-for-custom-build.patch} (96%)
 delete mode 100644 src/pulseaudio/0002-win32-Use-__MINGW_PRINTF_FORMAT-instead-of-__printf_.patch
 delete mode 100644 src/pulseaudio/0003-win32-Fix-format-specifiers-for-DWORD-values.patch
 delete mode 100644 src/pulseaudio/0004-win32-Fix-privlibdir-for-running-on-Windows.patch
 delete mode 100644 src/pulseaudio/0007-waveout-Fix-compile-warnings.patch
 delete mode 100644 src/pulseaudio/0008-utils-Fix-WSASYSNOTREADY-error-for-pacat-and-pactl-o.patch.old
 delete mode 100644 src/pulseaudio/0008-win32-Fix-WSAStartup-issues.patch
 delete mode 100644 src/pulseaudio/0009-cli-Fix-crash-when-using-.include-with-an-empty-dire.patch
 delete mode 100644 src/pulseaudio/0010-client-Make-auto_connect_localhost-respect-HAVE_IPv6.patch

diff --git a/src/Dockerfile b/src/Dockerfile
index fb81079..96a66ef 100644
--- a/src/Dockerfile
+++ b/src/Dockerfile
@@ -89,7 +89,7 @@ RUN mkdir -p /src
 RUN git init /src/pulseaudio && \
     git -C /src/pulseaudio remote add origin https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git && \
     git -C /src/pulseaudio fetch origin && \
-    git -C /src/pulseaudio checkout 81ebd8ba3f644e95a7f858ede9fc65d340ab06e2
+    git -C /src/pulseaudio checkout 613b3ebc2ccc3a39b49d033850e39d760d22b5aa
 COPY ./pulseaudio/* /src/
 RUN git -C /src/pulseaudio apply /src/*.patch
 ARG PAW32_VERSION=unknown
diff --git a/src/pulseaudio/0005-client-conf-Enable-auto-connect-localhost-by-default.patch b/src/pulseaudio/0001-client-conf-Enable-auto-connect-localhost-by-default.patch
similarity index 96%
rename from src/pulseaudio/0005-client-conf-Enable-auto-connect-localhost-by-default.patch
rename to src/pulseaudio/0001-client-conf-Enable-auto-connect-localhost-by-default.patch
index 9d50d54..0741183 100644
--- a/src/pulseaudio/0005-client-conf-Enable-auto-connect-localhost-by-default.patch
+++ b/src/pulseaudio/0001-client-conf-Enable-auto-connect-localhost-by-default.patch
@@ -1,4 +1,4 @@
-From 6d266315f994b71657bf91393334b16accaf5275 Mon Sep 17 00:00:00 2001
+From 505137c7a410b268b5d8a7726f362b90171d63a2 Mon Sep 17 00:00:00 2001
 From: Patrick Gaskin <patrick@pgaskin.net>
 Date: Thu, 31 Dec 2020 06:38:28 -0500
 Subject: [PATCH] client-conf: Enable auto-connect-localhost by default
@@ -49,5 +49,5 @@ index 26b7790aa..ee85808d1 100644
 +; auto-connect-localhost = yes
  ; auto-connect-display = no
 -- 
-2.29.2
+2.30.0
 
diff --git a/src/pulseaudio/0001-win32-Fix-duplicate-definitions-in-arpa-inet.h-arpa-.patch b/src/pulseaudio/0001-win32-Fix-duplicate-definitions-in-arpa-inet.h-arpa-.patch
deleted file mode 100644
index 2ffd145..0000000
--- a/src/pulseaudio/0001-win32-Fix-duplicate-definitions-in-arpa-inet.h-arpa-.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 572f747ebad0a7d4caaedc4d68ac83e27ab2de0e Mon Sep 17 00:00:00 2001
-From: Patrick Gaskin <patrick@pgaskin.net>
-Date: Thu, 31 Dec 2020 05:03:09 -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.
----
- src/pulsecore/arpa-inet.c | 4 ++++
- src/pulsecore/arpa-inet.h | 6 +++++-
- src/pulsecore/poll.h      | 2 ++
- 3 files changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/src/pulsecore/arpa-inet.c b/src/pulsecore/arpa-inet.c
-index afea3971a..b177dcc5f 100644
---- a/src/pulsecore/arpa-inet.c
-+++ b/src/pulsecore/arpa-inet.c
-@@ -31,6 +31,8 @@
- 
- #include "arpa-inet.h"
- 
-+#if NTDDI_VERSION < NTDDI_VISTA
-+
- const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) {
-     struct in_addr *in = (struct in_addr*)src;
- #ifdef HAVE_IPV6
-@@ -104,3 +106,5 @@ int inet_pton(int af, const char *src, void *dst) {
- }
- 
- #endif
-+
-+#endif
-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 <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
-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 <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'
--- 
-2.29.2
-
diff --git a/src/pulseaudio/0006-system.pa-Tweaks-for-custom-build.patch b/src/pulseaudio/0002-system.pa-Tweaks-for-custom-build.patch
similarity index 96%
rename from src/pulseaudio/0006-system.pa-Tweaks-for-custom-build.patch
rename to src/pulseaudio/0002-system.pa-Tweaks-for-custom-build.patch
index b4b256d..e180b17 100644
--- a/src/pulseaudio/0006-system.pa-Tweaks-for-custom-build.patch
+++ b/src/pulseaudio/0002-system.pa-Tweaks-for-custom-build.patch
@@ -1,4 +1,4 @@
-From 458090d3320859fe671bbf0413294d681087149e Mon Sep 17 00:00:00 2001
+From 368a54413e161209f130eb6c48c15e76cd984808 Mon Sep 17 00:00:00 2001
 From: Patrick Gaskin <patrick@pgaskin.net>
 Date: Thu, 31 Dec 2020 20:43:42 -0500
 Subject: [PATCH] system.pa: Tweaks for custom build
@@ -52,5 +52,5 @@ index 1470e2368..91d0a814a 100755
  ### Automatically restore the default sink/source when changed by the user
  ### during runtime
 -- 
-2.29.2
+2.30.0
 
diff --git a/src/pulseaudio/0002-win32-Use-__MINGW_PRINTF_FORMAT-instead-of-__printf_.patch b/src/pulseaudio/0002-win32-Use-__MINGW_PRINTF_FORMAT-instead-of-__printf_.patch
deleted file mode 100644
index 843bba6..0000000
--- a/src/pulseaudio/0002-win32-Use-__MINGW_PRINTF_FORMAT-instead-of-__printf_.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From f9832072ca8096060fe39ded8aca13a8bc64de16 Mon Sep 17 00:00:00 2001
-From: Patrick Gaskin <patrick@pgaskin.net>
-Date: Thu, 31 Dec 2020 05:24:30 -0500
-Subject: [PATCH] win32: Use __MINGW_PRINTF_FORMAT instead of __printf__ for
- MinGW builds
-
----
- src/pulse/gccmacro.h | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/src/pulse/gccmacro.h b/src/pulse/gccmacro.h
-index 81729dbba..4a0fff5f4 100644
---- a/src/pulse/gccmacro.h
-+++ b/src/pulse/gccmacro.h
-@@ -25,10 +25,8 @@
- 
- #if defined(__GNUC__)
- #ifdef __MINGW32__
--/* libintl overrides printf with a #define. As this breaks this attribute,
-- * it has a workaround. However the workaround isn't enabled for MINGW
-- * builds (only cygwin) */
--#define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (__printf__, a, b)))
-+#include <stdio.h>
-+#define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (__MINGW_PRINTF_FORMAT, a, b)))
- #else
- #define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
- #endif
--- 
-2.29.2
-
diff --git a/src/pulseaudio/0003-win32-Fix-format-specifiers-for-DWORD-values.patch b/src/pulseaudio/0003-win32-Fix-format-specifiers-for-DWORD-values.patch
deleted file mode 100644
index 8449a59..0000000
--- a/src/pulseaudio/0003-win32-Fix-format-specifiers-for-DWORD-values.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 8eb996eb319093af4834145dcff1297522dccd7b Mon Sep 17 00:00:00 2001
-From: Patrick Gaskin <patrick@pgaskin.net>
-Date: Thu, 31 Dec 2020 05:33:19 -0500
-Subject: [PATCH] win32: Fix format specifiers for DWORD values
-
----
- src/pulse/util.c            | 2 +-
- src/pulsecore/conf-parser.c | 2 +-
- src/pulsecore/core-util.c   | 6 +++---
- 3 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/src/pulse/util.c b/src/pulse/util.c
-index 2be389b22..0b30abaf4 100644
---- a/src/pulse/util.c
-+++ b/src/pulse/util.c
-@@ -510,7 +510,7 @@ int pa_thread_make_realtime(int rtprio) {
-         return 0;
-     }
- 
--    pa_log_warn("SetThreadPriority() failed: 0x%08X", GetLastError());
-+    pa_log_warn("SetThreadPriority() failed: 0x%08lX", GetLastError());
-     errno = EPERM;
- #else
-     errno = ENOTSUP;
-diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
-index 73b7061f4..7707904d2 100644
---- a/src/pulsecore/conf-parser.c
-+++ b/src/pulsecore/conf-parser.c
-@@ -251,7 +251,7 @@ finish:
-                     LocalFree(msgbuf);
-                 } else {
-                     pa_log_warn("FindFirstFile(%s) failed with error %ld, ignoring.", pattern, err);
--                    pa_log_warn("FormatMessage failed with error %ld", GetLastError());
-+                    pa_log_warn("FormatMessage failed with error %lu", GetLastError());
-                 }
-             }
-         }
-diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
-index 1c9746dbf..24736e830 100644
---- a/src/pulsecore/core-util.c
-+++ b/src/pulsecore/core-util.c
-@@ -759,7 +759,7 @@ int pa_raise_priority(int nice_level) {
- #ifdef OS_IS_WIN32
-     if (nice_level < 0) {
-         if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS)) {
--            pa_log_warn("SetPriorityClass() failed: 0x%08X", GetLastError());
-+            pa_log_warn("SetPriorityClass() failed: 0x%08lX", GetLastError());
-             errno = EPERM;
-             return -1;
-         }
-@@ -1325,7 +1325,7 @@ int pa_lock_fd(int fd, int b) {
-     if (!b && UnlockFile(h, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF))
-         return 0;
- 
--    pa_log("%slock failed: 0x%08X", !b ? "un" : "", GetLastError());
-+    pa_log("%slock failed: 0x%08lX", !b ? "un" : "", GetLastError());
- 
-     /* FIXME: Needs to set errno! */
- #endif
-@@ -3256,7 +3256,7 @@ char *pa_uname_string(void) {
-     i.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-     pa_assert_se(GetVersionEx(&i));
- 
--    return pa_sprintf_malloc("Windows %d.%d (%d) %s", i.dwMajorVersion, i.dwMinorVersion, i.dwBuildNumber, i.szCSDVersion);
-+    return pa_sprintf_malloc("Windows %lu.%lu (%lu) %s", i.dwMajorVersion, i.dwMinorVersion, i.dwBuildNumber, i.szCSDVersion);
- #endif
- }
- 
--- 
-2.29.2
-
diff --git a/src/pulseaudio/0004-win32-Fix-privlibdir-for-running-on-Windows.patch b/src/pulseaudio/0004-win32-Fix-privlibdir-for-running-on-Windows.patch
deleted file mode 100644
index 4792354..0000000
--- a/src/pulseaudio/0004-win32-Fix-privlibdir-for-running-on-Windows.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 79f21cd712f976ca202cd3ce8eca329213d174a0 Mon Sep 17 00:00:00 2001
-From: Patrick Gaskin <patrick@pgaskin.net>
-Date: Thu, 31 Dec 2020 06:13:06 -0500
-Subject: [PATCH] win32: Fix privlibdir for running on Windows
-
----
- meson.build | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/meson.build b/meson.build
-index cd617c602..888692e80 100644
---- a/meson.build
-+++ b/meson.build
-@@ -67,6 +67,11 @@ localstatedir = join_paths(prefix, get_option('localstatedir'))
- sysconfdir = join_paths(prefix, get_option('sysconfdir'))
- privlibdir = join_paths(libdir, 'pulseaudio')
- 
-+if host_machine.system() == 'windows'
-+  # Windows only supports loading libraries from the same dir as the executable
-+  privlibdir = bindir
-+endif
-+
- alsadatadir = get_option('alsadatadir')
- if alsadatadir == ''
-   alsadatadir = join_paths(datadir, 'pulseaudio', 'alsa-mixer')
--- 
-2.29.2
-
diff --git a/src/pulseaudio/0007-waveout-Fix-compile-warnings.patch b/src/pulseaudio/0007-waveout-Fix-compile-warnings.patch
deleted file mode 100644
index ffec4a3..0000000
--- a/src/pulseaudio/0007-waveout-Fix-compile-warnings.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 0f29f481972d9dc2087279b34df945743cf4df0a Mon Sep 17 00:00:00 2001
-From: Patrick Gaskin <patrick@pgaskin.net>
-Date: Thu, 31 Dec 2020 22:06:03 -0500
-Subject: [PATCH] waveout: Fix compile warnings
-
-* Include pulse/util.h for pa_thread_make_realtime.
-* Explicitly cast HWAVEOUT to UINT_PTR for waveOutGetDevCaps.
----
- src/modules/module-waveout.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/src/modules/module-waveout.c b/src/modules/module-waveout.c
-index f7ffdf754..5bde6a9cb 100644
---- a/src/modules/module-waveout.c
-+++ b/src/modules/module-waveout.c
-@@ -28,6 +28,7 @@
- 
- #include <pulse/xmalloc.h>
- #include <pulse/timeval.h>
-+#include <pulse/util.h>
- 
- #include <pulsecore/sink.h>
- #include <pulsecore/source.h>
-@@ -412,7 +413,7 @@ static void sink_get_volume_cb(pa_sink *s) {
-     DWORD vol;
-     pa_volume_t left, right;
- 
--    if (waveOutGetDevCaps(u->hwo, &caps, sizeof(caps)) != MMSYSERR_NOERROR)
-+    if (waveOutGetDevCaps((UINT_PTR) u->hwo, &caps, sizeof(caps)) != MMSYSERR_NOERROR)
-         return;
-     if (!(caps.dwSupport & WAVECAPS_VOLUME))
-         return;
-@@ -440,7 +441,7 @@ static void sink_set_volume_cb(pa_sink *s) {
-     WAVEOUTCAPS caps;
-     DWORD vol;
- 
--    if (waveOutGetDevCaps(u->hwo, &caps, sizeof(caps)) != MMSYSERR_NOERROR)
-+    if (waveOutGetDevCaps((UINT_PTR) u->hwo, &caps, sizeof(caps)) != MMSYSERR_NOERROR)
-         return;
-     if (!(caps.dwSupport & WAVECAPS_VOLUME))
-         return;
--- 
-2.29.2
-
diff --git a/src/pulseaudio/0008-utils-Fix-WSASYSNOTREADY-error-for-pacat-and-pactl-o.patch.old b/src/pulseaudio/0008-utils-Fix-WSASYSNOTREADY-error-for-pacat-and-pactl-o.patch.old
deleted file mode 100644
index 41fc9ec..0000000
--- a/src/pulseaudio/0008-utils-Fix-WSASYSNOTREADY-error-for-pacat-and-pactl-o.patch.old
+++ /dev/null
@@ -1,76 +0,0 @@
-From 0e96f3f0a06e5daf126baeb345d23dad3198efc6 Mon Sep 17 00:00:00 2001
-From: Patrick Gaskin <patrick@pgaskin.net>
-Date: Fri, 1 Jan 2021 09:36:18 -0500
-Subject: [PATCH] utils: Fix WSASYSNOTREADY error for pacat and pactl on win32
-
-TODO: It works, but is this a proper fix? I need to look at the
-WSAStartup in pulsecore/dllmain.c and figure out why it's there. I'll
-also need to see if pipes are used anywhere else on win32 other than
-the mainloop on win32.
----
- src/utils/meson.build | 4 ++--
- src/utils/pacat.c     | 7 +++++++
- src/utils/pactl.c     | 7 +++++++
- 3 files changed, 16 insertions(+), 2 deletions(-)
-
-diff --git a/src/utils/meson.build b/src/utils/meson.build
-index f40eaff95..f57f39e39 100644
---- a/src/utils/meson.build
-+++ b/src/utils/meson.build
-@@ -15,7 +15,7 @@ executable('pacat',
-   install_rpath : privlibdir,
-   include_directories : [configinc, topinc],
-   link_with : [libpulsecommon, libpulse],
--  dependencies : [sndfile_dep, libintl_dep],
-+  dependencies : [sndfile_dep, libintl_dep, platform_socket_dep],
-   c_args : pa_c_args,
- )
- 
-@@ -38,7 +38,7 @@ executable('pactl',
-   install_rpath : privlibdir,
-   include_directories : [configinc, topinc],
-   link_with : [libpulsecommon, libpulse],
--  dependencies : [sndfile_dep, libintl_dep],
-+  dependencies : [sndfile_dep, libintl_dep, platform_socket_dep],
-   c_args : pa_c_args,
- )
- 
-diff --git a/src/utils/pacat.c b/src/utils/pacat.c
-index 4d2ecf717..d5bb13d0f 100644
---- a/src/utils/pacat.c
-+++ b/src/utils/pacat.c
-@@ -785,6 +785,13 @@ int main(int argc, char *argv[]) {
-     bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
- #endif
- 
-+#ifdef OS_IS_WIN32
-+    {
-+        WSADATA data;
-+        WSAStartup(MAKEWORD(2, 0), &data);
-+    }
-+#endif
-+
-     bn = pa_path_get_filename(argv[0]);
- 
-     if (strstr(bn, "play")) {
-diff --git a/src/utils/pactl.c b/src/utils/pactl.c
-index bc1c5265a..84e2c74e0 100644
---- a/src/utils/pactl.c
-+++ b/src/utils/pactl.c
-@@ -1740,6 +1740,13 @@ int main(int argc, char *argv[]) {
-     bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
- #endif
- 
-+#ifdef OS_IS_WIN32
-+    {
-+        WSADATA data;
-+        WSAStartup(MAKEWORD(2, 0), &data);
-+    }
-+#endif
-+
-     bn = pa_path_get_filename(argv[0]);
- 
-     proplist = pa_proplist_new();
--- 
-2.29.2
-
diff --git a/src/pulseaudio/0008-win32-Fix-WSAStartup-issues.patch b/src/pulseaudio/0008-win32-Fix-WSAStartup-issues.patch
deleted file mode 100644
index 4572d27..0000000
--- a/src/pulseaudio/0008-win32-Fix-WSAStartup-issues.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From ccd7100bad6d699b6fdf8e70edbe58e90c71927b Mon Sep 17 00:00:00 2001
-From: Patrick Gaskin <patrick@pgaskin.net>
-Date: Fri, 1 Jan 2021 10:06:44 -0500
-Subject: [PATCH] win32: Fix WSAStartup issues
-
-WSAStartup was not being called for pacat and pactl built with meson,
-causing them to fail in pa_mainloop_new with "cannot create wakeup
-pipe". This issue also affects other applications linking to libpulse
-other than the pulseaudio daemon, which calls WSAStartup itself.
-
-When built with autotools, WSAStartup would have been called in
-DllMain, which is recommended against by the documentation [1].
-
-To fix these issues, the WSAStartup/WSACleanup calls can be moved
-into pa_mainloop_new/pa_mainloop_free.
-
-[1] https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsastartup
----
- src/Makefile.am         |  4 ----
- src/pulse/mainloop.c    | 21 ++++++++++++++++
- src/pulsecore/dllmain.c | 53 -----------------------------------------
- 3 files changed, 21 insertions(+), 57 deletions(-)
- delete mode 100644 src/pulsecore/dllmain.c
-
-diff --git a/src/Makefile.am b/src/Makefile.am
-index 97c9dce9f..7fb328ac0 100644
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -842,10 +842,6 @@ libpulsecommon_@PA_MAJORMINOR@_la_CFLAGS += $(LIBASYNCNS_CFLAGS)
- libpulsecommon_@PA_MAJORMINOR@_la_LIBADD += $(LIBASYNCNS_LIBS)
- endif
- 
--if OS_IS_WIN32
--libpulsecommon_@PA_MAJORMINOR@_la_SOURCES += pulsecore/dllmain.c
--endif
--
- if HAVE_DBUS
- libpulsecommon_@PA_MAJORMINOR@_la_SOURCES += \
- 		pulsecore/dbus-util.c pulsecore/dbus-util.h \
-diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
-index 355935e09..90112f589 100644
---- a/src/pulse/mainloop.c
-+++ b/src/pulse/mainloop.c
-@@ -32,6 +32,10 @@
- #include <pulsecore/pipe.h>
- #endif
- 
-+#ifdef OS_IS_WIN32
-+#include <winsock2.h>
-+#endif
-+
- #include <pulse/rtclock.h>
- #include <pulse/timeval.h>
- #include <pulse/xmalloc.h>
-@@ -450,6 +454,17 @@ static const pa_mainloop_api vtable = {
- pa_mainloop *pa_mainloop_new(void) {
-     pa_mainloop *m;
- 
-+#ifdef OS_IS_WIN32
-+    {
-+        int r;
-+        WSADATA data;
-+        if ((r = WSAStartup(MAKEWORD(2, 0), &data))) {
-+            pa_log_error("ERROR: cannot initialize Winsock2 (%d)", r);
-+            return NULL;
-+        }
-+    }
-+#endif
-+
-     pa_init_i18n();
- 
-     m = pa_xnew0(pa_mainloop, 1);
-@@ -579,6 +594,12 @@ void pa_mainloop_free(pa_mainloop *m) {
-     pa_close_pipe(m->wakeup_pipe);
- 
-     pa_xfree(m);
-+
-+#ifdef OS_IS_WIN32
-+    {
-+        WSACleanup();
-+    }
-+#endif
- }
- 
- static void scan_dead(pa_mainloop *m) {
-diff --git a/src/pulsecore/dllmain.c b/src/pulsecore/dllmain.c
-deleted file mode 100644
-index e594ae5ac..000000000
---- a/src/pulsecore/dllmain.c
-+++ /dev/null
-@@ -1,53 +0,0 @@
--/***
--  This file is part of PulseAudio.
--
--  Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
--
--  PulseAudio is free software; you can redistribute it and/or modify
--  it under the terms of the GNU Lesser General Public License as published
--  by the Free Software Foundation; either version 2.1 of the License,
--  or (at your option) any later version.
--
--  PulseAudio is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--  General Public License for more details.
--
--  You should have received a copy of the GNU Lesser General Public License
--  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
--***/
--
--#ifdef HAVE_CONFIG_H
--#include <config.h>
--#endif
--
--#ifdef OS_IS_WIN32
--
--#include <stdlib.h>
--#include <stdio.h>
--
--#include <windows.h>
--#include <winsock2.h>
--
--extern char *pa_win32_get_toplevel(HANDLE handle);
--
--BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
--    WSADATA data;
--
--    switch (fdwReason) {
--
--    case DLL_PROCESS_ATTACH:
--        if (!pa_win32_get_toplevel(hinstDLL))
--            return FALSE;
--        WSAStartup(MAKEWORD(2, 0), &data);
--        break;
--
--    case DLL_PROCESS_DETACH:
--        WSACleanup();
--        break;
--
--    }
--    return TRUE;
--}
--
--#endif /* OS_IS_WIN32 */
--- 
-2.29.2
-
diff --git a/src/pulseaudio/0009-cli-Fix-crash-when-using-.include-with-an-empty-dire.patch b/src/pulseaudio/0009-cli-Fix-crash-when-using-.include-with-an-empty-dire.patch
deleted file mode 100644
index 301daed..0000000
--- a/src/pulseaudio/0009-cli-Fix-crash-when-using-.include-with-an-empty-dire.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 5e02eaa8a34bab85ce694535eae050f4858b5f40 Mon Sep 17 00:00:00 2001
-From: Patrick Gaskin <patrick@pgaskin.net>
-Date: Sat, 2 Jan 2021 14:04:42 -0500
-Subject: [PATCH] cli: Fix crash when using .include with an empty directory
-
-This would previously fail the size > 0 assertion in pa_xmalloc.
----
- src/pulsecore/cli-command.c | 46 ++++++++++++++++++-------------------
- 1 file changed, 23 insertions(+), 23 deletions(-)
-
-diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
-index c5a21ed93..5dc2ac6b9 100644
---- a/src/pulsecore/cli-command.c
-+++ b/src/pulsecore/cli-command.c
-@@ -2118,34 +2118,34 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b
-                             }
- 
-                             closedir(d);
--
--                            count = pa_dynarray_size(files);
--                            sorted_files = pa_xnew(char*, count);
--                            for (i = 0; i < count; ++i)
--                                sorted_files[i] = pa_dynarray_get(files, i);
--                            pa_dynarray_free(files);
--
--                            for (i = 0; i < count; ++i) {
--                                for (unsigned j = 0; j < count; ++j) {
--                                    if (strcmp(sorted_files[i], sorted_files[j]) < 0) {
--                                        char *tmp = sorted_files[i];
--                                        sorted_files[i] = sorted_files[j];
--                                        sorted_files[j] = tmp;
-+                            if ((count = pa_dynarray_size(files))) {
-+                                sorted_files = pa_xnew(char*, count);
-+                                for (i = 0; i < count; ++i)
-+                                    sorted_files[i] = pa_dynarray_get(files, i);
-+                                pa_dynarray_free(files);
-+
-+                                for (i = 0; i < count; ++i) {
-+                                    for (unsigned j = 0; j < count; ++j) {
-+                                        if (strcmp(sorted_files[i], sorted_files[j]) < 0) {
-+                                            char *tmp = sorted_files[i];
-+                                            sorted_files[i] = sorted_files[j];
-+                                            sorted_files[j] = tmp;
-+                                        }
-                                     }
-                                 }
--                            }
- 
--                            for (i = 0; i < count; ++i) {
--                                if (!failed) {
--                                    if (pa_cli_command_execute_file(c, sorted_files[i], buf, fail) < 0 && *fail)
--                                        failed = true;
--                                }
-+                                for (i = 0; i < count; ++i) {
-+                                    if (!failed) {
-+                                        if (pa_cli_command_execute_file(c, sorted_files[i], buf, fail) < 0 && *fail)
-+                                            failed = true;
-+                                    }
- 
--                                pa_xfree(sorted_files[i]);
-+                                    pa_xfree(sorted_files[i]);
-+                                }
-+                                pa_xfree(sorted_files);
-+                                if (failed)
-+                                    return -1;
-                             }
--                            pa_xfree(sorted_files);
--                            if (failed)
--                                return -1;
-                         }
-                     } else if (pa_cli_command_execute_file(c, filename, buf, fail) < 0 && *fail) {
-                         return -1;
--- 
-2.29.2
-
diff --git a/src/pulseaudio/0010-client-Make-auto_connect_localhost-respect-HAVE_IPv6.patch b/src/pulseaudio/0010-client-Make-auto_connect_localhost-respect-HAVE_IPv6.patch
deleted file mode 100644
index b7b6461..0000000
--- a/src/pulseaudio/0010-client-Make-auto_connect_localhost-respect-HAVE_IPv6.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From b4f9e6bdf23d4e0c240a2f58cf4a70efbdb8f254 Mon Sep 17 00:00:00 2001
-From: Patrick Gaskin <patrick@pgaskin.net>
-Date: Sat, 2 Jan 2021 16:56:20 -0500
-Subject: [PATCH] client: Make auto_connect_localhost respect HAVE_IPv6 and
- OS_IS_WIN32
-
----
- src/pulse/context.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/src/pulse/context.c b/src/pulse/context.c
-index 05b6633aa..b0a838860 100644
---- a/src/pulse/context.c
-+++ b/src/pulse/context.c
-@@ -1027,7 +1027,10 @@ int pa_context_connect(
- 
-         /* Add TCP/IP on the localhost */
-         if (c->conf->auto_connect_localhost) {
-+#if defined(HAVE_IPV6) && !defined(OS_IS_WIN32)
-+            /* FIXME: pa_socket_client does not support IPv6 on Windows */
-             c->server_list = pa_strlist_prepend(c->server_list, "tcp6:[::1]");
-+#endif
-             c->server_list = pa_strlist_prepend(c->server_list, "tcp4:127.0.0.1");
-         }
- 
--- 
-2.29.2
-