Merge pull request #1784 from elmart/coverity-issues-2

Fix coverity issues. (2)
This commit is contained in:
Justin M. Keyes
2015-01-08 18:17:40 -05:00
2 changed files with 6 additions and 1 deletions

View File

@@ -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);

View File

@@ -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];