Mercurial > vim
comparison src/evalfunc.c @ 22405:0ef3ae4ec70e v8.2.1751
patch 8.2.1751: using 2 where bool is expected may throw an error
Commit: https://github.com/vim/vim/commit/bade44e5cad1b08c85d4a8ba08d94a30458dddfb
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 26 22:39:24 2020 +0200
patch 8.2.1751: using 2 where bool is expected may throw an error
Problem: Using 2 where bool is expected may throw an error.
Solution: Make this backwards compatible.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 26 Sep 2020 22:45:04 +0200 |
parents | 0a5770061295 |
children | 73be82f278c0 |
comparison
equal
deleted
inserted
replaced
22404:784337b701c8 | 22405:0ef3ae4ec70e |
---|---|
1980 int copyID; | 1980 int copyID; |
1981 | 1981 |
1982 if (argvars[1].v_type != VAR_UNKNOWN) | 1982 if (argvars[1].v_type != VAR_UNKNOWN) |
1983 noref = (int)tv_get_bool_chk(&argvars[1], NULL); | 1983 noref = (int)tv_get_bool_chk(&argvars[1], NULL); |
1984 if (noref < 0 || noref > 1) | 1984 if (noref < 0 || noref > 1) |
1985 emsg(_(e_invarg)); | 1985 semsg(_(e_using_number_as_bool_nr), noref); |
1986 else | 1986 else |
1987 { | 1987 { |
1988 copyID = get_copyID(); | 1988 copyID = get_copyID(); |
1989 item_copy(&argvars[0], rettv, TRUE, noref == 0 ? copyID : 0); | 1989 item_copy(&argvars[0], rettv, TRUE, noref == 0 ? copyID : 0); |
1990 } | 1990 } |
8191 int (*func_mb_ptr2char_adv)(char_u **pp); | 8191 int (*func_mb_ptr2char_adv)(char_u **pp); |
8192 | 8192 |
8193 if (argvars[1].v_type != VAR_UNKNOWN) | 8193 if (argvars[1].v_type != VAR_UNKNOWN) |
8194 skipcc = (int)tv_get_bool(&argvars[1]); | 8194 skipcc = (int)tv_get_bool(&argvars[1]); |
8195 if (skipcc < 0 || skipcc > 1) | 8195 if (skipcc < 0 || skipcc > 1) |
8196 emsg(_(e_invarg)); | 8196 semsg(_(e_using_number_as_bool_nr), skipcc); |
8197 else | 8197 else |
8198 { | 8198 { |
8199 func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv; | 8199 func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv; |
8200 while (*s != NUL) | 8200 while (*s != NUL) |
8201 { | 8201 { |