changeset 30024:fa45724a7fc8

save and restore output stream state in Octave's printf function (bug #61051) * oct-stream.cc (base_stream::do_printf): Use preserve_stream_state to save and restore stream state.
author John W. Eaton <jwe@octave.org>
date Fri, 20 Aug 2021 13:52:01 -0400
parents 374e68721324
children 815fbbbccd0c
files libinterp/corefcn/oct-stream.cc
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.cc	Fri Aug 20 08:56:40 2021 -0700
+++ b/libinterp/corefcn/oct-stream.cc	Fri Aug 20 13:52:01 2021 -0400
@@ -46,6 +46,7 @@
 #include "lo-mappers.h"
 #include "lo-utils.h"
 #include "oct-locbuf.h"
+#include "octave-preserve-stream-state.h"
 #include "quit.h"
 #include "str-vec.h"
 
@@ -5873,6 +5874,8 @@
       {
         std::ostream& os = *osp;
 
+        preserve_stream_state stream_state (os);
+
         const printf_format_elt *elt = fmt_list.first ();
 
         printf_value_cache val_cache (args, who);