Mercurial > hg > octave-lyh
diff src/oct-stream.cc @ 4425:82f8aae8cf20
[project @ 2003-06-13 15:08:25 by jwe]
author | jwe |
---|---|
date | Fri, 13 Jun 2003 15:08:26 +0000 |
parents | 3dfdbcaf4582 |
children | efb6301dae80 |
line wrap: on
line diff
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -2175,31 +2175,36 @@ { std::string retval; - octave_value tval = values (val_idx++); - - if (tval.rows () == 1) - retval = tval.string_value (); + if (exhausted ()) + curr_state = conversion_error; else { - // In the name of Matlab compatibility. - - charMatrix chm = tval.char_matrix_value (); - - int nr = chm.rows (); - int nc = chm.columns (); - - int k = 0; - - retval.resize (nr * nc, '\0'); - - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) - retval[k++] = chm(i,j); + octave_value tval = values (val_idx++); + + if (tval.rows () == 1) + retval = tval.string_value (); + else + { + // In the name of Matlab compatibility. + + charMatrix chm = tval.char_matrix_value (); + + int nr = chm.rows (); + int nc = chm.columns (); + + int k = 0; + + retval.resize (nr * nc, '\0'); + + for (int j = 0; j < nc; j++) + for (int i = 0; i < nr; i++) + retval[k++] = chm(i,j); + } + + if (error_state) + curr_state = conversion_error; } - if (error_state) - curr_state = conversion_error; - return retval; }