summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-02-10 10:36:36 +0100
committerAaron Griffin <aaron@archlinux.org>2007-02-10 10:36:36 +0100
commitc55ea22c584596897be792fb7a788f04a363b5a8 (patch)
tree260717c7e942a81f62a5fa88e4be80f0f055eb3b /lib/libalpm/add.c
parenta382d33d45d5e6c2a8ccca8fc946555f6123416f (diff)
downloadpacman-c55ea22c584596897be792fb7a788f04a363b5a8.tar.gz
pacman-c55ea22c584596897be792fb7a788f04a363b5a8.tar.xz
* 'add' percentages now cap at 100% (see the comment)
* downloaded packages now pass ONLY the package name to the callback
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index f3cc07a5..cad5ae13 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -496,10 +496,20 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
char pathname[PATH_MAX];
struct stat buf;
- STRNCPY(pathname, archive_entry_pathname (entry), PATH_MAX);
-
- if (info->size != 0)
- percent = (double)archive_position_uncompressed(archive) / info->size;
+ STRNCPY(pathname, archive_entry_pathname(entry), PATH_MAX);
+
+ if (info->size != 0) {
+ /* There's a problem here. These sizes don't match up. info->size is
+ * the COMPRESSED size, and info->isize is uncompressed. It appears,
+ * however, that these are the only two sizes available. It appears
+ * to be close enough, BUT easilly goes over 100%, so we'll stall
+ * there for now */
+ percent = (double)archive_position_uncompressed(archive) / info->size;
+ if(percent >= 1.0) {
+ percent = 1.0;
+ }
+ }
+
if (needdisp == 0) {
PROGRESS(trans, cb_state, what, (int)(percent * 100), alpm_list_count(trans->packages), (alpm_list_count(trans->packages) - alpm_list_count(targ) +1));
}