aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-07-21 10:39:50 +0200
committerMax Kellermann <max@duempel.org>2015-07-21 10:39:50 +0200
commit554888318af945a677f3e4a1bd8d3c4f4342786c (patch)
treec4d668203acc75fad9dd286a2e27601dc2321143 /src
parent49aaf98a7fbcc8a15fb4a461858db0f2bdd76676 (diff)
downloadmpd-554888318af945a677f3e4a1bd8d3c4f4342786c.tar.gz
mpd-554888318af945a677f3e4a1bd8d3c4f4342786c.tar.xz
mpd-554888318af945a677f3e4a1bd8d3c4f4342786c.zip
net/StaticSocketAddress: use SocketAddress::size_type
Diffstat (limited to '')
-rw-r--r--src/net/StaticSocketAddress.cxx2
-rw-r--r--src/net/StaticSocketAddress.hxx14
2 files changed, 10 insertions, 6 deletions
diff --git a/src/net/StaticSocketAddress.cxx b/src/net/StaticSocketAddress.cxx
index 15e8a9e44..d74df016c 100644
--- a/src/net/StaticSocketAddress.cxx
+++ b/src/net/StaticSocketAddress.cxx
@@ -44,7 +44,7 @@
StaticSocketAddress &
StaticSocketAddress::operator=(SocketAddress other)
{
- size = std::min(size_t(other.GetSize()), GetCapacity());
+ size = std::min(other.GetSize(), GetCapacity());
memcpy(&address, other.GetAddress(), size);
return *this;
}
diff --git a/src/net/StaticSocketAddress.hxx b/src/net/StaticSocketAddress.hxx
index ee0e18414..475c323e0 100644
--- a/src/net/StaticSocketAddress.hxx
+++ b/src/net/StaticSocketAddress.hxx
@@ -46,7 +46,11 @@
* An OO wrapper for struct sockaddr_storage.
*/
class StaticSocketAddress {
- size_t size;
+public:
+ typedef SocketAddress::size_type size_type;
+
+private:
+ size_type size;
struct sockaddr_storage address;
public:
@@ -74,17 +78,17 @@ public:
return reinterpret_cast<const struct sockaddr *>(&address);
}
- constexpr size_t GetCapacity() const {
+ constexpr size_type GetCapacity() const {
return sizeof(address);
}
- size_t GetSize() const {
+ size_type GetSize() const {
return size;
}
- void SetSize(size_t _size) {
+ void SetSize(size_type _size) {
assert(_size > 0);
- assert(_size <= sizeof(address));
+ assert(size_t(_size) <= sizeof(address));
size = _size;
}