diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-06-17 17:28:03 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-06-17 17:28:03 +0300 |
commit | 656190b0a063686b9bd675bbffe43fbebf4aacab (patch) | |
tree | 3f0336fb2080b938fc447ed4c155769be0211fb2 /src/commit.c | |
parent | ade8d0b4e9c206ab67dc8ef2006e8070011aae83 (diff) | |
download | apk-tools-656190b0a063686b9bd675bbffe43fbebf4aacab.tar.gz apk-tools-656190b0a063686b9bd675bbffe43fbebf4aacab.tar.bz2 apk-tools-656190b0a063686b9bd675bbffe43fbebf4aacab.tar.xz apk-tools-656190b0a063686b9bd675bbffe43fbebf4aacab.zip |
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.
Diffstat (limited to 'src/commit.c')
-rw-r--r-- | src/commit.c | 8 |
1 files changed, 3 insertions, 5 deletions
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; |