changeset 18384:bd9d34f28b0f stable

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.
author Mike Miller <mtmiller@ieee.org>
date Sat, 25 Jan 2014 01:02:12 -0500
parents abc78c10acb6
children 7e39cbefe299
files libinterp/corefcn/ls-mat4.cc libinterp/octave-value/ov-cell.cc libinterp/octave-value/ov-class.cc libinterp/octave-value/ov-fcn-handle.cc libinterp/octave-value/ov-struct.cc
diffstat 5 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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 ();
 }
--- 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";
--- 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++;
     }
--- 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 ();
             }
         }
     }
--- 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;