|
@@ -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)
|
|
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;
|
|
const SDL_DisplayMode *mode, *closest = NULL;
|
|
float aspect_ratio;
|
|
float aspect_ratio;
|
|
int i;
|
|
int i;
|
|
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
|
|
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
|
|
|
|
|
|
- if (result) {
|
|
|
|
- SDL_zerop(result);
|
|
|
|
- }
|
|
|
|
|
|
+ SDL_zerop(result);
|
|
|
|
|
|
CHECK_DISPLAY_MAGIC(display, false);
|
|
CHECK_DISPLAY_MAGIC(display, false);
|
|
|
|
|
|
@@ -1378,9 +1380,9 @@ bool SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h,
|
|
if (!closest) {
|
|
if (!closest) {
|
|
return SDL_SetError("Couldn't find any matching video modes");
|
|
return SDL_SetError("Couldn't find any matching video modes");
|
|
}
|
|
}
|
|
- if (result) {
|
|
|
|
- SDL_copyp(result, closest);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ SDL_copyp(result, closest);
|
|
|
|
+
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|