1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 16:28:50 -05:00

Use IEC unit prefixes

Display {KiB, MiB, ...} instead of {KB, MB, ...} since that's what's
actually being displayed.

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Jakob Gruber 2011-03-24 23:34:17 +01:00 committed by Dan McGee
parent 3c8a448a2f
commit 84cfc13589

View File

@ -612,7 +612,7 @@ static char *pkg_get_location(pmpkg_t *pkg)
* @param target_unit '\0' or a short label. If equal to one of the short unit * @param target_unit '\0' or a short label. If equal to one of the short unit
* labels ('B', 'K', ...) bytes is converted to target_unit; if '\0', the first * labels ('B', 'K', ...) bytes is converted to target_unit; if '\0', the first
* unit which will bring the value to below a threshold of 2048 will be chosen. * unit which will bring the value to below a threshold of 2048 will be chosen.
* @param long_labels whether to use short ("K") or long ("KB") unit labels * @param long_labels whether to use short ("K") or long ("KiB") unit labels
* @param label will be set to the appropriate unit label * @param label will be set to the appropriate unit label
* *
* @return the size in the appropriate unit * @return the size in the appropriate unit
@ -621,7 +621,7 @@ double humanize_size(off_t bytes, const char target_unit, int long_labels,
const char **label) const char **label)
{ {
static const char *shortlabels[] = {"B", "K", "M", "G", "T", "P"}; static const char *shortlabels[] = {"B", "K", "M", "G", "T", "P"};
static const char *longlabels[] = {"B", "KB", "MB", "GB", "TB", "PB"}; static const char *longlabels[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB"};
static const int unitcount = sizeof(shortlabels) / sizeof(shortlabels[0]); static const int unitcount = sizeof(shortlabels) / sizeof(shortlabels[0]);
const char **labels = long_labels ? longlabels : shortlabels; const char **labels = long_labels ? longlabels : shortlabels;