From 52e0b5f3d1bb8337b530d02e5eeecd72a32632e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 1 Feb 2022 19:01:04 +0100 Subject: [PATCH] tag: fix inverted logic for KiB vs KB logic --- CHANGELOG.md | 1 + tag.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa7a875..1a11471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ allowed, leading to various bad things; including yambar crashing, or worse, the compositor crashing (https://codeberg.org/dnkl/yambar/issues/129). +* kib/kb, mib/mb and gib/gb formatters were inverted. ### Security diff --git a/tag.c b/tag.c index 2943423..66b7f02 100644 --- a/tag.c +++ b/tag.c @@ -545,12 +545,12 @@ tags_expand_template(const char *template, const struct tag_set *tags) case FMT_MIBYTE: case FMT_GIBYTE: { const long divider = - format == FMT_KBYTE ? 1024 : - format == FMT_MBYTE ? 1024 * 1024 : - format == FMT_GBYTE ? 1024 * 1024 * 1024 : - format == FMT_KIBYTE ? 1000 : - format == FMT_MIBYTE ? 1000 * 1000 : - format == FMT_GIBYTE ? 1000 * 1000 * 1000 : + format == FMT_KBYTE ? 1000 : + format == FMT_MBYTE ? 1000 * 1000 : + format == FMT_GBYTE ? 1000 * 1000 * 1000 : + format == FMT_KIBYTE ? 1024 : + format == FMT_MIBYTE ? 1024 * 1024 : + format == FMT_GIBYTE ? 1024 * 1024 * 1024 : 1; char str[24];