--- a/upmpd/upmpdutils.cxx
+++ b/upmpd/upmpdutils.cxx
@@ -42,6 +42,7 @@
#include "mpdcli.hxx"
#include "upmpdutils.hxx"
#include "libupnpp/log.hxx"
+#include "libupnpp/soaphelp.hxx"
// Append system error string to input string
void catstrerror(string *reason, const char *what, int _errno)
@@ -210,22 +211,6 @@
}
}
-string xmlquote(const string& in)
-{
- string out;
- for (unsigned int i = 0; i < in.size(); i++) {
- switch(in[i]) {
- case '"': out += """;break;
- case '&': out += "&";break;
- case '<': out += "<";break;
- case '>': out += ">";break;
- case '\'': out += "'";break;
- default: out += in[i];
- }
- }
- return out;
-}
-
// Translate 0-100% MPD volume to UPnP VolumeDB: we do db upnp-encoded
// values from -10240 (0%) to 0 (100%)
int percentodbvalue(int value)
@@ -324,7 +309,7 @@
<< "<item restricted=\"1\">";
{ const string& val = song.title;
- ss << "<dc:title>" << xmlquote(val) << "</dc:title>";
+ ss << "<dc:title>" << SoapArgs::xmlQuote(val) << "</dc:title>";
}
// TBD Playlists etc?
@@ -332,7 +317,7 @@
{ const string& val = song.artist;
if (!val.empty()) {
- string a = xmlquote(val);
+ string a = SoapArgs::xmlQuote(val);
ss << "<dc:creator>" << a << "</dc:creator>" <<
"<upnp:artist>" << a << "</upnp:artist>";
}
@@ -340,13 +325,13 @@
{ const string& val = song.album;
if (!val.empty()) {
- ss << "<upnp:album>" << xmlquote(val) << "</upnp:album>";
+ ss << "<upnp:album>" << SoapArgs::xmlQuote(val) << "</upnp:album>";
}
}
{ const string& val = song.genre;
if (!val.empty()) {
- ss << "<upnp:genre>" << xmlquote(val) << "</upnp:genre>";
+ ss << "<upnp:genre>" << SoapArgs::xmlQuote(val) << "</upnp:genre>";
}
}
@@ -370,7 +355,7 @@
<< "sampleFrequency=\"44100\" audioChannels=\"2\" "
<< "protocolInfo=\"http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000\""
<< ">"
- << xmlquote(song.uri)
+ << SoapArgs::xmlQuote(song.uri)
<< "</res>"
<< "</item></DIDL-Lite>";
return ss.str();