Mercurial > vim
comparison src/memline.c @ 14980:c98810dfebaf v8.1.0501
patch 8.1.0501: cppcheck warns for using array index before bounds check
commit https://github.com/vim/vim/commit/a9a8e04eab106c1d21381f79f8965fe50b94e235
Author: Bram Moolenaar <Bram@vim.org>
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Oct 2018 22:30:07 +0100 |
parents | 95400980f7c9 |
children | 9df130fd5e0d |
comparison
equal
deleted
inserted
replaced
14979:a5f5944300fc | 14980:c98810dfebaf |
---|---|
5027 curix++) | 5027 curix++) |
5028 { | 5028 { |
5029 curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; | 5029 curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; |
5030 } | 5030 } |
5031 } | 5031 } |
5032 else if (line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines | 5032 else if (curix < buf->b_ml.ml_usedchunks - 1 |
5033 && curix < buf->b_ml.ml_usedchunks - 1) | 5033 && line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines) |
5034 { | 5034 { |
5035 /* Adjust cached curix & curline */ | 5035 /* Adjust cached curix & curline */ |
5036 curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; | 5036 curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; |
5037 curix++; | 5037 curix++; |
5038 } | 5038 } |