summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/diskspace.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-01-08 04:06:06 +0100
committerDan McGee <dan@archlinux.org>2011-01-08 04:15:47 +0100
commit62f5da377920c4e7823c4f8b8fb3673c9c2739e9 (patch)
tree3496e43e7161e765680daac4f0f56efe1dae754b /lib/libalpm/diskspace.c
parentf966f3a8344cd96bd675c79a5c470c66920b890c (diff)
downloadpacman-62f5da377920c4e7823c4f8b8fb3673c9c2739e9.tar.gz
pacman-62f5da377920c4e7823c4f8b8fb3673c9c2739e9.tar.xz
Fix some more simple conversion "errors"
None of these warn at the normal "-Wall -Werror" level, but casts do occur that we are fine with. Make them explicit to silence some warnings when using "-Wconversion". Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/diskspace.c')
-rw-r--r--lib/libalpm/diskspace.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index 5c9f74e5..87dca84f 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -178,7 +178,7 @@ static int calculate_removed_size(const alpm_list_t *mount_points,
}
data = mp->data;
- data->blocks_needed -= ceil((double)(st.st_size) /
+ data->blocks_needed -= (long)ceil((double)(st.st_size) /
(double)(data->fsp.f_bsize));
data->used = 1;
}
@@ -229,7 +229,7 @@ static int calculate_installed_size(const alpm_list_t *mount_points,
}
data = mp->data;
- data->blocks_needed += ceil((double)(archive_entry_size(entry)) /
+ data->blocks_needed += (long)ceil((double)(archive_entry_size(entry)) /
(double)(data->fsp.f_bsize));
data->used = 1;
}
@@ -243,12 +243,12 @@ cleanup:
int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
{
alpm_list_t *mount_points, *i;
- size_t replaces = 0, current = 0;
+ size_t replaces = 0, current = 0, numtargs;
int abort = 0;
alpm_list_t *targ;
pmpkg_t *pkg;
- size_t numtargs = alpm_list_count(trans->add);
+ numtargs = alpm_list_count(trans->add);
mount_points = mount_point_list();
if(mount_points == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not determine filesystem mount points"));
@@ -259,8 +259,8 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
if(replaces) {
numtargs += replaces;
for(targ = trans->remove; targ; targ = targ->next, current++) {
- double percent = (double)current / numtargs;
- PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", (percent * 100),
+ double percent = (double)current / (double)numtargs;
+ PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", (int)(percent * 100),
numtargs, current);
pkg = targ->data;
@@ -269,8 +269,8 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
}
for(targ = trans->add; targ; targ = targ->next, current++) {
- double percent = (double)current / numtargs;
- PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", (percent * 100),
+ double percent = (double)current / (double)numtargs;
+ PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", (int)(percent * 100),
numtargs, current);
pkg = targ->data;
@@ -295,8 +295,8 @@ int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
alpm_mountpoint_t *data = i->data;
if(data->used == 1) {
/* cushion is roughly min(5% capacity, 20MiB) */
- long fivepc = (data->fsp.f_blocks / 20) + 1;
- long twentymb = (20 * 1024 * 1024 / data->fsp.f_bsize) + 1;
+ long fivepc = ((long)data->fsp.f_blocks / 20) + 1;
+ long twentymb = (20 * 1024 * 1024 / (long)data->fsp.f_bsize) + 1;
long cushion = fivepc < twentymb ? fivepc : twentymb;
_alpm_log(PM_LOG_DEBUG, "partition %s, needed %ld, cushion %ld, free %ld\n",