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

@@ -1256,13 +1256,13 @@ SDL_CreateSystemCursor(SDL_SystemCursor id)
if this is desired for any reason. This is used when setting
the video mode and when the SDL window gains the mouse focus.
*/
void SDL_SetCursor(SDL_Cursor *cursor)
int SDL_SetCursor(SDL_Cursor *cursor)
{
SDL_Mouse *mouse = SDL_GetMouse();
/* Return immediately if setting the cursor to the currently set one (fixes #7151) */
if (cursor == mouse->cur_cursor) {
return;
return 0;
}
/* Set the new cursor */
@@ -1276,8 +1276,7 @@ void SDL_SetCursor(SDL_Cursor *cursor)
}
}
if (found == NULL) {
SDL_SetError("Cursor not associated with the current mouse");
return;
return SDL_SetError("Cursor not associated with the current mouse");
}
}
mouse->cur_cursor = cursor;
@@ -1298,6 +1297,7 @@ void SDL_SetCursor(SDL_Cursor *cursor)
mouse->ShowCursor(NULL);
}
}
return 0;
}
SDL_Cursor *