[PATCH] xactengine3_7: Return a valid HRESULT in IXACT3SoundBank Play

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed Sep 16 04:31:33 CDT 2020


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/xactengine3_7/xact_dll.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/dlls/xactengine3_7/xact_dll.c b/dlls/xactengine3_7/xact_dll.c
index 742fe86cc9..16eadea7f2 100644
--- a/dlls/xactengine3_7/xact_dll.c
+++ b/dlls/xactengine3_7/xact_dll.c
@@ -273,7 +273,7 @@ static HRESULT WINAPI IXACT3SoundBankImpl_Play(IXACT3SoundBank *iface,
     XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface);
     XACT3CueImpl *cue;
     FACTCue *fcue;
-    HRESULT hr;
+    UINT ret;
 
     TRACE("(%p)->(%u, 0x%x, %u, %p)\n", This, nCueIndex, dwFlags, timeOffset,
             ppCue);
@@ -283,28 +283,31 @@ static HRESULT WINAPI IXACT3SoundBankImpl_Play(IXACT3SoundBank *iface,
      * -flibit
      */
     if (ppCue == NULL){
-        hr = FACTSoundBank_Play(This->fact_soundbank, nCueIndex, dwFlags,
+        ret = FACTSoundBank_Play(This->fact_soundbank, nCueIndex, dwFlags,
                 timeOffset, NULL);
     }else{
-        hr = FACTSoundBank_Play(This->fact_soundbank, nCueIndex, dwFlags,
+        ret = FACTSoundBank_Play(This->fact_soundbank, nCueIndex, dwFlags,
                 timeOffset, &fcue);
-        if(FAILED(hr))
-            return hr;
-
-        cue = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cue));
-        if (!cue)
+        if(!ret)
         {
-            FACTCue_Destroy(fcue);
-            ERR("Failed to allocate XACT3CueImpl!");
-            return E_OUTOFMEMORY;
+            cue = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cue));
+            if (!cue)
+            {
+                FACTCue_Destroy(fcue);
+                ERR("Failed to allocate XACT3CueImpl!");
+                return E_OUTOFMEMORY;
+            }
+
+            cue->IXACT3Cue_iface.lpVtbl = &XACT3Cue_Vtbl;
+            cue->fact_cue = fcue;
+            *ppCue = (IXACT3Cue*)&cue->IXACT3Cue_iface;
         }
-
-        cue->IXACT3Cue_iface.lpVtbl = &XACT3Cue_Vtbl;
-        cue->fact_cue = fcue;
-        *ppCue = (IXACT3Cue*)&cue->IXACT3Cue_iface;
     }
 
-    return hr;
+    if(ret != 0)
+        WARN("FACTSoundBank_Play returned %d\n", ret);
+
+    return !ret ? S_OK : E_FAIL;
 }
 
 static HRESULT WINAPI IXACT3SoundBankImpl_Stop(IXACT3SoundBank *iface,
-- 
2.28.0




More information about the wine-devel mailing list