diff options
author | Max Kellermann <max@musicpd.org> | 2018-01-24 12:52:43 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-01-24 13:28:28 +0100 |
commit | 97f670658fb0ab21d469eb69510faa8403c99d65 (patch) | |
tree | 4925c68092e81c2839afc85855de37d98e8273aa /src/tag | |
parent | 4324fb2fbed32533d8efa8c211038ef8fe0b9a0e (diff) |
util/StringFormat: new utility library
Diffstat (limited to 'src/tag')
-rw-r--r-- | src/tag/Handler.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/tag/Handler.cxx b/src/tag/Handler.cxx index dda760c43..7c4210f7d 100644 --- a/src/tag/Handler.cxx +++ b/src/tag/Handler.cxx @@ -21,8 +21,8 @@ #include "Handler.hxx" #include "Builder.hxx" #include "util/ASCII.hxx" +#include "util/StringFormat.hxx" -#include <stdio.h> #include <stdlib.h> static void @@ -42,11 +42,8 @@ add_tag_tag(TagType type, const char *value, void *ctx) /* filter out this extra data and leading zeroes */ char *end; unsigned n = strtoul(value, &end, 10); - if (value != end) { - char s[21]; - if (snprintf(s, 21, "%u", n) > 0) - tag.AddItem(type, s); - } + if (value != end) + tag.AddItem(type, StringFormat<21>("%u", n)); } else tag.AddItem(type, value); } |