Mercurial > octave-nkf
diff src/DLD-FUNCTIONS/urlwrite.cc @ 14846:460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Example: func() => func ()
* dynamic.txi, func.txi, oop.txi, var.txi, embedded.cc, fortdemo.cc,
funcdemo.cc, paramdemo.cc, stringdemo.cc, unwinddemo.cc, Array.cc, Array.h,
CColVector.cc, CDiagMatrix.h, CMatrix.cc, CNDArray.cc, CRowVector.cc,
CSparse.cc, CmplxGEPBAL.cc, EIG.cc, MSparse.cc, MatrixType.cc,
Sparse-op-defs.h, Sparse-perm-op-defs.h, Sparse.cc, Sparse.h,
SparseCmplxCHOL.cc, SparseCmplxCHOL.h, SparseCmplxLU.cc, SparseCmplxQR.cc,
SparseCmplxQR.h, SparseQR.cc, SparseQR.h, SparsedbleCHOL.cc, SparsedbleCHOL.h,
SparsedbleLU.cc, SparsedbleLU.h, base-lu.cc, cmd-hist.cc, dColVector.cc,
dDiagMatrix.h, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, dbleCHOL.cc,
dbleGEPBAL.cc, dim-vector.cc, eigs-base.cc, f2c-main.c, fCColVector.cc,
fCDiagMatrix.h, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fCmplxGEPBAL.cc,
fColVector.cc, fDiagMatrix.h, fEIG.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc,
file-ops.cc, file-stat.cc, floatCHOL.cc, floatGEPBAL.cc, idx-vector.h,
lo-specfun.cc, lo-sysdep.cc, mx-inlines.cc, oct-binmap.h, oct-convn.cc,
oct-md5.cc, oct-mem.h, oct-rand.cc, oct-syscalls.cc, randgamma.c, randmtzig.c,
sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, sparse-dmsolve.cc,
tempname.c, curl.m, divergence.m, randi.m, dlmwrite.m, edit.m, getappdata.m,
what.m, getarchdir.m, install.m, installed_packages.m, repackage.m,
unload_packages.m, colorbar.m, figure.m, isosurface.m, legend.m, loglog.m,
plot.m, plot3.m, plotyy.m, polar.m, __errplot__.m, __ghostscript__.m,
__marching_cube__.m, __plt__.m, __scatter__.m, semilogx.m, semilogy.m,
trimesh.m, trisurf.m, demo.m, test.m, datetick.m, __delaunayn__.cc,
__dsearchn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, balance.cc,
bsxfun.cc, ccolamd.cc, cellfun.cc, chol.cc, daspk.cc, dasrt.cc, dassl.cc,
dmperm.cc, eig.cc, eigs.cc, fftw.cc, filter.cc, find.cc, kron.cc, lookup.cc,
lsode.cc, matrix_type.cc, md5sum.cc, mgorth.cc, qr.cc, quad.cc, rand.cc,
regexp.cc, symbfact.cc, tril.cc, urlwrite.cc, op-bm-bm.cc, op-cdm-cdm.cc,
op-cell.cc, op-chm.cc, op-cm-cm.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-scm.cc,
op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-fcdm-fcdm.cc,
op-fcm-fcm.cc, op-fdm-fdm.cc, op-fm-fm.cc, op-int.h, op-m-m.cc, op-m-scm.cc,
op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-range.cc, op-s-scm.cc,
op-s-sm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc,
op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc,
op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-str.cc, op-struct.cc, bitfcns.cc,
data.cc, debug.cc, dynamic-ld.cc, error.cc, gl-render.cc, graphics.cc,
graphics.in.h, load-path.cc, ls-hdf5.cc, ls-mat5.cc, ls-mat5.h,
ls-oct-ascii.cc, ls-oct-ascii.h, mex.cc, mk-errno-list, oct-map.cc, oct-obj.h,
oct-parse.yy, octave-config.in.cc, ov-base-int.cc, ov-base-mat.cc, ov-base.cc,
ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-cell.cc, ov-class.cc,
ov-class.h, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc,
ov-flt-re-mat.cc, ov-intx.h, ov-range.h, ov-re-mat.cc, ov-re-sparse.cc,
ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.h, ov.h, pr-output.cc, pt-id.cc,
pt-id.h, pt-mat.cc, pt-select.cc, sparse.cc, symtab.cc, symtab.h, syscalls.cc,
toplev.cc, txt-eng-ft.cc, variables.cc, zfstream.cc, zfstream.h, Dork.m,
getStash.m, myStash.m, Gork.m, Pork.m, myStash.m, getStash.m, myStash.m,
getStash.m, myStash.m, fntests.m: Use Octave coding convention for
cuddled parenthis in function calls with empty argument lists.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 08 Jul 2012 11:28:50 -0700 |
parents | c267a3522d6c |
children | 5ae9f0f77635 |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/urlwrite.cc Fri Jul 06 14:00:25 2012 -0700 +++ b/src/DLD-FUNCTIONS/urlwrite.cc Sun Jul 08 11:28:50 2012 -0700 @@ -188,7 +188,7 @@ init (user, passwd, std::cin, octave_stdout); std::string url = "ftp://" + _host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); // Setup the link, with no transfer if (!error_state) @@ -220,7 +220,7 @@ setopt (CURLOPT_POSTFIELDS, query_string.c_str ()); } else - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); if (!error_state) retval = perform (false); @@ -296,7 +296,7 @@ { struct curl_slist *slist = 0; std::string cmd = "cwd " + path; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) perform (); @@ -308,7 +308,7 @@ { struct curl_slist *slist = 0; std::string cmd = "dele " + file; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) perform (); @@ -320,7 +320,7 @@ { struct curl_slist *slist = 0; std::string cmd = "rmd " + path; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) perform (); @@ -333,7 +333,7 @@ bool retval = false; struct curl_slist *slist = 0; std::string cmd = "mkd " + path; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) retval = perform (curlerror); @@ -346,9 +346,9 @@ { struct curl_slist *slist = 0; std::string cmd = "rnfr " + oldname; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); cmd = "rnto " + newname; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) perform (); @@ -359,7 +359,7 @@ void put (const std::string& file, std::istream& is) const { std::string url = "ftp://" + rep->host + "/" + file; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_UPLOAD, 1); setopt (CURLOPT_NOBODY, 0); set_istream (is); @@ -369,13 +369,13 @@ setopt (CURLOPT_NOBODY, 1); setopt (CURLOPT_UPLOAD, 0); url = "ftp://" + rep->host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); } void get (const std::string& file, std::ostream& os) const { std::string url = "ftp://" + rep->host + "/" + file; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_NOBODY, 0); set_ostream (os); if (! error_state) @@ -383,19 +383,19 @@ set_ostream (octave_stdout); setopt (CURLOPT_NOBODY, 1); url = "ftp://" + rep->host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); } void dir (void) const { std::string url = "ftp://" + rep->host + "/"; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_NOBODY, 0); if (! error_state) perform (); setopt (CURLOPT_NOBODY, 1); url = "ftp://" + rep->host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); } string_vector list (void) const @@ -403,7 +403,7 @@ std::ostringstream buf; std::string url = "ftp://" + rep->host + "/"; setopt (CURLOPT_WRITEDATA, static_cast<void*> (&buf)); - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_DIRLISTONLY, 1); setopt (CURLOPT_NOBODY, 0); if (! error_state) @@ -412,7 +412,7 @@ url = "ftp://" + rep->host; setopt (CURLOPT_WRITEDATA, static_cast<void*> (&octave_stdout)); setopt (CURLOPT_DIRLISTONLY, 0); - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); // Count number of directory entries std::string str = buf.str (); @@ -443,10 +443,10 @@ void get_fileinfo (const std::string& filename, double& filesize, time_t& filetime, bool& fileisdir) const { - std::string path = pwd(); + std::string path = pwd (); std::string url = "ftp://" + rep->host + "/" + path + "/" + filename; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_FILETIME, 1); setopt (CURLOPT_HEADERFUNCTION, throw_away); setopt (CURLOPT_WRITEFUNCTION, throw_away); @@ -480,7 +480,7 @@ setopt (CURLOPT_HEADERFUNCTION, 0); setopt (CURLOPT_FILETIME, 0); url = "ftp://" + rep->host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); // The MDTM command seems to reset the path to the root with the // servers I tested with, so cd again into the correct path. Make @@ -503,7 +503,7 @@ if (! error_state) { perform (); - retval = buf.str(); + retval = buf.str (); // Can I assume that the path is alway in "" on the last line size_t pos2 = retval.rfind ('"'); @@ -536,9 +536,9 @@ std::string text = param(i+1).string_value (); // Encode strings. - char *enc_name = curl_easy_escape (rep->handle(), name.c_str (), + char *enc_name = curl_easy_escape (rep->handle (), name.c_str (), name.length ()); - char *enc_text = curl_easy_escape (rep->handle(), text.c_str (), + char *enc_text = curl_easy_escape (rep->handle (), text.c_str (), text.length ()); query << enc_name << "=" << enc_text; @@ -546,7 +546,7 @@ curl_free (enc_name); curl_free (enc_text); - if (i < param.numel()-1) + if (i < param.numel ()-1) query << "&"; } @@ -615,7 +615,7 @@ { // Remove the elements of the map explicitly as they should // be deleted before the call to curl_global_cleanup - map.erase (begin(), end()); + map.erase (begin (), end ()); curl_global_cleanup (); } @@ -741,7 +741,7 @@ return retval; } - std::string url = args(0).string_value(); + std::string url = args(0).string_value (); if (error_state) { @@ -750,7 +750,7 @@ } // name to store the file if download is succesful - std::string filename = args(1).string_value(); + std::string filename = args(1).string_value (); if (error_state) { @@ -763,7 +763,7 @@ if (nargin == 4) { - method = args(2).string_value(); + method = args(2).string_value (); if (error_state) { @@ -777,7 +777,7 @@ return retval; } - param = args(3).cell_value(); + param = args(3).cell_value (); if (error_state) { @@ -799,7 +799,7 @@ file_stat fs (filename); - std::ofstream ofile (filename.c_str(), std::ios::out | std::ios::binary); + std::ofstream ofile (filename.c_str (), std::ios::out | std::ios::binary); if (! ofile.is_open ()) { @@ -901,7 +901,7 @@ return retval; } - std::string url = args(0).string_value(); + std::string url = args(0).string_value (); if (error_state) { @@ -914,7 +914,7 @@ if (nargin == 3) { - method = args(1).string_value(); + method = args(1).string_value (); if (error_state) { @@ -928,7 +928,7 @@ return retval; } - param = args(2).cell_value(); + param = args(2).cell_value (); if (error_state) { @@ -1268,7 +1268,7 @@ const curl_handle curl = handles.contents (handle); if (curl.is_valid ()) - retval = (curl.is_ascii() ? "ascii" : "binary"); + retval = (curl.is_ascii () ? "ascii" : "binary"); else error ("__ftp_binary__: invalid ftp handle"); } @@ -1422,7 +1422,7 @@ if (! curl.mkdir (dir, false)) warning ("__ftp_mput__: can not create the remote directory ""%s""", - (base.length() == 0 ? dir : base + + (base.length () == 0 ? dir : base + file_ops::dir_sep_str () + dir).c_str ()); curl.cwd (dir); @@ -1433,7 +1433,7 @@ frame.add_fcn (reset_path, curl); - std::string realdir = base.length() == 0 ? dir : base + + std::string realdir = base.length () == 0 ? dir : base + file_ops::dir_sep_str () + dir; dir_entry dirlist (realdir); @@ -1469,7 +1469,7 @@ else { // FIXME Does ascii mode need to be flagged here? - std::ifstream ifile (realfile.c_str(), std::ios::in | + std::ifstream ifile (realfile.c_str (), std::ios::in | std::ios::binary); if (! ifile.is_open ()) @@ -1492,7 +1492,7 @@ } else error ("__ftp_mput__: can not read the directory ""%s""", - realdir.c_str()); + realdir.c_str ()); } return retval; @@ -1547,7 +1547,7 @@ else { // FIXME Does ascii mode need to be flagged here? - std::ifstream ifile (file.c_str(), std::ios::in | + std::ifstream ifile (file.c_str (), std::ios::in | std::ios::binary); if (! ifile.is_open ()) @@ -1593,7 +1593,7 @@ if (status < 0) error ("__ftp_mget__: can't create directory %s%s%s. %s", - target.c_str(), sep.c_str(), dir.c_str(), msg.c_str()); + target.c_str (), sep.c_str (), dir.c_str (), msg.c_str ()); } if (! error_state) @@ -1621,7 +1621,7 @@ else { std::string realfile = target + dir + sep + sv(i); - std::ofstream ofile (realfile.c_str(), + std::ofstream ofile (realfile.c_str (), std::ios::out | std::ios::binary); @@ -1699,7 +1699,7 @@ getallfiles (curl, sv(i), target); else { - std::ofstream ofile ((target + sv(i)).c_str(), + std::ofstream ofile ((target + sv(i)).c_str (), std::ios::out | std::ios::binary);