diff --git a/src/db/LightSong.hxx b/src/db/LightSong.hxx index 73329f9fd..0aecc4a53 100644 --- a/src/db/LightSong.hxx +++ b/src/db/LightSong.hxx @@ -42,7 +42,7 @@ struct LightSong { * #uri. To build the full URI, join directory and uri with a * slash. */ - const char *directory; + const char *directory = nullptr; const char *uri; @@ -54,7 +54,7 @@ struct LightSong { * This attribute is used for songs from the database which * have a relative URI. */ - const char *real_uri; + const char *real_uri = nullptr; /** * Metadata. @@ -65,18 +65,18 @@ struct LightSong { * The time stamp of the last file modification. A negative * value means that this is unknown/unavailable. */ - std::chrono::system_clock::time_point mtime; + std::chrono::system_clock::time_point mtime = std::chrono::system_clock::time_point::min(); /** * Start of this sub-song within the file. */ - SongTime start_time; + SongTime start_time = SongTime::zero(); /** * End of this sub-song within the file. * Unused if zero. */ - SongTime end_time; + SongTime end_time = SongTime::zero(); explicit LightSong(const Tag &_tag) noexcept :tag(_tag) {} diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index d82d2fcd4..5b7a09948 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -205,20 +205,15 @@ 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; const auto _mtime = mpd_song_get_last_modified(song); - mtime = _mtime > 0 - ? std::chrono::system_clock::from_time_t(_mtime) - : std::chrono::system_clock::time_point::min(); + if (_mtime > 0) + mtime = std::chrono::system_clock::from_time_t(_mtime); #if LIBMPDCLIENT_CHECK_VERSION(2,3,0) start_time = SongTime::FromS(mpd_song_get_start(song)); end_time = SongTime::FromS(mpd_song_get_end(song)); -#else - start_time = end_time = SongTime::zero(); #endif TagBuilder tag_builder; diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 4b93bd975..f24deb6a4 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -59,11 +59,8 @@ public: 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(); - mtime = std::chrono::system_clock::time_point::min(); - start_time = end_time = SongTime::zero(); } }; @@ -322,11 +319,8 @@ visitSong(const UPnPDirObject &meta, const char *path, return; LightSong song(meta.tag); - song.directory = nullptr; song.uri = path; song.real_uri = meta.url.c_str(); - song.mtime = std::chrono::system_clock::time_point::min(); - song.start_time = song.end_time = SongTime::zero(); if (selection.Match(song)) visit_song(song);