Mercurial > hg > octave-terminal
changeset 12892:67bf9b30f3f9 stable
Error when given non-string input to tolower, toupper, toascii (Bug #33537).
* mappers.cc (tolower, toupper, toascii): Raise error when given
non-string input.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Wed, 27 Jul 2011 09:38:39 -0700 |
parents | 73e75ff9c31b |
children | 72ffa81a68d4 |
files | src/mappers.cc |
diffstat | 1 files changed, 18 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mappers.cc +++ b/src/mappers.cc @@ -1777,10 +1777,13 @@ @end deftypefn") { octave_value retval; - if (args.length () == 1) + + if (args.length () != 1) + print_usage (); + else if (! (args(0).is_string () || args(0).is_cellstr ())) + error ("toascii: S input must be a string or cellstr"); + else retval = args(0).xtoascii (); - else - print_usage (); return retval; } @@ -1803,10 +1806,13 @@ @end deftypefn") { octave_value retval; - if (args.length () == 1) + + if (args.length () != 1) + print_usage (); + else if (! (args(0).is_string () || args(0).is_cellstr ())) + error ("tolower: S input must be a string or cellstr"); + else retval = args(0).xtolower (); - else - print_usage (); return retval; } @@ -1849,10 +1855,13 @@ @end deftypefn") { octave_value retval; - if (args.length () == 1) + + if (args.length () != 1) + print_usage (); + else if (! (args(0).is_string () || args(0).is_cellstr ())) + error ("toupper: S input must be a string or cellstr"); + else retval = args(0).xtoupper (); - else - print_usage (); return retval; }