mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-17 15:21:43 +00:00
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:

committed by
Sam Lantinga

parent
b305d9e3c0
commit
3bd737d44c
@@ -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)
|
||||
|
@@ -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 */
|
||||
|
Reference in New Issue
Block a user