diff options
-rw-r--r-- | src/decoder/Bridge.cxx | 6 | ||||
-rw-r--r-- | src/input/IcyInputStream.cxx | 2 | ||||
-rw-r--r-- | src/tag/Tag.cxx | 12 | ||||
-rw-r--r-- | src/tag/Tag.hxx | 7 |
4 files changed, 19 insertions, 8 deletions
diff --git a/src/decoder/Bridge.cxx b/src/decoder/Bridge.cxx index 57a2a9512..5f326a7f1 100644 --- a/src/decoder/Bridge.cxx +++ b/src/decoder/Bridge.cxx @@ -474,8 +474,8 @@ DecoderBridge::SubmitData(InputStream *is, if (UpdateStreamTag(is)) { if (decoder_tag != nullptr) /* merge with tag from decoder plugin */ - cmd = DoSendTag(*Tag::Merge(*decoder_tag, - *stream_tag)); + cmd = DoSendTag(Tag::Merge(*decoder_tag, + *stream_tag)); else /* send only the stream tag */ cmd = DoSendTag(*stream_tag); @@ -598,7 +598,7 @@ DecoderBridge::SubmitTag(InputStream *is, Tag &&tag) noexcept if (stream_tag != nullptr) /* merge with tag from input stream */ - cmd = DoSendTag(*Tag::Merge(*stream_tag, *decoder_tag)); + cmd = DoSendTag(Tag::Merge(*stream_tag, *decoder_tag)); else /* send only the decoder tag */ cmd = DoSendTag(*decoder_tag); diff --git a/src/input/IcyInputStream.cxx b/src/input/IcyInputStream.cxx index 46ebeaca4..631d935c0 100644 --- a/src/input/IcyInputStream.cxx +++ b/src/input/IcyInputStream.cxx @@ -92,7 +92,7 @@ IcyInputStream::ReadTag() noexcept if (icy_tag == nullptr) return std::make_unique<Tag>(*input_tag); - return Tag::Merge(*input_tag, *icy_tag); + return Tag::MergePtr(*input_tag, *icy_tag); } size_t diff --git a/src/tag/Tag.cxx b/src/tag/Tag.cxx index 3da75ac0b..5abb6d7f1 100644 --- a/src/tag/Tag.cxx +++ b/src/tag/Tag.cxx @@ -53,11 +53,19 @@ Tag::Tag(const Tag &other) noexcept } } -std::unique_ptr<Tag> +Tag Tag::Merge(const Tag &base, const Tag &add) noexcept { TagBuilder builder(add); builder.Complement(base); + return builder.Commit(); +} + +std::unique_ptr<Tag> +Tag::MergePtr(const Tag &base, const Tag &add) noexcept +{ + TagBuilder builder(add); + builder.Complement(base); return builder.CommitNew(); } @@ -70,7 +78,7 @@ Tag::Merge(std::unique_ptr<Tag> base, std::unique_ptr<Tag> add) noexcept if (base == nullptr) return add; - return Merge(*base, *add); + return MergePtr(*base, *add); } const char * diff --git a/src/tag/Tag.hxx b/src/tag/Tag.hxx index 5b3b59ec8..fca5ea284 100644 --- a/src/tag/Tag.hxx +++ b/src/tag/Tag.hxx @@ -117,8 +117,11 @@ struct Tag { * * @return a newly allocated tag */ - static std::unique_ptr<Tag> Merge(const Tag &base, - const Tag &add) noexcept; + static Tag Merge(const Tag &base, + const Tag &add) noexcept; + + static std::unique_ptr<Tag> MergePtr(const Tag &base, + const Tag &add) noexcept; /** * Merges the data from two tags. Any of the two may be nullptr. Both |