This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: JNI fix


I'm checking this in.

>From a discussion on the Classpath list I found out that our
DefineClass JNI method is missing an argument.  Oops.  Fixed as
appended.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* jni.cc: Added `name' argument.
	* include/jni.h (struct JNINativeInterface) [DefineClass]: Added
	`const char *' argument.
	(class _Jv_JNIEnv) [DefineClass]: Likewise.

Index: jni.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni.cc,v
retrieving revision 1.67
diff -u -r1.67 jni.cc
--- jni.cc 19 Nov 2002 21:23:27 -0000 1.67
+++ jni.cc 3 Dec 2002 03:45:05 -0000
@@ -428,13 +428,14 @@
 }
 
 static jclass
-(JNICALL _Jv_JNI_DefineClass) (JNIEnv *env, jobject loader,
+(JNICALL _Jv_JNI_DefineClass) (JNIEnv *env, const char *name, jobject loader,
 		               const jbyte *buf, jsize bufLen)
 {
   try
     {
       loader = unwrap (loader);
 
+      jstring sname = JvNewStringUTF (name);
       jbyteArray bytes = JvNewByteArray (bufLen);
 
       jbyte *elts = elements (bytes);
@@ -443,7 +444,7 @@
       java::lang::ClassLoader *l
 	= reinterpret_cast<java::lang::ClassLoader *> (loader);
 
-      jclass result = l->defineClass (bytes, 0, bufLen);
+      jclass result = l->defineClass (sname, bytes, 0, bufLen);
       return (jclass) wrap_value (env, result);
     }
   catch (jthrowable t)
Index: include/jni.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/jni.h,v
retrieving revision 1.23
diff -u -r1.23 jni.h
--- include/jni.h 19 Nov 2002 21:23:28 -0000 1.23
+++ include/jni.h 3 Dec 2002 03:45:05 -0000
@@ -249,14 +249,15 @@
   _Jv_func reserved3;
 
   jint     (JNICALL *GetVersion)                   (JNIEnv *);
-  jclass   (JNICALL *DefineClass)                  (JNIEnv *, jobject,
-                                                    const jbyte *, jsize);
+  jclass   (JNICALL *DefineClass)                  (JNIEnv *, const char *,
+						    jobject, const jbyte *,
+						    jsize);
   jclass   (JNICALL *FindClass)                    (JNIEnv *, const char *);
 
   jmethodID (JNICALL *FromReflectedMethod)	   (JNIEnv *, jobject);
   jfieldID  (JNICALL *FromReflectedField)	   (JNIEnv *, jobject);
-  jobject   (JNICALL *ToReflectedMethod)	   (JNIEnv *, jclass, jmethodID,
-                                                    jboolean);
+  jobject   (JNICALL *ToReflectedMethod)	   (JNIEnv *, jclass,
+						    jmethodID, jboolean);
 
   jclass   (JNICALL *GetSuperclass)                (JNIEnv *, jclass);
   jboolean (JNICALL *IsAssignableFrom)             (JNIEnv *, jclass, jclass);
@@ -687,8 +688,9 @@
   jint GetVersion ()
   { return p->GetVersion (this); }
 
-  jclass DefineClass (jobject obj0, const jbyte * val1, jsize val2)
-  { return p->DefineClass (this, obj0, val1, val2); }
+  jclass DefineClass (const char *name, jobject obj0, const jbyte * val1,
+		      jsize val2)
+  { return p->DefineClass (this, name, obj0, val1, val2); }
 
   jclass FindClass (const char * val0)
   { return p->FindClass (this, val0); }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]