db/LightSong: make Tag a reference
This enforces the "not nullptr" rule.
This commit is contained in:
@@ -203,11 +203,11 @@ Copy(TagBuilder &tag, TagType d_tag,
|
||||
}
|
||||
|
||||
ProxySong::ProxySong(const mpd_song *song)
|
||||
:LightSong(tag2)
|
||||
{
|
||||
directory = nullptr;
|
||||
uri = mpd_song_get_uri(song);
|
||||
real_uri = nullptr;
|
||||
tag = &tag2;
|
||||
|
||||
const auto _mtime = mpd_song_get_last_modified(song);
|
||||
mtime = _mtime > 0
|
||||
|
@@ -98,12 +98,11 @@ Song::GetURI() const noexcept
|
||||
LightSong
|
||||
Song::Export() const noexcept
|
||||
{
|
||||
LightSong dest;
|
||||
LightSong dest(tag);
|
||||
dest.directory = parent->IsRoot()
|
||||
? nullptr : parent->GetPath();
|
||||
dest.uri = uri;
|
||||
dest.real_uri = nullptr;
|
||||
dest.tag = &tag;
|
||||
dest.mtime = mtime;
|
||||
dest.start_time = start_time;
|
||||
dest.end_time = end_time;
|
||||
|
@@ -55,13 +55,13 @@ class UpnpSong : public LightSong {
|
||||
|
||||
public:
|
||||
UpnpSong(UPnPDirObject &&object, std::string &&_uri)
|
||||
:uri2(std::move(_uri)),
|
||||
:LightSong(tag2),
|
||||
uri2(std::move(_uri)),
|
||||
real_uri2(std::move(object.url)),
|
||||
tag2(std::move(object.tag)) {
|
||||
directory = nullptr;
|
||||
uri = uri2.c_str();
|
||||
real_uri = real_uri2.c_str();
|
||||
tag = &tag2;
|
||||
mtime = std::chrono::system_clock::time_point::min();
|
||||
start_time = end_time = SongTime::zero();
|
||||
}
|
||||
@@ -321,11 +321,10 @@ visitSong(const UPnPDirObject &meta, const char *path,
|
||||
if (!visit_song)
|
||||
return;
|
||||
|
||||
LightSong song;
|
||||
LightSong song(meta.tag);
|
||||
song.directory = nullptr;
|
||||
song.uri = path;
|
||||
song.real_uri = meta.url.c_str();
|
||||
song.tag = &meta.tag;
|
||||
song.mtime = std::chrono::system_clock::time_point::min();
|
||||
song.start_time = song.end_time = SongTime::zero();
|
||||
|
||||
|
Reference in New Issue
Block a user