|
a/libupnpp/device.cxx |
|
b/libupnpp/device.cxx |
|
... |
|
... |
27 |
#include "device.hxx"
|
27 |
#include "device.hxx"
|
28 |
#include "log.hxx"
|
28 |
#include "log.hxx"
|
29 |
|
29 |
|
30 |
unordered_map<std::string, UpnpDevice *> UpnpDevice::o_devices;
|
30 |
unordered_map<std::string, UpnpDevice *> UpnpDevice::o_devices;
|
31 |
|
31 |
|
32 |
static string xmlquote(const string& in)
|
|
|
33 |
{
|
|
|
34 |
string out;
|
|
|
35 |
for (unsigned int i = 0; i < in.size(); i++) {
|
|
|
36 |
switch(in[i]) {
|
|
|
37 |
case '"': out += """;break;
|
|
|
38 |
case '&': out += "&";break;
|
|
|
39 |
case '<': out += "<";break;
|
|
|
40 |
case '>': out += ">";break;
|
|
|
41 |
case '\'': out += "'";break;
|
|
|
42 |
default: out += in[i];
|
|
|
43 |
}
|
|
|
44 |
}
|
|
|
45 |
return out;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
static bool vectorstoargslists(const vector<string>& names,
|
32 |
static bool vectorstoargslists(const vector<string>& names,
|
49 |
const vector<string>& values,
|
33 |
const vector<string>& values,
|
50 |
vector<string>& qvalues,
|
34 |
vector<string>& qvalues,
|
51 |
vector<const char *>& cnames,
|
35 |
vector<const char *>& cnames,
|
52 |
vector<const char *>& cvalues)
|
36 |
vector<const char *>& cvalues)
|
|
... |
|
... |
60 |
qvalues.clear();
|
44 |
qvalues.clear();
|
61 |
qvalues.reserve(values.size());
|
45 |
qvalues.reserve(values.size());
|
62 |
cvalues.reserve(values.size());
|
46 |
cvalues.reserve(values.size());
|
63 |
for (unsigned int i = 0; i < values.size(); i++) {
|
47 |
for (unsigned int i = 0; i < values.size(); i++) {
|
64 |
cnames.push_back(names[i].c_str());
|
48 |
cnames.push_back(names[i].c_str());
|
65 |
qvalues.push_back(xmlquote(values[i]));
|
49 |
qvalues.push_back(SoapArgs::xmlQuote(values[i]));
|
66 |
cvalues.push_back(qvalues[i].c_str());
|
50 |
cvalues.push_back(qvalues[i].c_str());
|
67 |
//LOGDEB("Edata: " << cnames[i] << " -> " << cvalues[i] << endl);
|
51 |
//LOGDEB("Edata: " << cnames[i] << " -> " << cvalues[i] << endl);
|
68 |
}
|
52 |
}
|
69 |
return true;
|
53 |
return true;
|
70 |
}
|
54 |
}
|