From 50b1c19549994c3bd488a73942209ad30ee5d9c9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 14 Apr 2020 09:55:33 -0700 Subject: [PATCH] Fixed bug 5091 - Suspicious condition in HIDAPI_DriverXbox360_UpdateXInput meyraud705 On line 220 of SDL_hidapi_xbox360.c https://hg.libsdl.org/SDL/file/4608f0e6e8e3/src/joystick/hidapi/SDL_hidapi_xbox360.c#l220 if (!XINPUTGETSTATE(user_index, &xinput_state[user_index].state) == ERROR_SUCCESS) { logical not is only applied to the left hand side of this comparison. I think you mean: if (XINPUTGETSTATE(user_index, &xinput_state[user_index].state) != ERROR_SUCCESS) { --- src/joystick/hidapi/SDL_hidapi_xbox360.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360.c b/src/joystick/hidapi/SDL_hidapi_xbox360.c index 7c5f01b2e4..4ec380b122 100644 --- a/src/joystick/hidapi/SDL_hidapi_xbox360.c +++ b/src/joystick/hidapi/SDL_hidapi_xbox360.c @@ -217,7 +217,7 @@ HIDAPI_DriverXbox360_UpdateXInput() xinput_state_dirty = SDL_FALSE; for (user_index = 0; user_index < SDL_arraysize(xinput_state); ++user_index) { if (xinput_state[user_index].connected) { - if (!XINPUTGETSTATE(user_index, &xinput_state[user_index].state) == ERROR_SUCCESS) { + if (XINPUTGETSTATE(user_index, &xinput_state[user_index].state) != ERROR_SUCCESS) { xinput_state[user_index].connected = SDL_FALSE; } }