diff libinterp/corefcn/oct-fstrm.cc @ 20931:69dcb58b9ada

Clean up use of error() versus ::error() in stream-based code. * oct-fstrm.cc, oct-iostrm.cc, oct-strstrm.cc: Add comments before code that is specifically using error from stream class rather than ::error from error.h * oct-stream.cc: Overhaul file. Add programming note about difference between error() and ::error() at top of file. Put input validation first. Cuddle parentheses to variable when doing indexing. Declare variables as late as possible. Wrap lines < 80 characters, but try to break comments into intelligible blocks. Avoid declaring retval when returning a value would do just as well.
author Rik <rik@octave.org>
date Thu, 17 Dec 2015 10:55:28 -0800
parents 8ddb11c0b1f8
children aac911d8847b
line wrap: on
line diff
--- a/libinterp/corefcn/oct-fstrm.cc	Thu Dec 17 13:39:00 2015 -0500
+++ b/libinterp/corefcn/oct-fstrm.cc	Thu Dec 17 10:55:28 2015 -0800
@@ -56,6 +56,7 @@
 #endif
 
   if (! fs)
+    // Note: error() is inherited from octave_base_stream, not ::error().
     error (gnulib::strerror (errno));
 }
 
@@ -64,6 +65,8 @@
 int
 octave_fstream::seek (off_t, int)
 {
+  // Note: error() is inherited from octave_base_stream, not ::error().
+  // This error function does not halt execution so "return ..." must exist.
   error ("fseek: invalid_operation");
   return -1;
 }
@@ -73,6 +76,8 @@
 off_t
 octave_fstream::tell (void)
 {
+  // Note: error() is inherited from octave_base_stream, not ::error().
+  // This error function does not halt execution so "return ..." must exist.
   error ("ftell: invalid_operation");
   return -1;
 }