mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-20 03:35:41 +02:00
commit
9f5f35a8ac
2 changed files with 9 additions and 1 deletions
|
@ -17,6 +17,12 @@
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
* Compiler error _‘fmt’ may be used uninitialized_ ([#311][311]).
|
||||||
|
|
||||||
|
[311]: https://codeberg.org/dnkl/yambar/issues/311
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
### Contributors
|
### Contributors
|
||||||
|
|
||||||
|
|
4
tag.c
4
tag.c
|
@ -674,7 +674,7 @@ tags_expand_template(const char *template, const struct tag_set *tags)
|
||||||
const long max = tag->max(tag);
|
const long max = tag->max(tag);
|
||||||
long value = kind == VALUE_MIN ? min : max;
|
long value = kind == VALUE_MIN ? min : max;
|
||||||
|
|
||||||
const char *fmt;
|
const char *fmt = NULL;
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case FMT_DEFAULT: fmt = zero_pad ? "%0*ld" : "%*ld"; break;
|
case FMT_DEFAULT: fmt = zero_pad ? "%0*ld" : "%*ld"; break;
|
||||||
case FMT_HEX: fmt = zero_pad ? "%0*lx" : "%*lx"; break;
|
case FMT_HEX: fmt = zero_pad ? "%0*lx" : "%*lx"; break;
|
||||||
|
@ -704,6 +704,8 @@ tags_expand_template(const char *template, const struct tag_set *tags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(fmt != NULL);
|
||||||
|
|
||||||
char str[24];
|
char str[24];
|
||||||
snprintf(str, sizeof(str), fmt, digits, value);
|
snprintf(str, sizeof(str), fmt, digits, value);
|
||||||
sbuf_append(&formatted, str);
|
sbuf_append(&formatted, str);
|
||||||
|
|
Loading…
Add table
Reference in a new issue