Commit 2c6ebe28 authored by Max Kellermann's avatar Max Kellermann

playlist/EmbeddedCue:: wrap CueParser in std::unique_ptr<>

parent 401f06f3
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "util/ASCII.hxx" #include "util/ASCII.hxx"
#include <memory>
#include <string.h> #include <string.h>
class EmbeddedCuePlaylist final : public SongEnumerator { class EmbeddedCuePlaylist final : public SongEnumerator {
...@@ -56,17 +58,9 @@ public: ...@@ -56,17 +58,9 @@ public:
*/ */
char *next; char *next;
CueParser *parser; std::unique_ptr<CueParser> parser;
public: public:
EmbeddedCuePlaylist() noexcept
:parser(nullptr) {
}
~EmbeddedCuePlaylist() noexcept override {
delete parser;
}
std::unique_ptr<DetachedSong> NextSong() override; std::unique_ptr<DetachedSong> NextSong() override;
}; };
...@@ -113,7 +107,7 @@ embcue_playlist_open_uri(const char *uri, ...@@ -113,7 +107,7 @@ embcue_playlist_open_uri(const char *uri,
playlist->cuesheet = std::move(extract_cuesheet.cuesheet); playlist->cuesheet = std::move(extract_cuesheet.cuesheet);
playlist->next = &playlist->cuesheet[0]; playlist->next = &playlist->cuesheet[0];
playlist->parser = new CueParser(); playlist->parser = std::make_unique<CueParser>();
return playlist; return playlist;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment