# HG changeset patch # User Mike Miller # Date 1390629732 18000 # Node ID bd9d34f28b0f5740212be0d37175eac56a80fa05 # Parent abc78c10acb62a5a6dcef5b728b8a030d24b9eaf Use std::ostream::fail instead of unsafe implicit bool conversion (bug #41335) * ls-mat4.cc (save_mat_binary_data): Use std::ostream::fail to return stream status instead of unsafe implicit bool conversion. * ov-cell.cc (octave_cell::save_ascii) Likewise. * ov-class.cc (octave_class::save_ascii, octave_class::save_binary) Likewise. * ov-fcn-handle.cc (octave_fcn_handle::save_ascii, octave_fcn_handle::save_binary) Likewise. * ov-struct.cc (octave_struct::save_ascii, octave_struct::save_binary, octave_scalar_struct::save_ascii, octave_scalar_struct::save_binary) Likewise. diff -r abc78c10acb6 -r bd9d34f28b0f libinterp/corefcn/ls-mat4.cc --- a/libinterp/corefcn/ls-mat4.cc Thu Jan 16 22:49:52 2014 -0500 +++ b/libinterp/corefcn/ls-mat4.cc Sat Jan 25 01:02:12 2014 -0500 @@ -585,5 +585,5 @@ else gripe_wrong_type_arg ("save", tc, false); - return os; + return ! os.fail (); } diff -r abc78c10acb6 -r bd9d34f28b0f libinterp/octave-value/ov-cell.cc --- a/libinterp/octave-value/ov-cell.cc Thu Jan 16 22:49:52 2014 -0500 +++ b/libinterp/octave-value/ov-cell.cc Sat Jan 25 01:02:12 2014 -0500 @@ -780,7 +780,7 @@ bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, false, 0); if (! b) - return os; + return ! os.fail (); } } else @@ -802,7 +802,7 @@ bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, false, 0); if (! b) - return os; + return ! os.fail (); } os << "\n"; diff -r abc78c10acb6 -r bd9d34f28b0f libinterp/octave-value/ov-class.cc --- a/libinterp/octave-value/ov-class.cc Thu Jan 16 22:49:52 2014 -0500 +++ b/libinterp/octave-value/ov-class.cc Sat Jan 25 01:02:12 2014 -0500 @@ -1355,7 +1355,7 @@ bool b = save_ascii_data (os, val, m.key (i), false, 0); if (! b) - return os; + return ! os.fail (); i++; } @@ -1484,7 +1484,7 @@ bool b = save_binary_data (os, val, m.key (i), "", 0, save_as_floats); if (! b) - return os; + return ! os.fail (); i++; } diff -r abc78c10acb6 -r bd9d34f28b0f libinterp/octave-value/ov-fcn-handle.cc --- a/libinterp/octave-value/ov-fcn-handle.cc Thu Jan 16 22:49:52 2014 -0500 +++ b/libinterp/octave-value/ov-fcn-handle.cc Sat Jan 25 01:02:12 2014 -0500 @@ -380,7 +380,7 @@ p = vars.begin (); p != vars.end (); p++) { if (! save_ascii_data (os, p->varval (0), p->name (), false, 0)) - return os; + return ! os.fail (); } } } @@ -556,7 +556,7 @@ { if (! save_binary_data (os, p->varval (0), p->name (), "", 0, save_as_floats)) - return os; + return ! os.fail (); } } } diff -r abc78c10acb6 -r bd9d34f28b0f libinterp/octave-value/ov-struct.cc --- a/libinterp/octave-value/ov-struct.cc Thu Jan 16 22:49:52 2014 -0500 +++ b/libinterp/octave-value/ov-struct.cc Sat Jan 25 01:02:12 2014 -0500 @@ -769,7 +769,7 @@ bool b = save_ascii_data (os, val, key, false, 0); if (! b) - return os; + return ! os.fail (); } return true; @@ -894,7 +894,7 @@ bool b = save_binary_data (os, val, key, "", 0, save_as_floats); if (! b) - return os; + return ! os.fail (); } return true; @@ -1471,7 +1471,7 @@ bool b = save_ascii_data (os, val, key, false, 0); if (! b) - return os; + return ! os.fail (); } return true; @@ -1555,7 +1555,7 @@ bool b = save_binary_data (os, val, key, "", 0, save_as_floats); if (! b) - return os; + return ! os.fail (); } return true;