From e8209b91b9974da95899b51dba4058b411d04d5b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 18 Apr 2021 16:08:52 +0200 Subject: patch 8.2.2783: duplicate code for setting byte in blob, blob test may fail Problem: Duplicate code for setting byte in blob, blob test may fail. Solution: Call blob_set_append(). Test sort failure with "N". --- src/eval.c | 16 +--------------- src/testdir/test_blob.vim | 2 +- src/version.c | 2 ++ 3 files changed, 4 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/eval.c b/src/eval.c index f8e922f911..4dbbc40961 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1321,21 +1321,7 @@ set_var_lval( { val = (int)tv_get_number_chk(rettv, &error); if (!error) - { - garray_T *gap = &lp->ll_blob->bv_ga; - - // Allow for appending a byte. Setting a byte beyond - // the end is an error otherwise. - if (lp->ll_n1 < gap->ga_len - || (lp->ll_n1 == gap->ga_len - && ga_grow(&lp->ll_blob->bv_ga, 1) == OK)) - { - blob_set(lp->ll_blob, lp->ll_n1, val); - if (lp->ll_n1 == gap->ga_len) - ++gap->ga_len; - } - // error for invalid range was already given in get_lval() - } + blob_set_append(lp->ll_blob, lp->ll_n1, val); } } else if (op != NULL && *op != '=') diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim index 84d24cb0a3..5eb3f3cb96 100644 --- a/src/testdir/test_blob.vim +++ b/src/testdir/test_blob.vim @@ -630,7 +630,7 @@ func Test_blob_sort() if has('float') call CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:') endif - call CheckLegacyAndVim9Failure(['call sort(["abc", 0z11], "f")'], 'E892:') + call CheckLegacyAndVim9Failure(['call sort([11, 0z11], "N")'], 'E974:') endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 811370cb15..9a2da2fbc2 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2783, /**/ 2782, /**/ -- cgit v1.2.3