0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 9.0.0384: Covertity still complains about using return value of getc()

Problem:    Covertity still complains about using return value of getc().
Solution:   Check for EOF.
This commit is contained in:
Bram Moolenaar
2022-09-05 11:04:14 +01:00
parent 963ab26842
commit c7d2ff2ca0
2 changed files with 5 additions and 3 deletions

View File

@@ -846,7 +846,7 @@ read_region_section(FILE *fd, slang_T *lp, int len)
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] = c = getc(fd); // <regionname> lp->sl_regions[i] = (c = getc(fd)) == EOF ? 0 : c; // <regionname>
lp->sl_regions[len] = NUL; lp->sl_regions[len] = NUL;
return c == EOF ? SP_TRUNCERROR : 0; return c == EOF ? SP_TRUNCERROR : 0;
} }
@@ -927,7 +927,7 @@ 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++ = c = getc(fd); // <condstr> *p++ = (c = getc(fd)) == EOF ? 0 : c; // <condstr>
if (c == EOF) if (c == EOF)
break; break;
*p = NUL; *p = NUL;
@@ -1067,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++ = c = getc(fd); // <salfrom> *p++ = (c = getc(fd)) == EOF ? 0 : c; // <salfrom>
*p++ = NUL; *p++ = NUL;
// <saltolen> <salto> // <saltolen> <salto>

View File

@@ -703,6 +703,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 */
/**/
384,
/**/ /**/
383, 383,
/**/ /**/