From 10253a9c867f3036137ef5ed5379da930ef04c20 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Tue, 4 Sep 2007 00:52:20 +0200 Subject: [PATCH] Packages::DoDownload: Don't try to numerically compare a localized number After formatting a number with the help of sprintf, it is localized, i.e. the decimal point might not be a decimal point anymore. So don't try to compare it numerically (i.e. with '<' or '>') since that will not work. --- lib/Packages/DoDownload.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Packages/DoDownload.pm b/lib/Packages/DoDownload.pm index 7c59272..bc7dbab 100644 --- a/lib/Packages/DoDownload.pm +++ b/lib/Packages/DoDownload.pm @@ -85,9 +85,11 @@ sub do_download { $page_content->{archive} = $archive; $page_content->{suite} = $suite; $page_content->{pkg} = $pkg; - $page_content->{pkgsize} = sprintf( '%.1f', floor(($data{size}/102.4)+0.5)/10 ); - $page_content->{pkgsize_unit} = _g( 'kByte' ); - if ($page_content->{pkgsize} > 1024) { + my $pkgsize = floor(($data{size}/102.4)+0.5)/10; + if ($pkgsize < 1024) { + $page_content->{pkgsize} = sprintf( '%.1f', $pkgsize ); + $page_content->{pkgsize_unit} = _g( 'kByte' ); + } else { $page_content->{pkgsize} = sprintf( '%.1f', floor(($data{size}/(102.4*102.4))+0.5)/100 ); $page_content->{pkgsize_unit} = _g( 'MByte' ); } -- 2.39.2