diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-01-08 18:17:40 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-01-08 18:17:40 -0500 |
commit | b16162b00fa78ab2f3ef8a114d409213efcb578b (patch) | |
tree | 4dac9e697f6c3ef194257b2ad2ebef92feb61fa4 | |
parent | 641f79099f09966d4843cbcf12b3c4f864566e04 (diff) | |
parent | aeb68bbb074ec20b51908f50f876d340d2dca020 (diff) | |
download | rneovim-b16162b00fa78ab2f3ef8a114d409213efcb578b.tar.gz rneovim-b16162b00fa78ab2f3ef8a114d409213efcb578b.tar.bz2 rneovim-b16162b00fa78ab2f3ef8a114d409213efcb578b.zip |
Merge pull request #1784 from elmart/coverity-issues-2
Fix coverity issues. (2)
-rw-r--r-- | src/nvim/mark.c | 5 | ||||
-rw-r--r-- | src/nvim/normal.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 4ded438f52..ef9f0ca408 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -127,6 +127,7 @@ int setmark_pos(int c, pos_T *pos, int fnum) return OK; } if (isupper(c)) { + assert(c >= 'A' && c <= 'Z'); i = c - 'A'; namedfm[i].fmark.mark = *pos; namedfm[i].fmark.fnum = fnum; @@ -1219,8 +1220,10 @@ int read_viminfo_filemark(vir_T *virp, int force) } } else if (VIM_ISDIGIT(*str)) fm = &namedfm[*str - '0' + NMARKS]; - else + else { // is uppercase + assert(*str >= 'A' && *str <= 'Z'); fm = &namedfm[*str - 'A']; + } if (fm != NULL && (fm->fmark.mark.lnum == 0 || force)) { str = skipwhite(str + 1); fm->fmark.mark.lnum = getdigits(&str); diff --git a/src/nvim/normal.c b/src/nvim/normal.c index e1dc2b93d9..e1aed23e8c 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -11,6 +11,7 @@ * the operators. */ +#include <assert.h> #include <errno.h> #include <inttypes.h> #include <string.h> @@ -388,6 +389,7 @@ static int find_command(int cmdchar) /* If the character is in the first part: The character is the index into * nv_cmd_idx[]. */ + assert(nv_max_linear < (int)NV_CMDS_SIZE); if (cmdchar <= nv_max_linear) return nv_cmd_idx[cmdchar]; |