SDL: Workaround for Visual Studio 2019 const warning

From 9ff105548934cda2fd5f5510c3201eabe498b5b0 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 1 Feb 2023 09:20:14 -0800
Subject: [PATCH] Workaround for Visual Studio 2019 const warning

Visual Studio 2022, gcc, and clang all agree that "const SDL_DisplayMode **" is a non-const pointer to const data, but Visual Studio 2019 warns about this, so we'll just add a cast to the SDL_free() call for now.

Apparently this was a legitimate bug that has been recently fixed:
https://stackoverflow.com/questions/10403713/why-does-visual-c-warn-on-implicit-cast-from-const-void-to-void-in-c-but
---
 src/test/SDL_test_common.c  | 2 +-
 src/video/SDL_video.c       | 4 ++--
 test/testautomation_video.c | 2 +-
 test/testwm.c               | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index 49b60391feff..47176070bec4 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -1162,7 +1162,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
                         }
                     }
                 }
-                SDL_free(modes);
+                SDL_free((void *)modes);
 
 #if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
                 /* Print the D3D9 adapter index */
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index cfc249c5e4bc..73665a5f9f2d 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -913,7 +913,7 @@ static const SDL_DisplayMode *SDL_GetFullscreenModeMatch(const SDL_DisplayMode *
             }
         }
 
-        SDL_free(modes);
+        SDL_free((void *)modes);
     }
     return mode;
 }
@@ -1068,7 +1068,7 @@ const SDL_DisplayMode *SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID display
 
             closest = mode;
         }
-        SDL_free(modes);
+        SDL_free((void *)modes);
     }
     return closest;
 }
diff --git a/test/testautomation_video.c b/test/testautomation_video.c
index 144c2eb064b1..890e54e129f7 100644
--- a/test/testautomation_video.c
+++ b/test/testautomation_video.c
@@ -359,7 +359,7 @@ int video_getFullscreenDisplayModes(void *arg)
             SDLTest_AssertPass("Call to SDL_GetFullscreenDisplayModes(%" SDL_PRIu32 ")", displays[i]);
             SDLTest_AssertCheck(modes != NULL, "Validate returned value from function; expected != NULL; got: %p", modes);
             SDLTest_AssertCheck(count >= 0, "Validate number of modes; expected: >= 0; got: %d", count);
-            SDL_free(modes);
+            SDL_free((void *)modes);
         }
         SDL_free(displays);
     }
diff --git a/test/testwm.c b/test/testwm.c
index 97d8ad2cf412..884af29ac88d 100644
--- a/test/testwm.c
+++ b/test/testwm.c
@@ -138,7 +138,7 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport)
             column_chars = 0;
         }
     }
-    SDL_free(modes);
+    SDL_free((void *)modes);
 }
 
 void loop()
@@ -212,7 +212,7 @@ void loop()
                     SDL_memcpy(&state->fullscreen_mode, modes[highlighted_mode], sizeof(state->fullscreen_mode));
                     SDL_SetWindowFullscreenMode(window, modes[highlighted_mode]);
                 }
-                SDL_free(modes);
+                SDL_free((void *)modes);
             }
         }
     }