]> source.dussan.org Git - tigervnc.git/commitdiff
Work around -Wcast-function-type
authorPierre Ossman <ossman@cendio.se>
Wed, 4 Jan 2023 18:43:16 +0000 (19:43 +0100)
committerPierre Ossman <ossman@cendio.se>
Thu, 5 Jan 2023 15:43:34 +0000 (16:43 +0100)
That warning doesn't play well with Windows' GetProcAddress(), so add
some extra casting to work around it.

win/rfb_win32/WMHooks.cxx
win/winvnc/VNCServerService.cxx

index 3c58d8017c18c83925c5396ac8723ff8794493c1..70844563583c94cf0d12191f358289c27ede5067 100644 (file)
@@ -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;
 
index 4345985580cc87326a96afec84e14c131a2e47d0..b4f81e27336ef5024e4ce34d2c81b7b6ff7c0b7f 100644 (file)
@@ -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