A typo
V547 Expression ‘buffer[0] == ‘\r’ && buffer[0] == ‘\n ‘ ‘ is always false. Probably the ‘||’ operator should be used here. hdr_reader.cpp 84
unsigned char *loadHdr(....) { .... char buffer[MAXLINE]; // read header while(true) { if (! fgets(buffer, MAXLINE, fp)) goto error; if (buffer[0] == '\n') break; if (buffer[0] == '\r' && buffer[0] == '\n') break; .... } .... }
There is a mistake in the marked condition that causes it to be false all the time. What the programmer actually intended was probably to exit the while loop on encountering end-of-line character sequences such as \n or \r\n. In that case, the erroneous condition should be rewritten in the following way:
if (buffer[0] == '\r' && buffer[1] == '\n') break;
Please click here to see more bugs from this project.