From 52181848daad50dcd4da8fbeb431fe0a2e03bf4d Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 23 Jan 2024 04:11:20 +0300 Subject: [PATCH] fixes after ShowMessageBox changes: - SDL_video.c (SDL_ShowMessageBox): remove C99'ism. - SDL_os2video.c (OS2DIVE_bootstrap): add OS2_ShowMessageBox - SDL_os2video.c (OS2VMAN_bootstrap): add OS2_ShowMessageBox - SDL_DirectFB_video.c (DirectFB_bootstrap): NULL ShowMessageBox - SDL_naclvideo.c (NACL_bootstrap): NULL ShowMessageBox (cherry picked from commit 9e352e61db6836e85e24e9f2497dee5a62d8e212) --- src/video/SDL_video.c | 5 +++-- src/video/directfb/SDL_DirectFB_video.c | 3 ++- src/video/nacl/SDL_naclvideo.c | 3 ++- src/video/os2/SDL_os2video.c | 7 +++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index f18d4e988..c28c681cd 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -4445,13 +4445,14 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } else { /* It's completely fine to call this function before video is initialized */ const char *driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER); + int i; if (driver_name && *driver_name != 0) { const char *driver_attempt = driver_name; while (driver_attempt && (*driver_attempt != 0) && (retval == -1)) { const char *driver_attempt_end = SDL_strchr(driver_attempt, ','); size_t driver_attempt_len = (driver_attempt_end) ? (driver_attempt_end - driver_attempt) : SDL_strlen(driver_attempt); - for (int i = 0; bootstrap[i]; ++i) { + for (i = 0; bootstrap[i]; ++i) { if (bootstrap[i]->ShowMessageBox && (driver_attempt_len == SDL_strlen(bootstrap[i]->name)) && (SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) { if (bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) { @@ -4464,7 +4465,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) driver_attempt = (driver_attempt_end) ? (driver_attempt_end + 1) : NULL; } } else { - for (int i = 0; bootstrap[i]; ++i) { + for (i = 0; bootstrap[i]; ++i) { if (bootstrap[i]->ShowMessageBox && bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; break; diff --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c index 08d00010e..931a70541 100644 --- a/src/video/directfb/SDL_DirectFB_video.c +++ b/src/video/directfb/SDL_DirectFB_video.c @@ -65,7 +65,8 @@ static SDL_VideoDevice *DirectFB_CreateDevice(void); VideoBootStrap DirectFB_bootstrap = { "directfb", "DirectFB", - DirectFB_CreateDevice + DirectFB_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; static const DirectFBSurfaceDrawingFlagsNames(drawing_flags); diff --git a/src/video/nacl/SDL_naclvideo.c b/src/video/nacl/SDL_naclvideo.c index fbb9a7696..53fc679b0 100644 --- a/src/video/nacl/SDL_naclvideo.c +++ b/src/video/nacl/SDL_naclvideo.c @@ -134,7 +134,8 @@ static SDL_VideoDevice *NACL_CreateDevice(void) { VideoBootStrap NACL_bootstrap = { NACLVID_DRIVER_NAME, "SDL Native Client Video Driver", - NACL_CreateDevice + NACL_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; int NACL_VideoInit(_THIS) { diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c index e68445a98..8da1f4f48 100644 --- a/src/video/os2/SDL_os2video.c +++ b/src/video/os2/SDL_os2video.c @@ -31,6 +31,7 @@ #include "SDL_os2video.h" #include "SDL_syswm.h" #include "SDL_os2util.h" +#include "SDL_os2messagebox.h" #define __MEERROR_H__ #define _MEERROR_H_ @@ -1683,12 +1684,14 @@ static SDL_VideoDevice *OS2VMAN_CreateDevice(void) VideoBootStrap OS2DIVE_bootstrap = { OS2DRIVER_NAME_DIVE, "OS/2 video driver", - OS2DIVE_CreateDevice + OS2DIVE_CreateDevice, + OS2_ShowMessageBox }; VideoBootStrap OS2VMAN_bootstrap = { OS2DRIVER_NAME_VMAN, "OS/2 video driver", - OS2VMAN_CreateDevice + OS2VMAN_CreateDevice, + OS2_ShowMessageBox }; #endif /* SDL_VIDEO_DRIVER_OS2 */