diff options
Diffstat (limited to '')
-rw-r--r-- | src/db/update/UpdateGlue.cxx | 3 | ||||
-rw-r--r-- | src/db/update/Walk.cxx | 18 | ||||
-rw-r--r-- | src/db/update/Walk.hxx | 7 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/db/update/UpdateGlue.cxx b/src/db/update/UpdateGlue.cxx index 285143ffe..742fbfe98 100644 --- a/src/db/update/UpdateGlue.cxx +++ b/src/db/update/UpdateGlue.cxx @@ -44,7 +44,8 @@ UpdateService::Task() SetThreadIdlePriority(); - modified = walk.Walk(next.path_utf8.c_str(), next.discard); + modified = walk.Walk(*db_get_root(), next.path_utf8.c_str(), + next.discard); if (modified || !db_exists()) { Error error; diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx index ff59fe960..ed09c1676 100644 --- a/src/db/update/Walk.cxx +++ b/src/db/update/Walk.cxx @@ -23,7 +23,6 @@ #include "Editor.hxx" #include "UpdateDomain.hxx" #include "db/DatabaseLock.hxx" -#include "db/DatabaseSimple.hxx" #include "db/Directory.hxx" #include "db/Song.hxx" #include "db/PlaylistVector.hxx" @@ -393,9 +392,9 @@ UpdateWalk::DirectoryMakeChildChecked(Directory &parent, const char *name_utf8) } inline Directory * -UpdateWalk::DirectoryMakeUriParentChecked(const char *uri) +UpdateWalk::DirectoryMakeUriParentChecked(Directory &root, const char *uri) { - Directory *directory = db_get_root(); + Directory *directory = &root; char *duplicated = xstrdup(uri); char *name_utf8 = duplicated, *slash; @@ -418,9 +417,9 @@ UpdateWalk::DirectoryMakeUriParentChecked(const char *uri) } inline void -UpdateWalk::UpdateUri(const char *uri) +UpdateWalk::UpdateUri(Directory &root, const char *uri) { - Directory *parent = DirectoryMakeUriParentChecked(uri); + Directory *parent = DirectoryMakeUriParentChecked(root, uri); if (parent == nullptr) return; @@ -435,19 +434,18 @@ UpdateWalk::UpdateUri(const char *uri) } bool -UpdateWalk::Walk(const char *path, bool discard) +UpdateWalk::Walk(Directory &root, const char *path, bool discard) { walk_discard = discard; modified = false; if (path != nullptr && !isRootDirectory(path)) { - UpdateUri(path); + UpdateUri(root, path); } else { - Directory *directory = db_get_root(); struct stat st; - if (stat_directory(*directory, &st) == 0) - UpdateDirectory(*directory, &st); + if (stat_directory(root, &st) == 0) + UpdateDirectory(root, &st); } return modified; diff --git a/src/db/update/Walk.hxx b/src/db/update/Walk.hxx index 12274ccdf..ecb04387d 100644 --- a/src/db/update/Walk.hxx +++ b/src/db/update/Walk.hxx @@ -54,7 +54,7 @@ public: /** * Returns true if the database was modified. */ - bool Walk(const char *path, bool discard); + bool Walk(Directory &root, const char *path, bool discard); private: gcc_pure @@ -126,9 +126,10 @@ private: Directory *DirectoryMakeChildChecked(Directory &parent, const char *name_utf8); - Directory *DirectoryMakeUriParentChecked(const char *uri); + Directory *DirectoryMakeUriParentChecked(Directory &root, + const char *uri); - void UpdateUri(const char *uri); + void UpdateUri(Directory &root, const char *uri); }; #endif |