From 6a580b997b9f8124d23ca6c87a47b4fec2e3e9e7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 8 Mar 2024 13:56:27 +0800 Subject: [PATCH] vim-patch:8.2.5077: various warnings from clang on MS-Windows (#27773) Problem: Various warnings from clang on MS-Windows. Solution: Avoid the warnings. (Yegappan Lakshmanan, closes vim/vim#10553) https://github.com/vim/vim/commit/a34b4460c2843c67a35a2d236b01e6cb9bc38734 Co-authored-by: Yegappan Lakshmanan --- src/nvim/os/env.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 0d4452662d..5b1cb01976 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -586,6 +586,9 @@ void expand_env_esc(char *restrict srcp, char *restrict dst, int dstlen, bool es bool copy_char; bool mustfree; // var was allocated, need to free it later bool at_start = true; // at start of a name +#if defined(BACKSLASH_IN_FILENAME) + char *const save_dst = dst; +#endif int prefix_len = (prefix == NULL) ? 0 : (int)strlen(prefix); @@ -726,7 +729,7 @@ void expand_env_esc(char *restrict srcp, char *restrict dst, int dstlen, bool es // with it, skip a character if (after_pathsep(dst, dst + c) #if defined(BACKSLASH_IN_FILENAME) - && dst[-1] != ':' + && (dst == save_dst || dst[-1] != ':') #endif && vim_ispathsep(*tail)) { tail++;