Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f25ef8d6
Commit
f25ef8d6
authored
Feb 04, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/Walk: add Directory reference parameter
Remove dependency on the DatabaseSimple library.
parent
33a2c01e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
UpdateGlue.cxx
src/db/update/UpdateGlue.cxx
+2
-1
Walk.cxx
src/db/update/Walk.cxx
+8
-10
Walk.hxx
src/db/update/Walk.hxx
+4
-3
No files found.
src/db/update/UpdateGlue.cxx
View file @
f25ef8d6
...
...
@@ -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
;
...
...
src/db/update/Walk.cxx
View file @
f25ef8d6
...
...
@@ -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
;
...
...
src/db/update/Walk.hxx
View file @
f25ef8d6
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment