You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/05/04 15:42:31 UTC

svn commit: r1099443 - in /commons/sandbox/runtime/trunk/src/main/native: os/win32/inetsock.c shared/netaddr.c

Author: mturk
Date: Wed May  4 13:42:30 2011
New Revision: 1099443

URL: http://svn.apache.org/viewvc?rev=1099443&view=rev
Log:
Seem getnameinfo works on all platforms. Axe dead code

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/inetsock.c
    commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/inetsock.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/inetsock.c?rev=1099443&r1=1099442&r2=1099443&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/inetsock.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/inetsock.c Wed May  4 13:42:30 2011
@@ -31,7 +31,7 @@ ACR_NET_EXPORT(jint, SocketDescriptor, c
 
 ACR_NET_EXPORT(jint, SocketDescriptor, sync0)(JNI_STDARGS, jint fd)
 {
-    if (send((SOCKET)fd, &fd, 0, 0) == -1)
+    if (send((SOCKET)fd, (const char *)&fd, 0, 0) == -1)
         return ACR_GET_OS_ERROR();
     else
         return 0;

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c?rev=1099443&r1=1099442&r2=1099443&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c Wed May  4 13:42:30 2011
@@ -605,7 +605,6 @@ AcrIsSockaddrEqual(const acr_sockaddr_t 
 int
 AcrGetNameInfo(char **hostname, acr_sockaddr_t *sockaddr, int flags)
 {
-#if defined(HAVE_GETNAMEINFO)
     int rc;
 #if !defined(NI_MAXHOST)
 # define NI_MAXHOST 256
@@ -670,52 +669,4 @@ AcrGetNameInfo(char **hostname, acr_sock
     strlcpy(sockaddr->hostname, tmphostname, 256);
     *hostname = sockaddr->hostname;
     return 0;
-#else
-/* XXX: Do we need the following block
- */
-#if HAVE_GETHOSTBYADDR_R
-    char tmp[GETHOSTBYNAME_BUFLEN];
-    int hosterror;
-    struct hostent hs, *hptr;
-
-#if defined(HPUX) || defined(AIX)
-    /* AIX, HP/UX, D/UX et alia */
-    gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr,
-                  sizeof(struct in_addr), AF_INET, &hs, &hd);
-    hptr = &hs;
-#else
-#if defined(LINUX)
-    /* Linux glibc2+ */
-    gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr,
-                    sizeof(struct in_addr), AF_INET,
-                    &hs, tmp, GETHOSTBYNAME_BUFLEN - 1, &hptr, &hosterror);
-#else
-    /* Solaris, Irix et alia */
-    hptr = gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr,
-                           sizeof(struct in_addr), AF_INET,
-                           &hs, tmp, GETHOSTBYNAME_BUFLEN, &hosterror);
-#endif
-    if (!hptr) {
-        *hostname = 0;
-        return hosterror + ACR_OS_START_SYSERR;
-    }
-#endif
-#else
-    struct hostent *hptr;
-    hptr = gethostbyaddr((char *)&sockaddr->sa.sin.sin_addr,
-                         sizeof(struct in_addr), AF_INET);
-#endif
-
-    if (hptr) {
-        strlcpy(sockaddr->hostname, hptr->h_name, 256);
-        *hostname = sockaddr->hostname;
-        return 0;
-    }
-    *hostname = 0;
-#if defined(WINDOWS)
-    return ACR_GET_NETOS_ERROR();
-#else
-    return h_errno + ACR_OS_START_SYSERR;
-#endif
-#endif
 }