diff options
author | 2025-06-27 19:08:39 +0200 | |
---|---|---|
committer | 2025-06-27 19:08:39 +0200 | |
commit | c17f9d6b17daa6121ec1ef0284d701cd3d1387b2 (patch) | |
tree | 9f60b9710363e9a18665a550af2a4f95e1c41f50 /src | |
parent | f89dea1aa863d09078650ab744b939e02924e411 (diff) | |
download | idevicerestore-c17f9d6b17daa6121ec1ef0284d701cd3d1387b2.tar.gz idevicerestore-c17f9d6b17daa6121ec1ef0284d701cd3d1387b2.tar.bz2 |
download: Use new CURLOPT_XFERINFOFUNCTION for libcurl >= 7.32
Diffstat (limited to 'src')
-rw-r--r-- | src/download.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/download.c b/src/download.c index d9fac45..2f3a836 100644 --- a/src/download.c +++ b/src/download.c @@ -86,9 +86,13 @@ int download_to_buffer(const char* url, char** buf, uint32_t* length) return res; } +#if LIBCURL_VERSION_NUM >= 0x072000 +static int download_progress(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) +#else static int download_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) +#endif { - double p = (dlnow / dltotal); + double p = ((double)dlnow / (double)dltotal); set_progress('DNLD', p); @@ -125,7 +129,11 @@ int download_to_file(const char* url, const char* filename, int enable_progress) if (enable_progress > 0) { register_progress('DNLD', "Downloading"); +#if LIBCURL_VERSION_NUM >= 0x072000 + curl_easy_setopt(handle, CURLOPT_XFERINFOFUNCTION, (curl_progress_callback)&download_progress); +#else curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, (curl_progress_callback)&download_progress); +#endif } curl_easy_setopt(handle, CURLOPT_NOPROGRESS, enable_progress > 0 ? 0: 1); |