Browse Source

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

Sam Lantinga 1 year ago
parent
commit
b566bfce07

+ 1 - 1
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;

+ 1 - 1
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. */

+ 1 - 1
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));

+ 1 - 1
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 */

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 3 - 3
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;
 }

+ 2 - 2
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;