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

This commit is contained in:
Max Kellermann 2017-11-26 12:10:33 +01:00
parent b13b023c6b
commit 2a774a1fea
5 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ MemorySongEnumerator::NextSong()
if (songs.empty())
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();
return result;
}

View File

@ -229,7 +229,7 @@ CueParser::Feed2(char *p) noexcept
}
state = TRACK;
current.reset(new DetachedSong(filename));
current = std::make_unique<DetachedSong>(filename);
assert(!current->GetTag().IsDefined());
song_tag = header_tag;

View File

@ -135,7 +135,7 @@ ExtM3uPlaylist::NextSong()
line_s = StripLeft(line_s);
} 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[] = {

View File

@ -80,7 +80,7 @@ FlacPlaylist::NextSong()
? c.tracks[next_track].offset
: 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->SetEndTime(SongTime::FromScale(end, sample_rate));
return song;

View File

@ -55,7 +55,7 @@ M3uPlaylist::NextSong()
line_s = Strip(line_s);
} 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[] = {