Mercurial > hg > octave-nkf
changeset 1698:0892abda7553
[project @ 1996-01-07 02:28:21 by jwe]
author | jwe |
---|---|
date | Sun, 07 Jan 1996 02:31:40 +0000 |
parents | 597c3ca9f6e8 |
children | 0c6d3b73bf69 |
files | liboctave/Array.cc liboctave/dMatrix.cc |
diffstat | 2 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -393,8 +393,8 @@ { int a_rows = a.rows (); int a_cols = a.cols (); - if (r < 0 || r + a_rows - 1 > rows () - || c < 0 || c + a_cols - 1 > cols ()) + + if (r < 0 || r + a_rows > rows () || c < 0 || c + a_cols > cols ()) { (*current_liboctave_error_handler) ("range error for insert"); return *this;
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -129,7 +129,7 @@ Matrix::insert (const RowVector& a, int r, int c) { int a_len = a.length (); - if (r < 0 || r >= rows () || c < 0 || c + a_len - 1 > cols ()) + if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) { (*current_liboctave_error_handler) ("range error for insert"); return *this; @@ -145,7 +145,7 @@ Matrix::insert (const ColumnVector& a, int r, int c) { int a_len = a.length (); - if (r < 0 || r + a_len - 1 > rows () || c < 0 || c >= cols ()) + if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ()) { (*current_liboctave_error_handler) ("range error for insert"); return *this; @@ -163,8 +163,7 @@ int a_nr = a.rows (); int a_nc = a.cols (); - if (r < 0 || r + a_nr - 1 > rows () - || c < 0 || c + a_nc - 1 > cols ()) + if (r < 0 || r + a_nr > rows () || c < 0 || c + a_nc > cols ()) { (*current_liboctave_error_handler) ("range error for insert"); return *this;