changeset 4889:658aad1c1b05

[project @ 2004-04-30 22:38:30 by jwe]
author jwe
date Fri, 30 Apr 2004 22:38:30 +0000
parents 4a796c5fc7a3
children e7da90a1cc11
files src/ChangeLog src/oct-stream.cc src/oct-stream.h
diffstat 3 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Apr 30 18:27:07 2004 +0000
+++ b/src/ChangeLog	Fri Apr 30 22:38:30 2004 +0000
@@ -1,6 +1,8 @@
 2004-04-30  John W. Eaton  <jwe@octave.org>
 
-	* oct-stream.cc (octave_base_stream::clear): Also clear stream state.
+	* oct-stream.cc (octave_base_stream::clearerr): New function.
+	(octave_stream::clearerr): New function.
+	(seek (long, int)): Call clearerr here.
 	* oct-stdstrm.h (octave_stdiostream::clear): New function.
 	* c-file-ptr-stream.h (c_file_ptr_buf::clear,
 	i_c_file_ptr_stream::clear, o_c_file_ptr_stream::clear,
--- a/src/oct-stream.cc	Fri Apr 30 18:27:07 2004 +0000
+++ b/src/oct-stream.cc	Fri Apr 30 22:38:30 2004 +0000
@@ -935,6 +935,13 @@
 void
 octave_base_stream::clear (void)
 {
+  fail = false;
+  errmsg = "";
+}
+
+void
+octave_base_stream::clearerr (void)
+{
   std::istream *is = input_stream ();
   std::ostream *os = output_stream ();
 
@@ -943,9 +950,6 @@
 
   if (os)
     os->clear ();
-
-  fail = false;
-  errmsg = "";
 }
 
 // Functions that are defined for all input streams (input streams
@@ -2706,7 +2710,11 @@
   int retval = -1;
 
   if (stream_ok ("fseek"))
-    retval = rep->seek (offset, origin);
+    {
+      clearerr ();
+
+      retval = rep->seek (offset, origin);
+    }
 
   return retval;
 }
--- a/src/oct-stream.h	Fri Apr 30 18:27:07 2004 +0000
+++ b/src/oct-stream.h	Fri Apr 30 22:38:30 2004 +0000
@@ -398,6 +398,10 @@
 
   void clear (void);
 
+  // Clear stream state.
+
+  void clearerr (void);
+
 private:
 
   // A reference count.
@@ -572,6 +576,8 @@
 
   std::ostream *output_stream (void) { return rep ? rep->output_stream () : 0; }
 
+  void clearerr (void) { if (rep) rep->clearerr (); }
+
 private:
 
   // The actual representation of this stream.