This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: jni.cc fixes
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: jni.cc fixes
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 14 Mar 2000 15:02:30 -0700
- Reply-To: tromey at cygnus dot com
This patch fixes a couple bugs that are revelead if you enable
assertions. I'm checking it in.
2000-03-14 Tom Tromey <tromey@cygnus.com>
* jni.cc (mangled_name): Fixed assertion.
(JNI_GetCreatedJavaVMs): Don't comment out `buf_len' argument;
turned assert into actual failure.
Tom
Index: jni.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/jni.cc,v
retrieving revision 1.26
diff -u -r1.26 jni.cc
--- jni.cc 2000/03/07 19:55:24 1.26
+++ jni.cc 2000/03/14 21:57:27
@@ -1606,7 +1606,7 @@
const unsigned char *sig = (const unsigned char *) signature->data;
limit = sig + signature->length;
- JvAssert (signature[0] == '(');
+ JvAssert (sig[0] == '(');
++sig;
while (1)
{
@@ -1958,9 +1958,11 @@
}
jint
-JNI_GetCreatedJavaVMs (JavaVM **vm_buffer, jsize /* buf_len */, jsize *n_vms)
+JNI_GetCreatedJavaVMs (JavaVM **vm_buffer, jsize buf_len, jsize *n_vms)
{
- JvAssert (buf_len > 0);
+ if (buf_len <= 0)
+ return JNI_ERR;
+
// We only support a single VM.
if (the_vm != NULL)
{