[PATCH] dinput/tests: Remove some redundant NULL pointer checks (Coverity).
Signed-off-by: Sven Baars <sven.wine(a)gmail.com> --- dlls/dinput/tests/device.c | 9 ++++----- dlls/dinput/tests/keyboard.c | 10 +++++----- dlls/dinput/tests/mouse.c | 8 ++++---- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/dlls/dinput/tests/device.c b/dlls/dinput/tests/device.c index fa9b6f1436..97dc3c19f5 100644 --- a/dlls/dinput/tests/device.c +++ b/dlls/dinput/tests/device.c @@ -177,7 +177,7 @@ struct enum_data static BOOL CALLBACK enum_devices(const DIDEVICEINSTANCEA *lpddi, void *pvRef) { struct enum_data *data = pvRef; - IDirectInputDeviceA *device, *obj = NULL; + IDirectInputDeviceA *device, *obj; HRESULT hr; hr = IDirectInput_GetDeviceStatus(data->pDI, &lpddi->guidInstance); @@ -192,13 +192,12 @@ static BOOL CALLBACK enum_devices(const DIDEVICEINSTANCEA *lpddi, void *pvRef) hr = IUnknown_QueryInterface(device, &IID_IDirectInputDevice2A, (LPVOID*)&obj); ok(SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice7A) failed: %08x\n", hr); test_object_info(obj, data->hwnd); - if (obj) IUnknown_Release(obj); - obj = NULL; + IUnknown_Release(obj); hr = IUnknown_QueryInterface(device, &IID_IDirectInputDevice2W, (LPVOID*)&obj); ok(SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice7W) failed: %08x\n", hr); test_object_info(obj, data->hwnd); - if (obj) IUnknown_Release(obj); + IUnknown_Release(obj); IUnknown_Release(device); } @@ -256,7 +255,7 @@ static void device_tests(void) DestroyWindow(hwnd); } if (obj) IUnknown_Release(obj); - if (pDI) IUnknown_Release(pDI); + IUnknown_Release(pDI); } START_TEST(device) diff --git a/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c index e8dfb4f484..9ac9d4ac1d 100644 --- a/dlls/dinput/tests/keyboard.c +++ b/dlls/dinput/tests/keyboard.c @@ -165,7 +165,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd) } keybd_event('Q', 0, KEYEVENTF_KEYUP, 0); - if (pKeyboard) IUnknown_Release(pKeyboard); + IUnknown_Release(pKeyboard); ActivateKeyboardLayout(hkl_orig, 0); UnloadKeyboardLayout(hkl); @@ -198,7 +198,7 @@ static const HRESULT SetCoop_child_window[16] = { static void test_set_coop(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - IDirectInputDeviceA *pKeyboard = NULL; + IDirectInputDeviceA *pKeyboard; int i; HWND child; @@ -233,13 +233,13 @@ static void test_set_coop(IDirectInputA *pDI, HWND hwnd) } DestroyWindow(child); - if (pKeyboard) IUnknown_Release(pKeyboard); + IUnknown_Release(pKeyboard); } static void test_get_prop(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - IDirectInputDeviceA *pKeyboard = NULL; + IDirectInputDeviceA *pKeyboard; DIPROPRANGE diprg; hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKeyboard, NULL); @@ -255,7 +255,7 @@ static void test_get_prop(IDirectInputA *pDI, HWND hwnd) hr = IDirectInputDevice_GetProperty(pKeyboard, DIPROP_RANGE, &diprg.diph); ok(hr == DIERR_UNSUPPORTED, "IDirectInputDevice_GetProperty() did not return DIPROP_RANGE but: %08x\n", hr); - if (pKeyboard) IUnknown_Release(pKeyboard); + IUnknown_Release(pKeyboard); } static void test_capabilities(IDirectInputA *pDI, HWND hwnd) diff --git a/dlls/dinput/tests/mouse.c b/dlls/dinput/tests/mouse.c index c2d0226487..46f3833fee 100644 --- a/dlls/dinput/tests/mouse.c +++ b/dlls/dinput/tests/mouse.c @@ -51,7 +51,7 @@ static const HRESULT SetCoop_child_window[16] = { static void test_set_coop(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - IDirectInputDeviceA *pMouse = NULL; + IDirectInputDeviceA *pMouse; int i; HWND child; @@ -81,13 +81,13 @@ static void test_set_coop(IDirectInputA *pDI, HWND hwnd) } DestroyWindow(child); - if (pMouse) IUnknown_Release(pMouse); + IUnknown_Release(pMouse); } static void test_acquire(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - IDirectInputDeviceA *pMouse = NULL; + IDirectInputDeviceA *pMouse; DIMOUSESTATE m_state; HWND hwnd2; DIPROPDWORD di_op; @@ -193,7 +193,7 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd) /* Granularity of Y axis should be 1! */ ok(hr == S_OK && di_op.dwData == 1, "GetProperty(): %08x, dwData: %i but should be 1.\n", hr, di_op.dwData); - if (pMouse) IUnknown_Release(pMouse); + IUnknown_Release(pMouse); DestroyWindow( hwnd2 ); } -- 2.17.1
Hi, While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48115 Your paranoid android. === debian9 (32 bit report) === dinput: mouse.c:173: Test failed: GetDeviceData() failed: 00000000 cnt:0 === debian9 (32 bit Japanese:Japan report) === dinput: mouse.c:173: Test failed: GetDeviceData() failed: 00000000 cnt:0 === debian9 (32 bit WoW report) === dinput: mouse.c:173: Test failed: GetDeviceData() failed: 00000000 cnt:0 === debian9 (64 bit WoW report) === dinput: mouse.c:173: Test failed: GetDeviceData() failed: 00000000 cnt:0
participants (2)
-
Marvin -
Sven Baars