Revert to CURLOPT_PROGRESSFUNCTION

CURLOPT_XFERINFOFUNCTION isn't widely supported yet.

http://hydra.nixos.org/build/26679495
This commit is contained in:
Eelco Dolstra 2015-10-08 13:15:21 +02:00
parent 21ecd106ed
commit 14f7e1fc42

View file

@ -70,7 +70,7 @@ struct Curl
return realSize; return realSize;
} }
int xferInfoCallback(curl_off_t dltotal, curl_off_t dlnow) int progressCallback(double dltotal, double dlnow)
{ {
if (showProgress) { if (showProgress) {
double now = getTime(); double now = getTime();
@ -88,10 +88,10 @@ struct Curl
return _isInterrupted; return _isInterrupted;
} }
static int xferInfoCallback_(void * userp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) static int progressCallback_(void * userp, double dltotal, double dlnow, double ultotal, double ulnow)
{ {
Curl & c(* (Curl *) userp); Curl & c(* (Curl *) userp);
return c.xferInfoCallback(dltotal, dlnow); return c.progressCallback(dltotal, dlnow);
} }
Curl() Curl()
@ -112,8 +112,8 @@ struct Curl
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, headerCallback); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, headerCallback);
curl_easy_setopt(curl, CURLOPT_HEADERDATA, (void *) &curl); curl_easy_setopt(curl, CURLOPT_HEADERDATA, (void *) &curl);
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferInfoCallback_); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progressCallback_);
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, (void *) &curl); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, (void *) &curl);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
showProgress = isatty(STDERR_FILENO); showProgress = isatty(STDERR_FILENO);