From 32ce9ce91946886cd0b443a3f4c1fc5f5ab07254 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 30 Nov 2020 21:30:39 +0100 Subject: [PATCH] net/IPv[46]Address: pass SocketAddress by value to Cast() --- src/net/IPv4Address.hxx | 2 +- src/net/IPv6Address.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/IPv4Address.hxx b/src/net/IPv4Address.hxx index b55204397..3f33529cf 100644 --- a/src/net/IPv4Address.hxx +++ b/src/net/IPv4Address.hxx @@ -170,7 +170,7 @@ public: * Return a downcasted reference to the address. This call is * only legal after verifying SocketAddress::GetFamily(). */ - static constexpr const IPv4Address &Cast(const SocketAddress &src) noexcept { + static constexpr const IPv4Address &Cast(const SocketAddress src) noexcept { /* this reinterpret_cast works because this class is just a wrapper for struct sockaddr_in */ return *(const IPv4Address *)(const void *)src.GetAddress(); diff --git a/src/net/IPv6Address.hxx b/src/net/IPv6Address.hxx index 3ef6f7319..8b53339f5 100644 --- a/src/net/IPv6Address.hxx +++ b/src/net/IPv6Address.hxx @@ -139,7 +139,7 @@ public: * Return a downcasted reference to the address. This call is * only legal after verifying SocketAddress::GetFamily(). */ - static constexpr const IPv6Address &Cast(const SocketAddress &src) noexcept { + static constexpr const IPv6Address &Cast(const SocketAddress src) noexcept { /* this reinterpret_cast works because this class is just a wrapper for struct sockaddr_in6 */ return *(const IPv6Address *)(const void *)src.GetAddress();