From 2f1466ee943f870c157bb065edd92037c79e4b22 Mon Sep 17 00:00:00 2001 From: peavey Date: Sun, 2 Aug 2009 17:42:31 +0000 Subject: Since Windows SDK6.0a inet_pton and inet_ntop is defined if (NTDDI_VERSION >= NTDDI_LONGHORN). I found a similar fix in pythons socketcode and thus think this is fine. Fixes the breakage Brain mentions in r11407. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11459 e03df62e-2008-0410-955e-edbf42e46eb7 --- win/inspircd_win32wrapper.cpp | 4 ++++ win/inspircd_win32wrapper.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp index f42fa6479..cece56344 100644 --- a/win/inspircd_win32wrapper.cpp +++ b/win/inspircd_win32wrapper.cpp @@ -46,6 +46,7 @@ int inet_aton(const char *cp, struct in_addr *addr) return (addr->s_addr == INADDR_NONE) ? 0 : 1; } +#if !defined(NTDDI_VERSION) || (NTDDI_VERSION < NTDDI_LONGHORN) const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) { @@ -69,12 +70,14 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) } return NULL; } +#endif int geteuid() { return 1; } +#if !defined(NTDDI_VERSION) || (NTDDI_VERSION < NTDDI_LONGHORN) int inet_pton(int af, const char *src, void *dst) { sockaddr_in sa; @@ -90,6 +93,7 @@ int inet_pton(int af, const char *src, void *dst) memcpy(dst, &sa.sin_addr, sizeof(struct in_addr)); return rv; } +#endif void setcolor(int color_code) { diff --git a/win/inspircd_win32wrapper.h b/win/inspircd_win32wrapper.h index 75fcc41b7..ed0f461bc 100644 --- a/win/inspircd_win32wrapper.h +++ b/win/inspircd_win32wrapper.h @@ -110,11 +110,13 @@ #define EINPROGRESS WSAEWOULDBLOCK #define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#if !defined(NTDDI_VERSION) || (NTDDI_VERSION < NTDDI_LONGHORN) /* Convert formatted (xxx.xxx.xxx.xxx) string to in_addr struct */ CoreExport int inet_pton(int af, const char * src, void * dst); /* Convert struct to formatted (xxx.xxx.xxx.xxx) string */ CoreExport const char * inet_ntop(int af, const void * src, char * dst, socklen_t cnt); +#endif /* Safe printf functions aren't defined in VC2003 */ #define snprintf _snprintf -- cgit v1.2.3