Use new parameter validation macro

This commit is contained in:
Sam Lantinga
2025-09-16 21:51:03 -07:00
parent ee1c90a358
commit 25b2d2c821
60 changed files with 1113 additions and 1133 deletions

View File

@@ -238,7 +238,7 @@ bool SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect, SDL_BlendMode ble
{
SDL_Rect clipped;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendFillRect(): dst");
}
@@ -306,7 +306,7 @@ bool SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, SDL_
bool (*func)(SDL_Surface * dst, const SDL_Rect *rect, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
bool result = true;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendFillRects(): dst");
}

View File

@@ -923,7 +923,7 @@ bool SDL_BlendLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, SDL_BlendMo
{
BlendLineFunc func;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendLine(): dst");
}

View File

@@ -236,7 +236,7 @@ static bool SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode bl
bool SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendPoint(): dst");
}
@@ -302,7 +302,7 @@ bool SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, SDL_B
bool (*func)(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
bool result = true;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_BlendPoints(): dst");
}

View File

@@ -137,7 +137,7 @@ bool SDL_DrawLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint32 color
{
DrawLineFunc func;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_DrawLine(): dst");
}
@@ -164,7 +164,7 @@ bool SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count, Uint32
bool draw_end;
DrawLineFunc func;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_DrawLines(): dst");
}

View File

@@ -27,7 +27,7 @@
bool SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color)
{
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_DrawPoint(): dst");
}
@@ -66,7 +66,7 @@ bool SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count, Uint32
int i;
int x, y;
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("SDL_DrawPoints(): dst");
}

View File

@@ -1121,12 +1121,12 @@ bool SW_CreateRendererForSurface(SDL_Renderer *renderer, SDL_Surface *surface, S
{
SW_RenderData *data;
if (!SDL_SurfaceValid(surface)) {
CHECK_PARAM(!SDL_SurfaceValid(surface)) {
return SDL_InvalidParamError("surface");
}
if (SDL_BITSPERPIXEL(surface->format) < 8 ||
SDL_BITSPERPIXEL(surface->format) > 32) {
CHECK_PARAM(SDL_BITSPERPIXEL(surface->format) < 8 ||
SDL_BITSPERPIXEL(surface->format) > 32) {
return SDL_SetError("Unsupported surface format");
}

View File

@@ -502,10 +502,10 @@ bool SDL_SW_BlitTriangle(
bool has_modulation;
if (!SDL_SurfaceValid(src)) {
CHECK_PARAM(!SDL_SurfaceValid(src)) {
return SDL_InvalidParamError("src");
}
if (!SDL_SurfaceValid(dst)) {
CHECK_PARAM(!SDL_SurfaceValid(dst)) {
return SDL_InvalidParamError("dst");
}