summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/IcyMetaDataParser.cxx4
-rw-r--r--src/input/plugins/CurlInputPlugin.cxx3
-rw-r--r--src/lib/xiph/VorbisComments.cxx3
-rw-r--r--src/tag/Builder.cxx4
-rw-r--r--src/tag/Builder.hxx3
-rw-r--r--src/tag/Id3Scan.cxx3
-rw-r--r--src/tag/Tag.cxx2
7 files changed, 13 insertions, 9 deletions
diff --git a/src/IcyMetaDataParser.cxx b/src/IcyMetaDataParser.cxx
index bc2d3b357..b4015823e 100644
--- a/src/IcyMetaDataParser.cxx
+++ b/src/IcyMetaDataParser.cxx
@@ -115,7 +115,7 @@ find_end_quote(char *p, char *const end)
}
}
-static Tag *
+static std::unique_ptr<Tag>
icy_parse_tag(char *p, char *const end)
{
assert(p != nullptr);
@@ -210,7 +210,7 @@ IcyMetaDataParser::Meta(const void *data, size_t length)
delete tag;
- tag = icy_parse_tag(meta_data, meta_data + meta_size);
+ tag = icy_parse_tag(meta_data, meta_data + meta_size).release();
delete[] meta_data;
/* change back to normal data mode */
diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx
index cdeec5d94..ab568e62a 100644
--- a/src/input/plugins/CurlInputPlugin.cxx
+++ b/src/input/plugins/CurlInputPlugin.cxx
@@ -31,6 +31,7 @@
#include "config/ConfigGlobal.hxx"
#include "config/Block.hxx"
#include "tag/Builder.hxx"
+#include "tag/Tag.hxx"
#include "event/Call.hxx"
#include "event/Loop.hxx"
#include "thread/Cond.hxx"
@@ -222,7 +223,7 @@ CurlInputStream::OnHeaders(unsigned status,
TagBuilder tag_builder;
tag_builder.AddItem(TAG_NAME, i->second.c_str());
- SetTag(tag_builder.CommitNew());
+ SetTag(tag_builder.CommitNew().release());
}
if (!icy->IsEnabled()) {
diff --git a/src/lib/xiph/VorbisComments.cxx b/src/lib/xiph/VorbisComments.cxx
index 8477a8df4..fbec94c90 100644
--- a/src/lib/xiph/VorbisComments.cxx
+++ b/src/lib/xiph/VorbisComments.cxx
@@ -23,6 +23,7 @@
#include "tag/Table.hxx"
#include "tag/Handler.hxx"
#include "tag/Builder.hxx"
+#include "tag/Tag.hxx"
#include "tag/VorbisComment.hxx"
#include "tag/ReplayGain.hxx"
#include "ReplayGainInfo.hxx"
@@ -106,5 +107,5 @@ vorbis_comments_to_tag(char **comments) noexcept
vorbis_comments_scan(comments, add_tag_handler, &tag_builder);
return tag_builder.empty()
? nullptr
- : tag_builder.CommitNew();
+ : tag_builder.CommitNew().release();
}
diff --git a/src/tag/Builder.cxx b/src/tag/Builder.cxx
index d950c036b..d1e4c75bf 100644
--- a/src/tag/Builder.cxx
+++ b/src/tag/Builder.cxx
@@ -144,10 +144,10 @@ TagBuilder::Commit()
return tag;
}
-Tag *
+std::unique_ptr<Tag>
TagBuilder::CommitNew()
{
- Tag *tag = new Tag();
+ std::unique_ptr<Tag> tag(new Tag());
Commit(*tag);
return tag;
}
diff --git a/src/tag/Builder.hxx b/src/tag/Builder.hxx
index 2b0d3ef7e..8fb84b10a 100644
--- a/src/tag/Builder.hxx
+++ b/src/tag/Builder.hxx
@@ -25,6 +25,7 @@
#include "Compiler.h"
#include <vector>
+#include <memory>
struct StringView;
struct TagItem;
@@ -105,7 +106,7 @@ public:
* returned object is owned by the caller. This object is
* empty afterwards.
*/
- Tag *CommitNew();
+ std::unique_ptr<Tag> CommitNew();
void SetDuration(SignedSongTime _duration) {
duration = _duration;
diff --git a/src/tag/Id3Scan.cxx b/src/tag/Id3Scan.cxx
index 95479dd25..3c8054d1d 100644
--- a/src/tag/Id3Scan.cxx
+++ b/src/tag/Id3Scan.cxx
@@ -23,6 +23,7 @@
#include "Handler.hxx"
#include "Table.hxx"
#include "Builder.hxx"
+#include "Tag.hxx"
#include "Id3MusicBrainz.hxx"
#include "util/Alloc.hxx"
#include "util/ScopeExit.hxx"
@@ -336,7 +337,7 @@ tag_id3_import(struct id3_tag *tag)
scan_id3_tag(tag, add_tag_handler, &tag_builder);
return tag_builder.empty()
? nullptr
- : tag_builder.CommitNew();
+ : tag_builder.CommitNew().release();
}
bool
diff --git a/src/tag/Tag.cxx b/src/tag/Tag.cxx
index 1f425ec6a..054872096 100644
--- a/src/tag/Tag.cxx
+++ b/src/tag/Tag.cxx
@@ -60,7 +60,7 @@ Tag::Merge(const Tag &base, const Tag &add)
{
TagBuilder builder(add);
builder.Complement(base);
- return builder.CommitNew();
+ return builder.CommitNew().release();
}
Tag *