aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag/TagBuilder.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-10-10 22:01:29 +0200
committerMax Kellermann <max@duempel.org>2014-10-10 22:07:19 +0200
commitb7a1954c335b2324878c5c30b47828b092ed96c2 (patch)
treee18b1ad21cbc07731cd42cc4dfdc85cd9bde465a /src/tag/TagBuilder.cxx
parent6520589a376bfc7ffbee899e6f689dd6319d2e68 (diff)
downloadmpd-b7a1954c335b2324878c5c30b47828b092ed96c2.tar.gz
mpd-b7a1954c335b2324878c5c30b47828b092ed96c2.tar.xz
mpd-b7a1954c335b2324878c5c30b47828b092ed96c2.zip
TagString: return WritableBuffer<char>
Diffstat (limited to 'src/tag/TagBuilder.cxx')
-rw-r--r--src/tag/TagBuilder.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx
index 85060e9ee..c9ebcd654 100644
--- a/src/tag/TagBuilder.cxx
+++ b/src/tag/TagBuilder.cxx
@@ -23,6 +23,7 @@
#include "TagPool.hxx"
#include "TagString.hxx"
#include "Tag.hxx"
+#include "util/WritableBuffer.hxx"
#include <assert.h>
#include <string.h>
@@ -184,17 +185,17 @@ TagBuilder::AddItemInternal(TagType type, const char *value, size_t length)
assert(value != nullptr);
assert(length > 0);
- char *p = FixTagString(value, length);
- if (p != nullptr) {
- value = p;
- length = strlen(value);
+ auto f = FixTagString(value, length);
+ if (!f.IsNull()) {
+ value = f.data;
+ length = f.size;
}
tag_pool_lock.lock();
auto i = tag_pool_get_item(type, value, length);
tag_pool_lock.unlock();
- free(p);
+ free(f.data);
items.push_back(i);
}