mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 19:20:17 +08:00
Format byte numbers so that we never get a thousands separator in it. Prevents us from running into a conversion bug in helpers.CleanupNumber(). See http://www.heidisql.com/forum.php?t=20612
This commit is contained in:
@ -56,6 +56,14 @@ const
|
||||
{Pebibyte} SIZE_PB = 1125899906842624;
|
||||
{Exbibyte} SIZE_EB = 1152921504606846976;
|
||||
|
||||
// Size of byte units for formatting purposes
|
||||
{Kibibyte} FSIZE_KB = 1000;
|
||||
{Mebibyte} FSIZE_MB = 1024000;
|
||||
{Gibibyte} FSIZE_GB = 1048576000;
|
||||
{Tebibyte} FSIZE_TB = 1073741824000;
|
||||
{Pebibyte} FSIZE_PB = 1099511627776000;
|
||||
{Exbibyte} FSIZE_EB = 1125899906842624000;
|
||||
|
||||
// Abbreviations of byte unit names
|
||||
{Bytes} NAME_BYTES = ' B';
|
||||
{Kibibyte} NAME_KB = ' KiB';
|
||||
|
@ -1014,15 +1014,15 @@ end;
|
||||
}
|
||||
function FormatByteNumber( Bytes: Int64; Decimals: Byte = 1 ): String; Overload;
|
||||
begin
|
||||
if Bytes >= SIZE_PB then
|
||||
if Bytes >= FSIZE_PB then
|
||||
Result := FormatNumber( Bytes / SIZE_PB, Decimals ) + NAME_PB
|
||||
else if Bytes >= SIZE_TB then
|
||||
else if Bytes >= FSIZE_TB then
|
||||
Result := FormatNumber( Bytes / SIZE_TB, Decimals ) + NAME_TB
|
||||
else if Bytes >= SIZE_GB then
|
||||
else if Bytes >= FSIZE_GB then
|
||||
Result := FormatNumber( Bytes / SIZE_GB, Decimals ) + NAME_GB
|
||||
else if Bytes >= SIZE_MB then
|
||||
else if Bytes >= FSIZE_MB then
|
||||
Result := FormatNumber( Bytes / SIZE_MB, Decimals ) + NAME_MB
|
||||
else if Bytes >= SIZE_KB then
|
||||
else if Bytes >= FSIZE_KB then
|
||||
Result := FormatNumber( Bytes / SIZE_KB, Decimals ) + NAME_KB
|
||||
else
|
||||
Result := FormatNumber( Bytes ) + NAME_BYTES
|
||||
|
Reference in New Issue
Block a user