playlist/{flac,m3u}: use std::make_unique
This commit is contained in:
parent
b13b023c6b
commit
2a774a1fea
@ -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
|
|||||||
}
|
}
|
||||||
|
|
||||||
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()
|
|||||||
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()
|
|||||||
? 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()
|
|||||||
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[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user