mirror of https://github.com/CGAL/cgal
Fix stream status handling everywhere PLY reader is used
This commit is contained in:
parent
858d10070b
commit
1cfcb1ba5b
|
|
@ -394,7 +394,10 @@ read_ply_point_set(
|
|||
internal::PLY::Point_set_3_filler<Point, Vector> filler(point_set);
|
||||
|
||||
if (!(reader.init (stream)))
|
||||
{
|
||||
stream.setstate(std::ios::failbit);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (comments != NULL)
|
||||
*comments = reader.comments();
|
||||
|
|
@ -415,8 +418,7 @@ read_ply_point_set(
|
|||
{
|
||||
internal::PLY::PLY_read_number* property = element.property(k);
|
||||
property->get (stream);
|
||||
|
||||
if (stream.eof())
|
||||
if (stream.fail())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -425,7 +427,7 @@ read_ply_point_set(
|
|||
}
|
||||
}
|
||||
|
||||
return !stream.bad();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -765,7 +765,10 @@ bool read_ply_points_with_properties (std::istream& stream,
|
|||
internal::PLY::PLY_reader reader;
|
||||
|
||||
if (!(reader.init (stream)))
|
||||
{
|
||||
stream.setstate(std::ios::failbit);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < reader.number_of_elements(); ++ i)
|
||||
{
|
||||
|
|
@ -778,7 +781,7 @@ bool read_ply_points_with_properties (std::istream& stream,
|
|||
internal::PLY::PLY_read_number* property = element.property(k);
|
||||
property->get (stream);
|
||||
|
||||
if (stream.eof())
|
||||
if (stream.fail())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace CGAL{
|
|||
internal::PLY::PLY_read_number* property = element.property(k);
|
||||
property->get (in);
|
||||
|
||||
if (in.eof())
|
||||
if (in.fail())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ namespace CGAL{
|
|||
polygons.back()[i] = std::size_t(get<0>(new_face)[i]);
|
||||
}
|
||||
|
||||
return !in.bad();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -106,7 +106,10 @@ namespace CGAL{
|
|||
internal::PLY::PLY_reader reader;
|
||||
|
||||
if (!(reader.init (in)))
|
||||
{
|
||||
in.setstate(std::ios::failbit);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < reader.number_of_elements(); ++ i)
|
||||
{
|
||||
|
|
@ -121,7 +124,7 @@ namespace CGAL{
|
|||
internal::PLY::PLY_read_number* property = element.property(k);
|
||||
property->get (in);
|
||||
|
||||
if (in.eof())
|
||||
if (in.fail())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -160,14 +163,14 @@ namespace CGAL{
|
|||
internal::PLY::PLY_read_number* property = element.property(k);
|
||||
property->get (in);
|
||||
|
||||
if (in.eof())
|
||||
if (in.fail())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !in.bad();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class Point_3, class Polygon_3, class Color_rgb>
|
||||
|
|
@ -187,7 +190,10 @@ namespace CGAL{
|
|||
internal::PLY::PLY_reader reader;
|
||||
|
||||
if (!(reader.init (in)))
|
||||
{
|
||||
in.setstate(std::ios::failbit);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < reader.number_of_elements(); ++ i)
|
||||
{
|
||||
|
|
@ -215,7 +221,7 @@ namespace CGAL{
|
|||
internal::PLY::PLY_read_number* property = element.property(k);
|
||||
property->get (in);
|
||||
|
||||
if (in.eof())
|
||||
if (in.fail())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -266,14 +272,14 @@ namespace CGAL{
|
|||
internal::PLY::PLY_read_number* property = element.property(k);
|
||||
property->get (in);
|
||||
|
||||
if (in.eof())
|
||||
if (in.fail())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !in.bad();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue