# HG changeset patch # User jwe # Date 1099599131 0 # Node ID 1312d3af9eb06be9c3c5db009f02f187d11fd359 # Parent a6755bc45f15474cbd3695015591a8c7c75d6bb3 [project @ 2004-11-04 20:12:00 by jwe] diff -r a6755bc45f15 -r 1312d3af9eb0 scripts/ChangeLog --- a/scripts/ChangeLog Thu Nov 04 16:34:57 2004 +0000 +++ b/scripts/ChangeLog Thu Nov 04 20:12:11 2004 +0000 @@ -1,3 +1,7 @@ +2004-11-04 John W. Eaton + + * plot/hist.m: Always return row vectors for vector args. + 2004-09-23 John W. Eaton * strings/strcmp.m: If args are not strings or cell arrays of diff -r a6755bc45f15 -r 1312d3af9eb0 scripts/plot/hist.m --- a/scripts/plot/hist.m Thu Nov 04 16:34:57 2004 +0000 +++ b/scripts/plot/hist.m Thu Nov 04 20:12:11 2004 +0000 @@ -50,8 +50,9 @@ usage ("[nn, xx] = hist (y, x, norm)"); endif - transpose = rows (y) == 1; - if (transpose) + arg_is_vector = is_vector (y); + + if (rows (y) == 1) y = y(:); endif @@ -119,7 +120,7 @@ endif if (nargout > 0) - if (transpose) + if (arg_is_vector) nn = freq'; xx = x'; else diff -r a6755bc45f15 -r 1312d3af9eb0 src/ChangeLog --- a/src/ChangeLog Thu Nov 04 16:34:57 2004 +0000 +++ b/src/ChangeLog Thu Nov 04 20:12:11 2004 +0000 @@ -1,5 +1,9 @@ 2004-11-04 John W. Eaton + * oct-stream.cc (octave_stream::seek (long, int)): Return error + (but leave file position unchanged) for attempt to seek beyond end + of file. + * DLD-FUNCTIONS/inv.cc (Finv): Check rcond value returned from LAPACK routines, and be careful to avoid optimizing away the 1+rcond == 1.0 check. diff -r a6755bc45f15 -r 1312d3af9eb0 src/oct-stream.cc --- a/src/oct-stream.cc Thu Nov 04 16:34:57 2004 +0000 +++ b/src/oct-stream.cc Thu Nov 04 20:12:11 2004 +0000 @@ -2663,16 +2663,48 @@ int octave_stream::seek (long offset, int origin) { - int retval = -1; + int status = -1; if (stream_ok ("fseek")) { clearerr (); - retval = rep->seek (offset, origin); + long orig_pos = rep->tell (); + + status = rep->seek (offset, origin); + + if (status == 0) + { + long save_pos = rep->tell (); + + rep->seek (0, SEEK_END); + + long pos_eof = rep->tell (); + + // I don't think save_pos can be less than zero, but we'll + // check anyway... + + if (save_pos > pos_eof || save_pos < 0) + { + // Seek outside bounds of file. Failure should leave + // position unchanged. + + rep->seek (orig_pos, SEEK_SET); + + status = -1; + } + else + { + // Is it possible for this to fail? We are just + // returning to a position after the first successful + // seek. + + rep->seek (save_pos, SEEK_SET); + } + } } - return retval; + return status; } int @@ -2720,7 +2752,12 @@ } if (! conv_err) - retval = seek (xoffset, origin); + { + retval = seek (xoffset, origin); + + if (retval != 0) + error ("fseek: failed to seek to requested position"); + } else error ("fseek: invalid value for origin"); }