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 - Suspicious condition in HIDAPI_DriverXbox360_UpdateXInput
Summary: Suspicious condition in HIDAPI_DriverXbox360_UpdateXInput
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.13
Hardware: x86_64 All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-14 16:19 UTC by Mathieu Eyraud
Modified: 2020-04-14 16:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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