[Commits] SDL: wasapi: Patched to compile on non-UWP WinRT builds.

libsdl.org revision control commits-owner at libsdl.org
Sun Dec 31 00:37:04 PST 2017


details:   https://hg.libsdl.org/SDL/rev/3ec030c1ca8e
changeset: 11793:3ec030c1ca8e
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Sun Dec 31 03:34:16 2017 -0500
description:
wasapi: Patched to compile on non-UWP WinRT builds.

diffstat:

 src/audio/wasapi/SDL_wasapi.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r ff2d4c0c636d -r 3ec030c1ca8e src/audio/wasapi/SDL_wasapi.c
--- a/src/audio/wasapi/SDL_wasapi.c	Sun Dec 31 03:17:18 2017 -0500
+++ b/src/audio/wasapi/SDL_wasapi.c	Sun Dec 31 03:34:16 2017 -0500
@@ -84,7 +84,7 @@
 static WCHAR *
 WStrDupe(const WCHAR *wstr)
 {
-    const int len = (WStrLen(wstr) + 1) * sizeof (WCHAR);
+    const size_t len = (WStrLen(wstr) + 1) * sizeof (WCHAR);
     WCHAR *retval = (WCHAR *) SDL_malloc(len);
     if (retval) {
         SDL_memcpy(retval, wstr, len);
@@ -323,7 +323,7 @@
 {
     while (RecoverWasapiIfLost(this) && this->hidden->client && this->hidden->event) {
         /*SDL_Log("WAITDEVICE");*/
-        if (WaitForSingleObject(this->hidden->event, INFINITE) == WAIT_OBJECT_0) {
+        if (WaitForSingleObjectEx(this->hidden->event, INFINITE, FALSE) == WAIT_OBJECT_0) {
             const UINT32 maxpadding = this->spec.samples;
             UINT32 padding = 0;
             if (!WasapiFailed(this, IAudioClient_GetCurrentPadding(this->hidden->client, &padding))) {
@@ -530,7 +530,12 @@
 
     SDL_assert(client != NULL);
 
+#ifdef __WINRT__  /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */
+    this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS);
+#else
     this->hidden->event = CreateEventW(NULL, 0, 0, NULL);
+#endif
+
     if (this->hidden->event == NULL) {
         return WIN_SetError("WASAPI can't create an event handle");
     }


More information about the commits mailing list