# HG changeset patch # User jwe # Date 785443065 0 # Node ID 8fa3c25ab27102429aaa2f7155025afe7e2a3b79 # Parent c4827d0fe063506704b83353772e2cc6bf0bae52 [project @ 1994-11-21 18:37:45 by jwe] diff -r c4827d0fe063 -r 8fa3c25ab271 liboctave/idx-vector.cc --- a/liboctave/idx-vector.cc Mon Nov 21 15:45:09 1994 +0000 +++ b/liboctave/idx-vector.cc Mon Nov 21 18:37:45 1994 +0000 @@ -221,12 +221,18 @@ initialized = 0; return; } +#if 0 +// Checking max index against size won't work right here unless we +// also look at resize on range error, and we have to do that later +// on anyway. + else if (max_val >= z_len) { ::error ("%s index %d out of range", rc, max_val+1); initialized = 0; return; } +#endif initialized = 1; } diff -r c4827d0fe063 -r 8fa3c25ab271 src/tc-rep-idx.cc --- a/src/tc-rep-idx.cc Mon Nov 21 15:45:09 1994 +0000 +++ b/src/tc-rep-idx.cc Mon Nov 21 18:37:45 1994 +0000 @@ -154,9 +154,15 @@ if (! j) return retval; + int jmax = j.max (); int len = j.length (); if (len == j.ones_count ()) cols = len; + else if (jmax > 0) + { + error ("invalid scalar index = %d", jmax+1); + return retval; + } } else if (arg.const_type () == magic_colon || (arg.is_scalar_type () @@ -182,9 +188,15 @@ if (! i) return retval; + int imax = i.max (); int len = i.length (); if (len == i.ones_count ()) rows = len; + else if (imax > 0) + { + error ("invalid scalar index = %d", imax+1); + return retval; + } } else if (arg.const_type () == magic_colon || (arg.is_scalar_type () @@ -200,6 +212,8 @@ else break; +// If only one index, cols will not be set. + if (cols == 0) { if (user_pref.prefer_column_vectors)