From 05439698e091782feacccd7437890585c5f2e940 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 19 Mar 2019 17:53:57 +0000 Subject: [PATCH] [Minor] Properly print byte suffixes when humanizing --- src/libutil/printf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libutil/printf.c b/src/libutil/printf.c index 476c4de40..3c4acef47 100644 --- a/src/libutil/printf.c +++ b/src/libutil/printf.c @@ -60,14 +60,14 @@ rspamd_humanize_number (gchar *buf, gchar *last, gint64 num, gboolean bytes) if (!bytes) { divisor = 1000; - prefixes = "\0\0\0k\0\0M\0\0G\0\0T\0\0P\0\0E"; + prefixes = "\0\0\0\0k\0\0\0M\0\0\0G\0\0\0T\0\0\0P\0\0\0E"; } else { divisor = 1024; - prefixes = "B\0\0k\0\0M\0\0G\0\0T\0\0P\0\0E"; + prefixes = "B\0\0\0KiB\0MiB\0GiB\0TiB\0PiB\0EiB"; } -#define SCALE2PREFIX(scale) (&prefixes[(scale) * 3]) +#define SCALE2PREFIX(scale) (&prefixes[(scale) * 4]) if (num < 0) { sign = -1; -- 2.39.5