1
0
forked from aniani/vim

patch 9.0.0374: Coverity still complains about dropping sign of character

Problem:    Coverity still complains about dropping sign of character.
Solution:   Add intermediate variable.
This commit is contained in:
Bram Moolenaar
2022-09-04 11:55:19 +01:00
parent a5348f241b
commit 3c7707680f
2 changed files with 12 additions and 6 deletions

View File

@@ -404,7 +404,7 @@ spell_load_file(
* <HEADER>: <fileID> * <HEADER>: <fileID>
*/ */
for (i = 0; i < VIMSPELLMAGICL; ++i) for (i = 0; i < VIMSPELLMAGICL; ++i)
buf[i] = (unsigned)getc(fd); // <fileID> buf[i] = c = getc(fd); // <fileID>
if (STRNCMP(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) if (STRNCMP(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0)
{ {
emsg(_(e_this_does_not_look_like_spell_file)); emsg(_(e_this_does_not_look_like_spell_file));
@@ -700,7 +700,7 @@ suggest_load_files(void)
* <SUGHEADER>: <fileID> <versionnr> <timestamp> * <SUGHEADER>: <fileID> <versionnr> <timestamp>
*/ */
for (i = 0; i < VIMSUGMAGICL; ++i) for (i = 0; i < VIMSUGMAGICL; ++i)
buf[i] = (unsigned)getc(fd); // <fileID> buf[i] = c = getc(fd); // <fileID>
if (STRNCMP(buf, VIMSUGMAGIC, VIMSUGMAGICL) != 0) if (STRNCMP(buf, VIMSUGMAGIC, VIMSUGMAGICL) != 0)
{ {
semsg(_(e_this_does_not_look_like_sug_file_str), semsg(_(e_this_does_not_look_like_sug_file_str),
@@ -841,13 +841,14 @@ read_cnt_string(FILE *fd, int cnt_bytes, int *cntp)
read_region_section(FILE *fd, slang_T *lp, int len) read_region_section(FILE *fd, slang_T *lp, int len)
{ {
int i; int i;
int c;
if (len > MAXREGIONS * 2) if (len > MAXREGIONS * 2)
return SP_FORMERROR; return SP_FORMERROR;
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
lp->sl_regions[i] = (unsigned)getc(fd); // <regionname> lp->sl_regions[i] = c = getc(fd); // <regionname>
lp->sl_regions[len] = NUL; lp->sl_regions[len] = NUL;
return 0; return c == EOF ? SP_TRUNCERROR : 0;
} }
/* /*
@@ -898,6 +899,7 @@ read_prefcond_section(FILE *fd, slang_T *lp)
int cnt; int cnt;
int i; int i;
int n; int n;
int c;
char_u *p; char_u *p;
char_u buf[MAXWLEN + 1]; char_u buf[MAXWLEN + 1];
@@ -925,7 +927,9 @@ read_prefcond_section(FILE *fd, slang_T *lp)
buf[0] = '^'; // always match at one position only buf[0] = '^'; // always match at one position only
p = buf + 1; p = buf + 1;
while (n-- > 0) while (n-- > 0)
*p++ = (unsigned)getc(fd); // <condstr> *p++ = c = getc(fd); // <condstr>
if (c == EOF)
break;
*p = NUL; *p = NUL;
lp->sl_prefprog[i] = vim_regcomp(buf, RE_MAGIC + RE_STRING); lp->sl_prefprog[i] = vim_regcomp(buf, RE_MAGIC + RE_STRING);
} }
@@ -1063,7 +1067,7 @@ read_sal_section(FILE *fd, slang_T *slang)
// store the char we got while checking for end of sm_lead // store the char we got while checking for end of sm_lead
*p++ = c; *p++ = c;
for (++i; i < ccnt; ++i) for (++i; i < ccnt; ++i)
*p++ = (unsigned)getc(fd); // <salfrom> *p++ = c = getc(fd); // <salfrom>
*p++ = NUL; *p++ = NUL;
// <saltolen> <salto> // <saltolen> <salto>

View File

@@ -707,6 +707,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 */
/**/
374,
/**/ /**/
373, 373,
/**/ /**/