summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/download.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/download.c b/src/download.c
index cbde282..6222502 100644
--- a/src/download.c
+++ b/src/download.c
@@ -82,12 +82,17 @@ int download_to_buffer(const char* url, char** buf, uint32_t* length)
return res;
}
+static int lastprogress = 0;
+
int download_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
{
double p = (dlnow / dltotal) * 100;
if (p < 100.0f) {
- print_progress_bar(p);
+ if ((int)p > lastprogress) {
+ print_progress_bar(p);
+ lastprogress = (int)p;
+ }
}
return 0;
@@ -109,6 +114,7 @@ int download_to_file(const char* url, const char* filename)
return -1;
}
+ lastprogress = 0;
curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, (curl_write_callback)&fwrite);
curl_easy_setopt(handle, CURLOPT_WRITEDATA, f);
curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, (curl_progress_callback)&download_progress);