bug #1519859, avoid overflow on 64-bit machines

This commit is contained in:
Marc Delisle
2006-09-23 12:31:28 +00:00
parent daa561c098
commit f442bf7003
2 changed files with 9 additions and 5 deletions

View File

@@ -5,6 +5,9 @@ phpMyAdmin - ChangeLog
$Id$
$Source$
2006-09-23 Marc Delisle <lem9@users.sourceforge.net>
* libraries/common.lib.php: bug #1519859, avoid overflow on 64-bit machines
2006-09-22 Marc Delisle <lem9@users.sourceforge.net>
* libraries/tbl_properties_links.inc.php: bug #1560152,
after renaming a table the navigation does not work

View File

@@ -1534,7 +1534,8 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
for ($d = 6, $ex = 15; $d >= 1; $d--, $ex-=3) {
if (isset($GLOBALS['byteUnits'][$d]) && $value >= $li * pow(10, $ex)) {
$value = round($value / (pow(1024, $d) / $dh)) /$dh;
// use 1024.0 to avoid integer overflow on 64-bit machines
$value = round($value / (pow(1024.0, $d) / $dh)) /$dh;
$unit = $GLOBALS['byteUnits'][$d];
break 1;
} // end if
@@ -1623,16 +1624,16 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
if ($value >= 1) {
for ($d = 8; $d >= 0; $d--) {
if (isset($units[$d]) && $value >= $li * pow(1000, $d-1)) {
$value = round($value / (pow(1000, $d) / $dh)) /$dh;
if (isset($units[$d]) && $value >= $li * pow(1000.0, $d-1)) {
$value = round($value / (pow(1000.0, $d) / $dh)) /$dh;
$unit = $units[$d];
break 1;
} // end if
} // end for
} elseif (!$only_down && (float) $value !== 0.0) {
for ($d = -8; $d <= 8; $d++) {
if (isset($units[$d]) && $value <= $li * pow(1000, $d-1)) {
$value = round($value / (pow(1000, $d) / $dh)) /$dh;
if (isset($units[$d]) && $value <= $li * pow(1000.0, $d-1)) {
$value = round($value / (pow(1000.0, $d) / $dh)) /$dh;
$unit = $units[$d];
break 1;
} // end if