From 656190b0a063686b9bd675bbffe43fbebf4aacab Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Mon, 17 Jun 2013 17:28:03 +0300 Subject: io: get rid of APK_PROGRESS_SCALE no need to muldiv all the time, just pass the current amount of bytes done, and let callbacks use that directly. --- src/commit.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/commit.c') diff --git a/src/commit.c b/src/commit.c index 857c7bc..e55843e 100644 --- a/src/commit.c +++ b/src/commit.c @@ -125,16 +125,14 @@ struct progress { int flags; }; -static void progress_cb(void *ctx, size_t pkg_percent) +static void progress_cb(void *ctx, size_t installed_bytes) { struct progress *prog = (struct progress *) ctx; - size_t partial = 0, percent, total; + size_t percent, total; - if (prog->pkg != NULL) - partial = muldiv(pkg_percent, prog->pkg->installed_size, APK_PROGRESS_SCALE); total = prog->total.bytes + prog->total.packages; if (total > 0) - percent = muldiv(100, prog->done.bytes + prog->done.packages + partial, + percent = muldiv(100, prog->done.bytes + prog->done.packages + installed_bytes, prog->total.bytes + prog->total.packages); else percent = 0; -- cgit v1.2.3-70-g09d2