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

playlist/{flac,m3u}: use std::make_unique

parent b13b023c
...@@ -26,7 +26,7 @@ MemorySongEnumerator::NextSong() ...@@ -26,7 +26,7 @@ MemorySongEnumerator::NextSong()
if (songs.empty()) if (songs.empty())
return nullptr; return nullptr;
std::unique_ptr<DetachedSong> result(new DetachedSong(std::move(songs.front()))); auto result = std::make_unique<DetachedSong>(std::move(songs.front()));
songs.pop_front(); songs.pop_front();
return result; return result;
} }
...@@ -229,7 +229,7 @@ CueParser::Feed2(char *p) noexcept ...@@ -229,7 +229,7 @@ CueParser::Feed2(char *p) noexcept
} }
state = TRACK; state = TRACK;
current.reset(new DetachedSong(filename)); current = std::make_unique<DetachedSong>(filename);
assert(!current->GetTag().IsDefined()); assert(!current->GetTag().IsDefined());
song_tag = header_tag; song_tag = header_tag;
......
...@@ -135,7 +135,7 @@ ExtM3uPlaylist::NextSong() ...@@ -135,7 +135,7 @@ ExtM3uPlaylist::NextSong()
line_s = StripLeft(line_s); line_s = StripLeft(line_s);
} while (line_s[0] == '#' || *line_s == 0); } while (line_s[0] == '#' || *line_s == 0);
return std::unique_ptr<DetachedSong>(new DetachedSong(line_s, std::move(tag))); return std::make_unique<DetachedSong>(line_s, std::move(tag));
} }
static const char *const extm3u_suffixes[] = { static const char *const extm3u_suffixes[] = {
......
...@@ -80,7 +80,7 @@ FlacPlaylist::NextSong() ...@@ -80,7 +80,7 @@ FlacPlaylist::NextSong()
? c.tracks[next_track].offset ? c.tracks[next_track].offset
: total_samples; : total_samples;
std::unique_ptr<DetachedSong> song(new DetachedSong(uri)); auto song = std::make_unique<DetachedSong>(uri);
song->SetStartTime(SongTime::FromScale(start, sample_rate)); song->SetStartTime(SongTime::FromScale(start, sample_rate));
song->SetEndTime(SongTime::FromScale(end, sample_rate)); song->SetEndTime(SongTime::FromScale(end, sample_rate));
return song; return song;
......
...@@ -55,7 +55,7 @@ M3uPlaylist::NextSong() ...@@ -55,7 +55,7 @@ M3uPlaylist::NextSong()
line_s = Strip(line_s); line_s = Strip(line_s);
} while (line_s[0] == '#' || *line_s == 0); } while (line_s[0] == '#' || *line_s == 0);
return std::unique_ptr<DetachedSong>(new DetachedSong(line_s)); return std::make_unique<DetachedSong>(line_s);
} }
static const char *const m3u_suffixes[] = { static const char *const m3u_suffixes[] = {
......
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