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
9a4b572d
Commit
9a4b572d
authored
Jan 14, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp: getTagValue() returns string pointer
Reduce bloat.
parent
ddc75cc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
19 deletions
+13
-19
UpnpDatabasePlugin.cxx
src/db/UpnpDatabasePlugin.cxx
+13
-19
No files found.
src/db/UpnpDatabasePlugin.cxx
View file @
9a4b572d
...
...
@@ -280,28 +280,22 @@ UpnpDatabase::GetSong(const char *uri, Error &error) const
/**
* Retrieve the value for an MPD tag from an object entry.
*/
static
bool
getTagValue
(
const
UPnPDirObject
&
dirent
,
TagType
tag
,
std
::
string
&
tagvalue
)
gcc_pure
static
const
char
*
getTagValue
(
const
UPnPDirObject
&
dirent
,
TagType
tag
)
{
if
(
tag
==
TAG_TITLE
)
{
if
(
!
dirent
.
m_title
.
empty
())
{
tagvalue
=
dirent
.
m_title
;
return
true
;
}
return
false
;
if
(
!
dirent
.
m_title
.
empty
())
return
dirent
.
m_title
.
c_str
();
return
nullptr
;
}
const
char
*
name
=
tag_table_lookup
(
upnp_tags
,
tag
);
if
(
name
==
nullptr
)
return
false
;
const
char
*
value
=
dirent
.
getprop
(
name
);
if
(
value
==
nullptr
)
return
false
;
return
nullptr
;
tagvalue
=
value
;
return
true
;
return
dirent
.
getprop
(
name
);
}
/**
...
...
@@ -818,12 +812,12 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
dirent
.
item_class
!=
UPnPDirObject
::
ItemClass
::
MUSIC
)
continue
;
std
::
string
tagvalue
;
if
(
getTagValue
(
dirent
,
tag
,
tagvalue
)
)
{
const
char
*
value
=
getTagValue
(
dirent
,
tag
)
;
if
(
value
!=
nullptr
)
{
#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
values
.
emplace
(
std
::
move
(
tagvalue
)
);
values
.
emplace
(
value
);
#else
values
.
insert
(
std
::
move
(
tagvalue
)
);
values
.
insert
(
value
);
#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