SDL_GetClosestFullscreenDisplayMode(): Rename parameter mode to closest

Also: Check, if the parameter is NULL inside the function.
This commit is contained in:
Petar Popovic
2024-11-03 18:36:07 +01:00
committed by Sam Lantinga
parent 683991ab71
commit 96729e745a
3 changed files with 10 additions and 9 deletions

View File

@@ -1319,14 +1319,16 @@ SDL_DisplayMode **SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *co
bool SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, SDL_DisplayMode *result)
{
if (!result) {
return SDL_InvalidParamError("closest"); // Parameter `result` is called `closest` in the header.
}
const SDL_DisplayMode *mode, *closest = NULL;
float aspect_ratio;
int i;
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
if (result) {
SDL_zerop(result);
}
SDL_zerop(result);
CHECK_DISPLAY_MAGIC(display, false);
@@ -1378,9 +1380,9 @@ bool SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h,
if (!closest) {
return SDL_SetError("Couldn't find any matching video modes");
}
if (result) {
SDL_copyp(result, closest);
}
SDL_copyp(result, closest);
return true;
}