net/SocketAddress: add CastTo()

This commit is contained in:
Max Kellermann
2020-11-30 21:35:43 +01:00
committed by Max Kellermann
parent 32ce9ce919
commit 273771ffec
9 changed files with 46 additions and 36 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2019 Max Kellermann <max.kellermann@gmail.com>
* Copyright 2011-2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -85,7 +85,7 @@ ToString(SocketAddress address) noexcept
#ifdef HAVE_UN
if (address.GetFamily() == AF_LOCAL)
/* return path of local socket */
return LocalAddressToString(*(const sockaddr_un *)address.GetAddress(),
return LocalAddressToString(address.CastTo<struct sockaddr_un>(),
address.GetSize());
#endif