diff options
author | Max Kellermann <max@duempel.org> | 2013-12-03 11:27:16 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-03 11:46:24 +0100 |
commit | 7e8d254b95716f1253577a9a5d7df1760f9f6e47 (patch) | |
tree | 9d22bb8d6d3e1e1b064fca93397d945836e901ab /src/tag/TagBuilder.cxx | |
parent | 6325c3f14a4dd1442d69dc5716b33c9d5b410164 (diff) |
Tag: move code from Merge() to TagBuilder::Complement()
Diffstat (limited to 'src/tag/TagBuilder.cxx')
-rw-r--r-- | src/tag/TagBuilder.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx index 15e32bb01..6ba8c12db 100644 --- a/src/tag/TagBuilder.cxx +++ b/src/tag/TagBuilder.cxx @@ -109,6 +109,25 @@ TagBuilder::HasType(TagType type) const return false; } +void +TagBuilder::Complement(const Tag &other) +{ + if (time <= 0) + time = other.time; + + has_playlist |= other.has_playlist; + + items.reserve(items.size() + other.num_items); + + tag_pool_lock.lock(); + for (unsigned i = 0, n = other.num_items; i != n; ++i) { + TagItem *item = other.items[i]; + if (!HasType(item->type)) + items.push_back(tag_pool_dup_item(item)); + } + tag_pool_lock.unlock(); +} + inline void TagBuilder::AddItemInternal(TagType type, const char *value, size_t length) { |