Skip to content

Commit cacb30d

Browse files
committed
Fix the conversion to void*
LLVM libc++ does not implement std::basic_ios::operator void*, even in C++03.
1 parent 22ae533 commit cacb30d

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

Inventor/include/CGAL/IO/Inventor_ostream.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ class Inventor_ostream_base {
5353
|| defined BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
5454
typedef const void* Const_void_ptr;
5555
operator Const_void_ptr () const {
56-
if ( m_os)
57-
return *m_os;
56+
if ( m_os->fail() )
5857
return 0;
58+
else
59+
return static_cast<Const_void_ptr>(m_os);
5960
}
6061
#else
6162
explicit operator bool ()

Inventor/include/CGAL/IO/VRML_2_ostream.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ class VRML_2_ostream {
4747
|| defined BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
4848
typedef const void* Const_void_ptr;
4949
operator Const_void_ptr () const {
50-
if ( m_os)
51-
return *m_os;
50+
if ( m_os->fail() )
5251
return 0;
52+
else
53+
return static_cast<Const_void_ptr>(m_os);
5354
}
5455
#else
55-
explicit operator bool ()
56-
{
56+
explicit operator bool () {
5757
return m_os && !m_os->fail();
5858
}
5959
#endif

Polyhedron_IO/examples/Polyhedron_IO/off2iv.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ int main( int argc, char **argv) {
8181
CGAL::Inventor_ostream os( *p_out);
8282
CGAL::File_writer_inventor writer;
8383
CGAL::generic_copy_OFF( *p_in, *p_out, writer);
84+
if(!os) return EXIT_FAILURE;
8485
os.close();
8586
vout << " .... done." << endl;
8687

Polyhedron_IO/examples/Polyhedron_IO/off2vrml.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ int main( int argc, char **argv) {
8787
CGAL::VRML_1_ostream os( *p_out);
8888
CGAL::File_writer_inventor writer;
8989
CGAL::generic_copy_OFF( *p_in, *p_out, writer);
90+
if(!os) return EXIT_FAILURE;
9091
os.close();
9192
} else {
9293
CGAL::VRML_2_ostream os( *p_out);
9394
CGAL::File_writer_VRML_2 writer;
9495
CGAL::generic_copy_OFF( *p_in, *p_out, writer);
96+
if(!os) return EXIT_FAILURE;
9597
os.close();
9698
}
9799
vout << " .... done." << endl;

0 commit comments

Comments
 (0)