Commit Graph

20 Commits

Author SHA1 Message Date
Max Kellermann
32ce9ce919 net/IPv[46]Address: pass SocketAddress by value to Cast() 2020-11-30 21:49:07 +01:00
Max Kellermann
34a070f5a6 net/IPv[46]Address: add Cast(const sockaddr_in&) 2020-11-30 21:49:02 +01:00
Rosen Penev
a2f5a63bbc
replace stdint.h with cstdint
The former is deprecated by C++14. The standard says they are the same:

The header defines all types and macros the same as the C standard library
header<stdint.h>.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:39 -07:00
Max Kellermann
ea5e6d8f33 Merge branch 'v0.21.x' 2019-04-04 10:29:58 +02:00
Max Kellermann
37b54179d8 net/IPv[46]Address: add cast to void* to fix GCC9 build failure
Fixes:

 src/net/IPv4Address.hxx: In member function 'constexpr IPv4Address::operator SocketAddress() const':
 src/net/IPv4Address.hxx:171:24: error: a reinterpret_cast is not a constant expression
   171 |   return SocketAddress((const struct sockaddr *)&address,
       |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 src/net/IPv6Address.hxx: In member function 'constexpr IPv6Address::operator SocketAddress() const':
 src/net/IPv6Address.hxx:138:24: error: a reinterpret_cast is not a constant expression
   138 |   return SocketAddress((const struct sockaddr *)&address,
       |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Closes https://github.com/MusicPlayerDaemon/MPD/issues/522
2019-04-03 16:59:53 +02:00
Max Kellermann
c176d94598 system/ByteOrder: move to util/ 2019-03-08 10:21:10 +01:00
Max Kellermann
c0f57b8a8b net/IPv[46]Address: update copyright 2019-02-19 13:00:45 +01:00
Max Kellermann
701fd1d939 net/IPv4Address: fix comment typo 2019-01-20 21:05:12 +01:00
Max Kellermann
1fa99da3c2 net/IPv[46]Address: make the initializers even more portable
Similar to 5a5229b499: use more C++14
constexpr.
2019-01-14 19:21:07 +01:00
Max Kellermann
5a5229b499 net/IPv[46]Address: make the initializers more portable
Thanks to C++14, we can declare and fill variables inside `constexpr`
functions.  This means me can stop make assumptions on the `struct`
layouts without losing `constexpr`.

Closes #393
2018-11-02 17:47:43 +01:00
Max Kellermann
adc5c5db88 net/IPv4Address: pass reference to Cast() 2018-08-21 20:16:57 +02:00
Max Kellermann
4c6ae4e9e8 net/IPv4Address: add various helper methods 2018-08-20 15:57:13 +02:00
Max Kellermann
9cb9154b08 net/IPv4Address: add struct sockaddr_in constructor 2018-08-20 15:57:13 +02:00
Max Kellermann
2bf5f32224 net/IPv4Address: add API documentation 2018-08-20 15:50:25 +02:00
Max Kellermann
82d0f68acf net/IPv4Address: add static method ConstructInAddrBE() 2018-08-20 15:48:52 +02:00
Max Kellermann
616c8383c0 net/IPv4Address: check _WIN32 instead of WIN32 2018-08-20 15:48:49 +02:00
Max Kellermann
5de46268af net/IPv4Address: add "noexcept" 2018-08-20 15:43:35 +02:00
François Revol
7b2283c28b configure.ac: autodetect sin_len member in struct sockaddr_in.
This fixes a build issue on Haiku as it does have sin_len.
Tested on Linux as well.

For some reason AC_CHECK_MEMBER doesn't generate the proper define
in config.h.in, so I used AC_CHECK_MEMBERS.
2018-01-05 22:20:47 +01:00
Christopher Zimmermann
4d563e08e1 Fix building on BSDs 2017-09-16 09:14:11 +02:00
Max Kellermann
d705a92e43 net/IPv4Address: new class 2017-08-11 09:09:04 +02:00