diff --git a/NEWS b/NEWS index 33042d8a7..df4904e15 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ ver 0.21.1 (not yet released) * decoder - ffmpeg: fix build failure with non-standard FFmpeg installation path * fix build failure on Linux-PowerPC +* fix build failure on FreeBSD ver 0.21 (2018/10/31) * configuration diff --git a/src/net/IPv4Address.hxx b/src/net/IPv4Address.hxx index e57bdf4cf..d8be8e59d 100644 --- a/src/net/IPv4Address.hxx +++ b/src/net/IPv4Address.hxx @@ -53,20 +53,6 @@ class IPv4Address { uint8_t c, uint8_t d) noexcept { return {{{ a, b, c, d }}}; } - - /** - * @param x the 32 bit IP address in network byte order - */ - static constexpr struct in_addr ConstructInAddrBE(uint32_t x) noexcept { - return (struct in_addr){{.S_addr=x}}; - } - - /** - * @param x the 32 bit IP address in host byte order - */ - static constexpr struct in_addr ConstructInAddr(uint32_t x) noexcept { - return ConstructInAddr(x >> 24, x >> 16, x >> 8, x); - } #else #ifdef __BIONIC__ @@ -78,11 +64,19 @@ class IPv4Address { return ToBE32((a << 24) | (b << 16) | (c << 8) | d); } + static constexpr struct in_addr ConstructInAddr(uint8_t a, uint8_t b, + uint8_t c, uint8_t d) noexcept { + return { ConstructInAddrT(a, b, c, d) }; + } +#endif + /** * @param x the 32 bit IP address in network byte order */ static constexpr struct in_addr ConstructInAddrBE(uint32_t x) noexcept { - return { x }; + struct in_addr ia{}; + ia.s_addr = x; + return ia; } /** @@ -92,26 +86,16 @@ class IPv4Address { return ConstructInAddrBE(ToBE32(x)); } - static constexpr struct in_addr ConstructInAddr(uint8_t a, uint8_t b, - uint8_t c, uint8_t d) noexcept { - return { ConstructInAddrT(a, b, c, d) }; - } -#endif - /** * @param port the port number in host byte order */ static constexpr struct sockaddr_in Construct(struct in_addr address, uint16_t port) noexcept { - return { -#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN - sizeof(struct sockaddr_in), -#endif - AF_INET, - ToBE16(port), - address, - {}, - }; + struct sockaddr_in sin{}; + sin.sin_family = AF_INET; + sin.sin_port = ToBE16(port); + sin.sin_addr = address; + return sin; } /** diff --git a/src/net/IPv6Address.hxx b/src/net/IPv6Address.hxx index d8b9f7478..6f217772b 100644 --- a/src/net/IPv6Address.hxx +++ b/src/net/IPv6Address.hxx @@ -68,16 +68,12 @@ class IPv6Address { static constexpr struct sockaddr_in6 Construct(struct in6_addr address, uint16_t port, uint32_t scope_id) noexcept { - return { -#if defined(__APPLE__) - sizeof(struct sockaddr_in6), -#endif - AF_INET6, - ToBE16(port), - 0, - address, - scope_id, - }; + struct sockaddr_in6 sin{}; + sin.sin6_family = AF_INET6; + sin.sin6_port = ToBE16(port); + sin.sin6_addr = address; + sin.sin6_scope_id = scope_id; + return sin; } public: diff --git a/src/net/meson.build b/src/net/meson.build index 4b33e5aea..e75d641ea 100644 --- a/src/net/meson.build +++ b/src/net/meson.build @@ -10,14 +10,6 @@ if have_tcp and not get_option('ipv6').disabled() if not have_ipv6 and get_option('ipv6').enabled() error('IPv6 not supported by OS') endif - - conf.set('HAVE_STRUCT_SOCKADDR_IN_SIN_LEN', c_compiler.has_member('struct sockaddr_in', 'sin_len', prefix: ''' -#ifdef _WIN32 -#include -#include -#else -#include -#endif''')) else have_ipv6 = false endif