summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-07-25 16:47:03 +0200
committerBram Moolenaar <Bram@vim.org>2012-07-25 16:47:03 +0200
commit0cbba94b7e2575ba311d4eab316cc5528ffd5b67 (patch)
treed046867458eb407111993eb8a92648c726dbfccf
parent9bdb9a0987d45d74322b7403fe2203cfee983493 (diff)
downloadvim-git-0cbba94b7e2575ba311d4eab316cc5528ffd5b67.tar.gz
updated for version 7.3.614v7.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)
-rw-r--r--src/edit.c2
-rw-r--r--src/eval.c19
-rw-r--r--src/proto/eval.pro2
-rw-r--r--src/version.c2
4 files changed, 17 insertions, 8 deletions
diff --git a/src/edit.c b/src/edit.c
index 68b896858..1c614333f 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3959,7 +3959,7 @@ expand_by_function(type, base)
curbuf_save = curbuf;
/* Call a function, which returns a list or dict. */
- if (call_vim_function(funcname, 2, args, FALSE, &rettv) == OK)
+ if (call_vim_function(funcname, 2, args, FALSE, FALSE, &rettv) == OK)
{
switch (rettv.v_type)
{
diff --git a/src/eval.c b/src/eval.c
index b83334c36..b04f33034 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -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)
diff --git a/src/proto/eval.pro b/src/proto/eval.pro
index 63c140c55..a10259855 100644
--- a/src/proto/eval.pro
+++ b/src/proto/eval.pro
@@ -23,7 +23,7 @@ int eval_to_number __ARGS((char_u *expr));
list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
int get_spellword __ARGS((list_T *list, char_u **pp));
typval_T *eval_expr __ARGS((char_u *arg, char_u **nextcmd));
-int call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe, typval_T *rettv));
+int call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe, int str_arg_only, typval_T *rettv));
void *call_func_retstr __ARGS((char_u *func, int argc, char_u **argv, int safe));
long call_func_retnr __ARGS((char_u *func, int argc, char_u **argv, int safe));
void *call_func_retlist __ARGS((char_u *func, int argc, char_u **argv, int safe));
diff --git a/src/version.c b/src/version.c
index 15da1d8d7..3a662a2a8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 614,
+/**/
613,
/**/
612,