# HG changeset patch # User John W. Eaton # Date 1713632392 14400 # Node ID 71317c258da9f7820c91471a38dee10a8eaa5e0a # Parent 7ea909c9818a2aee31838177edee5d84f4cf5e8b improve argument checking in base64_decode functions * data.cc (Fbase64_decode, F__base64_decode_bytes__): Use xstring_value to extract first argument and provide meaningful error message if first argument is not a character array. Update tests. diff -r 7ea909c9818a -r 71317c258da9 libinterp/corefcn/data.cc --- a/libinterp/corefcn/data.cc Wed Apr 17 22:50:37 2024 -0400 +++ b/libinterp/corefcn/data.cc Sat Apr 20 12:59:52 2024 -0400 @@ -8618,7 +8618,7 @@ if (nargin < 1 || nargin > 2) print_usage (); - std::string str = args(0).string_value (); + std::string str = args(0).xstring_value ("base64_decode: first argument must be a character array"); Array retval = base64_decode (str); @@ -8652,7 +8652,7 @@ %!error base64_decode () %!error base64_decode (1,2,3) %!error base64_decode (1, "this is not a valid set of dimensions") -%!error base64_decode (1) +%!error base64_decode (1) %!error base64_decode ("AQ=") %!error base64_decode ("AQ==") */ @@ -8674,7 +8674,7 @@ if (nargin < 1 || nargin > 2) print_usage (); - std::string str = args(0).string_value (); + std::string str = args(0).xstring_value ("__base64_decode_bytes__: first argument must be a character array"); intNDArray retval = base64_decode_bytes (str); @@ -8708,7 +8708,7 @@ %!error __base64_decode_bytes__ () %!error __base64_decode_bytes__ (1,2,3) %!error __base64_decode_bytes__ (1, "this is not a valid set of dimensions") -%!error __base64_decode_bytes__ (1) +%!error __base64_decode_bytes__ (1) */ OCTAVE_END_NAMESPACE(octave)