fread() returns size_t, which is unsigned. Don't check
for negative values to avoid warnings from Clang.
/home/shade/dev/tigervnc/common/rdr/FileInStream.cxx:74:13: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
if (n < 0 || ferror(file))
~ ^ ~
while (end < b + itemSize) {
size_t n = fread((U8 *)end, b + sizeof(b) - end, 1, file);
- if (n < 1) {
- if (n < 0 || ferror(file))
+ if (n == 0) {
+ if (ferror(file))
throw SystemException("fread", errno);
if (feof(file))
throw EndOfStream();
- if (n == 0) { return 0; }
+ return 0;
}
end += b + sizeof(b) - end;
}