Hello,
This is a patch I send before, but unfortunately our university mailer
is blackholed, so I try again via gnu.org.
I have tried the latest CVS version of japhar, and after fixing some
things (patch appended), I had managed to run a HelloWorld program.
I used the classes from the blackdown jdk1.2-pre.
I have still problems related to zip files. If java.util.zip is used
libjaphar_zip will cause a segfault. BTW: I head to create a symlink
from libjaphar_zip.so to libjaphar_zip, strange. My zip problems may
be related to the zlib version; I have zlib-1.1.3.
Some explanations:
jninativ: method->jni_call wasn't initialized.
scandir: the returned pointer points to a temporary string, so the
string must be copied to.
interpfunc: the parameters of L2I got swapped.
zextract: I need this patch for zlib-1.1.3.
Jochen
Index: lib/libjni/src/jninativ.c
===================================================================
RCS file: /cvsroot/hungry/java/japhar/lib/libjni/src/jninativ.c,v
retrieving revision 1.22
diff -u -r1.22 jninativ.c
--- jninativ.c 1999/10/25 07:09:58 1.22
+++ jninativ.c 1999/11/10 20:10:59
@@ -83,6 +83,7 @@
printf ("[Registering JNI native method %s.%s]\n", class_name,
method->name);
method->native_func = (NativeFunc)methods[i].fnPtr;
+ method->jni_call = PR_TRUE;
}
}
Index: arch/scandir.c
===================================================================
RCS file: /cvsroot/hungry/java/japhar/arch/scandir.c,v
retrieving revision 1.19
diff -u -r1.19 scandir.c
--- scandir.c 1999/10/24 08:13:40 1.19
+++ scandir.c 1999/11/10 20:10:59
@@ -44,7 +44,7 @@
PRDirEntry **names;
int count = 0;
int pos = 0;
- int result = -1;
+ int error = 0;
if (NULL == d)
return -1;
@@ -61,14 +61,25 @@
while (NULL != (current = PR_ReadDir(d, PR_SKIP_NONE))) {
if ( NULL == select || select(current) ) {
PRDirEntry *copyentry = PR_MALLOC(sizeof(PRDirEntry));
+ if (copyentry == NULL) {
+ error = -1;
+ break;
+ }
+ copyentry->name = PL_strdup(current->name);
+ if (copyentry->name == NULL) {
+ error = -1;
+ break;
+ }
- memcpy(copyentry, current, sizeof(PRDirEntry));
-
names[pos] = copyentry;
pos++;
}
+ }
+ PR_CloseDir(d);
+ if (error) {
+ PR_DELETE(names);
+ return -1;
}
- result = PR_CloseDir(d);
if (pos != count)
names = PR_REALLOC(names, sizeof(struct dirent *)*pos);
Index: lib/libruntime/interpfunc.c
===================================================================
RCS file: /cvsroot/hungry/java/japhar/lib/libruntime/interpfunc.c,v
retrieving revision 1.125
diff -u -r1.125 interpfunc.c
--- interpfunc.c 1999/11/04 10:35:47 1.125
+++ interpfunc.c 1999/11/11 14:21:15
@@ -2046,7 +2046,7 @@
op_stack_pop_long(f->_env->op_stack, lvalue);
- LL_L2I(lvalue, ivalue);
+ LL_L2I(ivalue, lvalue);
op_stack_push_int(f->_env->op_stack, ivalue);
}
Index: lib/libruntime/zextract.c
===================================================================
RCS file: /cvsroot/hungry/java/japhar/lib/libruntime/zextract.c,v
retrieving revision 1.31
diff -u -r1.31 zextract.c
--- zextract.c 1999/10/26 20:13:32 1.31
+++ zextract.c 1999/11/11 14:21:15
@@ -438,8 +438,8 @@
else if (err != Z_OK)
PR_LOG(inflateLm, PR_LOG_DEBUG, ("oops! (inflateInit2() err = %d)\n",
err));
-
- while (zstrm.avail_in > 0) {
+
+ while (err != Z_STREAM_END) {
while (zstrm.avail_out > 0) {
err = inflate(&zstrm, Z_PARTIAL_FLUSH);
@@ -451,7 +451,7 @@
PR_LOG(inflateLm, PR_LOG_DEBUG,
("oops! (inflate(first loop) err = %d)\n", err));
- if (zstrm.avail_in <= 0L) /* "END-of-entry-condition" ? */
+ if (err == Z_STREAM_END) /* "END-of-entry-condition" ? */
break;
PR_LOG(inflateLm, PR_LOG_DEBUG, (" avail_in = %d\n",