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
46debfb8
Commit
46debfb8
authored
Jan 14, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp/Object: disallow copying, always move
Reduce bloat.
parent
9a4b572d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
8 deletions
+11
-8
UpnpDatabasePlugin.cxx
src/db/UpnpDatabasePlugin.cxx
+4
-5
Directory.cxx
src/db/upnp/Directory.cxx
+1
-1
Directory.hxx
src/db/upnp/Directory.hxx
+2
-2
Object.hxx
src/db/upnp/Object.hxx
+4
-0
No files found.
src/db/UpnpDatabasePlugin.cxx
View file @
46debfb8
...
...
@@ -488,7 +488,7 @@ UpnpDatabase::ReadNode(ContentDirectoryService *server,
return
false
;
if
(
dirbuf
.
objects
.
size
()
==
1
)
{
dirent
=
dirbuf
.
objects
[
0
]
;
dirent
=
std
::
move
(
dirbuf
.
objects
[
0
])
;
}
else
{
error
.
Format
(
upnp_domain
,
"Bad resource"
);
return
false
;
...
...
@@ -542,8 +542,7 @@ UpnpDatabase::Namei(ContentDirectoryService* server,
return
false
;
// Look for the name in the sub-container list
const
UPnPDirObject
*
child
=
dirbuf
.
FindObject
(
vpath
[
i
].
c_str
());
UPnPDirObject
*
child
=
dirbuf
.
FindObject
(
vpath
[
i
].
c_str
());
if
(
child
==
nullptr
)
break
;
...
...
@@ -558,7 +557,7 @@ UpnpDatabase::Namei(ContentDirectoryService* server,
// The last element in the path was found and it's
// a container, we're done
oobjid
=
objid
;
odirent
=
*
child
;
odirent
=
std
::
move
(
*
child
)
;
return
true
;
}
break
;
...
...
@@ -568,7 +567,7 @@ UpnpDatabase::Namei(ContentDirectoryService* server,
// else it does not exist
if
(
i
==
vpath
.
size
()
-
1
)
{
oobjid
=
objid
;
odirent
=
*
child
;
odirent
=
std
::
move
(
*
child
)
;
return
true
;
}
else
{
error
.
Format
(
db_domain
,
DB_NOT_FOUND
,
...
...
src/db/upnp/Directory.cxx
View file @
46debfb8
...
...
@@ -151,7 +151,7 @@ protected:
{
if
((
!
strcmp
(
name
,
"container"
)
||
!
strcmp
(
name
,
"item"
))
&&
checkobjok
())
m_dir
.
objects
.
push_back
(
m_tobj
);
m_dir
.
objects
.
push_back
(
std
::
move
(
m_tobj
)
);
m_path
.
pop_back
();
}
...
...
src/db/upnp/Directory.hxx
View file @
46debfb8
...
...
@@ -37,8 +37,8 @@ public:
std
::
vector
<
UPnPDirObject
>
objects
;
gcc_pure
const
UPnPDirObject
*
FindObject
(
const
char
*
name
)
const
{
for
(
const
auto
&
o
:
objects
)
UPnPDirObject
*
FindObject
(
const
char
*
name
)
{
for
(
auto
&
o
:
objects
)
if
(
o
.
name
==
name
)
return
&
o
;
...
...
src/db/upnp/Object.hxx
View file @
46debfb8
...
...
@@ -70,6 +70,10 @@ public:
*/
int
duration
;
UPnPDirObject
()
=
default
;
UPnPDirObject
(
UPnPDirObject
&&
)
=
default
;
UPnPDirObject
&
operator
=
(
UPnPDirObject
&&
)
=
default
;
/** Get named property
* @param property name (e.g. upnp:artist, upnp:album,
* upnp:originalTrackNumber, upnp:genre). Use m_title instead
...
...
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