0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.1.0501: cppcheck warns for using array index before bounds check

Problem:    Cppcheck warns for using array index before bounds check.
Solution:   Swap the conditions. (Dominique Pelle)
This commit is contained in:
Bram Moolenaar
2018-10-30 22:15:55 +01:00
parent 833e5dab14
commit a9a8e04eab
2 changed files with 4 additions and 2 deletions

View File

@@ -5029,8 +5029,8 @@ ml_updatechunk(
curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines;
} }
} }
else if (line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines else if (curix < buf->b_ml.ml_usedchunks - 1
&& curix < buf->b_ml.ml_usedchunks - 1) && line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines)
{ {
/* Adjust cached curix & curline */ /* Adjust cached curix & curline */
curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines;

View File

@@ -792,6 +792,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
501,
/**/ /**/
500, 500,
/**/ /**/