Mercurial > hg > octave-avbm
changeset 7093:e5005117103d
[project @ 2007-10-31 23:41:37 by jwe]
author | jwe |
---|---|
date | Wed, 31 Oct 2007 23:41:37 +0000 |
parents | 62930dfd99fd |
children | dbf9b76b0fe9 |
files | src/ChangeLog src/data.cc src/version.h |
diffstat | 3 files changed, 30 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2007-10-31 John W. Eaton <jwe@octave.org> + + * data.cc (Fnorm): Avoid warning about p_val possibly being used + uninitialized. + + * version.h (OCTAVE_VERSION): Now 2.9.16+. + 2007-10-31 John W. Eaton <jwe@octave.org> * version.h (OCTAVE_VERSION): Now 2.9.16.
--- a/src/data.cc +++ b/src/data.cc @@ -2684,32 +2684,30 @@ if ((x_arg.rows () == 1 || x_arg.columns () == 1) && ! (x_arg.is_sparse_type () || x_arg.is_integer_type ())) { - double p_val; - - octave_value p_arg; - - if (nargin == 1) - p_arg = 2; - else - p_arg = args(1); - - if (p_arg.is_string ()) + double p_val = 2; + + if (nargin == 2) { - std::string p = args(1).string_value (); - - if (p == "inf") - p_val = octave_Inf; - else if (p == "fro") - p_val = -1; + octave_value p_arg = args(1); + + if (p_arg.is_string ()) + { + std::string p = args(1).string_value (); + + if (p == "inf") + p_val = octave_Inf; + else if (p == "fro") + p_val = -1; + else + error ("norm: unrecognized norm `%s'", p.c_str ()); + } else - error ("norm: unrecognized norm `%s'", p.c_str ()); - } - else - { - p_val = p_arg.double_value (); - - if (error_state) - error ("norm: unrecognized norm value"); + { + p_val = p_arg.double_value (); + + if (error_state) + error ("norm: unrecognized norm value"); + } } if (! error_state)