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
@@ -801,6 +801,10 @@ extern DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
|
||||
/**
|
||||
* Clear any pending data in the stream without converting it
|
||||
*
|
||||
* \param stream The audio stream to clear
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_CreateAudioStream
|
||||
@@ -810,7 +814,7 @@ extern DECLSPEC int SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream);
|
||||
* \sa SDL_FlushAudioStream
|
||||
* \sa SDL_DestroyAudioStream
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
|
||||
extern DECLSPEC int SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream);
|
||||
|
||||
/**
|
||||
* Free an audio stream
|
||||
|
||||
@@ -537,10 +537,12 @@ extern DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad);
|
||||
* \param gamepad the gamepad object to adjust.
|
||||
* \param player_index Player index to assign to this gamepad, or -1 to clear
|
||||
* the player index and turn off player LEDs.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
|
||||
extern DECLSPEC int SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
|
||||
|
||||
/**
|
||||
* Get the USB vendor ID of an opened gamepad, if available.
|
||||
|
||||
@@ -66,12 +66,14 @@ typedef struct {
|
||||
* \param guid the ::SDL_GUID you wish to convert to string
|
||||
* \param pszGUID buffer in which to write the ASCII string
|
||||
* \param cbGUID the size of pszGUID
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GUIDFromString
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
|
||||
extern DECLSPEC int SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
|
||||
|
||||
/**
|
||||
* Convert a GUID string into a ::SDL_GUID structure.
|
||||
|
||||
@@ -597,6 +597,8 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_GetJoystickType(SDL_Joystick *joyst
|
||||
* \param guid the SDL_JoystickGUID you wish to convert to string
|
||||
* \param pszGUID buffer in which to write the ASCII string
|
||||
* \param cbGUID the size of pszGUID
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
@@ -604,7 +606,7 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_GetJoystickType(SDL_Joystick *joyst
|
||||
* \sa SDL_GetJoystickGUID
|
||||
* \sa SDL_GetJoystickGUIDFromString
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
|
||||
extern DECLSPEC int SDLCALL SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
|
||||
|
||||
/**
|
||||
* Convert a GUID string into a SDL_JoystickGUID structure.
|
||||
|
||||
@@ -529,13 +529,15 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface,
|
||||
* clipped
|
||||
* \param rect an SDL_Rect structure filled in with the clipping rectangle for
|
||||
* the surface
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_BlitSurface
|
||||
* \sa SDL_SetSurfaceClipRect
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface,
|
||||
extern DECLSPEC int SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface,
|
||||
SDL_Rect *rect);
|
||||
|
||||
/*
|
||||
|
||||
@@ -115,12 +115,14 @@ typedef struct SDL_version
|
||||
* This function may be called safely at any time, even before SDL_Init().
|
||||
*
|
||||
* \param ver the SDL_version structure that contains the version information
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetRevision
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
|
||||
extern DECLSPEC int SDLCALL SDL_GetVersion(SDL_version * ver);
|
||||
|
||||
/**
|
||||
* Get the code revision of SDL that is linked against your program.
|
||||
|
||||
Reference in New Issue
Block a user