summaryrefslogtreecommitdiff
path: root/src/tool_cb_prg.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2012-04-17 00:45:20 +0200
committerDaniel Stenberg <daniel@haxx.se>2012-04-17 00:45:20 +0200
commit4d28a59fc2b21fd7cbf54e48e9c28018b991c987 (patch)
tree1b46e46b2091f3aa6f3cab88d993fa827d6187ab /src/tool_cb_prg.c
parenta498daa0e0793ef0529b61ba1df31aeb9057d33c (diff)
downloadgnurl-4d28a59fc2b21fd7cbf54e48e9c28018b991c987.tar.gz
gnurl-4d28a59fc2b21fd7cbf54e48e9c28018b991c987.tar.bz2
gnurl-4d28a59fc2b21fd7cbf54e48e9c28018b991c987.zip
-# progress meter: avoid superfluous updates and duplicate lines
By comparing if a different "progress point" is reached or not since the previous update, the progress function callback for this now avoids many superfluous screen updates. This has the nice side-effect that it fixes a problem that causes a second progress meter line. The second line output happened because when we use the -# progress meter, we force a newline output after the transfer in the main loop in curl, but when libcurl calls the progress callback from curl_easy_cleanup() it would then output the progress display again. Possibly the naive newline output is wrong but this optimization was suitable anyway... Reported by: Daniel Theron Bug: http://curl.haxx.se/bug/view.cgi?id=3517418
Diffstat (limited to 'src/tool_cb_prg.c')
-rw-r--r--src/tool_cb_prg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c
index 809b4d487..7a701b692 100644
--- a/src/tool_cb_prg.c
+++ b/src/tool_cb_prg.c
@@ -76,7 +76,7 @@ int tool_progress_cb(void *clientp,
prevblock++;
}
}
- else {
+ else if(point != bar->prev) {
frac = (double)point / (double)total;
percent = frac * 100.0f;
barwidth = bar->width - 7;