changeset 12714:65b7ce254ba3

Fix loading of function handles saved in binary format. Bug #33456. * src/ov-fcn-handle.cc (load_binary): Replace is.get() with is.read().
author Olaf Till <olaf.till@uni-jena.de>
date Thu, 02 Jun 2011 16:31:13 +0200
parents f66dacbeb7be
children 6835bc816ef2
files src/ov-fcn-handle.cc
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ov-fcn-handle.cc
+++ b/src/ov-fcn-handle.cc
@@ -553,7 +553,10 @@
     swap_bytes<4> (&tmp);
 
   OCTAVE_LOCAL_BUFFER (char, ctmp1, tmp+1);
-  is.get (ctmp1, tmp+1, 0);
+  // is.get (ctmp1, tmp+1, 0); caused is.eof () to be true though
+  // effectively not reading over file end
+  is.read (ctmp1, tmp);
+  ctmp1[tmp] = 0;
   nm = std::string (ctmp1);
 
   if (! is)
@@ -578,7 +581,10 @@
         swap_bytes<4> (&tmp);
 
       OCTAVE_LOCAL_BUFFER (char, ctmp2, tmp+1);
-      is.get (ctmp2, tmp+1, 0);
+      // is.get (ctmp2, tmp+1, 0); caused is.eof () to be true though
+      // effectively not reading over file end
+      is.read (ctmp2, tmp);
+      ctmp2[tmp] = 0;
 
       unwind_protect_safe frame;
 
@@ -658,7 +664,7 @@
       success = set_fcn (octaveroot, fpath);
      }
 
- return success;
+  return success;
 }
 
 #if defined (HAVE_HDF5)