Skip to content

Commit 6ebbb79

Browse files
Signed-off-by: Volker Christian <me@vchrist.at>
1 parent 45d1fdc commit 6ebbb79

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ cmake_minimum_required(VERSION 3.18)
4242
project(
4343
SNode.C
4444
DESCRIPTION "Simple Node in C++, a Slim Network Framework"
45-
VERSION 1.0.0
45+
VERSION 1.0.1
4646
)
4747
set(SNODEC_SOVERSION ${SNode.C_VERSION_MAJOR})
4848

src/core/system/netdb.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747

4848
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
4949

50+
// Workaround for https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/netdb.h#205
51+
#ifdef __ANDROID__
52+
#include <cstddef>
53+
#define HOSTLEN_CAST(A) static_cast<std::size_t>((A))
54+
#define SERVLEN_CAST(A) static_cast<std::size_t>((A))
55+
#else
56+
#define HOSTLEN_CAST(A) ((A))
57+
#define SERVLEN_CAST(A) ((A))
58+
#endif
59+
5060
namespace core::system {
5161

5262
int getaddrinfo(const char* node, const char* service, const struct addrinfo* hints, struct addrinfo** res) {
@@ -61,7 +71,7 @@ namespace core::system {
6171

6272
int getnameinfo(const sockaddr* addr, socklen_t addrlen, char* host, socklen_t hostlen, char* serv, socklen_t servlen, int flags) {
6373
errno = 0;
64-
return ::getnameinfo(addr, addrlen, host, hostlen, serv, servlen, flags);
74+
return ::getnameinfo(addr, addrlen, host, HOSTLEN_CAST(hostlen), serv, SERVLEN_CAST(servlen), flags);
6575
}
6676

6777
} // namespace core::system

0 commit comments

Comments
 (0)