On Mon, Mar 21, 2011 at 5:53 AM, Lukas Fleischer <[email protected]> wrote: > Drawing progress bars before calling curl_easy_perform() is needless as > the curl progress callback is called with zero progress before actually > downloading the file anyways. Fixes display of "0%" progress bars when > sync'ing package databases that are already up to date.
I'll take this for now, but there is still some hackjob action going on in here- comparing doubles via equality to ints, etc. I figure these will get worked out in time though. > Signed-off-by: Lukas Fleischer <[email protected]> > --- > lib/libalpm/dload.c | 7 +++---- > 1 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c > index ebfd042..a14d1d1 100644 > --- a/lib/libalpm/dload.c > +++ b/lib/libalpm/dload.c > @@ -212,10 +212,9 @@ static int curl_download_internal(const char *url, const > char *localpath, > sigaction(SIGINT, NULL, &sig_int[OLD]); > sigaction(SIGINT, &sig_int[NEW], NULL); > > - /* Progress 0 - initialize */ > - if(handle->dlcb) { > - handle->dlcb(filename, 0, 1); > - } > + /* set initial value of prevprogress to -1 which causes > curl_progress() to > + * initialize the progress bar with 0% once. */ > + prevprogress = -1; > > /* perform transfer */ > handle->curlerr = curl_easy_perform(handle->curl); > -- > 1.7.4.1
