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

This commit is contained in:
Max Kellermann 2019-04-26 14:58:09 +02:00
parent 401f06f367
commit 2c6ebe28e9

View File

@ -35,6 +35,8 @@
#include "fs/AllocatedPath.hxx"
#include "util/ASCII.hxx"
#include <memory>
#include <string.h>
class EmbeddedCuePlaylist final : public SongEnumerator {
@ -56,17 +58,9 @@ public:
*/
char *next;
CueParser *parser;
std::unique_ptr<CueParser> parser;
public:
EmbeddedCuePlaylist() noexcept
:parser(nullptr) {
}
~EmbeddedCuePlaylist() noexcept override {
delete parser;
}
std::unique_ptr<DetachedSong> NextSong() override;
};
@ -113,7 +107,7 @@ embcue_playlist_open_uri(const char *uri,
playlist->cuesheet = std::move(extract_cuesheet.cuesheet);
playlist->next = &playlist->cuesheet[0];
playlist->parser = new CueParser();
playlist->parser = std::make_unique<CueParser>();
return playlist;
}