diff libinterp/octave-value/ov-base-sparse.cc @ 17818:f1b59ef34eda

attempt to avoid setting persistent state on i/o streams (bug #40396) * utils.h, utils.cc (octave_preserve_stream_state): New class. * debug.cc, pr-output.cc, variables.cc, ov-base-sparse.cc: Use it to save and restore stream flags, precision, field width, and fill character.
author John W. Eaton <jwe@octave.org>
date Thu, 31 Oct 2013 17:26:04 -0400
parents 175b392e91fe
children 1b6db9303933
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base-sparse.cc	Thu Oct 31 21:44:58 2013 +0100
+++ b/libinterp/octave-value/ov-base-sparse.cc	Thu Oct 31 17:26:04 2013 -0400
@@ -42,6 +42,7 @@
 #include "boolSparse.h"
 #include "ov-base-sparse.h"
 #include "pager.h"
+#include "utils.h"
 
 template <class T>
 octave_value
@@ -306,6 +307,8 @@
 octave_base_sparse<T>::print_raw (std::ostream& os,
                                   bool pr_as_read_syntax) const
 {
+  octave_preserve_stream_state stream_state (os);
+
   octave_idx_type nr = matrix.rows ();
   octave_idx_type nc = matrix.cols ();
   octave_idx_type nz = nnz ();