From: Gustavo Lopes Date: Wed, 30 Jan 2013 20:40:45 +0000 (+0100) Subject: Remove some pre-vista code X-Git-Tag: php-5.5.0alpha5~43^2~11^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8561680533c7fd6b66497ed10246fe9e57e9d351;p=php Remove some pre-vista code --- diff --git a/win32/inet.c b/win32/inet.c index d424c8a546..686cf1265c 100644 --- a/win32/inet.c +++ b/win32/inet.c @@ -1,83 +1,4 @@ -#include "config.w32.h" -#include "php.h" -#include -#include -#include - #include "inet.h" -#if (_WIN32_WINNT < 0x0600) /* Vista/2k8 have these functions */ - - -PHPAPI int inet_pton(int af, const char* src, void* dst) -{ - int address_length; - struct sockaddr_storage sa; - struct sockaddr_in *sin = (struct sockaddr_in *)&sa; - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa; - - switch (af) { - case AF_INET: - address_length = sizeof (struct sockaddr_in); - break; - - case AF_INET6: - address_length = sizeof (struct sockaddr_in6); - break; - - default: - return -1; - } - - if (WSAStringToAddress ((LPTSTR) src, af, NULL, (LPSOCKADDR) &sa, &address_length) == 0) { - switch (af) { - case AF_INET: - memcpy (dst, &sin->sin_addr, sizeof (struct in_addr)); - break; - - case AF_INET6: - memcpy (dst, &sin6->sin6_addr, sizeof (struct in6_addr)); - break; - } - return 1; - } - - return 0; -} - -PHPAPI const char* inet_ntop(int af, const void* src, char* dst, size_t size) -{ - int address_length; - DWORD string_length = size; - struct sockaddr_storage sa; - struct sockaddr_in *sin = (struct sockaddr_in *)&sa; - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa; - - memset (&sa, 0, sizeof (sa)); - switch (af) { - case AF_INET: - address_length = sizeof (struct sockaddr_in); - sin->sin_family = af; - memcpy (&sin->sin_addr, src, sizeof (struct in_addr)); - break; - - case AF_INET6: - address_length = sizeof (struct sockaddr_in6); - sin6->sin6_family = af; - memcpy (&sin6->sin6_addr, src, sizeof (struct in6_addr)); - break; - - default: - return NULL; - } - - if (WSAAddressToString ((LPSOCKADDR) &sa, address_length, NULL, dst, &string_length) == 0) { - return dst; - } - - return NULL; -} - -#endif int inet_aton(const char *cp, struct in_addr *inp) { inp->s_addr = inet_addr(cp); diff --git a/win32/inet.h b/win32/inet.h index 623d114dfd..d71723759f 100644 --- a/win32/inet.h +++ b/win32/inet.h @@ -1,11 +1,4 @@ -#if _MSC_VER >= 1500 -# include -#endif -#include - -#if (_WIN32_WINNT <= 0x502) -PHPAPI int inet_pton(int af, const char* src, void* dst); -PHPAPI const char* inet_ntop(int af, const void* src, char* dst, size_t size); -#endif +#include +#include PHPAPI int inet_aton(const char *cp, struct in_addr *inp);