Skip to content

Commit

Permalink
SDL_gamecontroller.c: (unsigned char) cast to SDL_isdigit() parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Dec 17, 2021
1 parent ced442c commit 6110749
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/joystick/SDL_gamecontroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ static void SDL_PrivateGameControllerParseElement(SDL_GameController *gamecontro
invert_input = SDL_TRUE;
}

if (szJoystickButton[0] == 'a' && SDL_isdigit(szJoystickButton[1])) {
if (szJoystickButton[0] == 'a' && SDL_isdigit((unsigned char) szJoystickButton[1])) {
bind.inputType = SDL_CONTROLLER_BINDTYPE_AXIS;
bind.input.axis.axis = SDL_atoi(&szJoystickButton[1]);
if (half_axis_input == '+') {
Expand All @@ -878,11 +878,11 @@ static void SDL_PrivateGameControllerParseElement(SDL_GameController *gamecontro
bind.input.axis.axis_min = bind.input.axis.axis_max;
bind.input.axis.axis_max = tmp;
}
} else if (szJoystickButton[0] == 'b' && SDL_isdigit(szJoystickButton[1])) {
} else if (szJoystickButton[0] == 'b' && SDL_isdigit((unsigned char) szJoystickButton[1])) {
bind.inputType = SDL_CONTROLLER_BINDTYPE_BUTTON;
bind.input.button = SDL_atoi(&szJoystickButton[1]);
} else if (szJoystickButton[0] == 'h' && SDL_isdigit(szJoystickButton[1]) &&
szJoystickButton[2] == '.' && SDL_isdigit(szJoystickButton[3])) {
} else if (szJoystickButton[0] == 'h' && SDL_isdigit((unsigned char) szJoystickButton[1]) &&
szJoystickButton[2] == '.' && SDL_isdigit((unsigned char) szJoystickButton[3])) {
int hat = SDL_atoi(&szJoystickButton[1]);
int mask = SDL_atoi(&szJoystickButton[3]);
bind.inputType = SDL_CONTROLLER_BINDTYPE_HAT;
Expand Down

0 comments on commit 6110749

Please sign in to comment.