Примеры ошибок, обнаруженных с помощью диагностики V739
V739. EOF should not be compared with a value of the 'char' type. Consider using the 'int' type.
Computational Network Toolkit
V739 EOF should not be compared with a value of the 'char' type. The 'c' should be of the 'int' type. fileutil.cpp 852
string fgetstring(FILE* f)
{
string res;
for (;;)
{
char c = (char) fgetc(f); // <=
if (c == EOF) // <=
RuntimeError("error reading .... 0: %s", strerror(errno));
if (c == 0)
break;
res.push_back(c);
}
return res;
}
Android
V739 CWE-20 EOF should not be compared with a value of the 'char' type. The '(c = fgetc(blk_alloc_file))' should be of the 'int' type. blk_alloc_to_base_fs.c 61
int main(int argc, char **argv)
{
....
char c;
printf("%s is already in *.base_fs format, just copying ....);
rewind(blk_alloc_file);
while ((c = fgetc(blk_alloc_file)) != EOF) {
fputc(c, base_fs_file);
}
....
}
NCBI Genome Workbench
V739 EOF should not be compared with a value of the 'char' type. The 'linestring[0]' should be of the 'int' type. alnread.c 3509
static EBool
s_AfrpInitLineData(
....
char* linestring = readfunc (pfile);
....
while (linestring != NULL && linestring [0] != EOF) {
s_TrimSpace (&linestring);
....
}
....
}
rdesktop
V739 EOF should not be compared with a value of the 'char' type. The '(c = fgetc(fp))' should be of the 'int' type. ctrl.c 500
int
ctrl_send_command(const char *cmd, const char *arg)
{
char result[CTRL_RESULT_SIZE], c, *escaped;
....
while ((c = fgetc(fp)) != EOF && index < CTRL_RESULT_SIZE && c != '\n')
{
result[index] = c;
index++;
}
....
}