summaryrefslogtreecommitdiff
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-24 12:52:43 +0100
committerMax Kellermann <max@musicpd.org>2018-07-06 19:07:02 +0200
commit60d5bf0240dea58419edb05198906349e81abbe8 (patch)
tree3811d24f1ec17257b14d7dd8759a6948ac676399 /src/tag
parent41cdc4e14b3d36d70039a7ac1578fe7c898a0bac (diff)
util/StringFormat: new utility library
Diffstat (limited to 'src/tag')
-rw-r--r--src/tag/TagHandler.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/tag/TagHandler.cxx b/src/tag/TagHandler.cxx
index 345c64a21..d59ac9a9c 100644
--- a/src/tag/TagHandler.cxx
+++ b/src/tag/TagHandler.cxx
@@ -21,8 +21,8 @@
#include "TagHandler.hxx"
#include "TagBuilder.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);
}