From df2c3b204b9622687d0cd7dd59cbd3f89d9383ce Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 May 2024 13:57:41 +0800 Subject: vim-patch:9.1.0449: MS-Windows: Compiler warnings Problem: MS-Windows: Compiler warnings Solution: Resolve size_t to int warnings closes: vim/vim#14874 A couple of warnings in ex_docmd.c have been resolved by modifying their function argument types, followed by some changes in various function call sites. This also allowed removal of some casts to cope with size_t/int conversion. https://github.com/vim/vim/commit/51024bbc1a9e298b1fb8f2e465fccb5db409551e Co-authored-by: Mike Williams --- src/nvim/strings.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 16ae35272b..485551da6e 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -266,11 +266,11 @@ char *vim_strsave_shellescape(const char *string, bool do_special, bool do_newli *d++ = *p++; continue; } - if (do_special && find_cmdline_var(p, &l) >= 0) { + if (do_special && find_cmdline_var(p, &l) >= 0 && l > 0) { *d++ = '\\'; // insert backslash - while (--l != SIZE_MAX) { // copy the var + do { // copy the var *d++ = *p++; - } + } while (--l > 0); continue; } if (*p == '\\' && fish_like) { -- cgit From 2de12e9bd7fe72eb4656a3c0f689caf6ce971451 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 31 May 2024 05:50:57 +0800 Subject: vim-patch:9.1.0451: No test for escaping '<' with shellescape() Problem: No test for escaping '<' with shellescape() Solution: Add a test. Use memcpy() in code to make it easier to understand. Fix a typo (zeertzjq). closes: vim/vim#14876 https://github.com/vim/vim/commit/88c8c547d5fc380e5685c2b01ec564ccdf9b259a --- src/nvim/search.h | 2 +- src/nvim/strings.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/search.h b/src/nvim/search.h index 783756b781..92ee5d6854 100644 --- a/src/nvim/search.h +++ b/src/nvim/search.h @@ -84,7 +84,7 @@ typedef struct { /// Structure containing last search pattern and its attributes. typedef struct { char *pat; ///< The pattern (in allocated memory) or NULL. - size_t patlen; ///< The length of the patten (0 is pat is NULL). + size_t patlen; ///< The length of the pattern (0 if pat is NULL). bool magic; ///< Magicness of the pattern. bool no_scs; ///< No smartcase for this pattern. Timestamp timestamp; ///< Time of the last change. diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 485551da6e..8fef4ba7fd 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -266,11 +266,11 @@ char *vim_strsave_shellescape(const char *string, bool do_special, bool do_newli *d++ = *p++; continue; } - if (do_special && find_cmdline_var(p, &l) >= 0 && l > 0) { + if (do_special && find_cmdline_var(p, &l) >= 0) { *d++ = '\\'; // insert backslash - do { // copy the var - *d++ = *p++; - } while (--l > 0); + memcpy(d, p, l); // copy the var + d += l; + p += l; continue; } if (*p == '\\' && fish_like) { -- cgit