From 68a824da3c013d06ff52c98a3a7f04473af4405e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 28 Jan 2021 22:08:35 +0100 Subject: [PATCH] Fix using gethostbyxxx_r() with newer Android NDK This might break using it with the older versions, but it's not clear whether we still need to support them, so for now apply the simplest fix which works with the recent NDK and we'll add configure tests later if we really need them. See https://github.com/wxWidgets/wxWidgets/pull/2195 --- src/common/sckaddr.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 3e252f0522..775f0cc3ea 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -106,11 +106,17 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress); #endif #endif // __WINDOWS__ -#ifdef __ANDROID__ - #ifndef HAVE_GETHOSTBYNAME - #define HAVE_GETHOSTBYNAME - #endif -#else // these functions are missing on android (see netdb.h) +// we assume that we have gethostbyaddr_r() if and only if we have +// gethostbyname_r() and that it uses the similar conventions to it (see +// comment in configure) +// +// this used not to be the case under older Android systems, where +// gethostbyname_r() was available, but gethostbyaddr_r() wasn't, but it's not +// clear if we still need to support the old NDKs, so for now keep things +// simple -- and if we really need to account for this case, we'll add the +// tests for gethostbyaddr_r() to configure later +#define HAVE_GETHOSTBYADDR HAVE_GETHOSTBYNAME + #ifdef HAVE_FUNC_GETHOSTBYNAME_R_3 #define HAVE_FUNC_GETHOSTBYADDR_R_3 #endif @@ -120,12 +126,6 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress); #ifdef HAVE_FUNC_GETHOSTBYNAME_R_6 #define HAVE_FUNC_GETHOSTBYADDR_R_6 #endif -#endif // __ANDROID__/!__ANDROID__ - -// we assume that we have gethostbyaddr_r() if and only if we have -// gethostbyname_r() and that it uses the similar conventions to it (see -// comment in configure) -#define HAVE_GETHOSTBYADDR HAVE_GETHOSTBYNAME // the _r functions need the extra buffer parameter but unfortunately its type // differs between different systems and for the systems which use opaque