SDL: fixes after ShowMessageBox changes:

From 9e352e61db6836e85e24e9f2497dee5a62d8e212 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
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
---
 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 f18d4e988fdf..c28c681cdab8 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 08d00010e452..931a7054124b 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 fbb9a7696ae6..53fc679b0303 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 e68445a98693..8da1f4f480c6 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 */