diff src/gui_w32.c @ 29105:faf7fcd1c8d5 v8.2.5073

patch 8.2.5073: clang on MS-Windows produces warnings Commit: https://github.com/vim/vim/commit/35d7a2fb13fc833aa1b654ca6fd6e429e72e6b49 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 9 20:53:54 2022 +0100 patch 8.2.5073: clang on MS-Windows produces warnings Problem: Clang on MS-Windows produces warnings. Solution: Avoid the warnings. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/10546)
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 Jun 2022 22:00:07 +0200
parents d2ef7d649fcb
children 495d55210aac
line wrap: on
line diff
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -392,7 +392,7 @@ stubGetDpiForSystem(void)
 }
 
     static int WINAPI
-stubGetSystemMetricsForDpi(int nIndex, UINT dpi)
+stubGetSystemMetricsForDpi(int nIndex, UINT dpi UNUSED)
 {
     return GetSystemMetrics(nIndex);
 }
@@ -4149,7 +4149,7 @@ init_mouse_wheel(void)
  * Mouse scroll event handler.
  */
     static void
-_OnMouseWheel(HWND hwnd, WPARAM wParam, LPARAM lParam, int horizontal)
+_OnMouseWheel(HWND hwnd UNUSED, WPARAM wParam, LPARAM lParam, int horizontal)
 {
     int		button;
     win_T	*wp;
@@ -4336,9 +4336,10 @@ static HWND hwndTip = NULL;
     static void
 show_sizing_tip(int cols, int rows)
 {
-    TOOLINFOA ti = {sizeof(ti)};
+    TOOLINFOA ti;
     char buf[32];
 
+    ti.cbSize = sizeof(ti);
     ti.hwnd = s_hwnd;
     ti.uId = (UINT_PTR)s_hwnd;
     ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
@@ -4636,7 +4637,7 @@ destroy_sizing_tip(void)
 #endif
 
     static LRESULT
-_OnDpiChanged(HWND hwnd, UINT xdpi, UINT ydpi, RECT *rc)
+_OnDpiChanged(HWND hwnd, UINT xdpi UNUSED, UINT ydpi, RECT *rc UNUSED)
 {
     s_dpi = ydpi;
     s_in_dpichanged = TRUE;
@@ -5106,12 +5107,12 @@ load_dpi_func(void)
     if (hUser32 == NULL)
 	goto fail;
 
-    pGetDpiForSystem = (void*)GetProcAddress(hUser32, "GetDpiForSystem");
-    pGetDpiForWindow = (void*)GetProcAddress(hUser32, "GetDpiForWindow");
-    pGetSystemMetricsForDpi = (void*)GetProcAddress(hUser32, "GetSystemMetricsForDpi");
+    pGetDpiForSystem = (UINT (WINAPI *)(void))GetProcAddress(hUser32, "GetDpiForSystem");
+    pGetDpiForWindow = (UINT (WINAPI *)(HWND))GetProcAddress(hUser32, "GetDpiForWindow");
+    pGetSystemMetricsForDpi = (int (WINAPI *)(int, UINT))GetProcAddress(hUser32, "GetSystemMetricsForDpi");
     //pGetWindowDpiAwarenessContext = (void*)GetProcAddress(hUser32, "GetWindowDpiAwarenessContext");
-    pSetThreadDpiAwarenessContext = (void*)GetProcAddress(hUser32, "SetThreadDpiAwarenessContext");
-    pGetAwarenessFromDpiAwarenessContext = (void*)GetProcAddress(hUser32, "GetAwarenessFromDpiAwarenessContext");
+    pSetThreadDpiAwarenessContext = (DPI_AWARENESS_CONTEXT (WINAPI *)(DPI_AWARENESS_CONTEXT))GetProcAddress(hUser32, "SetThreadDpiAwarenessContext");
+    pGetAwarenessFromDpiAwarenessContext = (DPI_AWARENESS (WINAPI *)(DPI_AWARENESS_CONTEXT))GetProcAddress(hUser32, "GetAwarenessFromDpiAwarenessContext");
 
     if (pSetThreadDpiAwarenessContext != NULL)
     {
@@ -7799,8 +7800,9 @@ initialise_toolbar(void)
 update_toolbar_size(void)
 {
     int		w, h;
-    TBMETRICS	tbm = {sizeof(TBMETRICS)};
-
+    TBMETRICS	tbm;
+
+    tbm.cbSize = sizeof(TBMETRICS);
     tbm.dwMask = TBMF_PAD | TBMF_BUTTONSPACING;
     SendMessage(s_toolbarhwnd, TB_GETMETRICS, 0, (LPARAM)&tbm);
     //TRACE("Pad: %d, %d", tbm.cxPad, tbm.cyPad);
@@ -8043,27 +8045,27 @@ dyn_imm_load(void)
 	return;
 
     pImmGetCompositionStringW
-	    = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringW");
+	    = (LONG (WINAPI *)(HIMC, DWORD, LPVOID, DWORD))GetProcAddress(hLibImm, "ImmGetCompositionStringW");
     pImmGetContext
-	    = (void *)GetProcAddress(hLibImm, "ImmGetContext");
+	    = (HIMC (WINAPI *)(HWND))GetProcAddress(hLibImm, "ImmGetContext");
     pImmAssociateContext
-	    = (void *)GetProcAddress(hLibImm, "ImmAssociateContext");
+	    = (HIMC (WINAPI *)(HWND, HIMC))GetProcAddress(hLibImm, "ImmAssociateContext");
     pImmReleaseContext
-	    = (void *)GetProcAddress(hLibImm, "ImmReleaseContext");
+	    = (BOOL (WINAPI *)(HWND, HIMC))GetProcAddress(hLibImm, "ImmReleaseContext");
     pImmGetOpenStatus
-	    = (void *)GetProcAddress(hLibImm, "ImmGetOpenStatus");
+	    = (BOOL (WINAPI *)(HIMC))GetProcAddress(hLibImm, "ImmGetOpenStatus");
     pImmSetOpenStatus
-	    = (void *)GetProcAddress(hLibImm, "ImmSetOpenStatus");
+	    = (BOOL (WINAPI *)(HIMC, BOOL))GetProcAddress(hLibImm, "ImmSetOpenStatus");
     pImmGetCompositionFontW
-	    = (void *)GetProcAddress(hLibImm, "ImmGetCompositionFontW");
+	    = (BOOL (WINAPI *)(HIMC, LPLOGFONTW))GetProcAddress(hLibImm, "ImmGetCompositionFontW");
     pImmSetCompositionFontW
-	    = (void *)GetProcAddress(hLibImm, "ImmSetCompositionFontW");
+	    = (BOOL (WINAPI *)(HIMC, LPLOGFONTW))GetProcAddress(hLibImm, "ImmSetCompositionFontW");
     pImmSetCompositionWindow
-	    = (void *)GetProcAddress(hLibImm, "ImmSetCompositionWindow");
+	    = (BOOL (WINAPI *)(HIMC, LPCOMPOSITIONFORM))GetProcAddress(hLibImm, "ImmSetCompositionWindow");
     pImmGetConversionStatus
-	    = (void *)GetProcAddress(hLibImm, "ImmGetConversionStatus");
+	    = (BOOL (WINAPI *)(HIMC, LPDWORD, LPDWORD))GetProcAddress(hLibImm, "ImmGetConversionStatus");
     pImmSetConversionStatus
-	    = (void *)GetProcAddress(hLibImm, "ImmSetConversionStatus");
+	    = (BOOL (WINAPI *)(HIMC, DWORD, DWORD))GetProcAddress(hLibImm, "ImmSetConversionStatus");
 
     if (       pImmGetCompositionStringW == NULL
 	    || pImmGetContext == NULL