From 4fd4a6888a468a7c35ef0f7ce804ac9e1518d62d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 8 Jun 2000 15:11:39 +0000 Subject: [PATCH] added progress callback stuff, changed the callback typedefs to be public --- lib/url.c | 13 +++++++++---- lib/urldata.h | 24 ++++-------------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/lib/url.c b/lib/url.c index 8c48d0512..ac97e23d3 100644 --- a/lib/url.c +++ b/lib/url.c @@ -96,7 +96,6 @@ #endif #include "urldata.h" -#include #include "netrc.h" #include "formdata.h" @@ -388,7 +387,7 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...) data->bits.ftp_use_port = data->ftpport?1:0; break; case CURLOPT_HTTPHEADER: - data->headers = va_arg(param, struct HttpHeader *); + data->headers = va_arg(param, struct curl_slist *); break; case CURLOPT_CUSTOMREQUEST: data->customrequest = va_arg(param, char *); @@ -449,6 +448,12 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...) case CURLOPT_POSTQUOTE: data->postquote = va_arg(param, struct curl_slist *); break; + case CURLOPT_PROGRESSFUNCTION: + data->fprogress = va_arg(param, curl_progress_callback); + break; + case CURLOPT_PROGRESSDATA: + data->progress_client = va_arg(param, void *); + break; case CURLOPT_PROXYUSERPWD: data->proxyuserpwd = va_arg(param, char *); data->bits.proxy_user_passwd = data->proxyuserpwd?1:0; @@ -464,13 +469,13 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...) data->err = va_arg(param, FILE *); break; case CURLOPT_WRITEFUNCTION: - data->fwrite = va_arg(param, write_callback); + data->fwrite = va_arg(param, curl_write_callback); break; case CURLOPT_WRITEINFO: data->writeinfo = va_arg(param, char *); break; case CURLOPT_READFUNCTION: - data->fread = va_arg(param, read_callback); + data->fread = va_arg(param, curl_read_callback); break; case CURLOPT_SSLCERT: data->cert = va_arg(param, char *); diff --git a/lib/urldata.h b/lib/urldata.h index b5493a700..efdf495fe 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -92,7 +92,7 @@ #include "timeval.h" - +#include /* Download buffer size, keep it fairly big for speed reasons */ #define BUFSIZE (1024*50) @@ -263,22 +263,6 @@ struct Configbits { bool verbose; }; -typedef size_t (*progress_callback)(void *clientp, - size_t dltotal, - size_t dlnow, - size_t ultotal, - size_t ulnow); - -typedef size_t (*write_callback)(char *buffer, - size_t size, - size_t nitems, - FILE *outstream); - -typedef size_t (*read_callback)(char *buffer, - size_t size, - size_t nitems, - FILE *instream); - /* What type of interface that intiated this struct */ typedef enum { CURLI_NONE, @@ -355,13 +339,13 @@ struct UrlData { char *ftpport; /* port to send with the PORT command */ /* function that stores the output:*/ - write_callback fwrite; + curl_write_callback fwrite; /* function that reads the input:*/ - read_callback fread; + curl_read_callback fread; /* function that wants progress information */ - progress_callback fprogress; + curl_progress_callback fprogress; void *progress_client; /* pointer to pass to the progress callback */ long timeout; /* in seconds, 0 means no timeout */