Re: loading of old binary files does not work

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: loading of old binary files does not work

Andres Weingessel

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 <[hidden email]> 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Ðâ@ð¡ø¡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)