mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-03 00:18:28 +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
@@ -21,13 +21,16 @@
|
||||
#include "SDL_internal.h"
|
||||
|
||||
/* convert the guid to a printable string */
|
||||
void SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID)
|
||||
int SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID)
|
||||
{
|
||||
static const char k_rgchHexToASCII[] = "0123456789abcdef";
|
||||
int i;
|
||||
|
||||
if ((pszGUID == NULL) || (cbGUID <= 0)) {
|
||||
return;
|
||||
if (pszGUID == NULL) {
|
||||
return SDL_InvalidParamError("pszGUID");
|
||||
}
|
||||
if (cbGUID <= 0) {
|
||||
return SDL_InvalidParamError("cbGUID");
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(guid.data) && i < (cbGUID - 1) / 2; i++) {
|
||||
@@ -39,6 +42,7 @@ void SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID)
|
||||
*pszGUID++ = k_rgchHexToASCII[c & 0x0F];
|
||||
}
|
||||
*pszGUID = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user