Mercurial > hg > octave-lojdl
changeset 6811:3fe394f8502b
[project @ 2007-08-10 19:07:34 by jwe]
author | jwe |
---|---|
date | Fri, 10 Aug 2007 19:07:35 +0000 |
parents | 56a7de3f6451 |
children | da3d4bb32f35 |
files | src/ChangeLog src/ov-struct.cc src/pt-idx.cc |
diffstat | 3 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2007-08-10 John W. Eaton <jwe@octave.org> + + * pt-idx.cc (tree_index_expression::get_struct_index): Improve + error message. + * ov-struct.cc (Fstruct, Fcell2struct): Trap invalid field names here. + 2007-08-10 Peter A. Gustafson <petegus@umich.edu> * graphics.h, graphics.cc (axes::axes_properties): New properties,
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -35,6 +35,7 @@ #include "ov-list.h" #include "ov-struct.h" #include "unwind-prot.h" +#include "utils.h" #include "variables.h" #include "Array-util.h" @@ -616,6 +617,12 @@ if (error_state) return retval; + if (! valid_identifier (key)) + { + error ("struct: invalid structure field name `%s'", key.c_str ()); + return retval; + } + // Value may be v, { v }, or { v1, v2, ... } // In the first two cases, we need to create a cell array of // the appropriate dimensions filled with v. In the last case, @@ -941,6 +948,13 @@ return retval; } + if (! valid_identifier (field_str)) + { + error ("cell2struct: invalid field name `%s'", + field_str.c_str ()); + break; + } + map.reshape (value_dv); map.assign (field_str, c_value);