com php-src: Remove some pre-vista code: win32/inet.c win32/inet.h
| From: | Gustavo André dos Santos Lopes | Date: | Sat, 02 Feb 2013 15:38:09 +0000 |
| Subject: | com php-src: Remove some pre-vista code: win32/inet.c win32/inet.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-71119@lists.php.net to get a copy of this message | ||
Commit: 8561680533c7fd6b66497ed10246fe9e57e9d351
Author: Gustavo Lopes <glopes@nebm.ist.utl.pt> Wed, 30 Jan 2013 21:40:45 +0100
Parents: 95f8d34f9c0980924098ce9554e899e461ce7cec
Branches: PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8561680533c7fd6b66497ed10246fe9e57e9d351
Log:
Remove some pre-vista code
Changed paths:
M win32/inet.c
M win32/inet.h
Diff:
diff --git a/win32/inet.c b/win32/inet.c
index d424c8a..686cf12 100644
--- a/win32/inet.c
+++ b/win32/inet.c
@@ -1,83 +1,4 @@
-#include "config.w32.h"
-#include "php.h"
-#include <winsock2.h>
-#include <windows.h>
-#include <Ws2tcpip.h>
-
#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 623d114..d717237 100644
--- a/win32/inet.h
+++ b/win32/inet.h
@@ -1,11 +1,4 @@
-#if _MSC_VER >= 1500
-# include <In6addr.h>
-#endif
-#include <Ws2tcpip.h>
-
-#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 <php.h>
+#include <Winsock2.h>
PHPAPI int inet_aton(const char *cp, struct in_addr *inp);