commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1100578 - /commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c
Date Sat, 07 May 2011 17:49:42 GMT
Author: mturk
Date: Sat May  7 17:49:42 2011
New Revision: 1100578

URL: http://svn.apache.org/viewvc?rev=1100578&view=rev
Log:
Fix address compare

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

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=1100578&r1=1100577&r2=1100578&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/netaddr.c Sat May  7 17:49:42 2011
@@ -797,13 +797,19 @@ ACR_NET_EXPORT(jboolean, EndpointAddress
     if (addr1 != 0 && addr2 != 0) {
         if (addr1->iplen == addr2->iplen) {
             if (addr1->family == AF_INET && addr2->family == AF_INET &&
-                memcmp(&addr1->sa.sin.sin_addr, &addr2->sa.sin.sin_addr, addr1->iplen)
== 0)
-                rv = JNI_TRUE;
-            else if (addr1->family == AF_INET6 && addr2->family == AF_INET6
&&
-                memcmp(&addr1->sa.sin6.sin6_addr, &addr2->sa.sin6.sin6_addr,
addr1->iplen) == 0)
-                rv = JNI_TRUE;
+                memcmp(&addr1->sa.sin.sin_addr, &addr2->sa.sin.sin_addr, addr1->iplen)
== 0) {
+                SOCKADDR_RELEASE(sa1, addr1);
+                SOCKADDR_RELEASE(sa2, addr2);
+                return JNI_TRUE;
+            }
+            if (addr1->family == AF_INET6 && addr2->family == AF_INET6 &&
+                memcmp(&addr1->sa.sin6.sin6_addr, &addr2->sa.sin6.sin6_addr,
addr1->iplen) == 0) {
+                SOCKADDR_RELEASE(sa1, addr1);
+                SOCKADDR_RELEASE(sa2, addr2);
+                return JNI_TRUE;
+            }
         }
-        else if (V4MAPPED_EQUAL(addr1, addr2))
+        if (V4MAPPED_EQUAL(addr1, addr2))
             rv = JNI_TRUE;
         else if (V4MAPPED_EQUAL(addr2, addr1))
             rv = JNI_TRUE;



Mime
View raw message