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
6c8eb3c7
Commit
6c8eb3c7
authored
Apr 03, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/simple/Directory: rename LookupResult::uri to "rest"
parent
87015121
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
Directory.hxx
src/db/plugins/simple/Directory.hxx
+1
-1
SimpleDatabasePlugin.cxx
src/db/plugins/simple/SimpleDatabasePlugin.cxx
+12
-12
Service.cxx
src/db/update/Service.cxx
+6
-6
No files found.
src/db/plugins/simple/Directory.hxx
View file @
6c8eb3c7
...
...
@@ -186,7 +186,7 @@ public:
* The remaining URI part (without leading slash) or
* nullptr if the given URI was consumed completely.
*/
const
char
*
uri
;
const
char
*
rest
;
};
/**
...
...
src/db/plugins/simple/SimpleDatabasePlugin.cxx
View file @
6c8eb3c7
...
...
@@ -212,7 +212,7 @@ SimpleDatabase::GetSong(const char *uri) const
protect
.
unlock
();
const
LightSong
*
song
=
r
.
directory
->
mounted_database
->
GetSong
(
r
.
uri
);
r
.
directory
->
mounted_database
->
GetSong
(
r
.
rest
);
if
(
song
==
nullptr
)
return
nullptr
;
...
...
@@ -222,17 +222,17 @@ SimpleDatabase::GetSong(const char *uri) const
return
prefixed_light_song
;
}
if
(
r
.
uri
==
nullptr
)
if
(
r
.
rest
==
nullptr
)
/* it's a directory */
throw
DatabaseError
(
DatabaseErrorCode
::
NOT_FOUND
,
"No such song"
);
if
(
strchr
(
r
.
uri
,
'/'
)
!=
nullptr
)
if
(
strchr
(
r
.
rest
,
'/'
)
!=
nullptr
)
/* refers to a URI "below" the actual song */
throw
DatabaseError
(
DatabaseErrorCode
::
NOT_FOUND
,
"No such song"
);
const
Song
*
song
=
r
.
directory
->
FindSong
(
r
.
uri
);
const
Song
*
song
=
r
.
directory
->
FindSong
(
r
.
rest
);
protect
.
unlock
();
if
(
song
==
nullptr
)
throw
DatabaseError
(
DatabaseErrorCode
::
NOT_FOUND
,
...
...
@@ -290,7 +290,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
protect
.
unlock
();
WalkMount
(
r
.
directory
->
GetPath
(),
*
(
r
.
directory
->
mounted_database
),
(
r
.
uri
==
nullptr
)
?
""
:
r
.
uri
,
selection
,
(
r
.
rest
==
nullptr
)
?
""
:
r
.
rest
,
selection
,
visit_directory
,
visit_song
,
visit_playlist
);
return
;
...
...
@@ -298,7 +298,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
DatabaseVisitorHelper
helper
(
CheckSelection
(
selection
),
visit_song
);
if
(
r
.
uri
==
nullptr
)
{
if
(
r
.
rest
==
nullptr
)
{
/* it's a directory */
if
(
selection
.
recursive
&&
visit_directory
)
...
...
@@ -311,9 +311,9 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
return
;
}
if
(
strchr
(
r
.
uri
,
'/'
)
==
nullptr
)
{
if
(
strchr
(
r
.
rest
,
'/'
)
==
nullptr
)
{
if
(
visit_song
)
{
Song
*
song
=
r
.
directory
->
FindSong
(
r
.
uri
);
Song
*
song
=
r
.
directory
->
FindSong
(
r
.
rest
);
if
(
song
!=
nullptr
)
{
const
LightSong
song2
=
song
->
Export
();
if
(
selection
.
Match
(
song2
))
...
...
@@ -402,15 +402,15 @@ SimpleDatabase::Mount(const char *uri, DatabasePtr db)
ScopeDatabaseLock
protect
;
auto
r
=
root
->
LookupDirectory
(
uri
);
if
(
r
.
uri
==
nullptr
)
if
(
r
.
rest
==
nullptr
)
throw
DatabaseError
(
DatabaseErrorCode
::
CONFLICT
,
"Already exists"
);
if
(
strchr
(
r
.
uri
,
'/'
)
!=
nullptr
)
if
(
strchr
(
r
.
rest
,
'/'
)
!=
nullptr
)
throw
DatabaseError
(
DatabaseErrorCode
::
NOT_FOUND
,
"Parent not found"
);
Directory
*
mnt
=
r
.
directory
->
CreateChild
(
r
.
uri
);
Directory
*
mnt
=
r
.
directory
->
CreateChild
(
r
.
rest
);
mnt
->
mounted_database
=
std
::
move
(
db
);
}
...
...
@@ -461,7 +461,7 @@ SimpleDatabase::LockUmountSteal(const char *uri) noexcept
ScopeDatabaseLock
protect
;
auto
r
=
root
->
LookupDirectory
(
uri
);
if
(
r
.
uri
!=
nullptr
||
!
r
.
directory
->
IsMount
())
if
(
r
.
rest
!=
nullptr
||
!
r
.
directory
->
IsMount
())
return
nullptr
;
auto
db
=
std
::
move
(
r
.
directory
->
mounted_database
);
...
...
src/db/update/Service.cxx
View file @
6c8eb3c7
...
...
@@ -192,17 +192,17 @@ UpdateService::Enqueue(const char *path, bool discard)
if
(
db2
==
nullptr
)
throw
std
::
runtime_error
(
"Cannot update this type of database"
);
if
(
lr
.
uri
==
nullptr
)
{
if
(
lr
.
rest
==
nullptr
)
{
storage2
=
storage
.
GetMount
(
path
);
path
=
""
;
}
else
{
assert
(
lr
.
uri
>
path
);
assert
(
lr
.
uri
<
path
+
strlen
(
path
));
assert
(
lr
.
uri
[
-
1
]
==
'/'
);
assert
(
lr
.
rest
>
path
);
assert
(
lr
.
rest
<
path
+
strlen
(
path
));
assert
(
lr
.
rest
[
-
1
]
==
'/'
);
const
std
::
string
mountpoint
(
path
,
lr
.
uri
-
1
);
const
std
::
string
mountpoint
(
path
,
lr
.
rest
-
1
);
storage2
=
storage
.
GetMount
(
mountpoint
.
c_str
());
path
=
lr
.
uri
;
path
=
lr
.
rest
;
}
}
else
{
/* use the "root" database/storage */
...
...
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