db/LightSong: make Tag a reference

This enforces the "not nullptr" rule.
This commit is contained in:
Max Kellermann
2018-07-06 16:43:11 +02:00
parent ebc006ab52
commit b9ff6383a4
13 changed files with 23 additions and 26 deletions

View File

@@ -26,18 +26,17 @@
DetachedSong::DetachedSong(const LightSong &other)
:uri(other.GetURI()),
real_uri(other.real_uri != nullptr ? other.real_uri : ""),
tag(*other.tag),
tag(other.tag),
mtime(other.mtime),
start_time(other.start_time),
end_time(other.end_time) {}
DetachedSong::operator LightSong() const noexcept
{
LightSong result;
LightSong result(tag);
result.directory = nullptr;
result.uri = uri.c_str();
result.real_uri = real_uri.empty() ? nullptr : real_uri.c_str();
result.tag = &tag;
result.mtime = mtime;
result.start_time = start_time;
result.end_time = end_time;