0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

updated for version 7.3.614

Problem:    Number argument gets turned into a number while it should be a
            string.
Solution:   Add flag to the call_vim_function() call. (Yasuhiro Matsumoto)
This commit is contained in:
Bram Moolenaar
2012-07-25 16:47:03 +02:00
parent 9bdb9a0987
commit 0cbba94b7e
4 changed files with 17 additions and 8 deletions

View File

@@ -1564,11 +1564,12 @@ eval_expr(arg, nextcmd)
* Returns OK or FAIL.
*/
int
call_vim_function(func, argc, argv, safe, rettv)
call_vim_function(func, argc, argv, safe, str_arg_only, rettv)
char_u *func;
int argc;
char_u **argv;
int safe; /* use the sandbox */
int str_arg_only; /* all arguments are strings */
typval_T *rettv;
{
typval_T *argvars;
@@ -1593,8 +1594,11 @@ call_vim_function(func, argc, argv, safe, rettv)
continue;
}
/* Recognize a number argument, the others must be strings. */
vim_str2nr(argv[i], NULL, &len, TRUE, TRUE, &n, NULL);
if (str_arg_only)
len = 0;
else
/* Recognize a number argument, the others must be strings. */
vim_str2nr(argv[i], NULL, &len, TRUE, TRUE, &n, NULL);
if (len != 0 && len == (int)STRLEN(argv[i]))
{
argvars[i].v_type = VAR_NUMBER;
@@ -1646,7 +1650,8 @@ call_func_retstr(func, argc, argv, safe)
typval_T rettv;
char_u *retval;
if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL)
/* All arguments are passed as strings, no conversion to number. */
if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL)
return NULL;
retval = vim_strsave(get_tv_string(&rettv));
@@ -1671,7 +1676,8 @@ call_func_retnr(func, argc, argv, safe)
typval_T rettv;
long retval;
if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL)
/* All arguments are passed as strings, no conversion to number. */
if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL)
return -1;
retval = get_tv_number_chk(&rettv, NULL);
@@ -1694,7 +1700,8 @@ call_func_retlist(func, argc, argv, safe)
{
typval_T rettv;
if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL)
/* All arguments are passed as strings, no conversion to number. */
if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL)
return NULL;
if (rettv.v_type != VAR_LIST)