Merge pull request #6018 from afabri/PSP-check_open_close-GF

Unset fail bit and add assertions about the state of a stream
This commit is contained in:
Laurent Rineau
2021-09-30 16:49:37 +02:00
3 changed files with 134 additions and 94 deletions
@@ -190,12 +190,15 @@ bool read_OFF(std::istream& is,
put(normal_map, pwn, normal); // normal_map[&pwn] = normal
*output++ = pwn;
pointsRead++;
}
// ...or skip comment line
}
// Skip remaining lines
}
if(is.eof()) {
is.clear(is.rdstate() & ~std::ios_base::failbit); // set by getline
}
return true;
}
@@ -179,6 +179,9 @@ bool read_XYZ(std::istream& is,
return false;
}
}
if(is.eof()) {
is.clear(is.rdstate() & ~std::ios_base::failbit); // set by getline
}
return true;
}