[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch for gnu_java_net_PlainDatagramSocketImpl.c
From: |
Dr. Torsten Rupp |
Subject: |
Patch for gnu_java_net_PlainDatagramSocketImpl.c |
Date: |
Fri, 29 Oct 2004 10:30:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 |
Hi,
gnu_java_net_PlainDatagramSocketImpl.c seems to contain a small error.
Please find a patch below. I also changed "this" into "thiz" for
C++-compatibility in gnu_java_net_PlainDatagramSocketImpl.c and
gnu_java_net_PlainSocketImpl.c .
Bye,
Torsten
--- gnu_java_net_PlainDatagramSocketImpl.c Fri Oct 29 10:13:28 2004
+++ gnu_java_net_PlainDatagramSocketImpl.c.new Fri Oct 29 10:05:19 2004
@@ -67,13 +67,13 @@
* Creates a new datagram socket
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainDatagramSocketImpl_create(JNIEnv *env, jobject this)
+Java_gnu_java_net_PlainDatagramSocketImpl_create(JNIEnv *env, jobject thiz)
{
assert(env!=NULL);
assert((*env)!=NULL);
#ifndef WITHOUT_NETWORK
- _javanet_create(env, this, 0);
+ _javanet_create(env, thiz, 0);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -84,13 +84,13 @@
* Close the socket.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainDatagramSocketImpl_close(JNIEnv *env, jobject this)
+Java_gnu_java_net_PlainDatagramSocketImpl_close(JNIEnv *env, jobject thiz)
{
assert(env!=NULL);
assert((*env)!=NULL);
#ifndef WITHOUT_NETWORK
- _javanet_close(env, this, 0);
+ _javanet_close(env, thiz, 0);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -103,14 +103,14 @@
* variables.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainDatagramSocketImpl_bind(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainDatagramSocketImpl_bind(JNIEnv *env, jobject thiz,
jint port, jobject addr)
{
assert(env!=NULL);
assert((*env)!=NULL);
#ifndef WITHOUT_NETWORK
- _javanet_bind(env, this, addr, port, 0);
+ _javanet_bind(env, thiz, addr, port, 0);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -121,14 +121,14 @@
* This method sets the specified option for a socket
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainDatagramSocketImpl_setOption(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainDatagramSocketImpl_setOption(JNIEnv *env, jobject thiz,
jint option_id, jobject val)
{
assert(env!=NULL);
assert((*env)!=NULL);
#ifndef WITHOUT_NETWORK
- _javanet_set_option(env, this, option_id, val);
+ _javanet_set_option(env, thiz, option_id, val);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -139,15 +139,16 @@
* This method sets the specified option for a socket
*/
JNIEXPORT jobject JNICALL
-Java_gnu_java_net_PlainDatagramSocketImpl_getOption(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainDatagramSocketImpl_getOption(JNIEnv *env, jobject thiz,
jint option_id)
{
assert(env!=NULL);
assert((*env)!=NULL);
#ifndef WITHOUT_NETWORK
- return(_javanet_get_option(env, this, option_id));
+ return(_javanet_get_option(env, thiz, option_id));
#else /* not WITHOUT_NETWORK */
+ return NULL;
#endif /* not WITHOUT_NETWORK */
}
@@ -157,12 +158,12 @@
* Reads a buffer from a remote host
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject thiz,
jobject packet)
{
#ifndef WITHOUT_NETWORK
- int addr, port, bytes_read;
- unsigned int maxlen, offset;
+ int addr, port;
+ unsigned int maxlen, offset, bytes_read;
jclass cls, addr_cls;
jfieldID fid;
jmethodID mid;
@@ -227,7 +228,7 @@
/* Now get the maximal available length from the packet */
fid = (*env)->GetFieldID(env, cls, "maxlen", "I");
- if (mid == NULL)
+ if (fid == NULL)
{
JCL_ThrowException(env, IO_EXCEPTION, "Internal error: maxlen");
return;
@@ -242,7 +243,7 @@
/* Receive the packet */
/* should we try some sort of validation on the length? */
- bytes_read = _javanet_recvfrom(env, this, arr, offset, maxlen, &addr,
&port);
+ bytes_read = _javanet_recvfrom(env, thiz, arr, offset, maxlen, &addr,
&port);
if ((bytes_read == -1) || (*env)->ExceptionOccurred(env))
{
JCL_ThrowException(env, IO_EXCEPTION, "Internal error: receive");
@@ -355,7 +356,7 @@
* Writes a buffer to the remote host
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainDatagramSocketImpl_sendto(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainDatagramSocketImpl_sendto(JNIEnv *env, jobject thiz,
jobject addr, jint port, jarray
buf,
jint offset, jint len)
{
@@ -371,7 +372,7 @@
DBG("PlainDatagramSocketImpl.sendto(): have addr\n");
- _javanet_sendto(env, this, buf, offset, len, netAddress, port);
+ _javanet_sendto(env, thiz, buf, offset, len, netAddress, port);
if ((*env)->ExceptionOccurred(env))
{ JCL_ThrowException(env, IO_EXCEPTION, "Internal error: send data");
return; }
@@ -386,7 +387,7 @@
* Joins a multicast group
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainDatagramSocketImpl_join(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainDatagramSocketImpl_join(JNIEnv *env, jobject thiz,
jobject addr)
{
#ifndef WITHOUT_NETWORK
@@ -404,7 +405,7 @@
return;
}
- fd = _javanet_get_int_field(env, this, "native_fd");
+ fd = _javanet_get_int_field(env, thiz, "native_fd");
if ((*env)->ExceptionOccurred(env))
{
JCL_ThrowException(env, IO_EXCEPTION, "Internal error");
@@ -432,7 +433,7 @@
* Leaves a multicast group
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainDatagramSocketImpl_leave(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainDatagramSocketImpl_leave(JNIEnv *env, jobject thiz,
jobject addr)
{
#ifndef WITHOUT_NETWORK
@@ -450,7 +451,7 @@
return;
}
- fd = _javanet_get_int_field(env, this, "native_fd");
+ fd = _javanet_get_int_field(env, thiz, "native_fd");
if ((*env)->ExceptionOccurred(env))
{ JCL_ThrowException(env, IO_EXCEPTION, "Internal error"); return; }
@@ -467,3 +468,4 @@
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
+
--- gnu_java_net_PlainSocketImpl.c Fri Oct 29 10:18:05 2004
+++ gnu_java_net_PlainSocketImpl.c.new Fri Oct 29 10:17:24 2004
@@ -68,13 +68,13 @@
* Creates a new stream or datagram socket
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainSocketImpl_create(JNIEnv *env, jobject this, jboolean
stream)
+Java_gnu_java_net_PlainSocketImpl_create(JNIEnv *env, jobject thiz, jboolean
stream)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- _javanet_create(env, this, stream);
+ _javanet_create(env, thiz, stream);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -86,13 +86,13 @@
* action as well.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainSocketImpl_close(JNIEnv *env, jobject this)
+Java_gnu_java_net_PlainSocketImpl_close(JNIEnv *env, jobject thiz)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- _javanet_close(env, this, 1);
+ _javanet_close(env, thiz, 1);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -103,14 +103,14 @@
* Connects to the specified destination.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainSocketImpl_connect(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainSocketImpl_connect(JNIEnv *env, jobject thiz,
jobject addr, jint port)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- _javanet_connect(env, this, addr, port);
+ _javanet_connect(env, thiz, addr, port);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -123,14 +123,14 @@
* variables.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainSocketImpl_bind(JNIEnv *env, jobject this, jobject addr,
+Java_gnu_java_net_PlainSocketImpl_bind(JNIEnv *env, jobject thiz, jobject addr,
jint port)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- _javanet_bind(env, this, addr, port, 1);
+ _javanet_bind(env, thiz, addr, port, 1);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -142,13 +142,13 @@
* connections allowed.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainSocketImpl_listen(JNIEnv *env, jobject this, jint
queuelen)
+Java_gnu_java_net_PlainSocketImpl_listen(JNIEnv *env, jobject thiz, jint
queuelen)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- _javanet_listen(env, this, queuelen);
+ _javanet_listen(env, thiz, queuelen);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -160,13 +160,13 @@
* object. Note that we assume this is a PlainSocketImpl just like us.
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainSocketImpl_accept(JNIEnv *env, jobject this, jobject
impl)
+Java_gnu_java_net_PlainSocketImpl_accept(JNIEnv *env, jobject thiz, jobject
impl)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- _javanet_accept(env, this, impl);
+ _javanet_accept(env, thiz, impl);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -174,7 +174,7 @@
/*************************************************************************/
JNIEXPORT jint JNICALL
-Java_gnu_java_net_PlainSocketImpl_available(JNIEnv *env, jobject this)
+Java_gnu_java_net_PlainSocketImpl_available(JNIEnv *env, jobject thiz)
{
#ifndef WITHOUT_NETWORK
jclass cls;
@@ -186,7 +186,7 @@
assert(env!=NULL);
assert((*env)!=NULL);
- cls = (*env)->GetObjectClass(env, this);
+ cls = (*env)->GetObjectClass(env, thiz);
if (cls == 0)
{
JCL_ThrowException(env, IO_EXCEPTION, "internal error");
@@ -200,7 +200,7 @@
return 0;
}
- fd = (*env)->GetIntField(env, this, fid);
+ fd = (*env)->GetIntField(env, thiz, fid);
TARGET_NATIVE_NETWORK_SOCKET_RECEIVE_AVAILABLE(fd,bytesAvailable,result);
if (result != TARGET_NATIVE_OK)
@@ -211,6 +211,7 @@
return bytesAvailable;
#else /* not WITHOUT_NETWORK */
+ return 0;
#endif /* not WITHOUT_NETWORK */
}
@@ -220,14 +221,14 @@
* This method sets the specified option for a socket
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainSocketImpl_setOption(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainSocketImpl_setOption(JNIEnv *env, jobject thiz,
jint option_id, jobject val)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- _javanet_set_option(env, this, option_id, val);
+ _javanet_set_option(env, thiz, option_id, val);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
@@ -238,15 +239,16 @@
* This method sets the specified option for a socket
*/
JNIEXPORT jobject JNICALL
-Java_gnu_java_net_PlainSocketImpl_getOption(JNIEnv *env, jobject this,
+Java_gnu_java_net_PlainSocketImpl_getOption(JNIEnv *env, jobject thiz,
jint option_id)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- return(_javanet_get_option(env, this, option_id));
+ return(_javanet_get_option(env, thiz, option_id));
#else /* not WITHOUT_NETWORK */
+ return NULL;
#endif /* not WITHOUT_NETWORK */
}
@@ -256,15 +258,16 @@
* Reads a buffer from a remote host
*/
JNIEXPORT jint JNICALL
-Java_gnu_java_net_PlainSocketImpl_read(JNIEnv *env, jobject this, jarray buf,
+Java_gnu_java_net_PlainSocketImpl_read(JNIEnv *env, jobject thiz, jarray buf,
jint offset, jint len)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- return(_javanet_recvfrom(env, this, buf, offset, len, 0, 0));
+ return(_javanet_recvfrom(env, thiz, buf, offset, len, 0, 0));
#else /* not WITHOUT_NETWORK */
+ return 0;
#endif /* not WITHOUT_NETWORK */
}
@@ -274,16 +277,18 @@
* Writes a buffer to the remote host
*/
JNIEXPORT void JNICALL
-Java_gnu_java_net_PlainSocketImpl_write(JNIEnv *env, jobject this, jarray buf,
+Java_gnu_java_net_PlainSocketImpl_write(JNIEnv *env, jobject thiz, jarray buf,
jint offset, jint len)
{
#ifndef WITHOUT_NETWORK
assert(env!=NULL);
assert((*env)!=NULL);
- _javanet_sendto(env, this, buf, offset, len, 0, 0);
+ _javanet_sendto(env, thiz, buf, offset, len, 0, 0);
#else /* not WITHOUT_NETWORK */
#endif /* not WITHOUT_NETWORK */
}
/* end of file */
+
+
- Patch for gnu_java_net_PlainDatagramSocketImpl.c,
Dr. Torsten Rupp <=