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]

Patch: JNI fixes


I'm checking this in on the branch and the trunk.
It fixes a couple JNI bugs.

2001-03-30  Tom Tromey  <tromey@redhat.com>

	* jni.cc (add_char): Correctly encode non-ascii characters.
	(add_char): Define even when INTERPRETER not defined.
	(mangled_name): Likewise.
	(_Jv_GetJNIEnvNewFrame): Likewise.
	(_Jv_LookupJNIMethod): Likewise.

Tom

Index: jni.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni.cc,v
retrieving revision 1.36.4.2
diff -u -r1.36.4.2 jni.cc
--- jni.cc	2001/03/23 19:12:19	1.36.4.2
+++ jni.cc	2001/04/02 19:46:25
@@ -1595,8 +1595,6 @@
 
 
 
-#ifdef INTERPRETER
-
 // Add a character to the buffer, encoding properly.
 static void
 add_char (char *buf, jchar c, int *here)
@@ -1622,8 +1620,8 @@
   else if (c == '/' || c == '.')
     buf[(*here)++] = '_';
   else if ((c >= '0' && c <= '9')
-      || (c >= 'a' && c <= 'z')
-      || (c >= 'A' && c <= 'Z'))
+	   || (c >= 'a' && c <= 'z')
+	   || (c >= 'A' && c <= 'Z'))
     buf[(*here)++] = (char) c;
   else
     {
@@ -1633,7 +1631,7 @@
       for (int i = 0; i < 4; ++i)
 	{
 	  int val = c & 0x0f;
-	  buf[(*here) + 4 - i] = (val > 10) ? ('a' + val - 10) : ('0' + val);
+	  buf[(*here) + 3 - i] = (val > 10) ? ('a' + val - 10) : ('0' + val);
 	  c >>= 4;
 	}
       *here += 4;
@@ -1752,6 +1750,8 @@
 
   return function;
 }
+
+#ifdef INTERPRETER
 
 // This function is the stub which is used to turn an ordinary (CNI)
 // method call into a JNI call.


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