# HG changeset patch # User Jaroslav Hajek # Date 1225451356 -3600 # Node ID 7e87d3d76a5689e02cad5e31bb8e95c85a888627 # Parent dc62132651db810382080c62059a12e7f77d8947 fix extent query for empty ranges diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,10 @@ +2008-10-31 Jaroslav Hajek + + * idx-vector.h (idx_vector::idx_range_rep::extent): Don't change + extent when len is zero. + * idx-vector.h (idx_vector::idx_range_rep::idx_range_rep (void)): + Create empty range by default. + 2008-10-30 Jaroslav Hajek * oct-inttypes.h (octave_int_abs): New function. diff --git a/liboctave/idx-vector.h b/liboctave/idx-vector.h --- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -152,7 +152,7 @@ : idx_base_rep (), start(_start), len(_len), step(_step) { } idx_range_rep (void) - : start(0), len(1), step(1) { } + : start(0), len(0), step(1) { } // Zero-based constructor. idx_range_rep (octave_idx_type _start, octave_idx_type _limit, @@ -169,7 +169,7 @@ { return len; } octave_idx_type extent (octave_idx_type n) const - { return std::max (n, (start + 1 + (step < 0 ? 0 : step * (len - 1)))); } + { return len ? std::max (n, (start + 1 + (step < 0 ? 0 : step * (len - 1)))) : n; } idx_class_type idx_class () const { return class_range; }