summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-01-10 08:44:23 -0600
committerDan McGee <dan@archlinux.org>2011-01-10 10:50:03 -0600
commit3e1bdfa93c0c0c1a966ba24f8013754a8a87f0ec (patch)
tree7463db4f66e9ded8becb1232a1304353d31ee64e /src
parent5f140a62debb7d55436af7f84b0ecf5696f46c86 (diff)
downloadpacman-3e1bdfa93c0c0c1a966ba24f8013754a8a87f0ec.tar.xz
Use double rather than float everywhere
No real need to use the smaller floating point types here. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/callback.c12
-rw-r--r--src/pacman/package.c6
-rw-r--r--src/pacman/util.c3
3 files changed, 10 insertions, 11 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 92920f76..da07b161 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -36,7 +36,7 @@
#include "conf.h"
/* download progress bar */
-static float rate_last;
+static double rate_last;
static off_t xfered_last;
static off_t list_xfered = 0.0;
static off_t list_total = 0.0;
@@ -55,9 +55,9 @@ static alpm_list_t *output = NULL;
*
* first_call indicates if this is the first time it is called, for
* initialization purposes */
-static float get_update_timediff(int first_call)
+static double get_update_timediff(int first_call)
{
- float retval = 0.0;
+ double retval = 0.0;
static struct timeval last_time = {0, 0};
/* on first call, simply set the last time and return */
@@ -65,7 +65,7 @@ static float get_update_timediff(int first_call)
gettimeofday(&last_time, NULL);
} else {
struct timeval this_time;
- float diff_sec, diff_usec;
+ double diff_sec, diff_usec;
gettimeofday(&this_time, NULL);
diff_sec = this_time.tv_sec - last_time.tv_sec;
@@ -473,7 +473,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
int totaldownload = 0;
off_t xfered, total;
- float rate = 0.0, timediff = 0.0, f_xfered = 0.0;
+ double rate = 0.0, timediff = 0.0, f_xfered = 0.0;
unsigned int eta_h = 0, eta_m = 0, eta_s = 0;
int file_percent = 0, total_percent = 0;
char rate_size = 'K', xfered_size = 'K';
@@ -532,7 +532,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
} else if(file_xfered == file_total) {
/* compute final values */
struct timeval current_time;
- float diff_sec, diff_usec;
+ double diff_sec, diff_usec;
gettimeofday(&current_time, NULL);
diff_sec = current_time.tv_sec - initial_time.tv_sec;
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 66f21b14..7af38435 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -106,15 +106,15 @@ void dump_pkg_full(pmpkg_t *pkg, int level)
list_display(_("Replaces :"), alpm_pkg_get_replaces(pkg));
if(level < 0) {
printf(_("Download Size : %6.2f K\n"),
- (float)alpm_pkg_get_size(pkg) / 1024.0);
+ (double)alpm_pkg_get_size(pkg) / 1024.0);
}
if(level == 0) {
printf(_("Compressed Size: %6.2f K\n"),
- (float)alpm_pkg_get_size(pkg) / 1024.0);
+ (double)alpm_pkg_get_size(pkg) / 1024.0);
}
printf(_("Installed Size : %6.2f K\n"),
- (float)alpm_pkg_get_isize(pkg) / 1024.0);
+ (double)alpm_pkg_get_isize(pkg) / 1024.0);
string_display(_("Packager :"), alpm_pkg_get_packager(pkg));
string_display(_("Architecture :"), alpm_pkg_get_arch(pkg));
string_display(_("Build Date :"), bdatestr);
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 4af639fd..fbc1a184 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -644,8 +644,7 @@ void print_packages(const alpm_list_t *packages)
/* %s : size */
if(strstr(temp,"%s")) {
char *size;
- double mbsize = 0.0;
- mbsize = (double)pkg_get_size(pkg) / (1024.0 * 1024.0);
+ double mbsize = (double)pkg_get_size(pkg) / (1024.0 * 1024.0);
pm_asprintf(&size, "%.2f", mbsize);
string = strreplace(temp, "%s", size);
free(size);