You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2008/02/14 21:13:51 UTC
svn commit: r627863 - in /harmony/enhanced/classlib/trunk/modules:
luni/src/main/java/org/apache/harmony/luni/platform/
luni/src/main/native/luni/shared/
nio/src/main/java/common/org/apache/harmony/nio/internal/
Author: tellison
Date: Thu Feb 14 12:13:47 2008
New Revision: 627863
URL: http://svn.apache.org/viewvc?rev=627863&view=rev
Log:
Remove unnecessary 'offset' parameter to direct memory read/write socket calls.
Modified:
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java?rev=627863&r1=627862&r2=627863&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java Thu Feb 14 12:13:47 2008
@@ -31,10 +31,6 @@
*/
public interface INetworkSystem {
- // -----------------------------------------------
- // Class Const
- // -----------------------------------------------
-
/*
* Socket connect Step start
*/
@@ -45,10 +41,6 @@
*/
public final int SOCKET_CONNECT_STEP_CHECK = 1;
- // -----------------------------------------------
- // Methods
- // -----------------------------------------------
-
/*
* socket accept
*/
@@ -67,13 +59,13 @@
public int read(FileDescriptor aFD, byte[] data, int offset, int count,
int timeout) throws IOException;
- public int readDirect(FileDescriptor aFD, long address, int offset, int count,
+ public int readDirect(FileDescriptor aFD, long address, int count,
int timeout) throws IOException;
public int write(FileDescriptor fd, byte[] data, int offset, int count)
throws IOException;
- public int writeDirect(FileDescriptor fd, long address, int offset, int count)
+ public int writeDirect(FileDescriptor fd, long address, int count)
throws IOException;
public void setNonBlocking(FileDescriptor aFD, boolean block)
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java?rev=627863&r1=627862&r2=627863&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java Thu Feb 14 12:13:47 2008
@@ -82,9 +82,9 @@
return readSocketImpl(aFD, data, offset, count, timeout);
}
- public int readDirect(FileDescriptor aFD, long address, int offset, int count,
+ public int readDirect(FileDescriptor aFD, long address, int count,
int timeout) throws IOException {
- return readSocketDirectImpl(aFD, address, offset, count, timeout);
+ return readSocketDirectImpl(aFD, address, count, timeout);
}
public int write(FileDescriptor aFD, byte[] data, int offset, int count)
@@ -92,9 +92,9 @@
return writeSocketImpl(aFD, data, offset, count);
}
- public int writeDirect(FileDescriptor aFD, long address, int offset,
- int count) throws IOException {
- return writeSocketDirectImpl(aFD, address, offset, count);
+ public int writeDirect(FileDescriptor aFD, long address, int count)
+ throws IOException {
+ return writeSocketDirectImpl(aFD, address, count);
}
public void setNonBlocking(FileDescriptor aFD, boolean block)
@@ -428,13 +428,13 @@
int offset, int count, int timeout) throws IOException;
static native int readSocketDirectImpl(FileDescriptor aFD, long address,
- int offset, int count, int timeout) throws IOException;
+ int count, int timeout) throws IOException;
static native int writeSocketImpl(FileDescriptor fd, byte[] data,
int offset, int count) throws IOException;
static native int writeSocketDirectImpl(FileDescriptor fd, long address,
- int offset, int count) throws IOException;
+ int count) throws IOException;
static native void setNonBlockingImpl(FileDescriptor aFD,
boolean block);
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?rev=627863&r1=627862&r2=627863&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c Thu Feb 14 12:13:47 2008
@@ -352,7 +352,7 @@
result =
Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirectImpl
- (env, thisClz, fileDescriptor, (jlong) message, 0, count, timeout);
+ (env, thisClz, fileDescriptor, (jlong) message, count, timeout);
if (result > 0) {
(*env)->SetByteArrayRegion(env, data, offset, result, (jbyte *) message);
@@ -368,16 +368,16 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
* Method: readSocketDirectImpl
- * Signature: (Ljava/io/FileDescriptor;JIII)I
+ * Signature: (Ljava/io/FileDescriptor;JII)I
*/
JNIEXPORT jint JNICALL
Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirectImpl
(JNIEnv * env, jclass thisClz, jobject fileDescriptor, jlong address,
- jint offset, jint count, jint timeout)
+ jint count, jint timeout)
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t hysocketP;
- jbyte *message = (jbyte *) (address + offset);
+ jbyte *message = (jbyte *) address;
I_32 result, localCount;
hysocketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
@@ -447,7 +447,7 @@
result =
Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketDirectImpl
- (env, thisClz, fileDescriptor, (jlong) message, 0, count);
+ (env, thisClz, fileDescriptor, (jlong) message, count);
out:
if ((U_8 *) message != internalBuffer) {
@@ -465,11 +465,11 @@
JNIEXPORT jint JNICALL
Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketDirectImpl
(JNIEnv * env, jclass thisClz, jobject fileDescriptor, jlong address,
- jint offset, jint count)
+ jint count)
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t socketP;
- jbyte *message = (jbyte *) (address + offset);
+ jbyte *message = (jbyte *) address;
I_32 result = 0, sent = 0;
if (sent < count) {
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h?rev=627863&r1=627862&r2=627863&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h Thu Feb 14 12:13:47 2008
@@ -104,10 +104,10 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
* Method: readSocketDirectImpl
- * Signature: (Ljava/io/FileDescriptor;JIII)I
+ * Signature: (Ljava/io/FileDescriptor;JII)I
*/
JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirectImpl
- (JNIEnv *, jclass, jobject, jlong, jint, jint, jint);
+ (JNIEnv *, jclass, jobject, jlong, jint, jint);
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
@@ -120,10 +120,10 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
* Method: writeSocketDirectImpl
- * Signature: (Ljava/io/FileDescriptor;JII)I
+ * Signature: (Ljava/io/FileDescriptor;JI)I
*/
JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketDirectImpl
- (JNIEnv *, jclass, jobject, jlong, jint, jint);
+ (JNIEnv *, jclass, jobject, jlong, jint);
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java?rev=627863&r1=627862&r2=627863&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SocketChannelImpl.java Thu Feb 14 12:13:47 2008
@@ -449,7 +449,7 @@
int length = target.remaining();
if (target.isDirect()) {
long address = AddressUtil.getDirectBufferAddress(target);
- readCount = networkSystem.readDirect(fd, address, offset,
+ readCount = networkSystem.readDirect(fd, address + offset,
length, (isBlocking() ? TIMEOUT_BLOCK
: TIMEOUT_NONBLOCK));
} else {
@@ -546,7 +546,7 @@
}
if (source.isDirect()) {
long address = AddressUtil.getDirectBufferAddress(source);
- writeCount = networkSystem.writeDirect(fd, address, pos,
+ writeCount = networkSystem.writeDirect(fd, address + pos,
length);
} else if (source.hasArray()) {
pos += source.arrayOffset();