aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhor Antonov <ngortheone@users.noreply.github.com>2019-07-16 13:58:30 -0400
committerJustin M. Keyes <justinkz@gmail.com>2019-07-16 19:58:30 +0200
commit56bc0a8bed16f3b43ea23cb25e558e582393146f (patch)
tree3cd2eec8713abe35d9eec2344569c53ad8a95f09
parentb53b3f7dac51ee1001a97efea83690908cb5db76 (diff)
downloadrneovim-56bc0a8bed16f3b43ea23cb25e558e582393146f.tar.gz
rneovim-56bc0a8bed16f3b43ea23cb25e558e582393146f.tar.bz2
rneovim-56bc0a8bed16f3b43ea23cb25e558e582393146f.zip
PVS/V108: cast operands, not the result #10501
-rw-r--r--src/nvim/ops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 5fbcd54a19..7c38ecff4a 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -379,8 +379,10 @@ static void shift_block(oparg_T *oap, int amount)
/* if we're splitting a TAB, allow for it */
bd.textcol -= bd.pre_whitesp_c - (bd.startspaces != 0);
const int len = (int)STRLEN(bd.textstart) + 1;
- newp = (char_u *)xmalloc((size_t)(bd.textcol + i + j + len));
- memset(newp, NUL, (size_t)(bd.textcol + i + j + len));
+ int col = bd.textcol + i +j + len;
+ assert(col >= 0);
+ newp = (char_u *)xmalloc((size_t)col);
+ memset(newp, NUL, (size_t)col);
memmove(newp, oldp, (size_t)bd.textcol);
memset(newp + bd.textcol, TAB, (size_t)i);
memset(newp + bd.textcol + i, ' ', (size_t)j);