]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0449: MS-Windows: Compiler warnings v9.1.0449
authorMike Williams <mrmrdubya@gmail.com>
Thu, 30 May 2024 05:46:30 +0000 (07:46 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 30 May 2024 05:46:30 +0000 (07:46 +0200)
Problem:  MS-Windows: Compiler warnings
Solution: Resolve size_t to int warnings

closes: #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.

Signed-off-by: Mike Williams <mrmrdubya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/evalfunc.c
src/ex_docmd.c
src/filepath.c
src/if_cscope.c
src/proto/ex_docmd.pro
src/proto/filepath.pro
src/strings.c
src/version.c

index d53dda4576c90661f04e47263b1f653cb413e1d0..6e1eb037e44da7df057334c82e29984076c55f63 100644 (file)
@@ -4458,7 +4458,7 @@ f_exists_compiled(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
 f_expand(typval_T *argvars, typval_T *rettv)
 {
     char_u     *s;
-    int                len;
+    size_t     len;
     int                options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND;
     expand_T   xpc;
     int                error = FALSE;
index c2aaca0656f325a3d527464d2c627c08af240078..71bfa93222d90f60d8395b8269dacbf90c1b4db4 100644 (file)
@@ -5077,7 +5077,7 @@ expand_filename(
 {
     int                has_wildcards;  // need to expand wildcards
     char_u     *repl;
-    int                srclen;
+    size_t     srclen;
     char_u     *p;
     int                n;
     int                escaped;
@@ -5201,7 +5201,7 @@ expand_filename(
            }
        }
 
-       p = repl_cmdline(eap, p, (size_t)srclen, repl, cmdlinep);
+       p = repl_cmdline(eap, p, srclen, repl, cmdlinep);
        vim_free(repl);
        if (p == NULL)
            return FAIL;
@@ -9363,7 +9363,7 @@ enum {
  * the variable.  Otherwise return -1 and "*usedlen" is unchanged.
  */
     int
-find_cmdline_var(char_u *src, int *usedlen)
+find_cmdline_var(char_u *src, size_t *usedlen)
 {
     // must be sorted by the 'value' field because it is used by bsearch()!
     static keyvalue_T spec_str_tab[] = {
@@ -9444,7 +9444,7 @@ find_cmdline_var(char_u *src, int *usedlen)
 eval_vars(
     char_u     *src,           // pointer into commandline
     char_u     *srcstart,      // beginning of valid memory for src
-    int                *usedlen,       // characters after src that are used
+    size_t     *usedlen,       // characters after src that are used
     linenr_T   *lnump,         // line number for :e command, or NULL
     char       **errormsg,     // pointer to error message
     int                *escaped,       // return value has escaped white space (can
@@ -9514,7 +9514,7 @@ eval_vars(
      */
     else
     {
-       int off = 0;
+       size_t off = 0;
 
        switch (spec_idx)
        {
@@ -9781,7 +9781,7 @@ expand_sfile(char_u *arg)
     size_t     len;
     char_u     *repl;
     size_t     repllen;
-    int                srclen;
+    size_t     srclen;
     char_u     *p;
 
     resultlen = STRLEN(arg);
index 3bf8a2d269e71ff9cd31e8051924f40657324ae3..e68075a45e563f36dc4ebe5d4e92c1857cf957d7 100644 (file)
@@ -292,7 +292,7 @@ shortpath_for_partial(
 modify_fname(
     char_u     *src,           // string with modifiers
     int                tilde_file,     // "~" is a file name, not $HOME
-    int                *usedlen,       // characters after src that are used
+    size_t     *usedlen,       // characters after src that are used
     char_u     **fnamep,       // file name so far
     char_u     **bufp,         // buffer for allocated file name or NULL
     int                *fnamelen)      // length of fnamep
@@ -668,7 +668,7 @@ repeat:
                        str = vim_strnsave(*fnamep, *fnamelen);
                        if (sub != NULL && str != NULL)
                        {
-                           *usedlen = (int)(p + 1 - src);
+                           *usedlen = p + 1 - src;
                            s = do_string_sub(str, pat, sub, NULL, flags);
                            if (s != NULL)
                            {
@@ -1038,7 +1038,7 @@ f_fnamemodify(typval_T *argvars, typval_T *rettv)
 {
     char_u     *fname;
     char_u     *mods;
-    int                usedlen = 0;
+    size_t     usedlen = 0;
     int                len = 0;
     char_u     *fbuf = NULL;
     char_u     buf[NUMBUFLEN];
@@ -2707,7 +2707,7 @@ home_replace(
 
     if (homedir_env != NULL && *homedir_env == '~')
     {
-       int     usedlen = 0;
+       size_t  usedlen = 0;
        int     flen;
        char_u  *fbuf = NULL;
 
@@ -3170,7 +3170,7 @@ expand_wildcards_eval(
     char_u     *eval_pat = NULL;
     char_u     *exp_pat = *pat;
     char       *ignored_msg;
-    int                usedlen;
+    size_t     usedlen;
     int                is_cur_alt_file = *exp_pat == '%' || *exp_pat == '#';
     int                star_follows = FALSE;
 
index d9982ef1644cb645e0618320f92114c75d5ec221..7b6fd926efad737885e60815b7d996ba5d3c472f 100644 (file)
@@ -541,7 +541,7 @@ cs_add_common(
     char       *ppath = NULL;
     int                i;
     int                len;
-    int                usedlen = 0;
+    size_t     usedlen = 0;
     char_u     *fbuf = NULL;
 
     // get the filename (arg1), expand it, and try to stat it
index 3fd20b27a71b0073cc8998576fb75b99deac8081..3bd7705cb466faca67a97f0105e3b7c07d9059bc 100644 (file)
@@ -66,8 +66,8 @@ void restore_current_state(save_state_T *sst);
 void ex_normal(exarg_T *eap);
 void exec_normal_cmd(char_u *cmd, int remap, int silent);
 void exec_normal(int was_typed, int use_vpeekc, int may_use_terminal_loop);
-int find_cmdline_var(char_u *src, int *usedlen);
-char_u *eval_vars(char_u *src, char_u *srcstart, int *usedlen, linenr_T *lnump, char **errormsg, int *escaped, int empty_is_error);
+int find_cmdline_var(char_u *src, size_t *usedlen);
+char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnump, char **errormsg, int *escaped, int empty_is_error);
 char_u *expand_sfile(char_u *arg);
 void dialog_msg(char_u *buff, char *format, char_u *fname);
 void set_no_hlsearch(int flag);
index fd8de803792dea6740b93ee843513d69234df81d..53fa4ec3ff04fbb32c0f6eb9984e5e08d31d7a90 100644 (file)
@@ -1,5 +1,5 @@
 /* filepath.c */
-int modify_fname(char_u *src, int tilde_file, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen);
+int modify_fname(char_u *src, int tilde_file, size_t *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen);
 void shorten_dir(char_u *str);
 int file_is_readable(char_u *fname);
 void f_chdir(typval_T *argvars, typval_T *rettv);
index 33de175f298bd4e30822c4f23c1b2f911489a080..9b66ee0e4adce268e9a4cb4cc53c55c1578fcb18 100644 (file)
@@ -151,7 +151,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
     char_u     *p;
     char_u     *d;
     char_u     *escaped_string;
-    int                l;
+    size_t     l;
     int                csh_like;
     int                fish_like;
     char_u     *shname;
@@ -269,11 +269,12 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
                *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 >= 0)        // copy the var
+               do                      // copy the var
                    *d++ = *p++;
+               while (--l > 0);
                continue;
            }
            if (*p == '\\' && fish_like)
index 8a1cab3f292c1ffc9e6f19544d43d92857277750..6871bf97802f4f365c377183a61564e889f88fde 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    449,
 /**/
     448,
 /**/