commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1102960 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/net/SocketAddress.java native/os/unix/inetsock.c native/os/win32/inetsock.c native/shared/array.c
Date Sat, 14 May 2011 05:59:12 GMT
Author: mturk
Date: Sat May 14 05:59:12 2011
New Revision: 1102960

URL: http://svn.apache.org/viewvc?rev=1102960&view=rev
Log:
Add public api for ipv6 support

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java
    commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/inetsock.c
    commons/sandbox/runtime/trunk/src/main/native/shared/array.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java?rev=1102960&r1=1102959&r2=1102960&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketAddress.java
Sat May 14 05:59:12 2011
@@ -41,10 +41,17 @@ public abstract class SocketAddress exte
 
     private static native String  ipaddr0(byte[] sa);
     private static native int     next0(byte[] sa);
+    private static native boolean haveipv6();
 
     private String fqdn = null;
 
     /**
+     * Set to true if the IPV6 is supported by the
+     * Operating system
+     */
+    public static final boolean   HAVE_IPV6 = haveipv6();
+
+    /**
      * Creates an new object
      */
     protected SocketAddress()

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c?rev=1102960&r1=1102959&r2=1102960&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c Sat May 14 05:59:12 2011
@@ -32,7 +32,7 @@ ACR_NET_EXPORT(jint, SocketDescriptor, c
         return 0;
 }
 
-ACR_NET_EXPORT(jint, SocketDescriptor, sync0)(JNI_STDARGS, jint fd)
+ACR_NET_EXPORT(jint, SocketDescriptor, sendz0)(JNI_STDARGS, jint fd)
 {
     if (r_write(fd, &fd, 0) == -1)
         return ACR_GET_OS_ERROR();

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=1102960&r1=1102959&r2=1102960&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 Sat May 14 05:59:12
2011
@@ -30,7 +30,7 @@ ACR_NET_EXPORT(jint, SocketDescriptor, c
         return 0;
 }
 
-ACR_NET_EXPORT(jint, SocketDescriptor, sync0)(JNI_STDARGS, jint fd)
+ACR_NET_EXPORT(jint, SocketDescriptor, sendz0)(JNI_STDARGS, jint fd)
 {
     if (send(I2SOCK(fd), (const char *)&fd, 0, 0) == -1)
         return ACR_GET_OS_ERROR();

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/array.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/array.c?rev=1102960&r1=1102959&r2=1102960&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/array.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/array.c Sat May 14 05:59:12 2011
@@ -67,6 +67,7 @@ ACR_UTIL_EXPORT(jboolean, Array, memcpy1
                                           jint dstPos,
                                           jint length)
 {
+    jboolean rv = JNI_FALSE;
     jbyte *scp;
     jint   srcLen;
     jint   srcOff = srcPos * srcSiz;
@@ -78,15 +79,14 @@ ACR_UTIL_EXPORT(jboolean, Array, memcpy1
         (nbytes > ((srcLen * srcSiz) - dstOff)))
         return JNI_FALSE;
 
-    scp = (*env)->GetPrimitiveArrayCritical(env, src, 0);
+    scp = JARRAY_CRITICAL(jbyte, src);
     if (scp != 0) {
         memmove(scp + (size_t)dstOff,
                 scp + (size_t)srcOff, (size_t)nbytes);
-        (*env)->ReleasePrimitiveArrayCritical(env, src, scp, 0);
-        return JNI_TRUE;
+        rv = JNI_TRUE;
     }
-    else
-        return JNI_FALSE;
+    RELEASE_CRITICAL(src, scp);
+    return rv;
 }
 
 ACR_UTIL_EXPORT(jboolean, Array, memset0)(JNI_STDARGS,
@@ -96,6 +96,7 @@ ACR_UTIL_EXPORT(jboolean, Array, memset0
                                           jint number,
                                           jint length)
 {
+    jboolean rv = JNI_FALSE;
     jbyte *dcp;
     jint   dstLen;
     jint   dstOff = dstPos * dstSiz;
@@ -108,11 +109,10 @@ ACR_UTIL_EXPORT(jboolean, Array, memset0
     dcp = JARRAY_CRITICAL(jbyte, dst);
     if (dcp != 0) {
         memset(dcp + (size_t)dstOff, number, (size_t)nbytes);
-        RELEASE_CRITICAL(dst, dcp);
-        return JNI_TRUE;
+        rv = JNI_TRUE;
     }
-    else
-        return JNI_FALSE;
+    RELEASE_CRITICAL(dst, dcp);
+    return rv;
 }
 
 ACR_UTIL_EXPORT(jint, Array, memcmp0)(JNI_STDARGS,
@@ -131,17 +131,6 @@ ACR_UTIL_EXPORT(jint, Array, memcmp0)(JN
     jint   nbytes = length * srcSiz;
     jint   rv;
 
-#if 0    
-    jint   srcLen;
-    jint   dstLen;
-    srcLen = (jint)(*env)->GetArrayLength(env, src);
-    dstLen = (jint)(*env)->GetArrayLength(env, dst);
-    if ((length > (srcLen - srcPos)) ||
-        (nbytes > ((dstLen * dstSiz) - dstOff))) {
-        ACR_THROW(ACR_EX_EAINDEX, 0);
-        return -1;
-    }
-#endif
     scp = JARRAY_CRITICAL(jbyte, src);
     dcp = JARRAY_CRITICAL(jbyte, dst);
     if (dcp == 0 || scp == 0) {



Mime
View raw message