Change return type from void to int, for functions that set an error

(SDL_SetError(), SDL_OutOfMemory(), SDL_Unsupported(), SDL_InvalidParam())

Update prototype to forward errors to generic layer, for the functions:
MoveCursor, WarpMouse, GL_DeleteContext, GetDisplayModes.

Check invalid parameter in SDL_SetTextInputRect() generic layer.
This commit is contained in:
Sylvain
2023-02-06 20:24:12 +01:00
committed by Sam Lantinga
parent 6c37d5b57f
commit c5c94a6be6
100 changed files with 472 additions and 389 deletions

View File

@@ -118,29 +118,26 @@ SDL_INTERSECTRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
return !SDL_RECTEMPTY(result);
}
void SDL_UNIONRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
int SDL_UNIONRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
{
SCALARTYPE Amin, Amax, Bmin, Bmax;
if (A == NULL) {
SDL_InvalidParamError("A");
return;
return SDL_InvalidParamError("A");
} else if (B == NULL) {
SDL_InvalidParamError("B");
return;
return SDL_InvalidParamError("B");
} else if (result == NULL) {
SDL_InvalidParamError("result");
return;
return SDL_InvalidParamError("result");
} else if (SDL_RECTEMPTY(A)) { /* Special cases for empty Rects */
if (SDL_RECTEMPTY(B)) { /* A and B empty */
SDL_zerop(result);
} else { /* A empty, B not empty */
*result = *B;
}
return;
return 0;
} else if (SDL_RECTEMPTY(B)) { /* A not empty, B empty */
*result = *A;
return;
return 0;
}
/* Horizontal union */
@@ -170,6 +167,7 @@ void SDL_UNIONRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
Amax = Bmax;
}
result->h = Amax - Amin;
return 0;
}
SDL_bool SDL_ENCLOSEPOINTS(const POINTTYPE *points, int count, const RECTTYPE *clip,