Add error returns to void functions that can fail/set errors.

This takes care of the last set of void functions that could
potentially be shifted to instead return an int indicating success and
setting an error in case of an error.
This commit is contained in:
Linus Probert
2023-02-08 20:43:52 +01:00
committed by Sam Lantinga
parent b305d9e3c0
commit 3bd737d44c
13 changed files with 53 additions and 27 deletions

View File

@@ -2679,14 +2679,15 @@ int SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad)
/**
* Set the player index of an opened gamepad
*/
void SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index)
int SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index)
{
SDL_Joystick *joystick = SDL_GetGamepadJoystick(gamepad);
if (joystick == NULL) {
return;
/* SDL_SetError() will have been called already by SDL_GetGamepadJoystick() */
return -1;
}
SDL_SetJoystickPlayerIndex(joystick, player_index);
return SDL_SetJoystickPlayerIndex(joystick, player_index);
}
Uint16 SDL_GetGamepadVendor(SDL_Gamepad *gamepad)

View File

@@ -2826,9 +2826,9 @@ SDL_JoystickType SDL_GetJoystickType(SDL_Joystick *joystick)
}
/* convert the guid to a printable string */
void SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID)
int SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID)
{
SDL_GUIDToString(guid, pszGUID, cbGUID);
return SDL_GUIDToString(guid, pszGUID, cbGUID);
}
/* convert the string version of a joystick guid to the struct */