db/upnp/Discovery: don't copy XML to std::string

Pass "const char *" to Expat.
This commit is contained in:
Max Kellermann
2014-01-18 14:24:38 +01:00
parent 339d939873
commit be0759d465
3 changed files with 4 additions and 4 deletions

View File

@@ -99,12 +99,12 @@ protected:
} }
}; };
UPnPDevice::UPnPDevice(const std::string &url, const std::string &description) UPnPDevice::UPnPDevice(const std::string &url, const char *description)
:ok(false) :ok(false)
{ {
UPnPDeviceParser mparser(*this); UPnPDeviceParser mparser(*this);
Error error; Error error;
if (!mparser.Parse(description.data(), description.length(), true, if (!mparser.Parse(description, strlen(description), true,
error)) { error)) {
// TODO: pass Error to caller // TODO: pass Error to caller
LogError(error); LogError(error);

View File

@@ -82,7 +82,7 @@ public:
* @param url where the description came from * @param url where the description came from
* @param description the xml device description * @param description the xml device description
*/ */
UPnPDevice(const std::string &url, const std::string &description); UPnPDevice(const std::string &url, const char *description);
UPnPDevice() : ok(false) {} UPnPDevice() : ok(false) {}
}; };

View File

@@ -66,7 +66,7 @@ class UPnPDeviceDirectory {
class ContentDirectoryDescriptor { class ContentDirectoryDescriptor {
public: public:
ContentDirectoryDescriptor(const std::string &url, ContentDirectoryDescriptor(const std::string &url,
const std::string &description, const char *description,
time_t last, int exp) time_t last, int exp)
:device(url, description), last_seen(last), expires(exp+20) {} :device(url, description), last_seen(last), expires(exp+20) {}
UPnPDevice device; UPnPDevice device;