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
aa1eb2f4
Commit
aa1eb2f4
authored
Jan 21, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp: use iterator in Namei()
parent
7260d788
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
UpnpDatabasePlugin.cxx
src/db/UpnpDatabasePlugin.cxx
+5
-4
No files found.
src/db/UpnpDatabasePlugin.cxx
View file @
aa1eb2f4
...
...
@@ -480,13 +480,14 @@ UpnpDatabase::Namei(ContentDirectoryService &server,
std
::
string
objid
(
rootid
);
// Walk the path elements, read each directory and try to find the next one
for
(
unsigned
int
i
=
0
;
i
<
vpath
.
size
();
i
++
)
{
for
(
auto
i
=
vpath
.
begin
(),
end
=
vpath
.
end
(),
last
=
std
::
prev
(
end
);
i
!=
end
;
++
i
)
{
UPnPDirContent
dirbuf
;
if
(
!
server
.
readDir
(
handle
,
objid
.
c_str
(),
dirbuf
,
error
))
return
false
;
// Look for the name in the sub-container list
UPnPDirObject
*
child
=
dirbuf
.
FindObject
(
vpath
[
i
].
c_str
());
UPnPDirObject
*
child
=
dirbuf
.
FindObject
(
i
->
c_str
());
if
(
child
==
nullptr
)
break
;
...
...
@@ -497,7 +498,7 @@ UpnpDatabase::Namei(ContentDirectoryService &server,
case
UPnPDirObject
:
:
Type
::
CONTAINER
:
objid
=
child
->
m_id
;
// Next readdir target
if
(
i
==
vpath
.
size
()
-
1
)
{
if
(
i
==
last
)
{
// The last element in the path was found and it's
// a container, we're done
odirent
=
std
::
move
(
*
child
);
...
...
@@ -508,7 +509,7 @@ UpnpDatabase::Namei(ContentDirectoryService &server,
case
UPnPDirObject
:
:
Type
::
ITEM
:
// If this is the last path elt, we found the target,
// else it does not exist
if
(
i
==
vpath
.
size
()
-
1
)
{
if
(
i
==
last
)
{
odirent
=
std
::
move
(
*
child
);
return
true
;
}
else
{
...
...
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