summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-09-21 16:03:35 +0000
committerThierry Vignaud <tv@mandriva.org>2007-09-21 16:03:35 +0000
commit1911b93aecc2910912c2dd503a23cd8e6b61a0b8 (patch)
tree7e5ea671a10a52bcbfce9c91b22d6695fc6f3253
parent6826f3b226faa078dba5ba9869facc27884f2453 (diff)
downloaddrakx-backup-do-not-use-1911b93aecc2910912c2dd503a23cd8e6b61a0b8.tar
drakx-backup-do-not-use-1911b93aecc2910912c2dd503a23cd8e6b61a0b8.tar.gz
drakx-backup-do-not-use-1911b93aecc2910912c2dd503a23cd8e6b61a0b8.tar.bz2
drakx-backup-do-not-use-1911b93aecc2910912c2dd503a23cd8e6b61a0b8.tar.xz
drakx-backup-do-not-use-1911b93aecc2910912c2dd503a23cd8e6b61a0b8.zip
make formatXiB() handle negative numbers (for rpmdrake)
-rw-r--r--perl-install/NEWS2
-rw-r--r--perl-install/common.pm6
2 files changed, 5 insertions, 3 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 8c67165f4..f48dc080c 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,5 @@
+- make formatXiB() handle negative numbers (for rpmdrake)
+
Version 10.4.208 - 21 September 2007, by Olivier "blino" Blin
- service_harddrake:
diff --git a/perl-install/common.pm b/perl-install/common.pm
index d48eca789..cb040772a 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -134,19 +134,19 @@ sub formatXiB {
my ($nb, $base);
my $decr = sub {
($nb, $base) = ($newnb, $newbase);
- $base >= 1024 ? ($newbase = $base / 1024) : ($newnb = $nb / 1024);
+ abs($base) >= 1024 ? ($newbase = $base / 1024) : ($newnb = $nb / 1024);
};
my $suffix;
foreach (N("B"), N("KB"), N("MB"), N("GB"), N("TB")) {
$decr->();
- if ($newnb < 1 && $newnb * $newbase < 1) {
+ if (abs($newnb) < 1 && abs($newnb * $newbase) < 1) {
$suffix = $_;
last;
}
}
my $v = $nb * $base;
my $s = $v < 10 && int(10 * $v - 10 * int($v));
- int($v) . ($s ? ".$s" : '') . ($suffix || N("TB"));
+ int($v) . ($s ? "." . abs($s) : '') . ($suffix || N("TB"));
}
sub formatTime {