# HG changeset patch # User jwe # Date 1125415230 0 # Node ID 2f51d6d65fb2b1b77ec7d69c1cff8e62c0bb730d # Parent a42806a03f8fd6a62cd7aeb79e008687f2b3d5bb [project @ 2005-08-30 15:20:30 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2005-08-30 John W. Eaton + + * ov-struct.cc (octave_struct::load_ascii, + octave_struct::load_binary, octave_struct::load_hdf5): Try harder + to read old-style files correctly. + 2005-08-25 David Bateman * OPERATORS/op-sm-m.cc, OPERATORS/op-sm-cm.cc, OPERATORS/op-scm-m.cc, diff --git a/src/ov-struct.cc b/src/ov-struct.cc --- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -1026,15 +1026,20 @@ break; // Try for some backward compatibility... - Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); - - if (error_state) + if (t2.is_cell () && t2.length() > 1) + m.assign (nm, t2); + else { - error ("load: internal error loading struct elements"); - return false; + Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); + + if (error_state) + { + error ("load: internal error loading struct elements"); + return false; + } + + m.assign (nm, tcell); } - - m.assign (nm, tcell); } if (is) @@ -1111,15 +1116,20 @@ break; // Try for some backward compatibility... - Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); - - if (error_state) + if (t2.is_cell () && t2.length() > 1) + m.assign (nm, t2); + else { - error ("load: internal error loading struct elements"); - return false; + Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); + + if (error_state) + { + error ("load: internal error loading struct elements"); + return false; + } + + m.assign (nm, tcell); } - - m.assign (nm, tcell); } if (is) @@ -1197,16 +1207,21 @@ octave_value t2 = dsub.tc; // Try for some backward compatibility... - Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); - - if (error_state) + if (t2.is_cell () && t2.length() > 1) + m.assign (dsub.name, t2); + else { - error ("load: internal error loading struct elements"); - return false; + Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); + + if (error_state) + { + error ("load: internal error loading struct elements"); + return false; + } + + m.assign (dsub.name, tcell); } - m.assign (dsub.name, tcell); - if (have_h5giterate_bug) current_item++; // H5Giterate returned the last index processed }