# HG changeset patch # User John W. Eaton # Date 1380825211 14400 # Node ID f0d21e7d4653a0837566018c32e2be45898b637a # Parent 2d01e20abd85929b31c98d69daf2357726175565 avoid Cell arrays in usr_transfer classes * urlwrite.cc (Furlwrite, Furlread): Require property value pairs to be passed as a cell array of character strings. Extract as Array. (base_url_transfer::base_url_transfer, curl_transfer::curl_transfer, curl_transfer::form_query_string, url_transfer::url_transfer): Accept Array for parameters instead of Cell object. diff -r 2d01e20abd85 -r f0d21e7d4653 libinterp/dldfcn/urlwrite.cc --- a/libinterp/dldfcn/urlwrite.cc Thu Oct 03 14:27:47 2013 -0400 +++ b/libinterp/dldfcn/urlwrite.cc Thu Oct 03 14:33:31 2013 -0400 @@ -82,7 +82,8 @@ base_url_transfer (const std::string& /* url */, const std::string& /* method */, - const Cell& /* param */, std::ostream& /* os */) + const Array& /* param */, + std::ostream& /* os */) : count (1), host (), userpwd (), valid (false), ascii_mode (false), ok (true), errmsg () { } @@ -411,7 +412,7 @@ } curl_transfer (const std::string& url, const std::string& method, - const Cell& param, std::ostream& os) + const Array& param, std::ostream& os) : base_url_transfer (url, method, param, os), curl (curl_easy_init ()), errnum () { @@ -823,14 +824,14 @@ SETOPT (CURLOPT_QUOTE, 0); } - std::string form_query_string (const Cell& param) + std::string form_query_string (const Array& param) { std::ostringstream query; for (int i = 0; i < param.numel (); i += 2) { - std::string name = param(i).string_value (); - std::string text = param(i+1).string_value (); + std::string name = param(i); + std::string text = param(i+1); // Encode strings. char *enc_name = curl_easy_escape (curl, name.c_str (), @@ -892,7 +893,7 @@ } url_transfer (const std::string& url, const std::string& method, - const Cell& param, std::ostream& os) + const Array& param, std::ostream& os) : rep (new REP_CLASS (url, method, param, os)) { #if !defined (HAVE_CURL) @@ -1295,7 +1296,7 @@ } std::string method; - Cell param; // empty cell array + Array param; if (nargin == 4) { @@ -1313,11 +1314,11 @@ return retval; } - param = args(3).cell_value (); + param = args(3).cellstr_value (); if (error_state) { - error ("urlwrite: parameters (PARAM) for get and post requests must be given as a cell"); + error ("urlwrite: parameters (PARAM) for get and post requests must be given as a cell array of character strings"); return retval; } @@ -1437,7 +1438,7 @@ } std::string method; - Cell param; // empty cell array + Array param; if (nargin == 3) { @@ -1455,11 +1456,11 @@ return retval; } - param = args(2).cell_value (); + param = args(2).cellstr_value (); if (error_state) { - error ("urlread: parameters (PARAM) for get and post requests must be given as a cell"); + error ("urlread: parameters (PARAM) for get and post requests must be given as a cell array of character strings"); return retval; }