From 93bfa2b5be8aea6da5ba82526c7e6f2762250001 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Thu, 12 Jan 2012 00:36:08 +0100 Subject: [PATCH] dsound/tests: Sanitize START_TEST() in capture.c. --- dlls/dsound/tests/capture.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c index 760f0cc544e..02ef46a0590 100644 --- a/dlls/dsound/tests/capture.c +++ b/dlls/dsound/tests/capture.c @@ -177,7 +177,7 @@ EXIT: "should have 0\n", ref); } -static void IDirectSoundCapture_tests(void) +static void test_capture(void) { HRESULT rc; LPDIRECTSOUNDCAPTURE dsco=NULL; @@ -659,7 +659,7 @@ EXIT: return TRUE; } -static void capture_tests(void) +static void test_enumerate(void) { HRESULT rc; rc=pDirectSoundCaptureEnumerateA(&dscenum_callback,NULL); @@ -673,25 +673,21 @@ START_TEST(capture) CoInitialize(NULL); hDsound = LoadLibrary("dsound.dll"); - if (hDsound) - { - - pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound, - "DirectSoundCaptureCreate"); - pDirectSoundCaptureEnumerateA=(void*)GetProcAddress(hDsound, - "DirectSoundCaptureEnumerateA"); - if (pDirectSoundCaptureCreate && pDirectSoundCaptureEnumerateA) - { - IDirectSoundCapture_tests(); - capture_tests(); - } - else - skip("capture test skipped\n"); - - FreeLibrary(hDsound); - } - else + if (!hDsound) { skip("dsound.dll not found!\n"); + return; + } + pDirectSoundCaptureCreate = (void*)GetProcAddress(hDsound, "DirectSoundCaptureCreate"); + pDirectSoundCaptureEnumerateA = (void*)GetProcAddress(hDsound, "DirectSoundCaptureEnumerateA"); + if (!pDirectSoundCaptureCreate || !pDirectSoundCaptureEnumerateA) { + skip("capture test skipped\n"); + return; + } + + test_capture(); + test_enumerate(); + + FreeLibrary(hDsound); CoUninitialize(); }