comparison src/os_win32.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
comparison
equal deleted inserted replaced
29104:c58baa6d6dda 29105:faf7fcd1c8d5
271 (((major) << 24) | ((minor) << 16) | (build)) 271 (((major) << 24) | ((minor) << 16) | (build))
272 272
273 static DWORD 273 static DWORD
274 get_build_number(void) 274 get_build_number(void)
275 { 275 {
276 OSVERSIONINFOW osver = {sizeof(OSVERSIONINFOW)}; 276 OSVERSIONINFOW osver;
277 HMODULE hNtdll; 277 HMODULE hNtdll;
278 PfnRtlGetVersion pRtlGetVersion; 278 PfnRtlGetVersion pRtlGetVersion;
279 DWORD ver = MAKE_VER(0, 0, 0); 279 DWORD ver = MAKE_VER(0, 0, 0);
280 280
281 osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
281 hNtdll = GetModuleHandle("ntdll.dll"); 282 hNtdll = GetModuleHandle("ntdll.dll");
282 if (hNtdll != NULL) 283 if (hNtdll != NULL)
283 { 284 {
284 pRtlGetVersion = 285 pRtlGetVersion =
285 (PfnRtlGetVersion)GetProcAddress(hNtdll, "RtlGetVersion"); 286 (PfnRtlGetVersion)GetProcAddress(hNtdll, "RtlGetVersion");
323 */ 324 */
324 static BOOL 325 static BOOL
325 read_console_input( 326 read_console_input(
326 HANDLE hInput, 327 HANDLE hInput,
327 INPUT_RECORD *lpBuffer, 328 INPUT_RECORD *lpBuffer,
328 DWORD nLength, 329 int nLength,
329 LPDWORD lpEvents) 330 LPDWORD lpEvents)
330 { 331 {
331 enum 332 enum
332 { 333 {
333 IRSIZE = 10 334 IRSIZE = 10
421 HANDLE hInput, 422 HANDLE hInput,
422 INPUT_RECORD *lpBuffer, 423 INPUT_RECORD *lpBuffer,
423 DWORD nLength UNUSED, 424 DWORD nLength UNUSED,
424 LPDWORD lpEvents) 425 LPDWORD lpEvents)
425 { 426 {
426 return read_console_input(hInput, lpBuffer, (DWORD)-1, lpEvents); 427 return read_console_input(hInput, lpBuffer, -1, lpEvents);
427 } 428 }
428 429
429 # ifdef FEAT_CLIENTSERVER 430 # ifdef FEAT_CLIENTSERVER
430 static DWORD 431 static DWORD
431 msg_wait_for_multiple_objects( 432 msg_wait_for_multiple_objects(
433 LPHANDLE pHandles, 434 LPHANDLE pHandles,
434 BOOL fWaitAll, 435 BOOL fWaitAll,
435 DWORD dwMilliseconds, 436 DWORD dwMilliseconds,
436 DWORD dwWakeMask) 437 DWORD dwWakeMask)
437 { 438 {
438 if (read_console_input(NULL, NULL, (DWORD)-2, NULL)) 439 if (read_console_input(NULL, NULL, -2, NULL))
439 return WAIT_OBJECT_0; 440 return WAIT_OBJECT_0;
440 return MsgWaitForMultipleObjects(nCount, pHandles, fWaitAll, 441 return MsgWaitForMultipleObjects(nCount, pHandles, fWaitAll,
441 dwMilliseconds, dwWakeMask); 442 dwMilliseconds, dwWakeMask);
442 } 443 }
443 # endif 444 # endif
446 static DWORD 447 static DWORD
447 wait_for_single_object( 448 wait_for_single_object(
448 HANDLE hHandle, 449 HANDLE hHandle,
449 DWORD dwMilliseconds) 450 DWORD dwMilliseconds)
450 { 451 {
451 if (read_console_input(NULL, NULL, (DWORD)-2, NULL)) 452 if (read_console_input(NULL, NULL, -2, NULL))
452 return WAIT_OBJECT_0; 453 return WAIT_OBJECT_0;
453 return WaitForSingleObject(hHandle, dwMilliseconds); 454 return WaitForSingleObject(hHandle, dwMilliseconds);
454 } 455 }
455 # endif 456 # endif
456 #endif 457 #endif
758 return 0; 759 return 0;
759 } 760 }
760 } 761 }
761 762
762 // The bind_textdomain_codeset() function is optional. 763 // The bind_textdomain_codeset() function is optional.
763 dyn_libintl_bind_textdomain_codeset = (void *)GetProcAddress(hLibintlDLL, 764 dyn_libintl_bind_textdomain_codeset = (char *(*)(const char *, const char *))
764 "bind_textdomain_codeset"); 765 GetProcAddress(hLibintlDLL, "bind_textdomain_codeset");
765 if (dyn_libintl_bind_textdomain_codeset == NULL) 766 if (dyn_libintl_bind_textdomain_codeset == NULL)
766 dyn_libintl_bind_textdomain_codeset = 767 dyn_libintl_bind_textdomain_codeset =
767 null_libintl_bind_textdomain_codeset; 768 null_libintl_bind_textdomain_codeset;
768 769
769 // _wputenv() function for the libintl.dll is optional. 770 // _wputenv() function for the libintl.dll is optional.
770 hmsvcrt = find_imported_module_by_funcname(hLibintlDLL, "getenv"); 771 hmsvcrt = find_imported_module_by_funcname(hLibintlDLL, "getenv");
771 if (hmsvcrt != NULL) 772 if (hmsvcrt != NULL)
772 dyn_libintl_wputenv = (void *)GetProcAddress(hmsvcrt, "_wputenv"); 773 dyn_libintl_wputenv = (int (*)(const wchar_t *))
774 GetProcAddress(hmsvcrt, "_wputenv");
773 if (dyn_libintl_wputenv == NULL || dyn_libintl_wputenv == _wputenv) 775 if (dyn_libintl_wputenv == NULL || dyn_libintl_wputenv == _wputenv)
774 dyn_libintl_wputenv = null_libintl_wputenv; 776 dyn_libintl_wputenv = null_libintl_wputenv;
775 777
776 return 1; 778 return 1;
777 } 779 }
4222 s = vim_strchr(lp + written, NL); 4224 s = vim_strchr(lp + written, NL);
4223 WriteFile(g_hChildStd_IN_Wr, (char *)lp + written, 4225 WriteFile(g_hChildStd_IN_Wr, (char *)lp + written,
4224 s == NULL ? l : (DWORD)(s - (lp + written)), 4226 s == NULL ? l : (DWORD)(s - (lp + written)),
4225 &len, NULL); 4227 &len, NULL);
4226 } 4228 }
4227 if (len == (int)l) 4229 if (len == l)
4228 { 4230 {
4229 // Finished a line, add a NL, unless this line should not have 4231 // Finished a line, add a NL, unless this line should not have
4230 // one. 4232 // one.
4231 if (lnum != curbuf->b_op_end.lnum 4233 if (lnum != curbuf->b_op_end.lnum
4232 || (!curbuf->b_p_bin 4234 || (!curbuf->b_p_bin
8336 static int flag_idx = 0; 8338 static int flag_idx = 0;
8337 static int *timeout_flag = &timeout_flags[0]; 8339 static int *timeout_flag = &timeout_flags[0];
8338 8340
8339 8341
8340 static void CALLBACK 8342 static void CALLBACK
8341 set_flag(void *param, BOOLEAN unused2) 8343 set_flag(void *param, BOOLEAN unused2 UNUSED)
8342 { 8344 {
8343 int *timeout_flag = (int *)param; 8345 int *timeout_flag = (int *)param;
8344 8346
8345 *timeout_flag = TRUE; 8347 *timeout_flag = TRUE;
8346 } 8348 }