From 9e2289c63d8be9254e990cb29e414644d794dbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Sat, 25 Jan 2020 18:18:31 +0100 Subject: [PATCH] Clean code --- BGL/include/CGAL/boost/graph/IO/WRL.h | 1 - .../include/CGAL/IO/Generic_writer.h | 213 ++++++++++-------- .../CGAL/IO/OBJ/File_writer_wavefront.h | 2 +- Stream_support/include/CGAL/IO/OFF.h | 4 +- .../include/CGAL/IO/OFF/File_writer_OFF.h | 169 ++++++++------ .../include/CGAL/IO/OI/File_writer_inventor.h | 17 +- .../include/CGAL/IO/VRML/File_writer_VRML_2.h | 18 +- .../include/CGAL/IO/binary_file_io.h | 78 +++---- .../include/CGAL/Surface_mesh/IO/3mf.h | 6 +- 9 files changed, 279 insertions(+), 229 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/IO/WRL.h b/BGL/include/CGAL/boost/graph/IO/WRL.h index 4b474e69fcd..c54fe211784 100644 --- a/BGL/include/CGAL/boost/graph/IO/WRL.h +++ b/BGL/include/CGAL/boost/graph/IO/WRL.h @@ -57,7 +57,6 @@ bool write_WRL(const char* fname, const FaceGraph& g) { return write_WRL(fname, template bool write_WRL(const std::string& fname, const FaceGraph& g) { return write_WRL(fname, g, parameters::all_default()); } - } // namespace CGAL #endif // CGAL_BGL_IO_WRL_H diff --git a/Stream_support/include/CGAL/IO/Generic_writer.h b/Stream_support/include/CGAL/IO/Generic_writer.h index d2d67e2e87e..84f930d8d0b 100644 --- a/Stream_support/include/CGAL/IO/Generic_writer.h +++ b/Stream_support/include/CGAL/IO/Generic_writer.h @@ -18,65 +18,71 @@ #define CGAL_IO_GENERIC_WRITER_H #include + #include namespace CGAL { template -class I_Generic_writer_vertex_proxy { - Writer& m_writer; +class I_Generic_writer_vertex_proxy +{ + Writer& m_writer; + public: - typedef typename Writer::Point Point; - I_Generic_writer_vertex_proxy( Writer& w) : m_writer(w) {} - void operator= ( const Point& p) { m_writer.write_vertex(p); } + typedef typename Writer::Point Point; + I_Generic_writer_vertex_proxy(Writer& w) : m_writer(w) {} + void operator=(const Point& p) { m_writer.write_vertex(p); } }; template class I_Generic_writer_vertex_iterator { - Writer& m_writer; + Writer& m_writer; public: - typedef std::output_iterator_tag iterator_category; - typedef typename Writer::Point value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type* pointer; - typedef value_type& reference; + typedef std::output_iterator_tag iterator_category; + typedef typename Writer::Point value_type; + typedef std::ptrdiff_t difference_type; + typedef value_type* pointer; + typedef value_type& reference; - typedef I_Generic_writer_vertex_proxy< Writer> Proxy; - typedef I_Generic_writer_vertex_iterator< Writer> Self; + typedef I_Generic_writer_vertex_proxy< Writer> Proxy; + typedef I_Generic_writer_vertex_iterator< Writer> Self; - I_Generic_writer_vertex_iterator( Writer& w) : m_writer(w) {} - Self& operator++() { return *this; } - Self& operator++(int) { return *this; } - Proxy operator*() const { return Proxy( m_writer); } + I_Generic_writer_vertex_iterator(Writer& w) : m_writer(w) {} + Self& operator++() { return *this; } + Self& operator++(int) { return *this; } + Proxy operator*() const { return Proxy(m_writer); } }; template -class I_Generic_writer_facet_proxy { - Writer& m_writer; +class I_Generic_writer_facet_proxy +{ + Writer& m_writer; + public: - I_Generic_writer_facet_proxy( Writer& w) : m_writer(w) {} - void operator= ( std::size_t i) { m_writer.write_facet_index(i); } + I_Generic_writer_facet_proxy(Writer& w) : m_writer(w) { } + void operator= (std::size_t i) { m_writer.write_facet_index(i); } }; template class I_Generic_writer_facet_iterator { - Writer& m_writer; + Writer& m_writer; + public: - typedef std::output_iterator_tag iterator_category; - typedef std::size_t value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type* pointer; - typedef value_type& reference; + typedef std::output_iterator_tag iterator_category; + typedef std::size_t value_type; + typedef std::ptrdiff_t difference_type; + typedef value_type* pointer; + typedef value_type& reference; - typedef I_Generic_writer_facet_proxy Proxy; - typedef I_Generic_writer_facet_iterator Self; + typedef I_Generic_writer_facet_proxy Proxy; + typedef I_Generic_writer_facet_iterator Self; - I_Generic_writer_facet_iterator( Writer& w) : m_writer(w) {} - Self& operator++() { return *this; } - Self& operator++(int) { return *this; } - Proxy operator*() const { return Proxy( m_writer); } + I_Generic_writer_facet_iterator(Writer& w) : m_writer(w) { } + Self& operator++() { return *this; } + Self& operator++(int) { return *this; } + Proxy operator*() const { return Proxy(m_writer); } }; // The Generic_writer class contains also the state necessary for all @@ -86,76 +92,93 @@ public: // the situation where the iterators are copied by value. template < class Writer, class Pt > -class Generic_writer { - Writer m_writer; - std::size_t m_vertices; - std::size_t m_halfedges; - std::size_t m_facets; +class Generic_writer +{ + Writer m_writer; + std::size_t m_vertices; + std::size_t m_halfedges; + std::size_t m_facets; + + std::size_t m_vcnt; + std::size_t m_fcnt; + std::size_t m_icnt; - std::size_t m_vcnt; - std::size_t m_fcnt; - std::size_t m_icnt; public: - typedef Pt Point; - typedef Generic_writer< Writer, Pt> Self; - typedef I_Generic_writer_vertex_iterator Vertex_iterator; - typedef I_Generic_writer_facet_iterator Facet_iterator; + typedef Pt Point; + typedef Generic_writer< Writer, Pt> Self; + typedef I_Generic_writer_vertex_iterator Vertex_iterator; + typedef I_Generic_writer_facet_iterator Facet_iterator; - Generic_writer( const Writer& writer, std::ostream& out, - std::size_t v, std::size_t h, std::size_t f) - : m_writer( writer), m_vertices(v), m_halfedges(h), m_facets(f), - m_vcnt(0), m_fcnt(0), m_icnt(0) + Generic_writer(const Writer& writer, std::ostream& out, + std::size_t v, std::size_t h, std::size_t f) + : + m_writer(writer), + m_vertices(v), m_halfedges(h), m_facets(f), + m_vcnt(0), m_fcnt(0), m_icnt(0) + { + m_writer.write_header(out, v, h, f); + } + + const Writer& writer() const { return m_writer; } + std::size_t size_of_vertices() const { return m_vertices; } + std::size_t size_of_halfedges() const { return m_halfedges; } + std::size_t size_of_facets() const { return m_facets; } + + Vertex_iterator vertices_begin() { return Vertex_iterator(*this); } + Facet_iterator facets_begin() + { + if(m_vcnt != m_vertices) { - m_writer.write_header( out, v, h, f); - } - const Writer& writer() const { return m_writer; } - std::size_t size_of_vertices() const { return m_vertices; } - std::size_t size_of_halfedges() const { return m_halfedges; } - std::size_t size_of_facets() const { return m_facets; } - - Vertex_iterator vertices_begin() { return Vertex_iterator( *this); } - Facet_iterator facets_begin() { - if ( m_vcnt != m_vertices) { - std::cerr << "error: Generic_writer: wrong number of " - "vertices written, " << m_vcnt << " instead of " - << m_vertices << "." << std::endl; - m_writer.out().clear( std::ios::badbit); - } - m_writer.write_facet_header(); - if ( m_facets == 0) - m_writer.write_footer(); - return Facet_iterator( *this); + std::cerr << "error: Generic_writer: wrong number of vertices written, " + << m_vcnt << " instead of " << m_vertices << "." << std::endl; + m_writer.out().clear(std::ios::badbit); } - // Interface used by the iterators and their proxies. - void write_vertex( const Point& p) { - ++m_vcnt; - m_writer.write_vertex( ::CGAL::to_double( p.x()), - ::CGAL::to_double( p.y()), - ::CGAL::to_double( p.z())); + m_writer.write_facet_header(); + if(m_facets == 0) + m_writer.write_footer(); + + return Facet_iterator(*this); + } + + // Interface used by the iterators and their proxies. + void write_vertex(const Point& p) + { + ++m_vcnt; + m_writer.write_vertex(::CGAL::to_double(p.x()), + ::CGAL::to_double(p.y()), + ::CGAL::to_double(p.z())); + } + + void write_facet_index(std::size_t i) + { + if(m_fcnt > m_facets) + { + std::cerr << "error: Generic_writer: too many facets written." + << std::endl; + m_writer.out().clear(std::ios::badbit); } - void write_facet_index( std::size_t i) { - if ( m_fcnt > m_facets) { - std::cerr << "error: Generic_writer: too many facets written." - << std::endl; - m_writer.out().clear( std::ios::badbit); - } - if ( m_icnt == 0) { - m_writer.write_facet_begin( i); - m_icnt = i; - } else { - m_writer.write_facet_vertex_index( i); - m_icnt --; - if ( m_icnt == 0) { - m_writer.write_facet_end(); - m_fcnt ++; - if (m_fcnt == m_facets) - m_writer.write_footer(); - } - } + + if(m_icnt == 0) + { + m_writer.write_facet_begin(i); + m_icnt = i; } + else + { + m_writer.write_facet_vertex_index(i); + m_icnt--; + if(m_icnt == 0) + { + m_writer.write_facet_end(); + m_fcnt++; + if(m_fcnt == m_facets) + m_writer.write_footer(); + } + } + } }; } //namespace CGAL -#endif // CGAL_IO_GENERIC_WRITER_H // -// EOF // + +#endif // CGAL_IO_GENERIC_WRITER_H diff --git a/Stream_support/include/CGAL/IO/OBJ/File_writer_wavefront.h b/Stream_support/include/CGAL/IO/OBJ/File_writer_wavefront.h index dc2ba242c0b..9e8a7c3ca90 100644 --- a/Stream_support/include/CGAL/IO/OBJ/File_writer_wavefront.h +++ b/Stream_support/include/CGAL/IO/OBJ/File_writer_wavefront.h @@ -47,7 +47,7 @@ public: void write_footer() const { out() << "\n# End of Wavefront obj format #" << std::endl; } - void write_vertex(const double& x, const double& y, const double& z) { + void write_vertex(const double x, const double y, const double z) { out() << "v " << x << ' ' << y << ' ' << z << '\n'; } diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index f146743f1e1..17d12a801ba 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -179,8 +179,8 @@ bool read_OFF(std::istream& in, */ template bool write_OFF(std::ostream& out, - std::vector< Point_3 >& points, - std::vector< Polygon_3 >& polygons) + std::vector& points, + std::vector& polygons) { CGAL::File_writer_OFF writer; writer.write_header(out, points.size(), 0, polygons.size()); diff --git a/Stream_support/include/CGAL/IO/OFF/File_writer_OFF.h b/Stream_support/include/CGAL/IO/OFF/File_writer_OFF.h index 20bd7e1cd54..e5097765138 100644 --- a/Stream_support/include/CGAL/IO/OFF/File_writer_OFF.h +++ b/Stream_support/include/CGAL/IO/OFF/File_writer_OFF.h @@ -25,86 +25,111 @@ namespace CGAL { -class CGAL_EXPORT File_writer_OFF { - std::ostream* m_out; - File_header_OFF m_header; +class File_writer_OFF +{ + std::ostream* m_out; + File_header_OFF m_header; + public: - File_writer_OFF( bool verbose = false) : m_header( verbose) {} - File_writer_OFF( const File_header_OFF& h) : m_header( h) {} + File_writer_OFF(bool verbose = false) : m_header(verbose) {} + File_writer_OFF(const File_header_OFF& h) : m_header(h) {} - std::ostream& out() { return *m_out; } - File_header_OFF& header() { return m_header; } - const File_header_OFF& header() const { return m_header; } + std::ostream& out() { return *m_out; } + File_header_OFF& header() { return m_header; } + const File_header_OFF& header() const { return m_header; } - void write_header(std::ostream& out, - std::size_t vertices, - std::size_t /*halfedges*/, - std::size_t facets, - bool normals = false) + void write_header(std::ostream& out, + std::size_t vertices, + std::size_t /*halfedges*/, + std::size_t facets, + bool normals = false) + { + m_out = &o; + + m_header.set_vertices(vertices); + m_header.set_facets(facets); + m_header.set_normals(normals); + + // Print header. + out() << m_header; + } + + void write_footer() + { + if(m_header.ascii() && m_header.comments()) + out() << "\n\n# End of OFF #"; + out() << std::endl; + } + + void write_vertex(const double x, const double y, const double z) + { + if(m_header.binary()) { - m_out = &o; + I_Binary_write_big_endian_float32(out(), float(x)); + I_Binary_write_big_endian_float32(out(), float(y)); + I_Binary_write_big_endian_float32(out(), float(z)); + } + else + { + out() << '\n' << x << ' ' << y << ' ' << z; + } + } - m_header.set_vertices(vertices); - m_header.set_facets(facets); - m_header.set_normals(normals); + void write_normal(const double x, const double y, const double z) + { + if(m_header.binary()) + { + I_Binary_write_big_endian_float32(out(), float(x)); + I_Binary_write_big_endian_float32(out(), float(y)); + I_Binary_write_big_endian_float32(out(), float(z)); + } + else + { + out() << ' ' << ' ' << x << ' ' << y << ' ' << z; + } + } - // Print header. - out() << m_header; + void write_facet_header() + { + if(m_header.ascii()) + { + if(m_header.no_comments()) + { + out() << '\n'; + } + else + { + out() << "\n\n# " << m_header.size_of_facets() + << " facets\n"; + out() << "# ------------------------------------------" + "\n\n"; + } } + } - void write_footer() { - if ( m_header.ascii() && m_header.comments()) - out() << "\n\n# End of OFF #"; - out() << std::endl; - } - void write_vertex( const double& x, const double& y, const double& z) { - if ( m_header.binary()) { - I_Binary_write_big_endian_float32( out(), float(x)); - I_Binary_write_big_endian_float32( out(), float(y)); - I_Binary_write_big_endian_float32( out(), float(z)); - } else { - out() << '\n' << x << ' ' << y << ' ' << z; - } - } - void write_normal( const double& x, const double& y, const double& z) { - if ( m_header.binary()) { - I_Binary_write_big_endian_float32( out(), float(x)); - I_Binary_write_big_endian_float32( out(), float(y)); - I_Binary_write_big_endian_float32( out(), float(z)); - } else { - out() << ' ' << ' ' << x << ' ' << y << ' ' << z; - } - } - void write_facet_header() { - if ( m_header.ascii()) { - if ( m_header.no_comments()) - out() << '\n'; - else { - out() << "\n\n# " << m_header.size_of_facets() - << " facets\n"; - out() << "# ------------------------------------------" - "\n\n"; - } - } - } - void write_facet_begin( std::size_t no) { - if ( m_header.binary()) - I_Binary_write_big_endian_integer32( out(), static_cast(no)); - else - out() << no << ' '; - } - void write_facet_vertex_index( std::size_t index) { - if ( m_header.binary()) - I_Binary_write_big_endian_integer32( out(), static_cast(index)); - else - out() << ' ' << index; - } - void write_facet_end() { - if ( m_header.binary()) - I_Binary_write_big_endian_integer32( out(), 0); - else - out() << '\n'; - } + void write_facet_begin(std::size_t no) + { + if(m_header.binary()) + I_Binary_write_big_endian_integer32(out(), static_cast(no)); + else + out() << no << ' '; + } + + void write_facet_vertex_index(std::size_t index) + { + if(m_header.binary()) + I_Binary_write_big_endian_integer32(out(), static_cast(index)); + else + out() << ' ' << index; + } + + void write_facet_end() + { + if(m_header.binary()) + I_Binary_write_big_endian_integer32(out(), 0); + else + out() << '\n'; + } }; } //namespace CGAL diff --git a/Stream_support/include/CGAL/IO/OI/File_writer_inventor.h b/Stream_support/include/CGAL/IO/OI/File_writer_inventor.h index 8bb51193004..ebeb4c1fffb 100644 --- a/Stream_support/include/CGAL/IO/OI/File_writer_inventor.h +++ b/Stream_support/include/CGAL/IO/OI/File_writer_inventor.h @@ -15,7 +15,7 @@ // Author(s) : Lutz Kettner #ifndef CGAL_IO_FILE_WRITER_INVENTOR_H -#define CGAL_IO_FILE_WRITER_INVENTOR_H 1 +#define CGAL_IO_FILE_WRITER_INVENTOR_H #include @@ -25,24 +25,24 @@ namespace CGAL { class File_writer_inventor { - std::ostream* m_out; + Inventor_ostream_base* m_out; std::size_t m_facets; public: File_writer_inventor() {} - std::ostream& out() const { return *m_out; } + std::ostream& out() const { return m_out->os(); } void write_header(Inventor_ostream_base& o, std::size_t vertices, std::size_t halfedges, std::size_t facets) { - m_out = &(o.os()); + m_out = &o; m_facets = facets; - out() << "# " << vertices << " vertices\n"; + out() << "# " << vertices << " vertices\n"; out() << "# " << halfedges << " halfedges\n"; - out() << "# " << facets << " facets\n\n"; + out() << "# " << facets << " facets\n\n"; out() << "Separator {\n" " Coordinate3 {\n" " point [" << std::endl; @@ -55,7 +55,8 @@ public: "} #Separator" << std::endl; } - void write_vertex( const double& x, const double& y, const double& z) { + void write_vertex( const double x, const double y, const double z) + { out() << " " << x << ' ' << y << ' ' << z << ',' <<'\n'; } @@ -73,6 +74,6 @@ public: void write_facet_end() { out() << "-1,\n"; } }; -} //namespace CGAL +} // namespace CGAL #endif // CGAL_IO_FILE_WRITER_INVENTOR_H diff --git a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h index 64793b50cde..8b72d1117c7 100644 --- a/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h +++ b/Stream_support/include/CGAL/IO/VRML/File_writer_VRML_2.h @@ -28,25 +28,25 @@ namespace CGAL { class File_writer_VRML_2 { - std::ostream* m_out; + VRML_2_ostream* m_out; std::size_t m_facets; public: File_writer_VRML_2() {} - std::ostream& out() const { return *m_out; } + std::ostream& out() const { return m_out->os(); } void write_header(VRML_2_ostream& o, std::size_t vertices, std::size_t halfedges, std::size_t facets) { - m_out = &o.os(); + m_out = &o; m_facets = facets; out() << " #-- Begin of Polygon Mesh\n"; - out() << " # " << vertices << " vertices\n"; + out() << " # " << vertices << " vertices\n"; out() << " # " << halfedges << " halfedges\n"; - out() << " # " << facets << " facets\n"; + out() << " # " << facets << " facets\n"; out() << " Group {\n" " children [\n" " Shape {\n" @@ -67,10 +67,12 @@ public: " } #Group" << std::endl; } - void write_vertex( const double& x, const double& y, const double& z) { + void write_vertex( const double& x, const double& y, const double& z) + { out() << " " << x << ' ' << y << ' ' << z << ',' << '\n'; } + void write_facet_header() const { out() << " ] #point\n" @@ -78,9 +80,7 @@ public: " coordIndex [" << std::endl; } - void write_facet_begin( std::size_t) { - out() << " "; - } + void write_facet_begin( std::size_t) { out() << " "; } void write_facet_vertex_index( std::size_t idx) { out() << idx << ',';} void write_facet_end() { out() << "-1,\n"; } }; diff --git a/Stream_support/include/CGAL/IO/binary_file_io.h b/Stream_support/include/CGAL/IO/binary_file_io.h index 8b15ac2afb6..cdc613996c0 100644 --- a/Stream_support/include/CGAL/IO/binary_file_io.h +++ b/Stream_support/include/CGAL/IO/binary_file_io.h @@ -1,16 +1,16 @@ -// Copyright (c) 1997 +// Copyright (c) 1997 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), // INRIA Sophia-Antipolis (France), // Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// +// // // Author(s) : Lutz Kettner @@ -26,80 +26,80 @@ namespace CGAL { inline void I_Binary_write_integer32(std::ostream& out, boost::int32_t i) { - out.write( (char*)(&i), 4); + out.write( (char*)(&i), 4); } inline void I_Binary_write_float32(std::ostream& out, float f) { - out.write( (char*)(&f), 4); + out.write( (char*)(&f), 4); } inline void I_Binary_read_integer32(std::istream& in, boost::int32_t& i) { - in.read( (char*)(&i), 4); + in.read( (char*)(&i), 4); } inline void I_Binary_read_float32(std::istream& in, float& f) { - in.read( (char*)(&f), 4); + in.read( (char*)(&f), 4); } inline void I_swap_to_big_endian( boost::uint32_t& u) { - (void) u; + (void) u; #ifdef CGAL_LITTLE_ENDIAN - u = ((u >> 24) | (u << 24) | ((u >> 8) & 0xff00) | ((u << 8) & 0xff0000)); + u = ((u >> 24) | (u << 24) | ((u >> 8) & 0xff00) | ((u << 8) & 0xff0000)); #endif } inline void I_swap_to_big_endian( boost::int32_t& i) { - // We need to use a union instead of the 2 lines below, - // otherwise we get aliasing issues. - // boost::uint32_t& u = (boost::uint32_t&)i; - // I_swap_to_big_endian( u); - union { - boost::int32_t in; - boost::uint32_t ui; - } u; - u.in = i; - I_swap_to_big_endian(u.ui); - i = u.in; + // We need to use a union instead of the 2 lines below, + // otherwise we get aliasing issues. + // boost::uint32_t& u = (boost::uint32_t&)i; + // I_swap_to_big_endian( u); + union { + boost::int32_t in; + boost::uint32_t ui; + } u; + u.in = i; + I_swap_to_big_endian(u.ui); + i = u.in; } inline void I_swap_to_big_endian( float& f) { - // We need to use a union instead of the 2 lines below, - // otherwise we get aliasing issues. - // boost::uint32_t& u = (boost::uint32_t&)f; - // I_swap_to_big_endian( u); - union { - boost::uint32_t ui; - float fl; - } u; - u.fl = f; - I_swap_to_big_endian(u.ui); - f = u.fl; + // We need to use a union instead of the 2 lines below, + // otherwise we get aliasing issues. + // boost::uint32_t& u = (boost::uint32_t&)f; + // I_swap_to_big_endian( u); + union { + boost::uint32_t ui; + float fl; + } u; + u.fl = f; + I_swap_to_big_endian(u.ui); + f = u.fl; } inline void I_Binary_write_big_endian_integer32(std::ostream& out, boost::int32_t i) { - I_swap_to_big_endian( i); - out.write( (char*)(&i), 4); + I_swap_to_big_endian( i); + out.write( (char*)(&i), 4); } inline void I_Binary_write_big_endian_float32(std::ostream& out, float f) { - I_swap_to_big_endian( f); - out.write( (char*)(&f), 4); + I_swap_to_big_endian( f); + out.write( (char*)(&f), 4); } inline void I_Binary_read_big_endian_integer32(std::istream& in, boost::int32_t& i) { - in.read( (char*)(&i), 4); - I_swap_to_big_endian( i); + in.read( (char*)(&i), 4); + I_swap_to_big_endian( i); } inline void I_Binary_read_big_endian_float32(std::istream& in, float& f) { - in.read( (char*)(&f), 4); - I_swap_to_big_endian( f); + in.read( (char*)(&f), 4); + I_swap_to_big_endian( f); } } //namespace CGAL diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/3mf.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/3mf.h index 7a52be311ba..3df3e1a11d8 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/3mf.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/3mf.h @@ -13,10 +13,12 @@ #ifndef CGAL_SURFACE_MESH_IO_3MF_H #define CGAL_SURFACE_MESH_IO_3MF_H -#include -#include #include +#include + +#include + namespace CGAL{ /*! * Extracts the surface meshes from an input 3mf file and appends it to `output`.