mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
(size_trunc): added ability to show size in [G|g]bytes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
12c893c73e
commit
fc3bb20f09
@ -332,10 +332,17 @@ size_trunc (uintmax_t size, gboolean use_si)
|
||||
{
|
||||
divisor = use_si ? 1000 : 1024;
|
||||
xtra = use_si ? "k" : "K";
|
||||
|
||||
if (size / divisor > 999999999UL)
|
||||
{
|
||||
divisor = use_si ? (1000 * 1000) : (1024 * 1024);
|
||||
xtra = use_si ? "m" : "M";
|
||||
|
||||
if (size / divisor > 999999999UL)
|
||||
{
|
||||
divisor = use_si ? (1000 * 1000 * 1000) : (1024 * 1024 * 1024);
|
||||
xtra = use_si ? "g" : "G";
|
||||
}
|
||||
}
|
||||
}
|
||||
g_snprintf (x, sizeof (x), "%.0f%s", 1.0 * size / divisor, xtra);
|
||||
|
Loading…
Reference in New Issue
Block a user