File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111#endif
1212
1313#ifdef _WIN32
14- #include < string.h> // for memcpy()
1514#include < winsock2.h>
1615#include < ws2tcpip.h>
1716#else
1817#include < arpa/inet.h>
1918#include < netinet/in.h>
2019#endif
2120
21+ #ifndef __linux__
22+ #include < string.h> // for memcpy()
23+ #endif
24+
2225BareInetAddress::BareInetAddress (const IPv4Address &src) noexcept
2326{
2427 array[0 ] = 0 ;
@@ -33,16 +36,15 @@ BareInetAddress::BareInetAddress(const IPv6Address &_src) noexcept
3336{
3437 const auto &src = _src.GetAddress ();
3538 static_assert (sizeof (array) == sizeof (src));
36- static_assert (sizeof (array) == sizeof (src.s6_addr ));
3739
38- #ifdef _WIN32
39- /* Windows doesn't have s6_addr32 */
40- memcpy (array, &src, sizeof (array));
41- #else
40+ #ifdef __linux__
4241 array[0 ] = src.s6_addr32 [0 ];
4342 array[1 ] = src.s6_addr32 [1 ];
4443 array[2 ] = src.s6_addr32 [2 ];
4544 array[3 ] = src.s6_addr32 [3 ];
45+ #else
46+ /* s6_addr32 is Linux-only */
47+ memcpy (array, &src, sizeof (array));
4648#endif
4749}
4850
You can’t perform that action at this time.
0 commit comments