tag: fix inverted logic for KiB vs KB logic

This commit is contained in:
Daniel Eklöf 2022-02-01 19:01:04 +01:00
parent 1cf14a7f80
commit 52e0b5f3d1
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 7 additions and 6 deletions

View file

@ -50,6 +50,7 @@
allowed, leading to various bad things; including yambar crashing, allowed, leading to various bad things; including yambar crashing,
or worse, the compositor crashing or worse, the compositor crashing
(https://codeberg.org/dnkl/yambar/issues/129). (https://codeberg.org/dnkl/yambar/issues/129).
* kib/kb, mib/mb and gib/gb formatters were inverted.
### Security ### Security

12
tag.c
View file

@ -545,12 +545,12 @@ tags_expand_template(const char *template, const struct tag_set *tags)
case FMT_MIBYTE: case FMT_MIBYTE:
case FMT_GIBYTE: { case FMT_GIBYTE: {
const long divider = const long divider =
format == FMT_KBYTE ? 1024 : format == FMT_KBYTE ? 1000 :
format == FMT_MBYTE ? 1024 * 1024 : format == FMT_MBYTE ? 1000 * 1000 :
format == FMT_GBYTE ? 1024 * 1024 * 1024 : format == FMT_GBYTE ? 1000 * 1000 * 1000 :
format == FMT_KIBYTE ? 1000 : format == FMT_KIBYTE ? 1024 :
format == FMT_MIBYTE ? 1000 * 1000 : format == FMT_MIBYTE ? 1024 * 1024 :
format == FMT_GIBYTE ? 1000 * 1000 * 1000 : format == FMT_GIBYTE ? 1024 * 1024 * 1024 :
1; 1;
char str[24]; char str[24];