From ec71a79fdfeff3ba2c57b6f62ec55f51f1f46930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 13 Oct 2020 18:02:28 +0200 Subject: [PATCH] Fix some missing flushers --- BGL/include/CGAL/boost/graph/IO/GOCAD.h | 2 +- BGL/include/CGAL/boost/graph/IO/PLY.h | 2 ++ BGL/include/CGAL/boost/graph/IO/STL.h | 3 ++- BGL/include/CGAL/boost/graph/IO/VTK.h | 2 +- Point_set_processing_3/include/CGAL/IO/write_off_points.h | 4 +++- Point_set_processing_3/include/CGAL/IO/write_xyz_points.h | 4 +++- Stream_support/include/CGAL/IO/GOCAD.h | 2 +- Stream_support/include/CGAL/IO/STL.h | 2 +- Stream_support/include/CGAL/IO/VTK.h | 2 +- 9 files changed, 15 insertions(+), 8 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/IO/GOCAD.h b/BGL/include/CGAL/boost/graph/IO/GOCAD.h index 108f6fcd4de..474532aeede 100644 --- a/BGL/include/CGAL/boost/graph/IO/GOCAD.h +++ b/BGL/include/CGAL/boost/graph/IO/GOCAD.h @@ -309,7 +309,7 @@ bool write_GOCAD(std::ostream& os, os << "GOCAD TSurf 1\n" "HEADER {\n" "name:"; - os << name << std::endl; + os << name << "\n"; os << "*border:on\n" "*border*bstone:on\n" "}\n" diff --git a/BGL/include/CGAL/boost/graph/IO/PLY.h b/BGL/include/CGAL/boost/graph/IO/PLY.h index 90581b89a3d..94673e1bf8f 100644 --- a/BGL/include/CGAL/boost/graph/IO/PLY.h +++ b/BGL/include/CGAL/boost/graph/IO/PLY.h @@ -439,6 +439,8 @@ bool write_PLY(std::ostream& os, } } + os << std::flush; // write() doesn't flush + return os.good(); } diff --git a/BGL/include/CGAL/boost/graph/IO/STL.h b/BGL/include/CGAL/boost/graph/IO/STL.h index 71f97126c81..5854ce81537 100644 --- a/BGL/include/CGAL/boost/graph/IO/STL.h +++ b/BGL/include/CGAL/boost/graph/IO/STL.h @@ -279,6 +279,7 @@ bool write_STL(std::ostream& os, os.write(reinterpret_cast(&coords[i]), sizeof(coords[i])); os << " "; } + os << std::flush; } else { @@ -295,7 +296,7 @@ bool write_STL(std::ostream& os, os << "vertex " << p << "\n"; os << "vertex " << q << "\n"; os << "vertex " << r << "\n"; - os << "endloop\nendfacet" << std::endl; + os << "endloop\nendfacet" << "\n"; } os << "endsolid" << std::endl; } diff --git a/BGL/include/CGAL/boost/graph/IO/VTK.h b/BGL/include/CGAL/boost/graph/IO/VTK.h index effbdb32ab0..152604534f1 100644 --- a/BGL/include/CGAL/boost/graph/IO/VTK.h +++ b/BGL/include/CGAL/boost/graph/IO/VTK.h @@ -473,7 +473,7 @@ bool write_VTP(std::ostream& os, IO::internal::write_polys_points(os, g, np); IO::internal::write_polys(os, g, np); } - os << "\n"; + os << "" << std::endl; return os.good(); } diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index 6b6981647fd..ecb27a5cbfc 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -79,9 +79,11 @@ bool write_OFF_PSP(std::ostream& os, os << get(point_map, *it); if (has_normals) os << " " << get(normal_map, *it); - os << std::endl; + os << "\n"; } + os << std::flush; + return !os.fail(); } diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h index a49da0352db..4127d71b966 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h @@ -76,9 +76,11 @@ bool write_XYZ_PSP(std::ostream& os, os << get(point_map, *it); if(has_normals) os << " " << get(normal_map, *it); - os << std::endl; + os << "\n"; } + os << std::flush; + return !os.fail(); } diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index b037d3569ec..1ce4c20f13f 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -305,7 +305,7 @@ bool write_GOCAD(std::ostream& os, os << "GOCAD TSurf 1\n" "HEADER {\n" "name:"; - os << fname << std::endl; + os << fname << "\n"; os << "*border:on\n" "*border*bstone:on\n" "}\n" diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 3de5b5ca7f4..b5e8795dd8d 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -346,7 +346,7 @@ bool write_STL(std::ostream& os, os << "vertex " << p << "\n"; os << "vertex " << q << "\n"; os << "vertex " << r << "\n"; - os << "endloop\nendfacet"<\n"; + os << "" << std::endl; } /// \cond SKIP_IN_MANUAL