lib/upnp: add "noexcept"
This commit is contained in:
parent
fb01e41e8a
commit
4b2bb88375
@ -19,7 +19,7 @@
|
||||
|
||||
#include "Object.hxx"
|
||||
|
||||
UPnPDirObject::~UPnPDirObject()
|
||||
UPnPDirObject::~UPnPDirObject() noexcept
|
||||
{
|
||||
/* this destructor exists here just so it won't get inlined */
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
UPnPDirObject() = default;
|
||||
UPnPDirObject(UPnPDirObject &&) = default;
|
||||
|
||||
~UPnPDirObject();
|
||||
~UPnPDirObject() noexcept;
|
||||
|
||||
UPnPDirObject &operator=(UPnPDirObject &&) = default;
|
||||
|
||||
|
@ -41,7 +41,7 @@ class CurlSlist {
|
||||
struct curl_slist *head = nullptr;
|
||||
|
||||
public:
|
||||
CurlSlist() noexcept = default;
|
||||
CurlSlist() = default;
|
||||
|
||||
CurlSlist(CurlSlist &&src) noexcept
|
||||
:head(std::exchange(src.head, nullptr)) {}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <upnp/upnptools.h>
|
||||
|
||||
static inline constexpr unsigned
|
||||
CountNameValuePairs()
|
||||
CountNameValuePairs() noexcept
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -33,7 +33,7 @@ CountNameValuePairs()
|
||||
template<typename... Args>
|
||||
static inline constexpr unsigned
|
||||
CountNameValuePairs(gcc_unused const char *name, gcc_unused const char *value,
|
||||
Args... args)
|
||||
Args... args) noexcept
|
||||
{
|
||||
return 1 + CountNameValuePairs(args...);
|
||||
}
|
||||
@ -45,7 +45,7 @@ CountNameValuePairs(gcc_unused const char *name, gcc_unused const char *value,
|
||||
template<typename... Args>
|
||||
static inline IXML_Document *
|
||||
MakeActionHelper(const char *action_name, const char *service_type,
|
||||
Args... args)
|
||||
Args... args) noexcept
|
||||
{
|
||||
const unsigned n = CountNameValuePairs(args...);
|
||||
return UpnpMakeAction(action_name, service_type, n,
|
||||
|
@ -32,15 +32,15 @@ public:
|
||||
* Pass this value as "cookie" pointer to libupnp asynchronous
|
||||
* functions.
|
||||
*/
|
||||
void *GetUpnpCookie() {
|
||||
void *GetUpnpCookie() noexcept {
|
||||
return this;
|
||||
}
|
||||
|
||||
static UpnpCallback &FromUpnpCookie(void *cookie) {
|
||||
static UpnpCallback &FromUpnpCookie(void *cookie) noexcept {
|
||||
return *(UpnpCallback *)cookie;
|
||||
}
|
||||
|
||||
virtual int Invoke(Upnp_EventType et, void *evp) = 0;
|
||||
virtual int Invoke(Upnp_EventType et, void *evp) noexcept = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@ static unsigned upnp_client_ref;
|
||||
static UpnpClient_Handle upnp_client_handle;
|
||||
|
||||
static int
|
||||
UpnpClientCallback(Upnp_EventType et, void *evp, void *cookie)
|
||||
UpnpClientCallback(Upnp_EventType et, void *evp, void *cookie) noexcept
|
||||
{
|
||||
if (cookie == nullptr)
|
||||
/* this is the cookie passed to UpnpRegisterClient();
|
||||
@ -74,7 +74,7 @@ UpnpClientGlobalInit(UpnpClient_Handle &handle)
|
||||
}
|
||||
|
||||
void
|
||||
UpnpClientGlobalFinish()
|
||||
UpnpClientGlobalFinish() noexcept
|
||||
{
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(upnp_client_init_mutex);
|
||||
|
@ -28,6 +28,6 @@ void
|
||||
UpnpClientGlobalInit(UpnpClient_Handle &handle);
|
||||
|
||||
void
|
||||
UpnpClientGlobalFinish();
|
||||
UpnpClientGlobalFinish() noexcept;
|
||||
|
||||
#endif
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device,
|
||||
const UPnPService &service)
|
||||
const UPnPService &service) noexcept
|
||||
:m_actionURL(uri_apply_base(service.controlURL, device.URLBase)),
|
||||
m_serviceType(service.serviceType),
|
||||
m_deviceId(device.UDN),
|
||||
@ -44,7 +44,7 @@ ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device,
|
||||
}
|
||||
}
|
||||
|
||||
ContentDirectoryService::~ContentDirectoryService()
|
||||
ContentDirectoryService::~ContentDirectoryService() noexcept
|
||||
{
|
||||
/* this destructor exists here just so it won't get inlined */
|
||||
}
|
||||
|
@ -65,12 +65,12 @@ public:
|
||||
* UPnPDeviceDirectory::GetDirectories()
|
||||
*/
|
||||
ContentDirectoryService(const UPnPDevice &device,
|
||||
const UPnPService &service);
|
||||
const UPnPService &service) noexcept;
|
||||
|
||||
/** An empty one */
|
||||
ContentDirectoryService() = default;
|
||||
|
||||
~ContentDirectoryService();
|
||||
~ContentDirectoryService() noexcept;
|
||||
|
||||
/** Read a container's children list into dirbuf.
|
||||
*
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
UPnPDevice::~UPnPDevice()
|
||||
UPnPDevice::~UPnPDevice() noexcept
|
||||
{
|
||||
/* this destructor exists here just so it won't get inlined */
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
UPnPDevice(UPnPDevice &&) = default;
|
||||
UPnPDevice &operator=(UPnPDevice &&) = default;
|
||||
|
||||
~UPnPDevice();
|
||||
~UPnPDevice() noexcept;
|
||||
|
||||
/** Build device from xml description downloaded from discovery
|
||||
* @param url where the description came from
|
||||
|
@ -45,7 +45,7 @@ UPnPDeviceDirectory::Downloader::Downloader(UPnPDeviceDirectory &_parent,
|
||||
}
|
||||
|
||||
void
|
||||
UPnPDeviceDirectory::Downloader::Destroy()
|
||||
UPnPDeviceDirectory::Downloader::Destroy() noexcept
|
||||
{
|
||||
parent.downloaders.erase_and_dispose(parent.downloaders.iterator_to(*this),
|
||||
DeleteDisposer());
|
||||
@ -170,7 +170,7 @@ UPnPDeviceDirectory::LockRemove(const std::string &id)
|
||||
}
|
||||
|
||||
inline int
|
||||
UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco)
|
||||
UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco) noexcept
|
||||
{
|
||||
if (isMSDevice(disco->DeviceType) ||
|
||||
isCDService(disco->ServiceType)) {
|
||||
@ -192,7 +192,7 @@ UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco)
|
||||
}
|
||||
|
||||
inline int
|
||||
UPnPDeviceDirectory::OnByeBye(Upnp_Discovery *disco)
|
||||
UPnPDeviceDirectory::OnByeBye(Upnp_Discovery *disco) noexcept
|
||||
{
|
||||
if (isMSDevice(disco->DeviceType) ||
|
||||
isCDService(disco->ServiceType)) {
|
||||
@ -208,7 +208,7 @@ UPnPDeviceDirectory::OnByeBye(Upnp_Discovery *disco)
|
||||
// Example: ContentDirectories appearing and disappearing from the network
|
||||
// We queue a task for our worker thread(s)
|
||||
int
|
||||
UPnPDeviceDirectory::Invoke(Upnp_EventType et, void *evp)
|
||||
UPnPDeviceDirectory::Invoke(Upnp_EventType et, void *evp) noexcept
|
||||
{
|
||||
switch (et) {
|
||||
case UPNP_DISCOVERY_SEARCH_RESULT:
|
||||
@ -251,13 +251,13 @@ UPnPDeviceDirectory::ExpireDevices()
|
||||
|
||||
UPnPDeviceDirectory::UPnPDeviceDirectory(EventLoop &event_loop,
|
||||
UpnpClient_Handle _handle,
|
||||
UPnPDiscoveryListener *_listener)
|
||||
UPnPDiscoveryListener *_listener) noexcept
|
||||
:curl(event_loop), handle(_handle),
|
||||
listener(_listener)
|
||||
{
|
||||
}
|
||||
|
||||
UPnPDeviceDirectory::~UPnPDeviceDirectory()
|
||||
UPnPDeviceDirectory::~UPnPDeviceDirectory() noexcept
|
||||
{
|
||||
BlockingCall(GetEventLoop(), [this](){
|
||||
downloaders.clear_and_dispose(DeleteDisposer());
|
||||
@ -265,7 +265,7 @@ UPnPDeviceDirectory::~UPnPDeviceDirectory()
|
||||
}
|
||||
|
||||
inline EventLoop &
|
||||
UPnPDeviceDirectory::GetEventLoop()
|
||||
UPnPDeviceDirectory::GetEventLoop() noexcept
|
||||
{
|
||||
return curl->GetEventLoop();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class UPnPDeviceDirectory final : UpnpCallback {
|
||||
|
||||
ContentDirectoryDescriptor(std::string &&_id,
|
||||
std::chrono::steady_clock::time_point last,
|
||||
std::chrono::steady_clock::duration exp)
|
||||
std::chrono::steady_clock::duration exp) noexcept
|
||||
:id(std::move(_id)),
|
||||
expires(last + exp + std::chrono::seconds(20)) {}
|
||||
|
||||
@ -102,14 +102,14 @@ class UPnPDeviceDirectory final : UpnpCallback {
|
||||
Downloader(UPnPDeviceDirectory &_parent,
|
||||
const Upnp_Discovery &disco);
|
||||
|
||||
void Start() {
|
||||
void Start() noexcept {
|
||||
defer_start_event.Schedule();
|
||||
}
|
||||
|
||||
void Destroy();
|
||||
void Destroy() noexcept;
|
||||
|
||||
private:
|
||||
void OnDeferredStart() {
|
||||
void OnDeferredStart() noexcept {
|
||||
request.Start();
|
||||
}
|
||||
|
||||
@ -147,13 +147,13 @@ class UPnPDeviceDirectory final : UpnpCallback {
|
||||
|
||||
public:
|
||||
UPnPDeviceDirectory(EventLoop &event_loop, UpnpClient_Handle _handle,
|
||||
UPnPDiscoveryListener *_listener=nullptr);
|
||||
~UPnPDeviceDirectory();
|
||||
UPnPDiscoveryListener *_listener=nullptr) noexcept;
|
||||
~UPnPDeviceDirectory() noexcept;
|
||||
|
||||
UPnPDeviceDirectory(const UPnPDeviceDirectory &) = delete;
|
||||
UPnPDeviceDirectory& operator=(const UPnPDeviceDirectory &) = delete;
|
||||
|
||||
EventLoop &GetEventLoop();
|
||||
EventLoop &GetEventLoop() noexcept;
|
||||
|
||||
void Start();
|
||||
|
||||
@ -180,11 +180,11 @@ private:
|
||||
void LockAdd(ContentDirectoryDescriptor &&d);
|
||||
void LockRemove(const std::string &id);
|
||||
|
||||
int OnAlive(Upnp_Discovery *disco);
|
||||
int OnByeBye(Upnp_Discovery *disco);
|
||||
int OnAlive(Upnp_Discovery *disco) noexcept;
|
||||
int OnByeBye(Upnp_Discovery *disco) noexcept;
|
||||
|
||||
/* virtual methods from class UpnpCallback */
|
||||
virtual int Invoke(Upnp_EventType et, void *evp) override;
|
||||
int Invoke(Upnp_EventType et, void *evp) noexcept override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ UpnpGlobalInit()
|
||||
}
|
||||
|
||||
void
|
||||
UpnpGlobalFinish()
|
||||
UpnpGlobalFinish() noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(upnp_init_mutex);
|
||||
|
||||
|
@ -26,6 +26,6 @@ void
|
||||
UpnpGlobalInit();
|
||||
|
||||
void
|
||||
UpnpGlobalFinish();
|
||||
UpnpGlobalFinish() noexcept;
|
||||
|
||||
#endif
|
||||
|
@ -25,11 +25,11 @@
|
||||
#include <memory>
|
||||
|
||||
struct UpnpIxmlDeleter {
|
||||
void operator()(IXML_Document *doc) {
|
||||
void operator()(IXML_Document *doc) noexcept {
|
||||
ixmlDocument_free(doc);
|
||||
}
|
||||
|
||||
void operator()(IXML_NodeList *nl) {
|
||||
void operator()(IXML_NodeList *nl) noexcept {
|
||||
ixmlNodeList_free(nl);
|
||||
}
|
||||
};
|
||||
|
@ -21,7 +21,7 @@
|
||||
namespace ixmlwrap {
|
||||
|
||||
const char *
|
||||
getFirstElementValue(IXML_Document *doc, const char *name)
|
||||
getFirstElementValue(IXML_Document *doc, const char *name) noexcept
|
||||
{
|
||||
UniqueIxmlNodeList nodes(ixmlDocument_getElementsByTagName(doc, name));
|
||||
if (!nodes)
|
||||
|
@ -28,7 +28,7 @@ namespace ixmlwrap {
|
||||
* contain a text node
|
||||
*/
|
||||
const char *getFirstElementValue(IXML_Document *doc,
|
||||
const char *name);
|
||||
const char *name) noexcept;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user