mirror of
https://github.com/vim/vim.git
synced 2025-10-14 07:04:10 -04:00
patch 8.2.1624: Vim9: cannot pass "true" to split(), str2nr() and strchars()
Problem: Vim9: cannot pass "true" to split(), str2nr() and strchars(). Solution: Use tv_get_bool_chk(). (closes #6884, closes #6885, closes #6886)
This commit is contained in:
@@ -7884,7 +7884,7 @@ f_split(typval_T *argvars, typval_T *rettv)
|
||||
if (pat == NULL)
|
||||
typeerr = TRUE;
|
||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
||||
keepempty = (int)tv_get_number_chk(&argvars[2], &typeerr);
|
||||
keepempty = (int)tv_get_bool_chk(&argvars[2], &typeerr);
|
||||
}
|
||||
if (pat == NULL || *pat == NUL)
|
||||
pat = (char_u *)"[\\x01- ]\\+";
|
||||
@@ -8030,7 +8030,7 @@ f_str2nr(typval_T *argvars, typval_T *rettv)
|
||||
emsg(_(e_invarg));
|
||||
return;
|
||||
}
|
||||
if (argvars[2].v_type != VAR_UNKNOWN && tv_get_number(&argvars[2]))
|
||||
if (argvars[2].v_type != VAR_UNKNOWN && tv_get_bool(&argvars[2]))
|
||||
what |= STR2NR_QUOTE;
|
||||
}
|
||||
|
||||
@@ -8155,12 +8155,12 @@ f_strlen(typval_T *argvars, typval_T *rettv)
|
||||
f_strchars(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
char_u *s = tv_get_string(&argvars[0]);
|
||||
int skipcc = 0;
|
||||
int skipcc = FALSE;
|
||||
varnumber_T len = 0;
|
||||
int (*func_mb_ptr2char_adv)(char_u **pp);
|
||||
|
||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||
skipcc = (int)tv_get_number_chk(&argvars[1], NULL);
|
||||
skipcc = (int)tv_get_bool(&argvars[1]);
|
||||
if (skipcc < 0 || skipcc > 1)
|
||||
emsg(_(e_invarg));
|
||||
else
|
||||
|
Reference in New Issue
Block a user