Fix PLY Reader hang when reading directly from istream (Thanks to Paul Loré for the patch)

closes #46
This commit is contained in:
Jan Möbius
2018-11-27 14:34:35 +01:00
parent be36e14b8c
commit 56dc45f047
2 changed files with 9 additions and 12 deletions

View File

@@ -18,6 +18,7 @@
<ul>
<li>PLY Reader: Allowing the PLY reader to read custom face ( Thanks to morgan Leborgne for the patch)</li>
<li>PLY Reader: Fixed endless loop on unknown property list type</li>
<li>PLY Reader: Fix hang when reading directly from istream (Thanks to Paul Loré for the patch)</li>
<li>OM Writer/Reader: Update file format version to 2.0. Older files can still be read, but older OpenMesh versions cannot read new format.</li>
<li>OM Writer/Reader: Fixed inconsistent writing/reading of edge properties</li>
<li>OM Writer/Reader: Add option to store status</li>

View File

@@ -135,6 +135,14 @@ bool _PLYReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt) {
return false;
}
// Reparse the header
if (!can_u_read(_in)) {
omerr() << "[PLYReader] : Unable to parse header\n";
return false;
}
// filter relevant options for reading
bool swap = _opt.check(Options::Swap);
@@ -281,12 +289,6 @@ void _PLYReader_::readCustomProperty(std::istream& _in, BaseImporter& _bi, Handl
bool _PLYReader_::read_ascii(std::istream& _in, BaseImporter& _bi, const Options& _opt) const {
// Reparse the header
if (!can_u_read(_in)) {
omerr() << "[PLYReader] : Unable to parse header\n";
return false;
}
unsigned int i, j, k, l, idx;
unsigned int nV;
OpenMesh::Vec3f v, n;
@@ -507,12 +509,6 @@ bool _PLYReader_::read_ascii(std::istream& _in, BaseImporter& _bi, const Options
bool _PLYReader_::read_binary(std::istream& _in, BaseImporter& _bi, bool /*_swap*/, const Options& _opt) const {
// Reparse the header
if (!can_u_read(_in)) {
omerr() << "[PLYReader] : Unable to parse header\n";
return false;
}
OpenMesh::Vec3f v, n; // Vertex
OpenMesh::Vec2f t; // TexCoords
BaseImporter::VHandles vhandles;