From 9eebcfda9adac59cb2fccbe21f30ebffc1e3bbfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 29 May 2020 12:03:57 +0200 Subject: [PATCH] GOCAD reader fixes --- Stream_support/include/CGAL/IO/GOCAD.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index 801fc74ec43..c172a48f22d 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -46,7 +46,7 @@ bool read_GOCAD(std::istream& is, typedef typename boost::range_value::type Point; typedef typename boost::range_value::type Poly; - verbose = true; + set_ascii_mode(is); // GOCAD is ASCII only int offset = 0; std::string s; @@ -57,11 +57,12 @@ bool read_GOCAD(std::istream& is, while(std::getline(is, line)) { if(line.empty()) - break; + continue; std::istringstream iss(line); + if(!(iss >> s)) + continue; // can't read anything on the line, whitespace only? - iss >> s; if(s == "TFACE") break; @@ -93,7 +94,7 @@ bool read_GOCAD(std::istream& is, while(std::getline(is, line)) { if(line.empty()) - break; + continue; std::istringstream iss(line); if((line[0] == 'V') || (line[0] == 'P')) @@ -230,6 +231,8 @@ bool write_GOCAD(std::ostream& os, typedef typename CGAL::GetPointMap::type PointMap; PointMap point_map = choose_parameter(get_parameter(np, internal_np::point_map)); + set_ascii_mode(os); // GOCAD is ASCII only + if(!os.good()) return false;