# HG changeset patch # User Bram Moolenaar # Date 1654940704 -7200 # Node ID 495d55210aac2a90b5c95504aa76674be55c4633 # Parent a8ee24a8bde1968fb883af247f9f613fa662a772 patch 8.2.5077: various warnings from clang on MS-Windows Commit: https://github.com/vim/vim/commit/a34b4460c2843c67a35a2d236b01e6cb9bc38734 Author: Yegappan Lakshmanan Date: Sat Jun 11 10:43:26 2022 +0100 patch 8.2.5077: various warnings from clang on MS-Windows Problem: Various warnings from clang on MS-Windows. Solution: Avoid the warnings. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/10553) diff --git a/src/dosinst.c b/src/dosinst.c --- a/src/dosinst.c +++ b/src/dosinst.c @@ -1527,7 +1527,7 @@ register_openwith( "*\\OpenWithList\\gvim.exe", }; - for (i = 0; ERROR_SUCCESS == lRet && i < ARRAYSIZE(openwith); i++) + for (i = 0; ERROR_SUCCESS == lRet && i < (int)ARRAYSIZE(openwith); i++) lRet = reg_create_key_and_value(hRootKey, openwith[i], NULL, "", flag); } diff --git a/src/dosinst.h b/src/dosinst.h --- a/src/dosinst.h +++ b/src/dosinst.h @@ -341,23 +341,23 @@ struct // created when it's empty } targets[TARGET_COUNT] = { - {"all", "batch files"}, + {"all", "batch files", NULL, NULL, NULL, NULL, NULL, NULL, ""}, {"vim", "vim.bat", "Vim.lnk", - "vim.exe", "vim.exe", ""}, + "vim.exe", "vim.exe", "", NULL, NULL, ""}, {"gvim", "gvim.bat", "gVim.lnk", - "gvim.exe", "gvim.exe", ""}, + "gvim.exe", "gvim.exe", "", NULL, NULL, ""}, {"evim", "evim.bat", "gVim Easy.lnk", - "evim.exe", "gvim.exe", "-y"}, + "evim.exe", "gvim.exe", "-y", NULL, NULL, ""}, {"view", "view.bat", "Vim Read-only.lnk", - "view.exe", "vim.exe", "-R"}, + "view.exe", "vim.exe", "-R", NULL, NULL, ""}, {"gview", "gview.bat", "gVim Read-only.lnk", - "gview.exe", "gvim.exe", "-R"}, + "gview.exe", "gvim.exe", "-R", NULL, NULL, ""}, {"vimdiff", "vimdiff.bat", "Vim Diff.lnk", - "vimdiff.exe","vim.exe", "-d"}, + "vimdiff.exe","vim.exe", "-d", NULL, NULL, ""}, {"gvimdiff","gvimdiff.bat", "gVim Diff.lnk", - "gvimdiff.exe","gvim.exe", "-d"}, + "gvimdiff.exe","gvim.exe", "-d", NULL, NULL, ""}, {"vimtutor","vimtutor.bat", "Vim tutor.lnk", - "vimtutor.bat", "vimtutor.bat", ""}, + "vimtutor.bat", "vimtutor.bat", "", NULL, NULL, ""}, }; /* Uninstall key for vim.bat, etc. */ diff --git a/src/filepath.c b/src/filepath.c --- a/src/filepath.c +++ b/src/filepath.c @@ -191,7 +191,8 @@ shortpath_for_invalid_fname( } // concat the not-shortened part of the path - vim_strncpy(*fname + len, endp, sfx_len); + if ((*fname + len) != endp) + vim_strncpy(*fname + len, endp, sfx_len); (*fname)[new_len] = NUL; } diff --git a/src/gui_w32.c b/src/gui_w32.c --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -1712,7 +1712,7 @@ gui_mch_get_color(char_u *name) /* * Try to look up a system colour. */ - for (i = 0; i < ARRAY_LENGTH(sys_table); i++) + for (i = 0; i < (int)ARRAY_LENGTH(sys_table); i++) if (STRICMP(name, sys_table[i].name) == 0) return GetSysColor(sys_table[i].color); diff --git a/src/misc1.c b/src/misc1.c --- a/src/misc1.c +++ b/src/misc1.c @@ -1351,6 +1351,9 @@ expand_env_esc( int mustfree; // var was allocated, need to free it later int at_start = TRUE; // at start of a name int startstr_len = 0; +#if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) + char_u *save_dst = dst; +#endif if (startstr != NULL) startstr_len = (int)STRLEN(startstr); @@ -1575,7 +1578,7 @@ expand_env_esc( // with it, skip a character if (after_pathsep(dst, dst + c) #if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) - && dst[-1] != ':' + && (dst == save_dst || dst[-1] != ':') #endif && vim_ispathsep(*tail)) ++tail; diff --git a/src/os_win32.c b/src/os_win32.c --- a/src/os_win32.c +++ b/src/os_win32.c @@ -2355,11 +2355,11 @@ theend: * worth allowing these to make debugging of issues easier. */ static void -bad_param_handler(const wchar_t *expression, - const wchar_t *function, - const wchar_t *file, - unsigned int line, - uintptr_t pReserved) +bad_param_handler(const wchar_t *expression UNUSED, + const wchar_t *function UNUSED, + const wchar_t *file UNUSED, + unsigned int line UNUSED, + uintptr_t pReserved UNUSED) { } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 5077, +/**/ 5076, /**/ 5075,