#include <stdlib.h>
#include <ctype.h>
- #if !defined(__MWERKS__)
- #include <memory.h>
- #endif
+ #include <memory.h>
#endif // !WX_PRECOMP
#include "wx/socket.h"
#include <errno.h>
-#ifdef __UNIX__
+#if defined(__UNIX__) && !defined(__CYGWIN__)
#include <netdb.h>
#include <arpa/inet.h>
#endif // __UNIX__
// TODO: use POSIX getaddrinfo() (also available in Winsock 2) for simplicity
// and to use the same code for IPv4 and IPv6 support
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
#define HAVE_INET_ADDR
+ #ifndef HAVE_GETHOSTBYNAME
#define HAVE_GETHOSTBYNAME
+ #endif
+ #ifndef HAVE_GETSERVBYNAME
#define HAVE_GETSERVBYNAME
+ #endif
// under MSW getxxxbyname() functions are MT-safe (but not reentrant) so
// we don't need to serialize calls to them
#pragma warning(default:4706)
#endif
#endif
-#endif // __WXMSW__
+#endif // __WINDOWS__
// 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
#ifdef HAVE_FUNC_GETSERVBYNAME_R_4
struct wxGetservBuf : servent_data
{
- wxGethostBuf()
+ wxGetservBuf()
{
memset(this, 0, sizeof(servent_data));
}
#elif defined(HAVE_FUNC_GETHOSTBYNAME_R_5)
he = gethostbyname_r(hostname, h, buffer, size, err);
#elif defined(HAVE_FUNC_GETHOSTBYNAME_R_3)
- he = gethostbyname_r(hostname, h, &buffer);
- *err = h_errno;
+ wxUnusedVar(var);
+ *err = gethostbyname_r(hostname, h, &buffer);
+ he = h;
#elif defined(HAVE_GETHOSTBYNAME)
wxLOCK_GETBY_MUTEX(name);
#elif defined(HAVE_FUNC_GETHOSTBYADDR_R_5)
he = gethostbyaddr_r(addr_buf, buf_size, proto, h, buffer, size, err);
#elif defined(HAVE_FUNC_GETHOSTBYADDR_R_3)
- he = gethostbyaddr_r(addr_buf, buf_size, proto, h, buffer);
- *err = h_errno;
+ wxUnusedVar(size);
+ *err = gethostbyaddr_r(addr_buf, buf_size, proto, h, &buffer);
+ he = h;
#elif defined(HAVE_GETHOSTBYADDR)
wxLOCK_GETBY_MUTEX(addr);
#elif defined(HAVE_FUNC_GETSERVBYNAME_R_5)
se = getservbyname_r(port, protocol, serv, buffer, size);
#elif defined(HAVE_FUNC_GETSERVBYNAME_R_4)
+ wxUnusedVar(size);
if ( getservbyname_r(port, protocol, serv, &buffer) != 0 )
return NULL;
#elif defined(HAVE_GETSERVBYNAME)
return wxString::Format
(
- "%lu.%lu.%lu.%lu",
+ "%u.%u.%u.%u",
(addr >> 24) & 0xff,
(addr >> 16) & 0xff,
(addr >> 8) & 0xff,