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
791d6c13
Commit
791d6c13
authored
Jan 10, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp/Directory: eliminate struct StackEl, use std::string
Reduces bloat.
parent
10abb079
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
Directory.cxx
src/db/upnp/Directory.cxx
+6
-11
No files found.
src/db/upnp/Directory.cxx
View file @
791d6c13
...
...
@@ -53,12 +53,7 @@ ParseItemClass(const char *name)
* An XML parser which builds directory contents from DIDL lite input.
*/
class
UPnPDirParser
final
:
public
CommonExpatParser
{
struct
StackEl
{
StackEl
(
const
std
::
string
&
nm
)
:
name
(
nm
)
{}
std
::
string
name
;
};
std
::
vector
<
StackEl
>
m_path
;
std
::
vector
<
std
::
string
>
m_path
;
UPnPDirObject
m_tobj
;
public
:
...
...
@@ -71,7 +66,7 @@ public:
protected
:
virtual
void
StartElement
(
const
XML_Char
*
name
,
const
XML_Char
**
attrs
)
{
m_path
.
push_back
(
StackEl
(
name
)
);
m_path
.
push_back
(
name
);
std
::
map
<
std
::
string
,
std
::
string
>
attributes
;
for
(
int
i
=
0
;
attrs
[
i
]
!=
0
;
i
+=
2
)
...
...
@@ -161,19 +156,19 @@ protected:
return
;
std
::
string
str
(
s
,
len
);
trimstring
(
str
);
switch
(
m_path
.
back
()
.
name
[
0
])
{
switch
(
m_path
.
back
()[
0
])
{
case
'd'
:
if
(
!
m_path
.
back
().
name
.
compare
(
"dc:title"
))
if
(
!
m_path
.
back
().
compare
(
"dc:title"
))
m_tobj
.
m_title
+=
str
;
break
;
case
'r'
:
if
(
!
m_path
.
back
().
name
.
compare
(
"res"
))
{
if
(
!
m_path
.
back
().
compare
(
"res"
))
{
m_tobj
.
m_props
[
"url"
]
+=
str
;
}
break
;
case
'u'
:
for
(
int
i
=
0
;
i
<
nupnptags
;
i
++
)
{
if
(
!
m_path
.
back
().
name
.
compare
(
upnptags
[
i
]))
{
if
(
!
m_path
.
back
().
compare
(
upnptags
[
i
]))
{
m_tobj
.
m_props
[
upnptags
[
i
]]
+=
str
;
}
}
...
...
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