patch 8.2.5073: clang on MS-Windows produces warnings
Problem: Clang on MS-Windows produces warnings.
Solution: Avoid the warnings. (Yegappan Lakshmanan, closes #10546)
diff --git a/src/os_win32.c b/src/os_win32.c
index 300045b..07befb8 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -273,11 +273,12 @@
static DWORD
get_build_number(void)
{
- OSVERSIONINFOW osver = {sizeof(OSVERSIONINFOW)};
+ OSVERSIONINFOW osver;
HMODULE hNtdll;
PfnRtlGetVersion pRtlGetVersion;
DWORD ver = MAKE_VER(0, 0, 0);
+ osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
hNtdll = GetModuleHandle("ntdll.dll");
if (hNtdll != NULL)
{
@@ -325,7 +326,7 @@
read_console_input(
HANDLE hInput,
INPUT_RECORD *lpBuffer,
- DWORD nLength,
+ int nLength,
LPDWORD lpEvents)
{
enum
@@ -423,7 +424,7 @@
DWORD nLength UNUSED,
LPDWORD lpEvents)
{
- return read_console_input(hInput, lpBuffer, (DWORD)-1, lpEvents);
+ return read_console_input(hInput, lpBuffer, -1, lpEvents);
}
# ifdef FEAT_CLIENTSERVER
@@ -435,7 +436,7 @@
DWORD dwMilliseconds,
DWORD dwWakeMask)
{
- if (read_console_input(NULL, NULL, (DWORD)-2, NULL))
+ if (read_console_input(NULL, NULL, -2, NULL))
return WAIT_OBJECT_0;
return MsgWaitForMultipleObjects(nCount, pHandles, fWaitAll,
dwMilliseconds, dwWakeMask);
@@ -448,7 +449,7 @@
HANDLE hHandle,
DWORD dwMilliseconds)
{
- if (read_console_input(NULL, NULL, (DWORD)-2, NULL))
+ if (read_console_input(NULL, NULL, -2, NULL))
return WAIT_OBJECT_0;
return WaitForSingleObject(hHandle, dwMilliseconds);
}
@@ -760,8 +761,8 @@
}
// The bind_textdomain_codeset() function is optional.
- dyn_libintl_bind_textdomain_codeset = (void *)GetProcAddress(hLibintlDLL,
- "bind_textdomain_codeset");
+ dyn_libintl_bind_textdomain_codeset = (char *(*)(const char *, const char *))
+ GetProcAddress(hLibintlDLL, "bind_textdomain_codeset");
if (dyn_libintl_bind_textdomain_codeset == NULL)
dyn_libintl_bind_textdomain_codeset =
null_libintl_bind_textdomain_codeset;
@@ -769,7 +770,8 @@
// _wputenv() function for the libintl.dll is optional.
hmsvcrt = find_imported_module_by_funcname(hLibintlDLL, "getenv");
if (hmsvcrt != NULL)
- dyn_libintl_wputenv = (void *)GetProcAddress(hmsvcrt, "_wputenv");
+ dyn_libintl_wputenv = (int (*)(const wchar_t *))
+ GetProcAddress(hmsvcrt, "_wputenv");
if (dyn_libintl_wputenv == NULL || dyn_libintl_wputenv == _wputenv)
dyn_libintl_wputenv = null_libintl_wputenv;
@@ -4224,7 +4226,7 @@
s == NULL ? l : (DWORD)(s - (lp + written)),
&len, NULL);
}
- if (len == (int)l)
+ if (len == l)
{
// Finished a line, add a NL, unless this line should not have
// one.
@@ -8338,7 +8340,7 @@
static void CALLBACK
-set_flag(void *param, BOOLEAN unused2)
+set_flag(void *param, BOOLEAN unused2 UNUSED)
{
int *timeout_flag = (int *)param;