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
02f21710
Commit
02f21710
authored
Jan 22, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp/Util: pass char* to csvToStrings()
parent
a5e7d0a9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
ContentDirectoryService.cxx
src/db/upnp/ContentDirectoryService.cxx
+1
-1
Util.cxx
src/db/upnp/Util.cxx
+9
-6
Util.hxx
src/db/upnp/Util.hxx
+2
-1
No files found.
src/db/upnp/ContentDirectoryService.cxx
View file @
02f21710
...
...
@@ -249,7 +249,7 @@ ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl,
if
(
!
tbuf
.
compare
(
"*"
))
{
result
.
insert
(
result
.
end
(),
"*"
);
}
else
if
(
!
tbuf
.
empty
())
{
if
(
!
csvToStrings
(
tbuf
,
result
))
{
if
(
!
csvToStrings
(
tbuf
.
c_str
()
,
result
))
{
error
.
Set
(
upnp_domain
,
"Bad response"
);
return
false
;
}
...
...
src/db/upnp/Util.cxx
View file @
02f21710
...
...
@@ -139,14 +139,17 @@ stringToTokens(const std::string &str,
template
<
class
T
>
bool
csvToStrings
(
const
std
::
string
&
s
,
T
&
tokens
)
csvToStrings
(
const
char
*
s
,
T
&
tokens
)
{
std
::
string
current
;
tokens
.
clear
();
enum
states
{
TOKEN
,
ESCAPE
};
states
state
=
TOKEN
;
for
(
unsigned
int
i
=
0
;
i
<
s
.
length
();
i
++
)
{
switch
(
s
[
i
])
{
while
(
*
s
!=
0
)
{
const
char
ch
=
*
s
++
;
switch
(
ch
)
{
case
','
:
switch
(
state
)
{
case
TOKEN
:
...
...
@@ -179,7 +182,7 @@ csvToStrings(const std::string &s, T &tokens)
case
TOKEN
:
break
;
}
current
+=
s
[
i
]
;
current
+=
ch
;
}
}
switch
(
state
)
{
...
...
@@ -193,5 +196,5 @@ csvToStrings(const std::string &s, T &tokens)
}
//template bool csvToStrings<list<string> >(const string &, list<string> &);
template
bool
csvToStrings
<
std
::
vector
<
std
::
string
>
>
(
const
std
::
string
&
,
std
::
vector
<
std
::
string
>
&
);
template
bool
csvToStrings
<
std
::
set
<
std
::
string
>
>
(
const
std
::
string
&
,
std
::
set
<
std
::
string
>
&
);
template
bool
csvToStrings
<
std
::
vector
<
std
::
string
>
>
(
const
char
*
,
std
::
vector
<
std
::
string
>
&
);
template
bool
csvToStrings
<
std
::
set
<
std
::
string
>
>
(
const
char
*
,
std
::
set
<
std
::
string
>
&
);
src/db/upnp/Util.hxx
View file @
02f21710
...
...
@@ -40,6 +40,7 @@ stringToTokens(const std::string &str,
const
char
*
delims
=
"/"
,
bool
skipinit
=
true
);
template
<
class
T
>
bool
csvToStrings
(
const
std
::
string
&
s
,
T
&
tokens
);
bool
csvToStrings
(
const
char
*
s
,
T
&
tokens
);
#endif
/* _UPNPP_H_X_INCLUDED_ */
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