From 36f3690b09c2377814443f47fb493b767826aacf Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 4 Jan 2023 19:43:16 +0100 Subject: [PATCH] Work around -Wcast-function-type That warning doesn't play well with Windows' GetProcAddress(), so add some extra casting to work around it. --- win/rfb_win32/WMHooks.cxx | 18 +++++++++--------- win/winvnc/VNCServerService.cxx | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/win/rfb_win32/WMHooks.cxx b/win/rfb_win32/WMHooks.cxx index 3c58d801..70844563 100644 --- a/win/rfb_win32/WMHooks.cxx +++ b/win/rfb_win32/WMHooks.cxx @@ -72,37 +72,37 @@ static void LoadHooks() if (hooksLibrary == NULL) return; - WM_Hooks_WindowChanged = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_WindowChanged"); + WM_Hooks_WindowChanged = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_WindowChanged"); if (WM_Hooks_WindowChanged == NULL) goto error; - WM_Hooks_WindowBorderChanged = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_WindowBorderChanged"); + WM_Hooks_WindowBorderChanged = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_WindowBorderChanged"); if (WM_Hooks_WindowBorderChanged == NULL) goto error; - WM_Hooks_WindowClientAreaChanged = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_WindowClientAreaChanged"); + WM_Hooks_WindowClientAreaChanged = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_WindowClientAreaChanged"); if (WM_Hooks_WindowClientAreaChanged == NULL) goto error; - WM_Hooks_RectangleChanged = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_RectangleChanged"); + WM_Hooks_RectangleChanged = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_RectangleChanged"); if (WM_Hooks_RectangleChanged == NULL) goto error; #ifdef _DEBUG - WM_Hooks_Diagnostic = (WM_Hooks_WMVAL_proto)GetProcAddress(hooksLibrary, "WM_Hooks_Diagnostic"); + WM_Hooks_Diagnostic = (WM_Hooks_WMVAL_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_Diagnostic"); if (WM_Hooks_Diagnostic == NULL) goto error; #endif - WM_Hooks_Install = (WM_Hooks_Install_proto)GetProcAddress(hooksLibrary, "WM_Hooks_Install"); + WM_Hooks_Install = (WM_Hooks_Install_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_Install"); if (WM_Hooks_Install == NULL) goto error; - WM_Hooks_Remove = (WM_Hooks_Remove_proto)GetProcAddress(hooksLibrary, "WM_Hooks_Remove"); + WM_Hooks_Remove = (WM_Hooks_Remove_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_Remove"); if (WM_Hooks_Remove == NULL) goto error; #ifdef _DEBUG - WM_Hooks_SetDiagnosticRange = (WM_Hooks_SetDiagnosticRange_proto)GetProcAddress(hooksLibrary, "WM_Hooks_SetDiagnosticRange"); + WM_Hooks_SetDiagnosticRange = (WM_Hooks_SetDiagnosticRange_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_SetDiagnosticRange"); if (WM_Hooks_SetDiagnosticRange == NULL) goto error; #endif - WM_Hooks_EnableRealInputs = (WM_Hooks_EnableRealInputs_proto)GetProcAddress(hooksLibrary, "WM_Hooks_EnableRealInputs"); + WM_Hooks_EnableRealInputs = (WM_Hooks_EnableRealInputs_proto)(void*)GetProcAddress(hooksLibrary, "WM_Hooks_EnableRealInputs"); if (WM_Hooks_EnableRealInputs == NULL) goto error; diff --git a/win/winvnc/VNCServerService.cxx b/win/winvnc/VNCServerService.cxx index 43459855..b4f81e27 100644 --- a/win/winvnc/VNCServerService.cxx +++ b/win/winvnc/VNCServerService.cxx @@ -49,7 +49,7 @@ VNCServerService::VNCServerService() if (sasLibrary == NULL) { sasLibrary = LoadLibrary("sas.dll"); if (sasLibrary != NULL) - _SendSAS = (SendSAS_proto)GetProcAddress(sasLibrary, "SendSAS"); + _SendSAS = (SendSAS_proto)(void*)GetProcAddress(sasLibrary, "SendSAS"); } // - Set the service-mode logging defaults // These will be overridden by the Log option in the -- 2.39.5