Mercurial > hg > octave-avbm
changeset 942:8fa3c25ab271
[project @ 1994-11-21 18:37:45 by jwe]
author | jwe |
---|---|
date | Mon, 21 Nov 1994 18:37:45 +0000 |
parents | c4827d0fe063 |
children | 4fc1ae8c24dc |
files | liboctave/idx-vector.cc src/tc-rep-idx.cc |
diffstat | 2 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -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; }
--- a/src/tc-rep-idx.cc +++ b/src/tc-rep-idx.cc @@ -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)