Mercurial > octave
diff libinterp/corefcn/file-io.cc @ 20703:85e5efae848a
eliminate more uses of error_state
* ov.h, ov.cc: Provide more value extractors that handle error messages.
* besselj.cc, daspk.cc, dasrt.cc, dassl.cc, file-io.cc, graphics.cc,
matrix_type.cc, ordschur.cc, utils.cc, __eigs__.cc,
__magick_read__.cc: Eliminate more uses of error_state.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 14 Nov 2015 12:07:38 -0500 |
parents | 68e3a747ca02 |
children | 571508c1ed06 |
line wrap: on
line diff
--- a/libinterp/corefcn/file-io.cc Sat Nov 14 13:31:00 2015 +0100 +++ b/libinterp/corefcn/file-io.cc Sat Nov 14 12:07:38 2015 -0500 @@ -1321,41 +1321,36 @@ count = -1; - Array<double> size = size_arg.vector_value (); + Array<double> size = size_arg.xvector_value ("fread: invalid SIZE specified"); + + std::string prec = prec_arg.xstring_value ("fread: PRECISION must be a string"); + + int block_size = 1; + oct_data_conv::data_type input_type; + oct_data_conv::data_type output_type; + + oct_data_conv::string_to_data_type (prec, block_size, + input_type, output_type); if (! error_state) { - std::string prec = prec_arg.xstring_value ("fread: PRECISION must be a string"); - - int block_size = 1; - oct_data_conv::data_type input_type; - oct_data_conv::data_type output_type; - - oct_data_conv::string_to_data_type (prec, block_size, - input_type, output_type); + int skip = skip_arg.int_value (true); if (! error_state) { - int skip = skip_arg.int_value (true); - - if (! error_state) - { - std::string arch = arch_arg.xstring_value ("fread: ARCH architecture type must be a string"); + std::string arch = arch_arg.xstring_value ("fread: ARCH architecture type must be a string"); - oct_mach_info::float_format flt_fmt - = oct_mach_info::string_to_float_format (arch); + oct_mach_info::float_format flt_fmt + = oct_mach_info::string_to_float_format (arch); - retval = os.read (size, block_size, input_type, - output_type, skip, flt_fmt, count); - } - else - error ("fread: SKIP must be an integer"); + retval = os.read (size, block_size, input_type, + output_type, skip, flt_fmt, count); } else - error ("fread: invalid PRECISION specified"); + error ("fread: SKIP must be an integer"); } else - error ("fread: invalid SIZE specified"); + error ("fread: invalid PRECISION specified"); return retval; }