From octave-maintainers-request at bevo dot che dot wisc dot edu Tue Oct 29 03:17:26 1996 Subject: Re: loading of old binary files does not work From: Andreas Weingessel To: "John W. Eaton" Cc: octave-maintainers at bevo dot che dot wisc dot edu Date: Tue, 29 Oct 1996 10:19:11 +0100 This patch seems to work fine. Thanks, Andreas Weingessel >>>>> On Mon, 28 Oct 1996 11:23:10 -0600, >>>>> John W Eaton wrote: > On 28-Oct-1996, Andreas Weingessel wrote: > : It is not possible to load binary files which have been saved with an > : older version of octave using the default save command. > : The file "im1i7.p1" contains one variable p1 produced by > : save im1i7.p1 p1 > : with some older octave version (octave-1.1.1 or some newer snapshot). > : When loading this file the following happens > : > : Octave, version ss-961015 (i586-unknown-linux). > : Copyright (C) 1996 John W. Eaton. > : This is free software with ABSOLUTELY NO WARRANTY. > : For details, type `warranty'. > : > : octave:1> load im1i7.p1 > : octave:2> who > : > : *** local user variables: > : > : p1Ðâ at ð¡ø¡4 > Please try the following patch. > Thanks, > jwe > Index: load-save.cc > =================================================================== > RCS file: /home/jwe/src/master/octave/src/load-save.cc,v > retrieving revision 1.71 > diff -c -r1.71 load-save.cc > *** load-save.cc 1996/10/12 00:09:56 1.71 > --- load-save.cc 1996/10/28 17:18:59 > *************** > *** 1149,1159 **** > } > // LEN includes the terminating character, and the file is also > ! // supposed to include it. > ! name = new char [len]; > if (! is.read (name, len)) > goto data_read_error; > dlen = nr * nc; > if (dlen < 0) > --- 1149,1161 ---- > } > // LEN includes the terminating character, and the file is also > ! // supposed to include it, but apparently not all files do. Either > ! // way, I think this should work. > ! name = new char [len+1]; > if (! is.read (name, len)) > goto data_read_error; > + name[len] = '\0'; > dlen = nr * nc; > if (dlen < 0)