Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-02-11 00:53:25 +01:00
commit e5fecd3ac5
2 changed files with 5 additions and 2 deletions

View File

@ -1399,7 +1399,9 @@ class PMA_Util
$unit = $byteUnits[0];
for ($d = 6, $ex = 15; $d >= 1; $d--, $ex-=3) {
if (isset($byteUnits[$d]) && ($value >= $li * self::pow(10, $ex))) {
// cast to float to avoid overflow
$unitSize = (float) $li * self::pow(10, $ex);
if (isset($byteUnits[$d]) && $value >= $unitSize) {
// use 1024.0 to avoid integer overflow on 64-bit machines
$value = round($value / (self::pow(1024, $d) / $dh)) /$dh;
$unit = $byteUnits[$d];

View File

@ -92,7 +92,8 @@ class PMA_FormatNumberByteDown_Test extends PHPUnit_Framework_TestCase
array(100, 2, 2, array('0.10', __('KiB'))),
array(1034, 3, 2, array('1.01', __('KiB'))),
array(100233, 3, 3, array('97.884', __('KiB'))),
array(2206451, 1, 2, array('2.10', __('MiB')))
array(2206451, 1, 2, array('2.10', __('MiB'))),
array(21474836480, 4, 0, array('20', __('GiB')))
);
}