Mercurial > octave
diff libinterp/corefcn/file-io.cc @ 20812:d9ca869ca124
maint: Clean-up more instances of print_usage().
* mk-opts.pl: Fix script that generates *-opt.cc files to put print_usage()
first.
* __ilu__.cc (F__ilutp__): Don't declare and initialize multiple comma
separated variables.
* __lin_interpn__.cc (F__lin_interpn__): Eliminate extra spaces in if
conditional.
* dasrt.cc (Fdasrt): Declare variables only as needed, in this case, after
input validation has succeeded.
* file-io.cc (Frewind): Declare variables after input validation succeeds.
* file-io.cc (Ftempname): Rename variable len to nargin to match rest of code.
* gammainc.cc (Fgammainc): Put nargin checking first in function.
* hex2num.cc (Fhex2num, Fnum2hex): Declare "octave_value retval;" first in
function to match rest of Octave code base.
* load-path.cc (Frmpath): Re-phrase comment.
* lu.cc (Flu): Declare variables after input validation succeeds. Use space
after ! operator.
* lu.cc (Fluupdate): Place octave_value_list declaration first in function.
Declare variables after input validation succeeds.
* matrix_type.cc (Fmatrix_type): Place octave_value declaration first in
function.
* tril.cc (do_trilu): Move nargin checking higher in function.
* utils.cc (Fdir_in_loadpath): Declare variables after input validation
succeeds.
* __glpk__.cc (F__glpk__): Rename variable nrhs to nargin to match rest of
code base.
* __magick_read__.cc (F__magick_ping__, F__magick_formats__): Add newline
to space out code for readability.
* __osmesa_print__.cc (F__osmesa_print__): Use DeMorgan's Law to simplify
nargin validation.
* audiodevinfo.cc (F__recorder_record__): Correct indentation.
* chol.cc (Fcholinsert, Fcholdelete, Fcholshift): Place octave_value_list
declaration first in function.
* dmperm.cc (Fdmperm, Fsprank): Place octave_value_list declaration first in
function.
* qr.cc (Fqrupdate, Fqrinsert, Fqrdelete, Fqrshift): Place octave_value_list
declaration first in function.
* lex.ll (Fiskeyword): Rewrite function to use modern syntax. Add BIST
tests for special words "get", "set". Add BIST tests for input validation.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 05 Dec 2015 15:59:22 -0800 |
parents | 2d6ddb2b157c |
children | f428cbe7576f |
line wrap: on
line diff
--- a/libinterp/corefcn/file-io.cc Sat Dec 05 15:10:49 2015 -0800 +++ b/libinterp/corefcn/file-io.cc Sat Dec 05 15:59:22 2015 -0800 @@ -735,11 +735,11 @@ { octave_value retval; - int result = -1; - if (args.length () != 1) print_usage (); + int result = -1; + octave_stream os = octave_stream_list::lookup (args(0), "frewind"); result = os.rewind (); @@ -1781,19 +1781,19 @@ { octave_value retval; - int len = args.length (); + int nargin = args.length (); - if (len > 2) + if (nargin > 2) print_usage (); std::string dir; - if (len > 0) + if (nargin > 0) dir = args(0).xstring_value ("tempname: DIR must be a string"); std::string pfx ("oct-"); - if (len > 1) + if (nargin > 1) pfx = args(1).xstring_value ("tempname: PREFIX must be a string"); return octave_value (octave_tempnam (dir, pfx));