From 0a73b2562ae83e1cfe602fdc69bbb66752bbdc67 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 22 Oct 2006 07:05:34 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/jni.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/ase/awk/jni.c b/ase/awk/jni.c index 1bb5ef17..1ce8fbcc 100644 --- a/ase/awk/jni.c +++ b/ase/awk/jni.c @@ -1,5 +1,5 @@ /* - * $Id: jni.c,v 1.10 2006-10-18 14:02:19 bacon Exp $ + * $Id: jni.c,v 1.11 2006-10-22 07:05:34 bacon Exp $ */ #include @@ -301,6 +301,7 @@ static xp_ssize_t __call_java_read_source ( for (i = 0; i < ret; i++) buf[i] = (xp_char_t)tmp[i]; (*env)->ReleaseCharArrayElements (env, array, tmp, 0); + (*env)->DeleteLocalRef (env, array); return i; } @@ -334,6 +335,7 @@ static xp_ssize_t __call_java_write_source ( ret = -1; } + (*env)->DeleteLocalRef (env, array); return ret; } @@ -363,11 +365,34 @@ static xp_ssize_t __call_java_open_extio ( env, class, meth, "(Ljava/lang/String;)I"); if (mid == 0) return -1; - name_str = (*env)->NewString (env, name, xp_awk_strlen(name)); + name_str = (*env)->NewString ( + env, extio->name, xp_awk_strlen(extio->name)); if (name_str == 0) return -1; ret = (*env)->CallIntMethod (env, obj, mid, name_str); + + (*env)->DeleteLocalRef (env, name_str); */ + jclass extio_class; + jmethodID extio_cons; + jobject extio_object; + + extio_class = (*env)->FindClass (env, "xpkit/xpj/awk/Extio"); + if (extio_class == NULL) return -1; + + extio_cons = (*env)->GetMethodID ( + env, extio_class, "", "(J)V"); + if (extio_cons == NULL) return -1; + + mid = (*env)->GetMethodID ( + env, class, meth, "(Lxpkit/xpj/awk/Extio;)I"); + if (mid == NULL) return -1; + + extio_object = (*env)->NewObject ( + env, extio_class, extio_cons, (jlong)extio); + if (extio_object == NULL) return -1; + + ret = (*env)->CallIntMethod (env, obj, mid, extio_object); } thrown = (*env)->ExceptionOccurred (env); @@ -399,18 +424,18 @@ static xp_ssize_t __call_java_close_extio ( } else { - /* jstring name_str; mid = (*env)->GetMethodID ( env, class, meth, "(Ljava/lang/String;)I"); if (mid == 0) return -1; - name_str = (*env)->NewString (env, name, xp_awk_strlen(name)); + name_str = (*env)->NewString ( + env, extio->name, xp_awk_strlen(extio->name)); if (name_str == 0) return -1; ret = (*env)->CallIntMethod (env, obj, mid, name_str); - */ + (*env)->DeleteLocalRef (env, name_str); } thrown = (*env)->ExceptionOccurred (env); @@ -453,6 +478,7 @@ static xp_ssize_t __call_java_read_extio ( for (i = 0; i < ret; i++) buf[i] = (xp_char_t)tmp[i]; (*env)->ReleaseCharArrayElements (env, array, tmp, 0); + (*env)->DeleteLocalRef (env, array); return ret; } @@ -487,6 +513,7 @@ static xp_ssize_t __call_java_write_extio ( ret = -1; } + (*env)->DeleteLocalRef (env, array); return ret; }