We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5091

Summary: Suspicious condition in HIDAPI_DriverXbox360_UpdateXInput
Product: SDL Reporter: Mathieu Eyraud <meyraud705>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.13   
Hardware: x86_64   
OS: All   

Description Mathieu Eyraud 2020-04-14 16:19:21 UTC
On line 220 of SDL_hidapi_xbox360.c https://hg.libsdl.org/SDL/file/d0ef8ec6a2eb/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) {
Comment 1 Sam Lantinga 2020-04-14 16:56:15 UTC
Yup, good catch, thanks!
https://hg.libsdl.org/SDL/rev/dcf07006dda6