# HG changeset patch # User jwe # Date 1040169274 0 # Node ID 5ebaf7eee36ed15dd4051a4135e215f80334440e # Parent 1363b7e9bf3affd68a06ee901b402e52fc394317 [project @ 2002-12-17 23:54:34 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2002-12-17 John W. Eaton + + * pt-select.cc (equal): Don't look up == op, just try it and see + whether it works. + + * oct-stream.cc (printf_format_list::printf_format_list): + Handle empty format string. + 2002-12-06 John W. Eaton * pt-mat.cc (class tm_row_const::tm_row_const_rep): Derive from diff --git a/src/oct-stream.cc b/src/oct-stream.cc --- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -586,60 +586,72 @@ bool have_more = true; bool empty_buf = true; - while (i < n) + if (n == 0) { - have_more = true; - - if (! buf) + printf_format_elt *elt + = new printf_format_elt ("", args, fw, prec, flags, type, modifier); + + list(num_elts++) = elt; + + list.resize (num_elts); + } + else + { + while (i < n) { - buf = new OSSTREAM (); - empty_buf = true; - } - - switch (s[i]) - { - case '%': - { - if (empty_buf) + have_more = true; + + if (! buf) + { + buf = new OSSTREAM (); + empty_buf = true; + } + + switch (s[i]) + { + case '%': { - process_conversion (s, i, n, args, flags, fw, prec, - type, modifier, num_elts); - - have_more = (buf != 0); + if (empty_buf) + { + process_conversion (s, i, n, args, flags, fw, prec, + type, modifier, num_elts); + + have_more = (buf != 0); + } + else + add_elt_to_list (args, flags, fw, prec, type, modifier, + num_elts); } - else - add_elt_to_list (args, flags, fw, prec, type, modifier, - num_elts); - } - break; - - default: - { - args = 0; - flags = ""; - fw = 0; - prec = 0; - modifier = '\0'; - type = '\0'; - *buf << s[i++]; - empty_buf = false; - } - break; + break; + + default: + { + args = 0; + flags = ""; + fw = 0; + prec = 0; + modifier = '\0'; + type = '\0'; + *buf << s[i++]; + empty_buf = false; + } + break; + } + + if (nconv < 0) + { + have_more = false; + break; + } } - if (nconv < 0) - { - have_more = false; - break; - } + if (have_more) + add_elt_to_list (args, flags, fw, prec, type, modifier, num_elts); + + list.resize (num_elts); + + delete buf; } - - if (have_more) - add_elt_to_list (args, flags, fw, prec, type, modifier, num_elts); - - list.resize (num_elts); - - delete buf; } printf_format_list::~printf_format_list (void) diff --git a/src/pt-select.cc b/src/pt-select.cc --- a/src/pt-select.cc +++ b/src/pt-select.cc @@ -135,12 +135,9 @@ int t1 = val.type_id (); int t2 = test.type_id (); - binary_op_fcn f - = octave_value_typeinfo::lookup_binary_op (octave_value::op_eq, t1, t2); - // If there is no op_eq for these types, we can't compare values. - if (f && val.rows () == test.rows () && val.columns () == test.columns ()) + if (val.rows () == test.rows () && val.columns () == test.columns ()) { octave_value tmp = do_binary_op (octave_value::op_eq, val, test);