summaryrefslogtreecommitdiffstats
path: root/java/src/jni/h5oImp.c
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/jni/h5oImp.c')
-rw-r--r--java/src/jni/h5oImp.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c
index e332615..a52a905 100644
--- a/java/src/jni/h5oImp.c
+++ b/java/src/jni/h5oImp.c
@@ -378,15 +378,16 @@ H5O_iterate_cb
(hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data)
{
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
- jmethodID constructor, mid;
+ jmethodID mid;
jobject cb_info_t = NULL;
jobject visit_callback = wrapper->visit_callback;
+ jobject ret_obj = NULL;
jobject hdrinfobuf;
jobject ihinfobuf1;
jobject ihinfobuf2;
jstring str;
JNIEnv *cbenv = NULL;
- jclass cls;
+ jclass cbcls;
jvalue args[12];
void *op_data = (void *)wrapper->op_data;
jint status = FAIL;
@@ -396,10 +397,10 @@ H5O_iterate_cb
H5_JNI_FATAL_ERROR(CBENVONLY, "H5O_iterate_cb: failed to attach current thread to JVM");
}
- if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I")))
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
@@ -417,41 +418,21 @@ H5O_iterate_cb
args[9].j = (jlong)info->hdr.mesg.shared;
/* Get a reference to the H5_hdr_info_t class */
- if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t")))
- CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-
- /* Get a reference to the constructor; the name is <init> */
- if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(IIIIJJJJJJ)V")))
- CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-
- if (NULL == (hdrinfobuf = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) {
- HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_hdr_info_t: Creation failed\n");
- CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- }
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args, ret_obj);
+ hdrinfobuf = ret_obj;
args[0].j = (jlong)info->meta_size.obj.index_size;
args[1].j = (jlong)info->meta_size.obj.heap_size;
/* Get a reference to the H5_ih_info_t class */
- if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t")))
- CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-
- /* Get a reference to the constructor; the name is <init> */
- if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(JJ)V")))
- CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-
- if (NULL == (ihinfobuf1 = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) {
- HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n");
- CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- }
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ ihinfobuf1 = ret_obj;
args[0].j = (jlong)info->meta_size.attr.index_size;
args[1].j = (jlong)info->meta_size.attr.heap_size;
- if (NULL == (ihinfobuf2 = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) {
- HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n");
- CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- }
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ ihinfobuf2 = ret_obj;
args[0].j = (jlong)info->fileno;
args[1].j = (jlong)info->addr;