# HG changeset patch # User Jaroslav Hajek # Date 1260867695 -3600 # Node ID 43a29eeda9949eae63aaeee54f1e5271cd35aed4 # Parent d1cc2e0ddf55807ee3b252c00d5ec20b54d62028 fix idx_vector::loop for masks diff -r d1cc2e0ddf55 -r 43a29eeda994 liboctave/ChangeLog --- a/liboctave/ChangeLog Mon Dec 14 13:50:11 2009 -0500 +++ b/liboctave/ChangeLog Tue Dec 15 10:01:35 2009 +0100 @@ -1,3 +1,8 @@ +2009-12-15 Jaroslav Hajek + + * idx-vector.h (idx_vector::loop, idx_vector::bloop): Fix behavior for + masks. + 2009-12-13 Rik * Makefile.am: Use DISTCLEANFILES rather than distclean-local rule. diff -r d1cc2e0ddf55 -r 43a29eeda994 liboctave/idx-vector.h --- a/liboctave/idx-vector.h Mon Dec 14 13:50:11 2009 -0500 +++ b/liboctave/idx-vector.h Tue Dec 15 10:01:35 2009 +0100 @@ -824,8 +824,8 @@ idx_mask_rep * r = dynamic_cast (rep); const bool *data = r->get_data (); octave_idx_type ext = r->extent (0); - for (octave_idx_type i = 0, j = 0; i < ext; i++) - if (data[i]) body (j++); + for (octave_idx_type i = 0; i < ext; i++) + if (data[i]) body (i); } break; default: @@ -894,8 +894,16 @@ const bool *data = r->get_data (); octave_idx_type ext = r->extent (0), j = 0; for (octave_idx_type i = 0; i < ext; i++) - if (data[i] && body (j++)) - break; + { + if (data[i]) + { + if (body (i)) + break; + else + j++; + } + } + ret = j; } break;