solve FIXMEs in SDL_video.c

This commit is contained in:
pionere 2022-11-09 09:11:04 +01:00 committed by Ryan C. Gordon
parent e5c599f8c6
commit ac3349faaf
1 changed files with 35 additions and 30 deletions

View File

@ -694,10 +694,14 @@ SDL_GetDisplayName(int displayIndex)
int int
SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect) SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect)
{ {
SDL_VideoDisplay *display;
CHECK_DISPLAY_INDEX(displayIndex, -1); CHECK_DISPLAY_INDEX(displayIndex, -1);
if (rect) { if (!rect)
SDL_VideoDisplay *display = &_this->displays[displayIndex]; return SDL_InvalidParamError("rect");
display = &_this->displays[displayIndex];
if (_this->GetDisplayBounds) { if (_this->GetDisplayBounds) {
if (_this->GetDisplayBounds(_this, display, rect) == 0) { if (_this->GetDisplayBounds(_this, display, rect) == 0) {
@ -715,8 +719,7 @@ SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect)
} }
rect->w = display->current_mode.w; rect->w = display->current_mode.w;
rect->h = display->current_mode.h; rect->h = display->current_mode.h;
} return 0;
return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
} }
static int static int
@ -729,10 +732,14 @@ ParseDisplayUsableBoundsHint(SDL_Rect *rect)
int int
SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect) SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect)
{ {
SDL_VideoDisplay *display;
CHECK_DISPLAY_INDEX(displayIndex, -1); CHECK_DISPLAY_INDEX(displayIndex, -1);
if (rect) { if (!rect)
SDL_VideoDisplay *display = &_this->displays[displayIndex]; return SDL_InvalidParamError("rect");
display = &_this->displays[displayIndex];
if ((displayIndex == 0) && ParseDisplayUsableBoundsHint(rect)) { if ((displayIndex == 0) && ParseDisplayUsableBoundsHint(rect)) {
return 0; return 0;
@ -746,8 +753,6 @@ SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect)
/* Oh well, just give the entire display bounds. */ /* Oh well, just give the entire display bounds. */
return SDL_GetDisplayBounds(displayIndex, rect); return SDL_GetDisplayBounds(displayIndex, rect);
}
return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */
} }
int int