[Commits] SDL: revert the recent typecast assignment changes (see bug #4079)

libsdl.org revision control commits-owner at libsdl.org
Tue Feb 13 13:28:18 PST 2018


details:   https://hg.libsdl.org/SDL/rev/e917e911dab6
changeset: 11872:e917e911dab6
user:      sezero <sezero at users.sourceforge.net>
date:      Mon Feb 12 17:00:00 2018 +0300
description:
revert the recent typecast assignment changes (see bug #4079)

also change the void* typedefs for the two vulkan function
pointers added in vulkan_internal.h  into generic function
pointer typedefs.

diffstat:

 src/audio/SDL_audio.c                      |  10 ++--
 src/audio/directsound/SDL_directsound.c    |   2 +-
 src/audio/wasapi/SDL_wasapi_win32.c        |   4 +-
 src/core/linux/SDL_dbus.c                  |   2 +-
 src/core/windows/SDL_xinput.c              |  10 ++--
 src/dynapi/SDL_dynapi.c                    |   2 +-
 src/filesystem/windows/SDL_sysfilesystem.c |   2 +-
 src/render/direct3d11/SDL_render_d3d11.c   |   4 +-
 src/render/opengl/SDL_render_gl.c          |  27 +++++++------
 src/render/opengl/SDL_shaders_gl.c         |  28 +++++++-------
 src/render/opengles/SDL_render_gles.c      |   4 +-
 src/render/opengles2/SDL_render_gles2.c    |   4 +-
 src/thread/pthread/SDL_systhread.c         |   6 ++-
 src/thread/windows/SDL_systhread.c         |   2 +-
 src/video/SDL_blit.c                       |   4 +-
 src/video/SDL_egl.c                        |   4 +-
 src/video/SDL_video.c                      |  20 ++++-----
 src/video/SDL_vulkan_internal.h            |   4 +-
 src/video/android/SDL_androidvulkan.c      |   6 +-
 src/video/cocoa/SDL_cocoavulkan.m          |   6 +-
 src/video/mir/SDL_mirdyn.c                 |   2 +-
 src/video/mir/SDL_mirvulkan.c              |   7 ++-
 src/video/uikit/SDL_uikitvulkan.m          |   3 +-
 src/video/wayland/SDL_waylanddyn.c         |   2 +-
 src/video/wayland/SDL_waylandvulkan.c      |   7 ++-
 src/video/windows/SDL_windowsevents.c      |   4 +-
 src/video/windows/SDL_windowskeyboard.c    |  12 +++---
 src/video/windows/SDL_windowsopengl.c      |  29 ++++++++------
 src/video/windows/SDL_windowsvideo.c       |  16 ++++---
 src/video/windows/SDL_windowsvulkan.c      |   6 +-
 src/video/winrt/SDL_winrtopengles.cpp      |   3 +-
 src/video/x11/SDL_x11dyn.c                 |   8 ++-
 src/video/x11/SDL_x11opengl.c              |  60 +++++++++++++++++++-----------
 src/video/x11/SDL_x11vulkan.c              |  10 ++--
 34 files changed, 174 insertions(+), 146 deletions(-)

diffs (925 lines):

diff -r c207c3ab46ee -r e917e911dab6 src/audio/SDL_audio.c
--- a/src/audio/SDL_audio.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/audio/SDL_audio.c	Mon Feb 12 17:00:00 2018 +0300
@@ -151,11 +151,11 @@
         return SDL_FALSE;
     }
 
-    *(void **)&SRC_src_new = SDL_LoadFunction(SRC_lib, "src_new");
-    *(void **)&SRC_src_process = SDL_LoadFunction(SRC_lib, "src_process");
-    *(void **)&SRC_src_reset = SDL_LoadFunction(SRC_lib, "src_reset");
-    *(void **)&SRC_src_delete = SDL_LoadFunction(SRC_lib, "src_delete");
-    *(void **)&SRC_src_strerror = SDL_LoadFunction(SRC_lib, "src_strerror");
+    SRC_src_new = (SRC_STATE* (*)(int converter_type, int channels, int *error))SDL_LoadFunction(SRC_lib, "src_new");
+    SRC_src_process = (int (*)(SRC_STATE *state, SRC_DATA *data))SDL_LoadFunction(SRC_lib, "src_process");
+    SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset");
+    SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete");
+    SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror");
 
     if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) {
         SDL_UnloadObject(SRC_lib);
diff -r c207c3ab46ee -r e917e911dab6 src/audio/directsound/SDL_directsound.c
--- a/src/audio/directsound/SDL_directsound.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/audio/directsound/SDL_directsound.c	Mon Feb 12 17:00:00 2018 +0300
@@ -74,7 +74,7 @@
     } else {
         /* Now make sure we have DirectX 8 or better... */
         #define DSOUNDLOAD(f) { \
-            *(void**)&p##f = SDL_LoadFunction(DSoundDLL, #f); \
+            p##f = (fn##f) SDL_LoadFunction(DSoundDLL, #f); \
             if (!p##f) loaded = 0; \
         }
         loaded = 1;  /* will reset if necessary. */
diff -r c207c3ab46ee -r e917e911dab6 src/audio/wasapi/SDL_wasapi_win32.c
--- a/src/audio/wasapi/SDL_wasapi_win32.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/audio/wasapi/SDL_wasapi_win32.c	Mon Feb 12 17:00:00 2018 +0300
@@ -256,8 +256,8 @@
 
     libavrt = LoadLibraryW(L"avrt.dll");  /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */
     if (libavrt) {
-        *(void **)&pAvSetMmThreadCharacteristicsW = GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW");
-        *(void **)&pAvRevertMmThreadCharacteristics = GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics");
+        pAvSetMmThreadCharacteristicsW = (pfnAvSetMmThreadCharacteristicsW) GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW");
+        pAvRevertMmThreadCharacteristics = (pfnAvRevertMmThreadCharacteristics) GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics");
     }
 
     return 0;
diff -r c207c3ab46ee -r e917e911dab6 src/core/linux/SDL_dbus.c
--- a/src/core/linux/SDL_dbus.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/core/linux/SDL_dbus.c	Mon Feb 12 17:00:00 2018 +0300
@@ -33,7 +33,7 @@
 LoadDBUSSyms(void)
 {
     #define SDL_DBUS_SYM2(x, y) \
-        if (!(*(void**)&dbus.x = SDL_LoadFunction(dbus_handle, #y))) return -1
+        if (!(dbus.x = SDL_LoadFunction(dbus_handle, #y))) return -1
         
     #define SDL_DBUS_SYM(x) \
         SDL_DBUS_SYM2(x, dbus_##x)
diff -r c207c3ab46ee -r e917e911dab6 src/core/windows/SDL_xinput.c
--- a/src/core/windows/SDL_xinput.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/core/windows/SDL_xinput.c	Mon Feb 12 17:00:00 2018 +0300
@@ -104,13 +104,13 @@
     s_XInputDLLRefCount = 1;
 
     /* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */
-    *(void**)&SDL_XInputGetState = GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
+    SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
     if (!SDL_XInputGetState) {
-        *(void**)&SDL_XInputGetState = GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
+        SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
     }
-    *(void**)&SDL_XInputSetState = GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
-    *(void**)&SDL_XInputGetCapabilities = GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
-    *(void**)&SDL_XInputGetBatteryInformation = GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetBatteryInformation" );
+    SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
+    SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
+    SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetBatteryInformation" );
     if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) {
         WIN_UnloadXInputDLL();
         return -1;
diff -r c207c3ab46ee -r e917e911dab6 src/dynapi/SDL_dynapi.c
--- a/src/dynapi/SDL_dynapi.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/dynapi/SDL_dynapi.c	Mon Feb 12 17:00:00 2018 +0300
@@ -263,7 +263,7 @@
     SDL_DYNAPI_ENTRYFN entry = SDL_DYNAPI_entry;  /* funcs from here by default. */
 
     if (libname) {
-        *(void **)&entry = get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
+        entry = (SDL_DYNAPI_ENTRYFN) get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
         if (!entry) {
             /* !!! FIXME: fail to startup here instead? */
             /* !!! FIXME: definitely warn user. */
diff -r c207c3ab46ee -r e917e911dab6 src/filesystem/windows/SDL_sysfilesystem.c
--- a/src/filesystem/windows/SDL_sysfilesystem.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/filesystem/windows/SDL_sysfilesystem.c	Mon Feb 12 17:00:00 2018 +0300
@@ -50,7 +50,7 @@
         return NULL;
     }
 
-    *(void**)&pGetModuleFileNameExW = GetProcAddress(psapi, "GetModuleFileNameExW");
+    pGetModuleFileNameExW = (GetModuleFileNameExW_t)GetProcAddress(psapi, "GetModuleFileNameExW");
     if (!pGetModuleFileNameExW) {
         WIN_SetError("Couldn't find GetModuleFileNameExW");
         FreeLibrary(psapi);
diff -r c207c3ab46ee -r e917e911dab6 src/render/direct3d11/SDL_render_d3d11.c
--- a/src/render/direct3d11/SDL_render_d3d11.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/render/direct3d11/SDL_render_d3d11.c	Mon Feb 12 17:00:00 2018 +0300
@@ -568,7 +568,7 @@
         goto done;
     }
 
-    *(void**)&CreateDXGIFactoryFunc = SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
+    CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
     if (!CreateDXGIFactoryFunc) {
         result = E_FAIL;
         goto done;
@@ -580,7 +580,7 @@
         goto done;
     }
 
-    *(void**)D3D11CreateDeviceFunc = SDL_LoadFunction(data->hD3D11Mod, "D3D11CreateDevice");
+    D3D11CreateDeviceFunc = (PFN_D3D11_CREATE_DEVICE)SDL_LoadFunction(data->hD3D11Mod, "D3D11CreateDevice");
     if (!D3D11CreateDeviceFunc) {
         result = E_FAIL;
         goto done;
diff -r c207c3ab46ee -r e917e911dab6 src/render/opengl/SDL_render_gl.c
--- a/src/render/opengl/SDL_render_gl.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/render/opengl/SDL_render_gl.c	Mon Feb 12 17:00:00 2018 +0300
@@ -272,7 +272,7 @@
 #else
 #define SDL_PROC(ret,func,params) \
     do { \
-        *(void **)&data->func = SDL_GL_GetProcAddress(#func); \
+        data->func = SDL_GL_GetProcAddress(#func); \
         if ( ! data->func ) { \
             return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \
         } \
@@ -490,9 +490,7 @@
         data->debug_enabled = SDL_TRUE;
     }
     if (data->debug_enabled && SDL_GL_ExtensionSupported("GL_ARB_debug_output")) {
-        PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc;
-       
-        *(void **)&glDebugMessageCallbackARBFunc = SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
+        PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
 
         data->GL_ARB_debug_output_supported = SDL_TRUE;
         data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)(char *)&data->next_error_callback);
@@ -521,7 +519,7 @@
 
     /* Check for multitexture support */
     if (SDL_GL_ExtensionSupported("GL_ARB_multitexture")) {
-        *(void **)&data->glActiveTextureARB = SDL_GL_GetProcAddress("glActiveTextureARB");
+        data->glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glActiveTextureARB");
         if (data->glActiveTextureARB) {
             data->GL_ARB_multitexture_supported = SDL_TRUE;
             data->glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &data->num_texture_units);
@@ -549,11 +547,16 @@
 
     if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) {
         data->GL_EXT_framebuffer_object_supported = SDL_TRUE;
-        *(void**)&data->glGenFramebuffersEXT = SDL_GL_GetProcAddress("glGenFramebuffersEXT");
-        *(void**)&data->glDeleteFramebuffersEXT = SDL_GL_GetProcAddress("glDeleteFramebuffersEXT");
-        *(void**)&data->glFramebufferTexture2DEXT = SDL_GL_GetProcAddress("glFramebufferTexture2DEXT");
-        *(void**)&data->glBindFramebufferEXT = SDL_GL_GetProcAddress("glBindFramebufferEXT");
-        *(void**)&data->glCheckFramebufferStatusEXT = SDL_GL_GetProcAddress("glCheckFramebufferStatusEXT");
+        data->glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)
+            SDL_GL_GetProcAddress("glGenFramebuffersEXT");
+        data->glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)
+            SDL_GL_GetProcAddress("glDeleteFramebuffersEXT");
+        data->glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
+            SDL_GL_GetProcAddress("glFramebufferTexture2DEXT");
+        data->glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)
+            SDL_GL_GetProcAddress("glBindFramebufferEXT");
+        data->glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
+            SDL_GL_GetProcAddress("glCheckFramebufferStatusEXT");
         renderer->info.flags |= SDL_RENDERER_TARGETTEXTURE;
     }
     data->framebuffers = NULL;
@@ -1610,9 +1613,7 @@
 
         GL_ClearErrors(renderer);
         if (data->GL_ARB_debug_output_supported) {
-            PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc;
-            
-            *(void **)&glDebugMessageCallbackARBFunc = SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
+            PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
 
             /* Uh oh, we don't have a safe way of removing ourselves from the callback chain, if it changed after we set our callback. */
             /* For now, just always replace the callback with the original one */
diff -r c207c3ab46ee -r e917e911dab6 src/render/opengl/SDL_shaders_gl.c
--- a/src/render/opengl/SDL_shaders_gl.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/render/opengl/SDL_shaders_gl.c	Mon Feb 12 17:00:00 2018 +0300
@@ -453,20 +453,20 @@
         SDL_GL_ExtensionSupported("GL_ARB_shading_language_100") &&
         SDL_GL_ExtensionSupported("GL_ARB_vertex_shader") &&
         SDL_GL_ExtensionSupported("GL_ARB_fragment_shader")) {
-        *(void**)&ctx->glGetError = SDL_GL_GetProcAddress("glGetError");
-        *(void **)&ctx->glAttachObjectARB = SDL_GL_GetProcAddress("glAttachObjectARB");
-        *(void **)&ctx->glCompileShaderARB = SDL_GL_GetProcAddress("glCompileShaderARB");
-        *(void **)&ctx->glCreateProgramObjectARB = SDL_GL_GetProcAddress("glCreateProgramObjectARB");
-        *(void **)&ctx->glCreateShaderObjectARB = SDL_GL_GetProcAddress("glCreateShaderObjectARB");
-        *(void **)&ctx->glDeleteObjectARB = SDL_GL_GetProcAddress("glDeleteObjectARB");
-        *(void **)&ctx->glGetInfoLogARB = SDL_GL_GetProcAddress("glGetInfoLogARB");
-        *(void **)&ctx->glGetObjectParameterivARB = SDL_GL_GetProcAddress("glGetObjectParameterivARB");
-        *(void **)&ctx->glGetUniformLocationARB = SDL_GL_GetProcAddress("glGetUniformLocationARB");
-        *(void **)&ctx->glLinkProgramARB = SDL_GL_GetProcAddress("glLinkProgramARB");
-        *(void **)&ctx->glShaderSourceARB = SDL_GL_GetProcAddress("glShaderSourceARB");
-        *(void **)&ctx->glUniform1iARB = SDL_GL_GetProcAddress("glUniform1iARB");
-        *(void **)&ctx->glUniform1fARB = SDL_GL_GetProcAddress("glUniform1fARB");
-        *(void **)&ctx->glUseProgramObjectARB = SDL_GL_GetProcAddress("glUseProgramObjectARB");
+        ctx->glGetError = (GLenum (*)(void)) SDL_GL_GetProcAddress("glGetError");
+        ctx->glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) SDL_GL_GetProcAddress("glAttachObjectARB");
+        ctx->glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) SDL_GL_GetProcAddress("glCompileShaderARB");
+        ctx->glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glCreateProgramObjectARB");
+        ctx->glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) SDL_GL_GetProcAddress("glCreateShaderObjectARB");
+        ctx->glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) SDL_GL_GetProcAddress("glDeleteObjectARB");
+        ctx->glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) SDL_GL_GetProcAddress("glGetInfoLogARB");
+        ctx->glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterivARB");
+        ctx->glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetUniformLocationARB");
+        ctx->glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) SDL_GL_GetProcAddress("glLinkProgramARB");
+        ctx->glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glShaderSourceARB");
+        ctx->glUniform1iARB = (PFNGLUNIFORM1IARBPROC) SDL_GL_GetProcAddress("glUniform1iARB");
+        ctx->glUniform1fARB = (PFNGLUNIFORM1FARBPROC) SDL_GL_GetProcAddress("glUniform1fARB");
+        ctx->glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glUseProgramObjectARB");
         if (ctx->glGetError &&
             ctx->glAttachObjectARB &&
             ctx->glCompileShaderARB &&
diff -r c207c3ab46ee -r e917e911dab6 src/render/opengles/SDL_render_gles.c
--- a/src/render/opengles/SDL_render_gles.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/render/opengles/SDL_render_gles.c	Mon Feb 12 17:00:00 2018 +0300
@@ -198,14 +198,14 @@
 #else
 #define SDL_PROC(ret,func,params) \
     do { \
-        *(void**)&data->func = SDL_GL_GetProcAddress(#func); \
+        data->func = SDL_GL_GetProcAddress(#func); \
         if ( ! data->func ) { \
             return SDL_SetError("Couldn't load GLES function %s: %s", #func, SDL_GetError()); \
         } \
     } while ( 0 );
 #define SDL_PROC_OES(ret,func,params) \
     do { \
-        *(void**)&data->func = SDL_GL_GetProcAddress(#func); \
+        data->func = SDL_GL_GetProcAddress(#func); \
     } while ( 0 );    
 #endif /* __SDL_NOGETPROCADDR__ */
 
diff -r c207c3ab46ee -r e917e911dab6 src/render/opengles2/SDL_render_gles2.c
--- a/src/render/opengles2/SDL_render_gles2.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/render/opengles2/SDL_render_gles2.c	Mon Feb 12 17:00:00 2018 +0300
@@ -290,11 +290,11 @@
 #endif
 
 #if defined __SDL_NOGETPROCADDR__
-#define SDL_PROC(ret,func,params) *(void**)&data->func=func;
+#define SDL_PROC(ret,func,params) data->func=func;
 #else
 #define SDL_PROC(ret,func,params) \
     do { \
-        *(void **)&data->func = SDL_GL_GetProcAddress(#func); \
+        data->func = SDL_GL_GetProcAddress(#func); \
         if ( ! data->func ) { \
             return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \
         } \
diff -r c207c3ab46ee -r e917e911dab6 src/thread/pthread/SDL_systhread.c
--- a/src/thread/pthread/SDL_systhread.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/thread/pthread/SDL_systhread.c	Mon Feb 12 17:00:00 2018 +0300
@@ -91,7 +91,11 @@
     #if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
     if (!checked_setname) {
         void *fn = dlsym(RTLD_DEFAULT, "pthread_setname_np");
-        *(void **)&ppthread_setname_np = fn;
+        #if defined(__MACOSX__) || defined(__IPHONEOS__)
+        ppthread_setname_np = (int(*)(const char*)) fn;
+        #elif defined(__LINUX__)
+        ppthread_setname_np = (int(*)(pthread_t, const char*)) fn;
+        #endif
         checked_setname = SDL_TRUE;
     }
     #endif
diff -r c207c3ab46ee -r e917e911dab6 src/thread/windows/SDL_systhread.c
--- a/src/thread/windows/SDL_systhread.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/thread/windows/SDL_systhread.c	Mon Feb 12 17:00:00 2018 +0300
@@ -178,7 +178,7 @@
         if (!kernel32) {
             kernel32 = LoadLibraryW(L"kernel32.dll");
             if (kernel32) {
-                *(void**)&pSetThreadDescription = GetProcAddress(kernel32, "SetThreadDescription");
+                pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription");
             }
         }
 
diff -r c207c3ab46ee -r e917e911dab6 src/video/SDL_blit.c
--- a/src/video/SDL_blit.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/SDL_blit.c	Mon Feb 12 17:00:00 2018 +0300
@@ -82,7 +82,7 @@
         info->dst_pitch = dst->pitch;
         info->dst_skip =
             info->dst_pitch - info->dst_w * info->dst_fmt->BytesPerPixel;
-        *(void**)&RunBlit = src->map->data;
+        RunBlit = (SDL_BlitFunc) src->map->data;
 
         /* Run the actual software blit */
         RunBlit(info);
@@ -282,7 +282,7 @@
             blit = SDL_Blit_Slow;
         }
     }
-    *(SDL_BlitFunc *)&map->data = blit;
+    map->data = blit;
 
     /* Make sure we have a blit function */
     if (blit == NULL) {
diff -r c207c3ab46ee -r e917e911dab6 src/video/SDL_egl.c
--- a/src/video/SDL_egl.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/SDL_egl.c	Mon Feb 12 17:00:00 2018 +0300
@@ -86,7 +86,7 @@
 _this->egl_data->NAME = (void *)NAME;
 #else
 #define LOAD_FUNC(NAME) \
-*(void**)&_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \
+_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \
 if (!_this->egl_data->NAME) \
 { \
     return SDL_SetError("Could not retrieve EGL function " #NAME); \
@@ -417,7 +417,7 @@
             _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(size_t)native_display, NULL);
         } else {
             if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) {
-                *(void**)&_this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT");
+                _this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT");
                 if (_this->egl_data->eglGetPlatformDisplayEXT) {
                     _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(size_t)native_display, NULL);
                 }
diff -r c207c3ab46ee -r e917e911dab6 src/video/SDL_video.c
--- a/src/video/SDL_video.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/SDL_video.c	Mon Feb 12 17:00:00 2018 +0300
@@ -224,7 +224,7 @@
                 const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
                 const char *vendor = NULL;
 
-                *(void**)&glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+                glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
                 if (glGetStringFunc) {
                     vendor = (const char *) glGetStringFunc(GL_VENDOR);
                 }
@@ -2870,7 +2870,7 @@
 
     /* Lookup the available extensions */
 
-    *(void**)&glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+    glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
     if (!glGetStringFunc) {
         return SDL_FALSE;
     }
@@ -2881,8 +2881,8 @@
         GLint num_exts = 0;
         GLint i;
 
-        *(void**)&glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi");
-        *(void**)&glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
+        glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi");
+        glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
         if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
             return SDL_FALSE;
         }
@@ -3342,13 +3342,13 @@
     }
 
 #if SDL_VIDEO_OPENGL
-    *(void**)&glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+    glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
     if (!glGetStringFunc) {
         return -1;
     }
 
     if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
-        *(void**)&glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
+        glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
 
         if (glGetFramebufferAttachmentParameterivFunc) {
             glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value);
@@ -3359,7 +3359,7 @@
 #endif
     {
         void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
-        *(void**)&glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
+        glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
         if (glGetIntegervFunc) {
             glGetIntegervFunc(attrib, (GLint *) value);
         } else {
@@ -3367,7 +3367,7 @@
         }
     }
 
-    *(void**)&glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
+    glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
     if (!glGetErrorFunc) {
         return -1;
     }
@@ -3995,7 +3995,6 @@
 
 void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
 {
-    void *func = NULL;
     if (!_this) {
         SDL_UninitializedVideo();
         return NULL;
@@ -4004,8 +4003,7 @@
         SDL_SetError("No Vulkan loader has been loaded");
         return NULL;
     }
-    *(PFN_vkGetInstanceProcAddr*)&func =  _this->vulkan_config.vkGetInstanceProcAddr;
-    return func;
+    return _this->vulkan_config.vkGetInstanceProcAddr;
 }
 
 void SDL_Vulkan_UnloadLibrary(void)
diff -r c207c3ab46ee -r e917e911dab6 src/video/SDL_vulkan_internal.h
--- a/src/video/SDL_vulkan_internal.h	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/SDL_vulkan_internal.h	Mon Feb 12 17:00:00 2018 +0300
@@ -81,8 +81,8 @@
 /* No SDL Vulkan support, just include the header for typedefs */
 #include "SDL_vulkan.h"
 
-typedef void* PFN_vkGetInstanceProcAddr;
-typedef void* PFN_vkEnumerateInstanceExtensionProperties;
+typedef void (*PFN_vkGetInstanceProcAddr) ();
+typedef int  (*PFN_vkEnumerateInstanceExtensionProperties) ();
 
 #endif /* SDL_VIDEO_VULKAN */
 
diff -r c207c3ab46ee -r e917e911dab6 src/video/android/SDL_androidvulkan.c
--- a/src/video/android/SDL_androidvulkan.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/android/SDL_androidvulkan.c	Mon Feb 12 17:00:00 2018 +0300
@@ -56,13 +56,13 @@
         return -1;
     SDL_strlcpy(_this->vulkan_config.loader_path, path,
                 SDL_arraysize(_this->vulkan_config.loader_path));
-    *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
+    vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
         _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
     if(!vkGetInstanceProcAddr)
         goto fail;
-    _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
+    _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
     _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
-        (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(
+        (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
             VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
     if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
         goto fail;
diff -r c207c3ab46ee -r e917e911dab6 src/video/cocoa/SDL_cocoavulkan.m
--- a/src/video/cocoa/SDL_cocoavulkan.m	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/cocoa/SDL_cocoavulkan.m	Mon Feb 12 17:00:00 2018 +0300
@@ -83,7 +83,7 @@
         }
         SDL_strlcpy(_this->vulkan_config.loader_path, path,
                     SDL_arraysize(_this->vulkan_config.loader_path));
-        *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
+        vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
             _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
     }
 
@@ -95,9 +95,9 @@
         goto fail;
     }
 
-    _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
+    _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
     _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
-        (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(
+        (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
             VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
     if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
         goto fail;
diff -r c207c3ab46ee -r e917e911dab6 src/video/mir/SDL_mirdyn.c
--- a/src/video/mir/SDL_mirdyn.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/mir/SDL_mirdyn.c	Mon Feb 12 17:00:00 2018 +0300
@@ -139,7 +139,7 @@
 #include "SDL_mirsym.h"
 
 #define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname;
-#define SDL_MIR_SYM(rc,fn,params) *(void**)&MIR_##fn = MIR_GetSym(#fn,thismod);
+#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod);
 #define SDL_MIR_SYM_CONST(type,name) MIR_##name = *(SDL_DYMMIRCONST_##name*) MIR_GetSym(#name,thismod);
 #include "SDL_mirsym.h"
 
diff -r c207c3ab46ee -r e917e911dab6 src/video/mir/SDL_mirvulkan.c
--- a/src/video/mir/SDL_mirvulkan.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/mir/SDL_mirvulkan.c	Mon Feb 12 17:00:00 2018 +0300
@@ -56,13 +56,14 @@
         return -1;
     SDL_strlcpy(_this->vulkan_config.loader_path, path,
                 SDL_arraysize(_this->vulkan_config.loader_path));
-    *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
+    vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
         _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
     if(!vkGetInstanceProcAddr)
         goto fail;
-    _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
+    _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
     _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
-        (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+        (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+            VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
     if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
         goto fail;
     extensions = SDL_Vulkan_CreateInstanceExtensionsList(
diff -r c207c3ab46ee -r e917e911dab6 src/video/uikit/SDL_uikitvulkan.m
--- a/src/video/uikit/SDL_uikitvulkan.m	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/uikit/SDL_uikitvulkan.m	Mon Feb 12 17:00:00 2018 +0300
@@ -84,7 +84,8 @@
         }
         SDL_strlcpy(_this->vulkan_config.loader_path, path,
                     SDL_arraysize(_this->vulkan_config.loader_path));
-        *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
+        vkGetInstanceProcAddr =
+            (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
                                     _this->vulkan_config.loader_handle,
                                     "vkGetInstanceProcAddr");
     }
diff -r c207c3ab46ee -r e917e911dab6 src/video/wayland/SDL_waylanddyn.c
--- a/src/video/wayland/SDL_waylanddyn.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/wayland/SDL_waylanddyn.c	Mon Feb 12 17:00:00 2018 +0300
@@ -147,7 +147,7 @@
 #include "SDL_waylandsym.h"
 
 #define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname;
-#define SDL_WAYLAND_SYM(rc,fn,params) *(void**)&WAYLAND_##fn = WAYLAND_GetSym(#fn,thismod);
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod);
 #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod);
 #include "SDL_waylandsym.h"
 
diff -r c207c3ab46ee -r e917e911dab6 src/video/wayland/SDL_waylandvulkan.c
--- a/src/video/wayland/SDL_waylandvulkan.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/wayland/SDL_waylandvulkan.c	Mon Feb 12 17:00:00 2018 +0300
@@ -56,12 +56,13 @@
         return -1;
     SDL_strlcpy(_this->vulkan_config.loader_path, path,
                 SDL_arraysize(_this->vulkan_config.loader_path));
-    *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
+    vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+        _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
     if(!vkGetInstanceProcAddr)
         goto fail;
-    _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
+    _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
     _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
-        (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(
+        (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
             VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
     if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
         goto fail;
diff -r c207c3ab46ee -r e917e911dab6 src/video/windows/SDL_windowsevents.c
--- a/src/video/windows/SDL_windowsevents.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/windows/SDL_windowsevents.c	Mon Feb 12 17:00:00 2018 +0300
@@ -1086,9 +1086,7 @@
     HMODULE handle = GetModuleHandleW(L"ntdll.dll");
     if (handle) {
         typedef LONG(WINAPI* RtlGetVersionPtr)(struct SDL_WIN_OSVERSIONINFOW*);
-        RtlGetVersionPtr getVersionPtr;
-       
-        *(void**)&getVersionPtr = GetProcAddress(handle, "RtlGetVersion");
+        RtlGetVersionPtr getVersionPtr = (RtlGetVersionPtr)GetProcAddress(handle, "RtlGetVersion");
         if (getVersionPtr != NULL) {
             struct SDL_WIN_OSVERSIONINFOW info;
             SDL_zero(info);
diff -r c207c3ab46ee -r e917e911dab6 src/video/windows/SDL_windowskeyboard.c
--- a/src/video/windows/SDL_windowskeyboard.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/windows/SDL_windowskeyboard.c	Mon Feb 12 17:00:00 2018 +0300
@@ -354,10 +354,10 @@
         SDL_ClearError();
         return;
     }
-    *(void**)&videodata->ImmLockIMC = SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC");
-    *(void**)&videodata->ImmUnlockIMC = SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMC");
-    *(void**)&videodata->ImmLockIMCC = SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMCC");
-    *(void**)&videodata->ImmUnlockIMCC = SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMCC");
+    videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC");
+    videodata->ImmUnlockIMC = (BOOL (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMC");
+    videodata->ImmLockIMCC = (LPVOID (WINAPI *)(HIMCC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMCC");
+    videodata->ImmUnlockIMCC = (BOOL (WINAPI *)(HIMCC))SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMCC");
 
     IME_SetWindow(videodata, hwnd);
     videodata->ime_himc = ImmGetContext(hwnd);
@@ -654,9 +654,9 @@
     if (!hime)
         return;
 
-    *(void**)&videodata->GetReadingString =
+    videodata->GetReadingString = (UINT (WINAPI *)(HIMC, UINT, LPWSTR, PINT, BOOL*, PUINT))
         SDL_LoadFunction(hime, "GetReadingString");
-    *(void**)&videodata->ShowReadingWindow =
+    videodata->ShowReadingWindow = (BOOL (WINAPI *)(HIMC, BOOL))
         SDL_LoadFunction(hime, "ShowReadingWindow");
 
     if (videodata->ShowReadingWindow) {
diff -r c207c3ab46ee -r e917e911dab6 src/video/windows/SDL_windowsopengl.c
--- a/src/video/windows/SDL_windowsopengl.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/windows/SDL_windowsopengl.c	Mon Feb 12 17:00:00 2018 +0300
@@ -119,15 +119,15 @@
 
     /* Load function pointers */
     handle = _this->gl_config.dll_handle;
-    *(void**)&_this->gl_data->wglGetProcAddress =
+    _this->gl_data->wglGetProcAddress = (void *(WINAPI *) (const char *))
         SDL_LoadFunction(handle, "wglGetProcAddress");
-    *(void**)&_this->gl_data->wglCreateContext =
+    _this->gl_data->wglCreateContext = (HGLRC(WINAPI *) (HDC))
         SDL_LoadFunction(handle, "wglCreateContext");
-    *(void**)&_this->gl_data->wglDeleteContext =
+    _this->gl_data->wglDeleteContext = (BOOL(WINAPI *) (HGLRC))
         SDL_LoadFunction(handle, "wglDeleteContext");
-    *(void**)&_this->gl_data->wglMakeCurrent =
+    _this->gl_data->wglMakeCurrent = (BOOL(WINAPI *) (HDC, HGLRC))
         SDL_LoadFunction(handle, "wglMakeCurrent");
-    *(void**)&_this->gl_data->wglShareLists =
+    _this->gl_data->wglShareLists = (BOOL(WINAPI *) (HGLRC, HGLRC))
         SDL_LoadFunction(handle, "wglShareLists");
 
     if (!_this->gl_data->wglGetProcAddress ||
@@ -409,7 +409,7 @@
     }
     _this->gl_data->wglMakeCurrent(hdc, hglrc);
 
-    *(void**)&wglGetExtensionsStringARB =
+    wglGetExtensionsStringARB = (const char *(WINAPI *) (HDC))
         _this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB");
     if (wglGetExtensionsStringARB) {
         extensions = wglGetExtensionsStringARB(hdc);
@@ -420,9 +420,13 @@
     /* Check for WGL_ARB_pixel_format */
     _this->gl_data->HAS_WGL_ARB_pixel_format = SDL_FALSE;
     if (HasExtension("WGL_ARB_pixel_format", extensions)) {
-        *(void**)&_this->gl_data->wglChoosePixelFormatARB =
+        _this->gl_data->wglChoosePixelFormatARB = (BOOL(WINAPI *)
+                                                   (HDC, const int *,
+                                                    const FLOAT *, UINT,
+                                                    int *, UINT *))
             WIN_GL_GetProcAddress(_this, "wglChoosePixelFormatARB");
-        *(void**)&_this->gl_data->wglGetPixelFormatAttribivARB =
+        _this->gl_data->wglGetPixelFormatAttribivARB =
+            (BOOL(WINAPI *) (HDC, int, int, UINT, const int *, int *))
             WIN_GL_GetProcAddress(_this, "wglGetPixelFormatAttribivARB");
 
         if ((_this->gl_data->wglChoosePixelFormatARB != NULL) &&
@@ -434,9 +438,9 @@
     /* Check for WGL_EXT_swap_control */
     _this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_FALSE;
     if (HasExtension("WGL_EXT_swap_control", extensions)) {
-        *(void**)&_this->gl_data->wglSwapIntervalEXT =
+        _this->gl_data->wglSwapIntervalEXT =
             WIN_GL_GetProcAddress(_this, "wglSwapIntervalEXT");
-        *(void**)&_this->gl_data->wglGetSwapIntervalEXT =
+        _this->gl_data->wglGetSwapIntervalEXT =
             WIN_GL_GetProcAddress(_this, "wglGetSwapIntervalEXT");
         if (HasExtension("WGL_EXT_swap_control_tear", extensions)) {
             _this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_TRUE;
@@ -717,8 +721,9 @@
             return NULL;
         }
 
-        *(void**)&wglCreateContextAttribsARB =
-            _this->gl_data->wglGetProcAddress("wglCreateContextAttribsARB");
+        wglCreateContextAttribsARB =
+            (PFNWGLCREATECONTEXTATTRIBSARBPROC) _this->gl_data->
+            wglGetProcAddress("wglCreateContextAttribsARB");
         if (!wglCreateContextAttribsARB) {
             SDL_SetError("GL 3.x is not supported");
             context = temp_context;
diff -r c207c3ab46ee -r e917e911dab6 src/video/windows/SDL_windowsvideo.c
--- a/src/video/windows/SDL_windowsvideo.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/windows/SDL_windowsvideo.c	Mon Feb 12 17:00:00 2018 +0300
@@ -113,16 +113,16 @@
 
     data->userDLL = SDL_LoadObject("USER32.DLL");
     if (data->userDLL) {
-        *(void**)&data->CloseTouchInputHandle = SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
-        *(void**)&data->GetTouchInputInfo = SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
-        *(void**)&data->RegisterTouchWindow = SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
+        data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
+        data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
+        data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
     } else {
         SDL_ClearError();
     }
 
     data->shcoreDLL = SDL_LoadObject("SHCORE.DLL");
     if (data->shcoreDLL) {
-        *(void**)&data->GetDpiForMonitor = SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor");
+        data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor");
     } else {
         SDL_ClearError();
     }
@@ -256,7 +256,7 @@
         typedef HRESULT (WINAPI *Direct3DCreate9Ex_t)(UINT SDKVersion, IDirect3D9Ex **ppD3D);
         Direct3DCreate9Ex_t Direct3DCreate9ExFunc;
 
-        *(void**)&Direct3DCreate9ExFunc = SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9Ex");
+        Direct3DCreate9ExFunc = (Direct3DCreate9Ex_t)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9Ex");
         if (Direct3DCreate9ExFunc) {
             IDirect3D9Ex *pDirect3D9ExInterface;
             HRESULT hr = Direct3DCreate9ExFunc(D3D_SDK_VERSION, &pDirect3D9ExInterface);
@@ -271,7 +271,7 @@
         }
 #endif /* USE_D3D9EX */
 
-        *(void**)&Direct3DCreate9Func = SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9");
+        Direct3DCreate9Func = (Direct3DCreate9_t)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9");
         if (Direct3DCreate9Func) {
             *pDirect3D9Interface = Direct3DCreate9Func(D3D_SDK_VERSION);
             if (*pDirect3D9Interface) {
@@ -338,7 +338,9 @@
     if (*pDXGIDLL) {
         HRESULT (WINAPI *CreateDXGI)(REFIID riid, void **ppFactory);
 
-        *(void**)&CreateDXGI = SDL_LoadFunction(*pDXGIDLL, "CreateDXGIFactory");
+        CreateDXGI =
+            (HRESULT (WINAPI *) (REFIID, void**)) SDL_LoadFunction(*pDXGIDLL,
+            "CreateDXGIFactory");
         if (CreateDXGI) {
             GUID dxgiGUID = {0x7b7166ec,0x21c7,0x44ae,{0xb2,0x1a,0xc9,0xae,0x32,0x1a,0xe3,0x69}};
             if (!SUCCEEDED(CreateDXGI(&dxgiGUID, (void**)pDXGIFactory))) {
diff -r c207c3ab46ee -r e917e911dab6 src/video/windows/SDL_windowsvulkan.c
--- a/src/video/windows/SDL_windowsvulkan.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/windows/SDL_windowsvulkan.c	Mon Feb 12 17:00:00 2018 +0300
@@ -57,13 +57,13 @@
         return -1;
     SDL_strlcpy(_this->vulkan_config.loader_path, path,
                 SDL_arraysize(_this->vulkan_config.loader_path));
-    *(void **)&vkGetInstanceProcAddr = SDL_LoadFunction(
+    vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
         _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
     if(!vkGetInstanceProcAddr)
         goto fail;
-    _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
+    _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
     _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
-        (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(
+        (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
             VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
     if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
         goto fail;
diff -r c207c3ab46ee -r e917e911dab6 src/video/winrt/SDL_winrtopengles.cpp
--- a/src/video/winrt/SDL_winrtopengles.cpp	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/winrt/SDL_winrtopengles.cpp	Mon Feb 12 17:00:00 2018 +0300
@@ -63,8 +63,7 @@
     }
 
     /* Load ANGLE/WinRT-specific functions */
-    CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow;
-    *(void**)&CreateWinrtEglWindow =  SDL_LoadFunction(_this->egl_data->egl_dll_handle, "CreateWinrtEglWindow");
+    CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow = (CreateWinrtEglWindow_Old_Function) SDL_LoadFunction(_this->egl_data->egl_dll_handle, "CreateWinrtEglWindow");
     if (CreateWinrtEglWindow) {
         /* 'CreateWinrtEglWindow' was found, which means that an an older
          * version of ANGLE/WinRT is being used.  Continue setting up EGL,
diff -r c207c3ab46ee -r e917e911dab6 src/video/x11/SDL_x11dyn.c
--- a/src/video/x11/SDL_x11dyn.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/x11/SDL_x11dyn.c	Mon Feb 12 17:00:00 2018 +0300
@@ -172,12 +172,14 @@
 #include "SDL_x11sym.h"
 
 #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
-#define SDL_X11_SYM(a,fn,x,y,z) *(void**)&X11_##fn = X11_GetSym(#fn,thismod);
+#define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) X11_GetSym(#fn,thismod);
 #include "SDL_x11sym.h"
 
 #ifdef X_HAVE_UTF8_STRING
-        *(void**)&X11_XCreateIC = X11_GetSym("XCreateIC", &SDL_X11_HAVE_UTF8);
-        *(void**)&X11_XGetICValues = X11_GetSym("XGetICValues", &SDL_X11_HAVE_UTF8);
+        X11_XCreateIC = (SDL_DYNX11FN_XCreateIC)
+                        X11_GetSym("XCreateIC", &SDL_X11_HAVE_UTF8);
+        X11_XGetICValues = (SDL_DYNX11FN_XGetICValues)
+                        X11_GetSym("XGetICValues", &SDL_X11_HAVE_UTF8);
 #endif
 
         if (SDL_X11_HAVE_BASEXLIB) {
diff -r c207c3ab46ee -r e917e911dab6 src/video/x11/SDL_x11opengl.c
--- a/src/video/x11/SDL_x11opengl.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/x11/SDL_x11opengl.c	Mon Feb 12 17:00:00 2018 +0300
@@ -189,21 +189,29 @@
 
     /* Load function pointers */
     handle = _this->gl_config.dll_handle;
-    *(void**)&_this->gl_data->glXQueryExtension =
+    _this->gl_data->glXQueryExtension =
+        (Bool (*)(Display *, int *, int *))
             GL_LoadFunction(handle, "glXQueryExtension");
-    *(void**)&_this->gl_data->glXGetProcAddress =
+    _this->gl_data->glXGetProcAddress =
+        (void *(*)(const GLubyte *))
             GL_LoadFunction(handle, "glXGetProcAddressARB");
-    *(void**)&_this->gl_data->glXChooseVisual =
+    _this->gl_data->glXChooseVisual =
+        (XVisualInfo * (*)(Display *, int, int *))
             X11_GL_GetProcAddress(_this, "glXChooseVisual");
-    *(void**)&_this->gl_data->glXCreateContext =
+    _this->gl_data->glXCreateContext =
+        (GLXContext(*)(Display *, XVisualInfo *, GLXContext, int))
             X11_GL_GetProcAddress(_this, "glXCreateContext");
-    *(void**)&_this->gl_data->glXDestroyContext =
+    _this->gl_data->glXDestroyContext =
+        (void (*)(Display *, GLXContext))
             X11_GL_GetProcAddress(_this, "glXDestroyContext");
-    *(void**)&_this->gl_data->glXMakeCurrent =
+    _this->gl_data->glXMakeCurrent =
+        (int (*)(Display *, GLXDrawable, GLXContext))
             X11_GL_GetProcAddress(_this, "glXMakeCurrent");
-    *(void**)&_this->gl_data->glXSwapBuffers =
+    _this->gl_data->glXSwapBuffers =
+        (void (*)(Display *, GLXDrawable))
             X11_GL_GetProcAddress(_this, "glXSwapBuffers");
-    *(void**)&_this->gl_data->glXQueryDrawable =
+    _this->gl_data->glXQueryDrawable =
+        (void (*)(Display*,GLXDrawable,int,unsigned int*))
             X11_GL_GetProcAddress(_this, "glXQueryDrawable");
 
     if (!_this->gl_data->glXQueryExtension ||
@@ -333,11 +341,13 @@
 
     vinfo = X11_GL_GetVisual(_this, display, screen);
     if (vinfo) {
-        GLXContext (*glXGetCurrentContextFunc)(void);
-        GLXDrawable (*glXGetCurrentDrawableFunc)(void);
+        GLXContext (*glXGetCurrentContextFunc) (void) =
+            (GLXContext(*)(void))
+                X11_GL_GetProcAddress(_this, "glXGetCurrentContext");
 
-        *(void**)&glXGetCurrentContextFunc = X11_GL_GetProcAddress(_this, "glXGetCurrentContext");
-        *(void**)&glXGetCurrentDrawableFunc = X11_GL_GetProcAddress(_this, "glXGetCurrentDrawable");
+        GLXDrawable (*glXGetCurrentDrawableFunc) (void) =
+            (GLXDrawable(*)(void))
+                X11_GL_GetProcAddress(_this, "glXGetCurrentDrawable");
 
         if (glXGetCurrentContextFunc && glXGetCurrentDrawableFunc) {
             XSetWindowAttributes xattr;
@@ -363,7 +373,9 @@
         X11_XFree(vinfo);
     }
 
-    *(void**)&glXQueryExtensionsStringFunc = X11_GL_GetProcAddress(_this, "glXQueryExtensionsString");
+    glXQueryExtensionsStringFunc =
+        (const char *(*)(Display *, int)) X11_GL_GetProcAddress(_this,
+                                                                "glXQueryExtensionsString");
     if (glXQueryExtensionsStringFunc) {
         extensions = glXQueryExtensionsStringFunc(display, screen);
     } else {
@@ -373,7 +385,8 @@
     /* Check for GLX_EXT_swap_control(_tear) */
     _this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_FALSE;
     if (HasExtension("GLX_EXT_swap_control", extensions)) {
-        *(void**)&_this->gl_data->glXSwapIntervalEXT =
+        _this->gl_data->glXSwapIntervalEXT =
+            (void (*)(Display*,GLXDrawable,int))
                 X11_GL_GetProcAddress(_this, "glXSwapIntervalEXT");
         if (HasExtension("GLX_EXT_swap_control_tear", extensions)) {
             _this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_TRUE;
@@ -382,23 +395,26 @@
 
     /* Check for GLX_MESA_swap_control */
     if (HasExtension("GLX_MESA_swap_control", extensions)) {
-        *(void**)&_this->gl_data->glXSwapIntervalMESA =
-                X11_GL_GetProcAddress(_this, "glXSwapIntervalMESA");
-        *(void**)&_this->gl_data->glXGetSwapIntervalMESA =
-                X11_GL_GetProcAddress(_this, "glXGetSwapIntervalMESA");
+        _this->gl_data->glXSwapIntervalMESA =
+            (int(*)(int)) X11_GL_GetProcAddress(_this, "glXSwapIntervalMESA");
+        _this->gl_data->glXGetSwapIntervalMESA =
+            (int(*)(void)) X11_GL_GetProcAddress(_this,
+                                                   "glXGetSwapIntervalMESA");
     }
 
     /* Check for GLX_SGI_swap_control */
     if (HasExtension("GLX_SGI_swap_control", extensions)) {
-        *(void**)&_this->gl_data->glXSwapIntervalSGI =
-                 X11_GL_GetProcAddress(_this, "glXSwapIntervalSGI");
+        _this->gl_data->glXSwapIntervalSGI =
+            (int (*)(int)) X11_GL_GetProcAddress(_this, "glXSwapIntervalSGI");
     }
 
     /* Check for GLX_ARB_create_context */
     if (HasExtension("GLX_ARB_create_context", extensions)) {
-        *(void**)&_this->gl_data->glXCreateContextAttribsARB =
+        _this->gl_data->glXCreateContextAttribsARB =
+            (GLXContext (*)(Display*,GLXFBConfig,GLXContext,Bool,const int *))
                 X11_GL_GetProcAddress(_this, "glXCreateContextAttribsARB");
-        *(void**)&_this->gl_data->glXChooseFBConfig =
+        _this->gl_data->glXChooseFBConfig =
+            (GLXFBConfig *(*)(Display *, int, const int *, int *))
                 X11_GL_GetProcAddress(_this, "glXChooseFBConfig");
     }
 
diff -r c207c3ab46ee -r e917e911dab6 src/video/x11/SDL_x11vulkan.c
--- a/src/video/x11/SDL_x11vulkan.c	Tue Feb 13 13:25:59 2018 -0800
+++ b/src/video/x11/SDL_x11vulkan.c	Mon Feb 12 17:00:00 2018 +0300
@@ -57,14 +57,14 @@
     if(!_this->vulkan_config.loader_handle)
         return -1;
     SDL_strlcpy(_this->vulkan_config.loader_path, path, SDL_arraysize(_this->vulkan_config.loader_path));
-    *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
+    vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
         _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
     if(!vkGetInstanceProcAddr)
         goto fail;
-    _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
+    _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
     _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
-        (PFN_vkEnumerateInstanceExtensionProperties)
-        _this->vulkan_config.vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+        (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+            VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
     if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
         goto fail;
     extensions = SDL_Vulkan_CreateInstanceExtensionsList(
@@ -108,7 +108,7 @@
         videoData->vulkan_xlib_xcb_library = SDL_LoadObject(libX11XCBLibraryName);
         if(!videoData->vulkan_xlib_xcb_library)
             goto fail;
-        *(void**)&videoData->vulkan_XGetXCBConnection =
+        videoData->vulkan_XGetXCBConnection =
             SDL_LoadFunction(videoData->vulkan_xlib_xcb_library, "XGetXCBConnection");
         if(!videoData->vulkan_XGetXCBConnection)
         {


More information about the commits mailing list