From 22dd3c8048a408a5c045164c439bb2f94b062fa3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 18 Jan 2014 13:47:12 +0100 Subject: db/upnp/Device: move code to method Parse() Forward the Error to the caller. --- src/db/upnp/Device.cxx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/db/upnp/Device.cxx') diff --git a/src/db/upnp/Device.cxx b/src/db/upnp/Device.cxx index b5174236b..413d6ac99 100644 --- a/src/db/upnp/Device.cxx +++ b/src/db/upnp/Device.cxx @@ -21,7 +21,6 @@ #include "Device.hxx" #include "Util.hxx" #include "Expat.hxx" -#include "Log.hxx" #include "util/Error.hxx" #include @@ -99,16 +98,15 @@ protected: } }; -UPnPDevice::UPnPDevice(const std::string &url, const char *description) - :ok(false) +bool +UPnPDevice::Parse(const std::string &url, const char *description, + Error &error) { - UPnPDeviceParser mparser(*this); - Error error; - if (!mparser.Parse(description, strlen(description), true, - error)) { - // TODO: pass Error to caller - LogError(error); - return; + { + UPnPDeviceParser mparser(*this); + if (!mparser.Parse(description, strlen(description), + true, error)) + return false; } if (URLBase.empty()) { @@ -129,5 +127,6 @@ UPnPDevice::UPnPDevice(const std::string &url, const char *description) } } } - ok = true; + + return true; } -- cgit v1.2.3