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:
parent
b305d9e3c0
commit
3bd737d44c
13 changed files with 53 additions and 27 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue