diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-01-06 02:32:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-06 02:32:30 +0100 |
commit | f3d2d3c8144b8716f34f9237ac3a8d2dd6662a4d (patch) | |
tree | b58de2a929d1329fed703aa701b5d208ae1cb64d /src/nvim/normal.c | |
parent | 38b4ca26b555e5bdca4d672917a85f1bd60297c2 (diff) | |
parent | 2d1214ef46a69f891415a3004412c41e12cebc17 (diff) | |
download | rneovim-f3d2d3c8144b8716f34f9237ac3a8d2dd6662a4d.tar.gz rneovim-f3d2d3c8144b8716f34f9237ac3a8d2dd6662a4d.tar.bz2 rneovim-f3d2d3c8144b8716f34f9237ac3a8d2dd6662a4d.zip |
Merge #9458 from justinmk/pvs-warnings
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 462b476a35..705dea4e88 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1,11 +1,11 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -/* - * normal.c: Contains the main routine for processing characters in command - * mode. Communicates closely with the code in ops.c to handle - * the operators. - */ +// +// normal.c: Contains the main routine for processing characters in command +// mode. Communicates closely with the code in ops.c to handle +// the operators. +// #include <assert.h> #include <inttypes.h> @@ -3939,9 +3939,11 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist) (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL); linelen = linetabsize(get_cursor_line_ptr()); - if (linelen > width1) - curwin->w_curswant += (((linelen - width1 - 1) / width2) - + 1) * width2; + if (linelen > width1) { + int w = (((linelen - width1 - 1) / width2) + 1) * width2; + assert(curwin->w_curswant <= INT_MAX - w); + curwin->w_curswant += w; + } } } else { /* dir == FORWARD */ if (linelen > width1) |