aboutsummaryrefslogtreecommitdiffstats
path: root/src/Song.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-19 19:57:27 +0100
committerMax Kellermann <max@duempel.org>2014-01-19 23:16:09 +0100
commit64465c1318e227ca625ee2047ec8b6a8f0c2faff (patch)
treecebe7785a4c50b698e29597eb28c70bcca5864ce /src/Song.cxx
parenta506adea41e21e071ac3e88d69824d6dd3a3c925 (diff)
downloadmpd-64465c1318e227ca625ee2047ec8b6a8f0c2faff.tar.gz
mpd-64465c1318e227ca625ee2047ec8b6a8f0c2faff.tar.xz
mpd-64465c1318e227ca625ee2047ec8b6a8f0c2faff.zip
Song: make the "parent" attribute mandatory
The Song class is only used for database songs now. A Song without a Directory is not possible anymore.
Diffstat (limited to 'src/Song.cxx')
-rw-r--r--src/Song.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Song.cxx b/src/Song.cxx
index 565b9af98..15924a40a 100644
--- a/src/Song.cxx
+++ b/src/Song.cxx
@@ -29,8 +29,8 @@
#include <string.h>
#include <stdlib.h>
-inline Song::Song(const char *_uri, size_t uri_length, Directory *_parent)
- :parent(_parent), mtime(0), start_ms(0), end_ms(0)
+inline Song::Song(const char *_uri, size_t uri_length, Directory &_parent)
+ :parent(&_parent), mtime(0), start_ms(0), end_ms(0)
{
memcpy(uri, _uri, uri_length + 1);
}
@@ -40,7 +40,7 @@ inline Song::~Song()
}
static Song *
-song_alloc(const char *uri, Directory *parent)
+song_alloc(const char *uri, Directory &parent)
{
size_t uri_length;
@@ -54,7 +54,7 @@ song_alloc(const char *uri, Directory *parent)
}
Song *
-Song::NewFrom(DetachedSong &&other, Directory *parent)
+Song::NewFrom(DetachedSong &&other, Directory &parent)
{
Song *song = song_alloc(other.GetURI(), parent);
song->tag = std::move(other.WritableTag());
@@ -65,7 +65,7 @@ Song::NewFrom(DetachedSong &&other, Directory *parent)
}
Song *
-Song::NewFile(const char *path, Directory *parent)
+Song::NewFile(const char *path, Directory &parent)
{
return song_alloc(path, parent);
}
@@ -81,7 +81,7 @@ Song::GetURI() const
{
assert(*uri);
- if (parent == nullptr || parent->IsRoot())
+ if (parent->IsRoot())
return std::string(uri);
else {
const char *path = parent->GetPath();