SDL: Fixed warning C4152: nonstandard extension, function/data pointer conversion in expression

From b566bfce071637834ae5e99faa775569040d7398 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 19 Jan 2024 06:36:05 -0800
Subject: [PATCH] Fixed warning C4152: nonstandard extension, function/data
 pointer conversion in expression

---
 src/core/windows/SDL_windows.c        | 2 +-
 src/core/windows/SDL_windows.h        | 2 +-
 src/loadso/windows/SDL_sysloadso.c    | 2 +-
 src/thread/SDL_thread_c.h             | 2 +-
 src/thread/windows/SDL_systhread.c    | 2 +-
 src/video/SDL_blit.c                  | 2 +-
 src/video/windows/SDL_windowsopengl.c | 6 +++---
 src/video/windows/SDL_windowsvulkan.c | 4 ++--
 8 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c
index f6f679bd6da1..616af55c51e4 100644
--- a/src/core/windows/SDL_windows.c
+++ b/src/core/windows/SDL_windows.c
@@ -120,7 +120,7 @@ void WIN_CoUninitialize(void)
 }
 
 #ifndef __WINRT__
-void *WIN_LoadComBaseFunction(const char *name)
+FARPROC WIN_LoadComBaseFunction(const char *name)
 {
     static SDL_bool s_bLoaded;
     static HMODULE s_hComBase;
diff --git a/src/core/windows/SDL_windows.h b/src/core/windows/SDL_windows.h
index 610449565515..67333ac34f08 100644
--- a/src/core/windows/SDL_windows.h
+++ b/src/core/windows/SDL_windows.h
@@ -134,7 +134,7 @@ extern int WIN_SetError(const char *prefix);
 
 #ifndef __WINRT__
 /* Load a function from combase.dll */
-void *WIN_LoadComBaseFunction(const char *name);
+FARPROC WIN_LoadComBaseFunction(const char *name);
 #endif
 
 /* Wrap up the oddities of CoInitialize() into a common function. */
diff --git a/src/loadso/windows/SDL_sysloadso.c b/src/loadso/windows/SDL_sysloadso.c
index 92a61beb0086..12a7d6956a48 100644
--- a/src/loadso/windows/SDL_sysloadso.c
+++ b/src/loadso/windows/SDL_sysloadso.c
@@ -60,7 +60,7 @@ void *SDL_LoadObject(const char *sofile)
 
 SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
 {
-    void *symbol = (void *)GetProcAddress((HMODULE)handle, name);
+    SDL_FunctionPointer symbol = (SDL_FunctionPointer)GetProcAddress((HMODULE)handle, name);
     if (!symbol) {
         char errbuf[512];
         SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h
index 42737a59e9ce..9ae2720b84bd 100644
--- a/src/thread/SDL_thread_c.h
+++ b/src/thread/SDL_thread_c.h
@@ -69,7 +69,7 @@ struct SDL_Thread
     int(SDLCALL *userfunc)(void *);
     void *userdata;
     void *data;
-    void *endfunc; /* only used on some platforms. */
+    SDL_FunctionPointer endfunc; /* only used on some platforms. */
 };
 
 /* This is the function called to run a thread */
diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c
index c8b564f7a546..e2643f0993b5 100644
--- a/src/thread/windows/SDL_systhread.c
+++ b/src/thread/windows/SDL_systhread.c
@@ -82,7 +82,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread)
     const DWORD flags = thread->stacksize ? STACK_SIZE_PARAM_IS_A_RESERVATION : 0;
 
     /* Save the function which we will have to call to clear the RTL of calling app! */
-    thread->endfunc = pfnEndThread;
+    thread->endfunc = (SDL_FunctionPointer)pfnEndThread;
 
     /* thread->stacksize == 0 means "system default", same as win32 expects */
     if (pfnBeginThread) {
diff --git a/src/video/SDL_blit.c b/src/video/SDL_blit.c
index fb82675bc1ac..56c61a19e35a 100644
--- a/src/video/SDL_blit.c
+++ b/src/video/SDL_blit.c
@@ -271,7 +271,7 @@ int SDL_CalculateBlit(SDL_Surface *surface)
             blit = SDL_Blit_Slow;
         }
     }
-    map->data = blit;
+    map->data = (void *)blit;
 
     /* Make sure we have a blit function */
     if (!blit) {
diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c
index d7bc3146be61..6d4e90e9fd49 100644
--- a/src/video/windows/SDL_windowsopengl.c
+++ b/src/video/windows/SDL_windowsopengl.c
@@ -214,13 +214,13 @@ int WIN_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 
 SDL_FunctionPointer WIN_GL_GetProcAddress(SDL_VideoDevice *_this, const char *proc)
 {
-    void *func;
+    SDL_FunctionPointer func;
 
     /* This is to pick up extensions */
-    func = _this->gl_data->wglGetProcAddress(proc);
+    func = (SDL_FunctionPointer)_this->gl_data->wglGetProcAddress(proc);
     if (!func) {
         /* This is probably a normal GL function */
-        func = GetProcAddress(_this->gl_config.dll_handle, proc);
+        func = (SDL_FunctionPointer)GetProcAddress(_this->gl_config.dll_handle, proc);
     }
     return func;
 }
diff --git a/src/video/windows/SDL_windowsvulkan.c b/src/video/windows/SDL_windowsvulkan.c
index b2eee2b56e70..0115904f4764 100644
--- a/src/video/windows/SDL_windowsvulkan.c
+++ b/src/video/windows/SDL_windowsvulkan.c
@@ -65,9 +65,9 @@ int WIN_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
     if (!vkGetInstanceProcAddr) {
         goto fail;
     }
-    _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+    _this->vulkan_config.vkGetInstanceProcAddr = (SDL_FunctionPointer)vkGetInstanceProcAddr;
     _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
-        (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+        (SDL_FunctionPointer)vkGetInstanceProcAddr(
             VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
     if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
         goto fail;