net/IPv[46]Address: pass SocketAddress by value to Cast()

This commit is contained in:
Max Kellermann 2020-11-30 21:30:39 +01:00 committed by Max Kellermann
parent 34a070f5a6
commit 32ce9ce919
2 changed files with 2 additions and 2 deletions

View File

@ -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();

View File

@ -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();