comparison libinterp/corefcn/strfns.cc @ 19437:03067dab10ca

Use stricter input validation when looking for a string as input (bug #42651). * data.cc (get_sort_mode_option, Fissorted): Use is_string() to check string input. * debug.cc (Fdbstep): use "string" rather than "character string" in error messages. * error.cc (Flasterr, Flastwarn): use "string" rather than "character string" in error messages. * file-io.cc (do_stream_open, do_fread, do_fwrite, Fpopen, Ftempname, Fmkstemp): Use is_string() to check string input. * graphics.cc (Fgraphics_toolkit): Use is_string() to check string input. Rephrase error message. * help.cc (F__list_functions): Use is_string() to check string input. * input.cc (Fyes_or_no): Use is_string() to check string input. Rephrase error message. * input.cc (Fadd_input_event_hook): Rephrase error message. * load-path.cc (Fgenpath, Faddpath): Rephrase error message. * matrix_type.cc (Fmatrix_type): Use is_string() to check string input. * qz.cc (Fqz): Follow Octave coding convention for space after '!'. * regexp.cc (parse_options): Use is_string() to check string input. Rephrase error message. * schur.cc (Fschur): Use is_string() to check string input. * strfns.cc (Flist_in_columns): Use is_string() to check string input. Rephrase error message. * symtab.cc (Fignore_function_time_stamp): Use is_string() to check string input. Rephrase error message. * syscalls.cc (Fexec, Fpopen2, Fcanonicalize_file_name): Use is_string() to check string input. Rephrase error message. * sysdep.cc (Fsetenv): Use is_string() to check string input. * time.cc (Fstrftime, Fstrptime): Use is_string() to check string input. * toplev.cc (Fsystem, Fatexit): Use is_string() to check string input. * urlwrite.cc (Furlwrite, Furlread): Rephrase error message. * utils.cc (Ffile_in_path): Use is_string() to check string input. Rephrase error message. * variables.cc (extract_function): Add FIXME about potentially using is_string. * variables.cc (do_isglobal, Fmunlock, Fmislocked): Use is_string() to check string input. * variables.cc (set_internal_variable): Rephrase error message. * ov-base.cc (make_idx_args): Rephrase error message. * ov-class.cc (octave_class::all_strings, Fclass): Rephrase error message. * ov-fcn-handle.cc (Fstr2func): Use is_string() to check string input * ov-java.cc (FjavaObject, FjavaMethod, F__java_get__, F__java_set__): Use is_string() to check string input. * ov.cc (Fdecode_subscripts): Use is_string() to check string input. Rephrase error message. * pt-idx.cc (tree_index_expression::get_struct_index): Rephrase error message. * io.tst: Change %!warning test to %!error test to match stricter checking. * system.tst: Change %!warning test for setenv to %!error test to match stricter checking.
author Rik <rik@octave.org>
date Tue, 16 Dec 2014 09:21:29 -0800
parents b560bac0fca2
children 4197fc428c7d
comparison
equal deleted inserted replaced
19436:5cd83b466a3e 19437:03067dab10ca
914 914
915 string_vector s = args(0).all_strings (); 915 string_vector s = args(0).all_strings ();
916 916
917 if (error_state) 917 if (error_state)
918 { 918 {
919 error ("list_in_columns: expecting cellstr or char array"); 919 error ("list_in_columns: ARG must be a cellstr or char array");
920 return retval; 920 return retval;
921 } 921 }
922 922
923 int width = -1; 923 int width = -1;
924 924
936 std::string prefix; 936 std::string prefix;
937 937
938 if (nargin > 2) 938 if (nargin > 2)
939 { 939 {
940 if (args(2).is_string ()) 940 if (args(2).is_string ())
941 { 941 prefix = args(2).string_value ();
942 prefix = args(2).string_value ();
943
944 if (error_state)
945 {
946 error ("list_in_columns: PREFIX must be a character string");
947 return retval;
948 }
949 }
950 else 942 else
951 { 943 {
952 error ("list_in_columns: PREFIX must be a character string"); 944 error ("list_in_columns: PREFIX must be a string");
953 return retval; 945 return retval;
954 } 946 }
955 } 947 }
956 948
957 std::ostringstream buf; 949 std::ostringstream buf;