From b2c367b179c7e0eb1f2890428f7b02eeb323443f Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 19 Mar 2019 08:41:08 +1100
Subject: [PATCH 1/6] Revert "xaudio2_7/tests: Remove redundant not-NULL checks
 (coccinellery)."

This reverts commit 61d825ca3ed57ddec4a07f2e62f87432386a8daf.
---
 dlls/xaudio2_7/tests/xaudio2.c | 104 +++++++++++++++++++++--------------------
 1 file changed, 54 insertions(+), 50 deletions(-)

diff --git a/dlls/xaudio2_7/tests/xaudio2.c b/dlls/xaudio2_7/tests/xaudio2.c
index f2bffdf..4ead8d8 100644
--- a/dlls/xaudio2_7/tests/xaudio2.c
+++ b/dlls/xaudio2_7/tests/xaudio2.c
@@ -1000,9 +1000,28 @@ static void test_xapo_creation_legacy(const char *module, unsigned int version)
         return;
     }
 
-    for(i = 0; i < ARRAY_SIZE(const_clsids); ++i){
-        hr = pCreateFX(const_clsids[i], &fx_unk);
-        ok(hr == S_OK, "%s: CreateFX(%s) failed: %08x\n", module, wine_dbgstr_guid(const_clsids[i]), hr);
+    if(pCreateFX){
+        for(i = 0; i < ARRAY_SIZE(const_clsids); ++i){
+            hr = pCreateFX(const_clsids[i], &fx_unk);
+            ok(hr == S_OK, "%s: CreateFX(%s) failed: %08x\n", module, wine_dbgstr_guid(const_clsids[i]), hr);
+            if(SUCCEEDED(hr)){
+                IXAPO *xapo;
+                hr = IUnknown_QueryInterface(fx_unk, &IID_IXAPO27, (void**)&xapo);
+                ok(hr == S_OK, "Couldn't get IXAPO27 interface: %08x\n", hr);
+                if(SUCCEEDED(hr))
+                    IXAPO_Release(xapo);
+                IUnknown_Release(fx_unk);
+            }
+
+            hr = CoCreateInstance(const_clsids[i], NULL, CLSCTX_INPROC_SERVER,
+                    &IID_IUnknown, (void**)&fx_unk);
+            ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance should have failed: %08x\n", hr);
+            if(SUCCEEDED(hr))
+                IUnknown_Release(fx_unk);
+        }
+
+        hr = pCreateFX(avm_clsids[version - 20], &fx_unk);
+        ok(hr == S_OK, "%s: CreateFX(%s) failed: %08x\n", module, wine_dbgstr_guid(avm_clsids[version - 20]), hr);
         if(SUCCEEDED(hr)){
             IXAPO *xapo;
             hr = IUnknown_QueryInterface(fx_unk, &IID_IXAPO27, (void**)&xapo);
@@ -1012,33 +1031,16 @@ static void test_xapo_creation_legacy(const char *module, unsigned int version)
             IUnknown_Release(fx_unk);
         }
 
-        hr = CoCreateInstance(const_clsids[i], NULL, CLSCTX_INPROC_SERVER,
-                &IID_IUnknown, (void**)&fx_unk);
-        ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance should have failed: %08x\n", hr);
-        if(SUCCEEDED(hr))
+        hr = pCreateFX(ar_clsids[version - 20], &fx_unk);
+        ok(hr == S_OK, "%s: CreateFX(%s) failed: %08x\n", module, wine_dbgstr_guid(ar_clsids[version - 20]), hr);
+        if(SUCCEEDED(hr)){
+            IXAPO *xapo;
+            hr = IUnknown_QueryInterface(fx_unk, &IID_IXAPO27, (void**)&xapo);
+            ok(hr == S_OK, "Couldn't get IXAPO27 interface: %08x\n", hr);
+            if(SUCCEEDED(hr))
+                IXAPO_Release(xapo);
             IUnknown_Release(fx_unk);
-    }
-
-    hr = pCreateFX(avm_clsids[version - 20], &fx_unk);
-    ok(hr == S_OK, "%s: CreateFX(%s) failed: %08x\n", module, wine_dbgstr_guid(avm_clsids[version - 20]), hr);
-    if(SUCCEEDED(hr)){
-        IXAPO *xapo;
-        hr = IUnknown_QueryInterface(fx_unk, &IID_IXAPO27, (void**)&xapo);
-        ok(hr == S_OK, "Couldn't get IXAPO27 interface: %08x\n", hr);
-        if(SUCCEEDED(hr))
-            IXAPO_Release(xapo);
-        IUnknown_Release(fx_unk);
-    }
-
-    hr = pCreateFX(ar_clsids[version - 20], &fx_unk);
-    ok(hr == S_OK, "%s: CreateFX(%s) failed: %08x\n", module, wine_dbgstr_guid(ar_clsids[version - 20]), hr);
-    if(SUCCEEDED(hr)){
-        IXAPO *xapo;
-        hr = IUnknown_QueryInterface(fx_unk, &IID_IXAPO27, (void**)&xapo);
-        ok(hr == S_OK, "Couldn't get IXAPO27 interface: %08x\n", hr);
-        if(SUCCEEDED(hr))
-            IXAPO_Release(xapo);
-        IUnknown_Release(fx_unk);
+        }
     }
 
     FreeLibrary(xapofxdll);
@@ -1081,9 +1083,29 @@ static void test_xapo_creation_modern(const char *module)
         return;
     }
 
-    for(i = 0; i < ARRAY_SIZE(const_clsids); ++i){
-        hr = pCreateFX(const_clsids[i], &fx_unk, NULL, 0);
-        ok(hr == S_OK, "%s: CreateFX(%s) failed: %08x\n", module, wine_dbgstr_guid(const_clsids[i]), hr);
+    if(pCreateFX){
+        for(i = 0; i < ARRAY_SIZE(const_clsids); ++i){
+            hr = pCreateFX(const_clsids[i], &fx_unk, NULL, 0);
+            ok(hr == S_OK, "%s: CreateFX(%s) failed: %08x\n", module, wine_dbgstr_guid(const_clsids[i]), hr);
+            if(SUCCEEDED(hr)){
+                IXAPO *xapo;
+                hr = IUnknown_QueryInterface(fx_unk, &IID_IXAPO, (void**)&xapo);
+                ok(hr == S_OK, "Couldn't get IXAPO interface: %08x\n", hr);
+                if(SUCCEEDED(hr))
+                    IXAPO_Release(xapo);
+                IUnknown_Release(fx_unk);
+            }
+
+            hr = CoCreateInstance(const_clsids[i], NULL, CLSCTX_INPROC_SERVER,
+                    &IID_IUnknown, (void**)&fx_unk);
+            ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance should have failed: %08x\n", hr);
+            if(SUCCEEDED(hr))
+                IUnknown_Release(fx_unk);
+        }
+
+        /* test legacy CLSID */
+        hr = pCreateFX(&CLSID_AudioVolumeMeter27, &fx_unk, NULL, 0);
+        ok(hr == S_OK, "%s: CreateFX(CLSID_AudioVolumeMeter) failed: %08x\n", module, hr);
         if(SUCCEEDED(hr)){
             IXAPO *xapo;
             hr = IUnknown_QueryInterface(fx_unk, &IID_IXAPO, (void**)&xapo);
@@ -1092,24 +1114,6 @@ static void test_xapo_creation_modern(const char *module)
                 IXAPO_Release(xapo);
             IUnknown_Release(fx_unk);
         }
-
-        hr = CoCreateInstance(const_clsids[i], NULL, CLSCTX_INPROC_SERVER,
-                &IID_IUnknown, (void**)&fx_unk);
-        ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance should have failed: %08x\n", hr);
-        if(SUCCEEDED(hr))
-            IUnknown_Release(fx_unk);
-    }
-
-    /* test legacy CLSID */
-    hr = pCreateFX(&CLSID_AudioVolumeMeter27, &fx_unk, NULL, 0);
-    ok(hr == S_OK, "%s: CreateFX(CLSID_AudioVolumeMeter) failed: %08x\n", module, hr);
-    if(SUCCEEDED(hr)){
-        IXAPO *xapo;
-        hr = IUnknown_QueryInterface(fx_unk, &IID_IXAPO, (void**)&xapo);
-        ok(hr == S_OK, "Couldn't get IXAPO interface: %08x\n", hr);
-        if(SUCCEEDED(hr))
-            IXAPO_Release(xapo);
-        IUnknown_Release(fx_unk);
     }
 
     pCAVM = (void*)GetProcAddress(xaudio2dll, "CreateAudioVolumeMeter");
-- 
1.9.1

