diff options
author | Max Kellermann <max@musicpd.org> | 2017-06-03 21:33:44 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-06-04 12:46:48 +0200 |
commit | a057b4f6d88f7bfc1d9846e14de5617a4c281c0d (patch) | |
tree | 88c49e29042c500104827ac3d6e64bd447e1b4bf /src/net | |
parent | 62b03cfddf74c25d0b8187ce5e56d31ef49667b7 (diff) |
*: add lost of "noexcept" specifications
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/AllocatedSocketAddress.hxx | 24 | ||||
-rw-r--r-- | src/net/StaticSocketAddress.hxx | 22 |
2 files changed, 23 insertions, 23 deletions
diff --git a/src/net/AllocatedSocketAddress.hxx b/src/net/AllocatedSocketAddress.hxx index 15aafd7d1..6491fb9c0 100644 --- a/src/net/AllocatedSocketAddress.hxx +++ b/src/net/AllocatedSocketAddress.hxx @@ -76,47 +76,47 @@ public: AllocatedSocketAddress &operator=(const AllocatedSocketAddress &) = delete; - AllocatedSocketAddress &operator=(AllocatedSocketAddress &&src) { + AllocatedSocketAddress &operator=(AllocatedSocketAddress &&src) noexcept { std::swap(address, src.address); std::swap(size, src.size); return *this; } gcc_pure - bool operator==(SocketAddress other) const { + bool operator==(SocketAddress other) const noexcept { return (SocketAddress)*this == other; } - bool operator!=(SocketAddress &other) const { + bool operator!=(SocketAddress &other) const noexcept { return !(*this == other); } gcc_const - static AllocatedSocketAddress Null() { + static AllocatedSocketAddress Null() noexcept { return AllocatedSocketAddress(nullptr, 0); } - bool IsNull() const { + bool IsNull() const noexcept { return address == nullptr; } - size_type GetSize() const { + size_type GetSize() const noexcept { return size; } - const struct sockaddr *GetAddress() const { + const struct sockaddr *GetAddress() const noexcept { return address; } - operator SocketAddress() const { + operator SocketAddress() const noexcept { return SocketAddress(address, size); } - operator const struct sockaddr *() const { + operator const struct sockaddr *() const noexcept { return address; } - int GetFamily() const { + int GetFamily() const noexcept { return address->sa_family; } @@ -124,11 +124,11 @@ public: * Does the object have a well-defined address? Check !IsNull() * before calling this method. */ - bool IsDefined() const { + bool IsDefined() const noexcept { return GetFamily() != AF_UNSPEC; } - void Clear() { + void Clear() noexcept { free(address); address = nullptr; size = 0; diff --git a/src/net/StaticSocketAddress.hxx b/src/net/StaticSocketAddress.hxx index d2da90d2f..3b996ab88 100644 --- a/src/net/StaticSocketAddress.hxx +++ b/src/net/StaticSocketAddress.hxx @@ -51,52 +51,52 @@ public: StaticSocketAddress &operator=(SocketAddress other) noexcept; - operator SocketAddress() const { + operator SocketAddress() const noexcept { return SocketAddress(reinterpret_cast<const struct sockaddr *>(&address), size); } - struct sockaddr *GetAddress() { + struct sockaddr *GetAddress() noexcept { return reinterpret_cast<struct sockaddr *>(&address); } - const struct sockaddr *GetAddress() const { + const struct sockaddr *GetAddress() const noexcept { return reinterpret_cast<const struct sockaddr *>(&address); } - constexpr size_type GetCapacity() const { + constexpr size_type GetCapacity() const noexcept { return sizeof(address); } - size_type GetSize() const { + size_type GetSize() const noexcept { return size; } - void SetSize(size_type _size) { + void SetSize(size_type _size) noexcept { assert(_size > 0); assert(size_t(_size) <= sizeof(address)); size = _size; } - int GetFamily() const { + int GetFamily() const noexcept { return address.ss_family; } - bool IsDefined() const { + bool IsDefined() const noexcept { return GetFamily() != AF_UNSPEC; } - void Clear() { + void Clear() noexcept { address.ss_family = AF_UNSPEC; } gcc_pure - bool operator==(SocketAddress other) const { + bool operator==(SocketAddress other) const noexcept { return (SocketAddress)*this == other; } - bool operator!=(SocketAddress &other) const { + bool operator!=(SocketAddress &other) const noexcept { return !(*this == other); } }; |