From: Frank Lichtenheld Date: Mon, 3 Sep 2007 22:52:20 +0000 (+0200) Subject: Packages::DoDownload: Don't try to numerically compare a localized number X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=10253a9c867f3036137ef5ed5379da930ef04c20;p=deb%2Fpackages.git 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. --- 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' ); }