Tag: move code from Merge() to TagBuilder::Complement()

This commit is contained in:
Max Kellermann
2013-12-03 11:27:16 +01:00
parent 6325c3f14a
commit 7e8d254b95
3 changed files with 29 additions and 40 deletions

View File

@@ -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)
{