# HG changeset patch # User Bram Moolenaar # Date 1540935007 -3600 # Node ID c98810dfebaf550f2c682de252144f2cd47536e4 # Parent a5f5944300fcef5749f01b9994e8ad16ecd3a855 patch 8.1.0501: cppcheck warns for using array index before bounds check commit https://github.com/vim/vim/commit/a9a8e04eab106c1d21381f79f8965fe50b94e235 Author: Bram Moolenaar Date: Tue Oct 30 22:15:55 2018 +0100 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) diff --git a/src/memline.c b/src/memline.c --- a/src/memline.c +++ b/src/memline.c @@ -5029,8 +5029,8 @@ ml_updatechunk( curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; } } - else if (line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines - && curix < buf->b_ml.ml_usedchunks - 1) + else if (curix < buf->b_ml.ml_usedchunks - 1 + && line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines) { /* Adjust cached curix & curline */ curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -793,6 +793,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 501, +/**/ 500, /**/ 499,