diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-12-08 20:00:04 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-12-09 21:44:38 (GMT) |
commit | 310b42e35af19780000344fa8902c1954659ee58 (patch) | |
tree | 1a70cbbde96b927f2392fcd9efc178c098026c1f /java/src/jni | |
parent | dbd6fb0ba6062f1a48b893f79224c257d3282292 (diff) | |
download | hdf5-310b42e35af19780000344fa8902c1954659ee58.zip hdf5-310b42e35af19780000344fa8902c1954659ee58.tar.gz hdf5-310b42e35af19780000344fa8902c1954659ee58.tar.bz2 |
HDFFV-10876 Merge from develop
Diffstat (limited to 'java/src/jni')
-rw-r--r-- | java/src/jni/h5Constants.c | 14 | ||||
-rw-r--r-- | java/src/jni/h5aImp.c | 8 | ||||
-rw-r--r-- | java/src/jni/h5dImp.c | 8 | ||||
-rw-r--r-- | java/src/jni/h5pFAPLImp.c | 10 | ||||
-rw-r--r-- | java/src/jni/h5rImp.c | 590 | ||||
-rw-r--r-- | java/src/jni/h5rImp.h | 130 | ||||
-rw-r--r-- | java/src/jni/h5sImp.c | 6 | ||||
-rw-r--r-- | java/src/jni/h5sImp.h | 6 | ||||
-rw-r--r-- | java/src/jni/h5tImp.c | 6 | ||||
-rw-r--r-- | java/src/jni/h5tImp.h | 4 | ||||
-rw-r--r-- | java/src/jni/h5util.c | 344 | ||||
-rw-r--r-- | java/src/jni/h5util.h | 1 | ||||
-rw-r--r-- | java/src/jni/nativeData.c | 40 |
13 files changed, 1004 insertions, 163 deletions
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 9f52b3c..537cdcf 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -811,13 +811,25 @@ Java_hdf_hdf5lib_HDF5Constants_H5R_1BADTYPE(JNIEnv *env, jclass cls) { return H5 JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1MAXTYPE(JNIEnv *env, jclass cls) { return H5R_MAXTYPE; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5R_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_REF_BUF_SIZE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJ_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_OBJ_REF_BUF_SIZE; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1DSET_1REG_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_DSET_REG_REF_BUF_SIZE; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5R_1ATTR(JNIEnv *env, jclass cls) { return H5R_ATTR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT(JNIEnv *env, jclass cls) { return H5R_OBJECT; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT1(JNIEnv *env, jclass cls) { return H5R_OBJECT1; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT2(JNIEnv *env, jclass cls) { return H5R_OBJECT2; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION1(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION1; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION2(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION2; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1ALL(JNIEnv *env, jclass cls) { return H5S_ALL; } @@ -1209,6 +1221,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1DSETREG(JNIEnv *env, jclass cls) { JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1OBJ(JNIEnv *env, jclass cls) { return H5T_STD_REF_OBJ; } JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF(JNIEnv *env, jclass cls) { return H5T_STD_REF; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16BE(JNIEnv *env, jclass cls) { return H5T_STD_U16BE; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16LE(JNIEnv *env, jclass cls) { return H5T_STD_U16LE; } diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index 9f22665..85872b2 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -1304,7 +1304,7 @@ H5AwriteVL_asstr { const char *utf8 = NULL; hsize_t dims[H5S_MAX_RANK]; - jstring jstr; + jstring jstr = NULL; size_t typeSize; size_t i; hid_t sid = H5I_INVALID_HID; @@ -1390,7 +1390,7 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) { - hdset_reg_ref_t *ref_data = NULL; + H5R_ref_t *ref_data = NULL; h5str_t h5str; jstring jstr; jsize i, n; @@ -1405,7 +1405,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_reg_ref: buf length < 0"); } - if (NULL == (ref_data = (hdset_reg_ref_t *) HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t)))) + if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t)))) H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate read buffer"); if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, ref_data)) < 0) @@ -1419,7 +1419,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref for (i = 0; i < n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, ref_data[i], 0, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, (void*)&ref_data[i], 0, 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index b395189..352c047 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -1502,7 +1502,7 @@ H5DwriteVL_asstr (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf) { const char *utf8 = NULL; - jstring obj; + jstring obj = NULL; hbool_t close_mem_space = FALSE; size_t typeSize; size_t i; @@ -1630,7 +1630,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref jlong dataset_id, jlong mem_type_id, jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) { - hdset_reg_ref_t *ref_data = NULL; + H5R_ref_t *ref_data = NULL; h5str_t h5str; jstring jstr; jsize i, n; @@ -1645,7 +1645,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_reg_ref: buf length < 0"); } - if (NULL == (ref_data = (hdset_reg_ref_t *) HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t)))) + if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t)))) H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer"); if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, xfer_plist_id, ref_data)) < 0) @@ -1659,7 +1659,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref for (i = 0; i < n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, &ref_data[i], 0, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, (void*)&ref_data[i], 0, 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 006707a..a627e65 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -425,6 +425,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_hdfs_fapl_t", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V", args, ret_obj); #else + UNUSED(fapl_id); + H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_hdfs: not implemented"); #endif /* H5_HAVE_LIBHDFS */ @@ -532,6 +534,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs if (H5Pset_fapl_hdfs((hid_t)fapl_id, &instance) < 0) H5_LIBRARY_ERROR(ENVONLY); #else + UNUSED(fapl_id); + UNUSED(fapl_config); + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_hdfs: not implemented"); #endif /* H5_HAVE_LIBHDFS */ @@ -841,6 +846,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_ros3_fapl_t", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, ret_obj); #else + UNUSED(fapl_id); + H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_ros3: not implemented"); #endif /* H5_HAVE_ROS3_VFD */ @@ -939,6 +946,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 if (H5Pset_fapl_ros3((hid_t)fapl_id, &instance) < 0) H5_LIBRARY_ERROR(ENVONLY); #else + UNUSED(fapl_id); + UNUSED(fapl_config); + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_ros3: not implemented"); #endif /* H5_HAVE_ROS3_VFD */ diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index 1a77fd3..4ad5d5f 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -26,10 +26,596 @@ extern "C" { #include "h5jni.h" #include "h5rImp.h" + +/* H5R: HDF5 1.12 Reference API Functions */ + /* - * Pointer to the JNI's Virtual Machine; used for callback functions. + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate_object + * Signature: (JLjava/lang/String;)[B */ -/* extern JavaVM *jvm; */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Rcreate_1object + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong aid) +{ + const char *refName = NULL; + jbyteArray ref = NULL; + jbyte *refBuf = NULL; + herr_t status = FAIL; + + UNUSED(clss); + + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_object: name is NULL"); + + PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_object: reference name not pinned"); + + if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE))) + H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_object: failed to allocate reference buffer"); + + if ((status = H5Rcreate_object((hid_t)loc_id, refName, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + ENVPTR->SetByteArrayRegion(ENVONLY, ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)refBuf); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + +done: + if (refName) + UNPIN_JAVA_STRING(ENVONLY, name, refName); + if (refBuf) + HDfree(refBuf); + + return ref; +} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1object */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate_region + * Signature: (JLjava/lang/String;J)[B + */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Rcreate_1region + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong space_id, jlong aid) +{ + const char *refName = NULL; + jbyteArray ref = NULL; + jbyte *refBuf = NULL; + herr_t status = FAIL; + + UNUSED(clss); + + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_region: name is NULL"); + + PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_region: reference name not pinned"); + + if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE))) + H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_region: failed to allocate reference buffer"); + + if ((status = H5Rcreate_region((hid_t)loc_id, refName, space_id, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + ENVPTR->SetByteArrayRegion(ENVONLY, ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)refBuf); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + +done: + if (refName) + UNPIN_JAVA_STRING(ENVONLY, name, refName); + if (refBuf) + HDfree(refBuf); + + return ref; +} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1region */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate_attr + * Signature: (JLjava/lang/String;Ljava/lang/String;)[B + */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Rcreate_1attr + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jstring attr_name, jlong aid) +{ + const char *refName = NULL; + const char *attrName = NULL; + jbyteArray ref = NULL; + jbyte *refBuf = NULL; + herr_t status = FAIL; + + UNUSED(clss); + + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_attr: name is NULL"); + if (NULL == attr_name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_attr: attribute name is NULL"); + + PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Rcreate_attr: attribute name not pinned"); + + PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_attr: reference name not pinned"); + + if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE))) + H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate reference buffer"); + + if ((status = H5Rcreate_attr((hid_t)loc_id, refName, attrName, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + ENVPTR->SetByteArrayRegion(ENVONLY, ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)refBuf); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + +done: + if (attrName) + UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName); + if (refName) + UNPIN_JAVA_STRING(ENVONLY, name, refName); + if (refBuf) + HDfree(refBuf); + + return ref; +} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1attr */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rdestroy + * Signature: ([B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Rdestroy + (JNIEnv *env, jclass clss, jbyteArray ref) +{ + jboolean isCopy; + jbyte *refBuf = NULL; + jsize refBufLen; + herr_t status = FAIL; + + UNUSED(clss); + + if (NULL == ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rdestroy: reference is NULL"); + + if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdestroy: reference array length < 0"); + } + + PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rdestroy: reference buffer not pinned"); + + if ((status = H5Rdestroy((const H5R_ref_t *)refBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + if (refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (status < 0) ? JNI_ABORT : 0); +} /* end Java_hdf_hdf5lib_H5_H5Rdestroy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_type + * Signature: ([B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1type + (JNIEnv *env, jclass clss, jbyteArray ref) +{ + jboolean isCopy; + jbyte *refBuf = NULL; + jsize refBufLen; + H5R_type_t ref_type = -1; + + UNUSED(clss); + + if (NULL == ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_type: reference is NULL"); + + if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_type: reference array length < 0"); + } + + PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_type: reference buffer not pinned"); + + if ((ref_type = H5Rget_type((const H5R_ref_t *)refBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + if (refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (ref_type < 0) ? JNI_ABORT : 0); + + return (jint)ref_type; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Requal + * Signature: ([B[B)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Requal + (JNIEnv *env, jclass clss, jbyteArray ref1, jbyteArray ref2) +{ + jboolean isCopy; + jbyte *refBuf1 = NULL; + jbyte *refBuf2 = NULL; + jsize refBufLen; + htri_t bval = JNI_FALSE; + herr_t status = FAIL; + + UNUSED(clss); + + if (NULL == ref1) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference1 is NULL"); + + if (NULL == ref2) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference2 is NULL"); + + if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref1)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference1 array length < 0"); + } + + PIN_BYTE_ARRAY(ENVONLY, ref1, refBuf1, &isCopy, "H5Requal: reference1 buffer not pinned"); + + if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref2)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference2 array length < 0"); + } + + PIN_BYTE_ARRAY(ENVONLY, ref2, refBuf2, &isCopy, "H5Requal: reference2 buffer not pinned"); + + if ((bval = H5Requal((const H5R_ref_t *)refBuf1, (const H5R_ref_t *)refBuf2)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + status = bval; + + bval = (bval > 0) ? JNI_TRUE : JNI_FALSE; + +done: + if (refBuf2) + UNPIN_BYTE_ARRAY(ENVONLY, ref2, refBuf2, (status < 0) ? JNI_ABORT : 0); + if (refBuf1) + UNPIN_BYTE_ARRAY(ENVONLY, ref1, refBuf1, (status < 0) ? JNI_ABORT : 0); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Requal */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcopy + * Signature: ([B)[B + */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Rcopy + (JNIEnv *env, jclass clss, jbyteArray src_ref) +{ + jboolean isCopy; + jbyte *src_refBuf = NULL; + jsize refBufLen; + jbyteArray dst_ref = NULL; + jbyte *dst_refBuf = NULL; + herr_t status = FAIL; + + UNUSED(clss); + + if (NULL == src_ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcopy: src reference is NULL"); + + if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, src_ref)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcopy: src reference array length < 0"); + } + + PIN_BYTE_ARRAY(ENVONLY, src_ref, src_refBuf, &isCopy, "H5Rcopy: src reference buffer not pinned"); + + if (NULL == (dst_refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE))) + H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate dst reference buffer"); + + if ((status = H5Rcopy((const H5R_ref_t *)src_refBuf, (const H5R_ref_t *)dst_refBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (dst_ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + ENVPTR->SetByteArrayRegion(ENVONLY, dst_ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)dst_refBuf); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + +done: + if (src_refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, src_ref, src_refBuf, (status < 0) ? JNI_ABORT : 0); + if (dst_refBuf) + HDfree(dst_refBuf); + + return dst_ref; +} /* end Java_hdf_hdf5lib_H5_H5Rcopy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ropen_object + * Signature: ([BJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ropen_1object + (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id) +{ + jboolean isCopy; + jbyte *refBuf = NULL; + jsize refBufLen; + hid_t retVal = H5I_INVALID_HID; + + UNUSED(clss); + + if (NULL == ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ropen_object: reference is NULL"); + + if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ropen_object: reference array length < 0"); + } + + PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Ropen_object: reference buffer not pinned"); + + if ((retVal = H5Ropen_object((const H5R_ref_t *)refBuf, (hid_t)rapl_id, (hid_t)oapl_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + if (refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Ropen_1object */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ropen_region + * Signature: ([BJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ropen_1region + (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id) +{ + jboolean isCopy; + jbyte *refBuf = NULL; + jsize refBufLen; + hid_t retVal = H5I_INVALID_HID; + + UNUSED(clss); + + if (NULL == ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ropen_region: reference is NULL"); + + if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ropen_region: reference array length < 0"); + } + + PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Ropen_region: reference buffer not pinned"); + + if ((retVal = H5Ropen_region((const H5R_ref_t *)refBuf, (hid_t)rapl_id, (hid_t)oapl_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + if (refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Ropen_1region */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ropen_attr + * Signature: ([BJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ropen_1attr + (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong aapl_id) +{ + jboolean isCopy; + jbyte *refBuf = NULL; + jsize refBufLen; + hid_t retVal = H5I_INVALID_HID; + + UNUSED(clss); + + if (NULL == ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ropen_attr: reference is NULL"); + + if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ropen_attr: reference array length < 0"); + } + + PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Ropen_attr: reference buffer not pinned"); + + if ((retVal = H5Ropen_attr((const H5R_ref_t *)refBuf, (hid_t)rapl_id, (hid_t)aapl_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + if (refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Ropen_1attr */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_obj_type3 + * Signature: ([BJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3 + (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id) +{ + H5O_type_t object_info; + jboolean isCopy; + jbyte *refBuf = NULL; + int retVal = -1; + + UNUSED(clss); + + if (NULL == ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type3: reference buffer is NULL"); + + PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_type3: reference buffer not pinned"); + + if ((retVal = H5Rget_obj_type3((const H5R_ref_t *)refBuf, (hid_t)rapl_id, &object_info)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (retVal >= 0) + retVal = object_info; + +done: + if (refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_file_name + * Signature: ([B)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1file_1name + (JNIEnv *env, jclass clss, jbyteArray ref) +{ + jboolean isCopy; + jbyte *refBuf = NULL; + jstring str = NULL; + ssize_t buf_size; + ssize_t check_size = -1; + char *namePtr = NULL; + + UNUSED(clss); + + if (NULL == ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_file_name: reference buffer is NULL"); + + PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_file_name: reference buffer not pinned"); + + /* Get the length of the name */ + if ((buf_size = H5Rget_file_name((const H5R_ref_t *)refBuf, NULL, 0)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_file_name: malloc failed"); + + if ((check_size = H5Rget_file_name((const H5R_ref_t *)refBuf, namePtr, (size_t)buf_size + 1)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + namePtr[buf_size] = '\0'; + + if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + +done: + if (namePtr) + HDfree(namePtr); + if (refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0); + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1file_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_obj_name + * Signature: ([BJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1obj_1name + (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id) +{ + jboolean isCopy; + jbyte *refBuf = NULL; + jstring str = NULL; + ssize_t buf_size; + ssize_t check_size = -1; + char *namePtr = NULL; + + UNUSED(clss); + + if (NULL == ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_name: reference buffer is NULL"); + + PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_name: reference buffer not pinned"); + + /* Get the length of the name */ + if ((buf_size = H5Rget_obj_name((const H5R_ref_t *)refBuf, (hid_t)rapl_id, NULL, 0)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_obj_name: malloc failed"); + + if ((check_size = H5Rget_obj_name((const H5R_ref_t *)refBuf, (hid_t)rapl_id, namePtr, (size_t)buf_size + 1)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + namePtr[buf_size] = '\0'; + + if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + +done: + if (namePtr) + HDfree(namePtr); + if (refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0); + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_attr_name + * Signature: ([B)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1attr_1name + (JNIEnv *env, jclass clss, jbyteArray ref) +{ + jboolean isCopy; + jbyte *refBuf = NULL; + jstring str = NULL; + ssize_t buf_size; + ssize_t check_size = -1; + char *namePtr = NULL; + + UNUSED(clss); + + if (NULL == ref) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_attr_name: reference buffer is NULL"); + + PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_attr_name: reference buffer not pinned"); + + /* Get the length of the name */ + if ((buf_size = H5Rget_attr_name((const H5R_ref_t *)refBuf, NULL, 0)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) + H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_attr_name: malloc failed"); + + if ((check_size = H5Rget_attr_name((const H5R_ref_t *)refBuf, namePtr, (size_t)buf_size + 1)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + namePtr[buf_size] = '\0'; + + if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + +done: + if (namePtr) + HDfree(namePtr); + if (refBuf) + UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0); + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1attr_1name */ + +/* H5R: HDF5 1.8 Reference API Functions */ /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h index e28329b..3bdb266 100644 --- a/java/src/jni/h5rImp.h +++ b/java/src/jni/h5rImp.h @@ -21,6 +21,136 @@ extern "C" { #endif /* __cplusplus */ +/* H5R: HDF5 1.12 Reference API Functions */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate_object + * Signature: (JLjava/lang/String;)[B + */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Rcreate_1object + (JNIEnv *, jclass, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate_region + * Signature: (JLjava/lang/String;J)[B + */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Rcreate_1region + (JNIEnv *, jclass, jlong, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate_attr + * Signature: (JLjava/lang/String;Ljava/lang/String;)[B + */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Rcreate_1attr + (JNIEnv *, jclass, jlong, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rdestroy + * Signature: ([B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Rdestroy + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_type + * Signature: ([B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1type + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Requal + * Signature: ([B[B)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Requal + (JNIEnv *, jclass, jbyteArray, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcopy + * Signature: ([B)[B + */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Rcopy + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ropen_object + * Signature: ([BJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ropen_1object + (JNIEnv *, jclass, jbyteArray, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ropen_region + * Signature: ([BJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ropen_1region + (JNIEnv *, jclass, jbyteArray, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ropen_attr + * Signature: ([BJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ropen_1attr + (JNIEnv *, jclass, jbyteArray, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_obj_type3 + * Signature: ([BJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3 + (JNIEnv *, jclass, jbyteArray, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_file_name + * Signature: ([B)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1file_1name + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_obj_name + * Signature: ([BJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1obj_1name + (JNIEnv *, jclass, jbyteArray, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_attr_name + * Signature: ([B)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1attr_1name + (JNIEnv *, jclass, jbyteArray); + +/* H5R: HDF5 1.8 Reference API Functions */ + /* * Class: hdf_hdf5lib_H5 * Method: H5Rcreate diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index eedd42e..c703e90 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -162,9 +162,9 @@ done: } /* end Java_hdf_hdf5lib_H5__1H5Scopy */ #ifdef notdef -// 10/28/99 -- added code to copy the array -- this is not used, -// but serves as a reminder in case we try to implement this in -// the future.... +/* 10/28/99 -- added code to copy the array -- this is not used, + * but serves as a reminder in case we try to implement this in + */ the future.... /* * Note: the argument coord is actually long coord[][], which has been * flattened by the caller. diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h index 141e504..87661e3 100644 --- a/java/src/jni/h5sImp.h +++ b/java/src/jni/h5sImp.h @@ -49,9 +49,9 @@ Java_hdf_hdf5lib_H5__1H5Scopy (JNIEnv *, jclass, jlong); #ifdef notdef -// 10/28/99 -- added code to copy the array -- this is not used, -// but serves as a reminder in case we try to implement this in -// the future.... +/* 10/28/99 -- added code to copy the array -- this is not used, + * but serves as a reminder in case we try to implement this in + */ the future.... /* * Note: the argument coord is actually long coord[][], which has been * flattened by the caller. diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 3302b7d..1adff3c 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -981,9 +981,9 @@ done: /* * Class: hdf_hdf5lib_H5 * Method: H5Treclaim - * Signature: (JJJ[B)I + * Signature: (JJJ[B)V */ -JNIEXPORT jint JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Treclaim (JNIEnv *env, jclass clss, jlong type_id, jlong space_id, jlong xfer_plist_id, jbyteArray buf) @@ -1005,8 +1005,6 @@ Java_hdf_hdf5lib_H5_H5Treclaim done: if (pinBuf) UNPIN_BYTE_ARRAY(ENVONLY, buf, pinBuf, (status < 0) ? JNI_ABORT : 0); - - return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Treclaim */ /* diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h index a63969b..78e4561 100644 --- a/java/src/jni/h5tImp.h +++ b/java/src/jni/h5tImp.h @@ -402,9 +402,9 @@ Java_hdf_hdf5lib_H5_H5Tpack /* * Class: hdf_hdf5lib_H5 * Method: H5Treclaim - * Signature: (JJJ[B)I + * Signature: (JJJ[B)V */ -JNIEXPORT jint JNICALL +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Treclaim (JNIEnv*, jclass, jlong, jlong, jlong, jbyteArray); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 700f75f..5f1bccb 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -71,6 +71,12 @@ static int render_bin_output_region_data_points(FILE *stream, hid_t region_s static int render_bin_output_region_points(FILE *stream, hid_t region_space, hid_t region_id, hid_t container); +/* Strings for output */ +#define H5_TOOLS_GROUP "GROUP" +#define H5_TOOLS_DATASET "DATASET" +#define H5_TOOLS_DATATYPE "DATATYPE" +#define H5_TOOLS_ATTRIBUTE "ATTRIBUTE" + /** frees memory held by array of strings */ void h5str_array_free @@ -217,7 +223,7 @@ h5str_convert switch (typeSize) { case sizeof(float): { - float tmp_float = 0.0; + float tmp_float = 0.0f; sscanf(token, "%f", &tmp_float); HDmemcpy(cptr, &tmp_float, sizeof(float)); @@ -625,6 +631,69 @@ done: return retVal; } /* end h5str_convert */ +/*------------------------------------------------------------------------- + * Function: h5str_sprint_reference + * + * Purpose: Object reference -- show the name of the referenced object. + * + * Return: Nothing + *------------------------------------------------------------------------- + */ +void +h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p) +{ + ssize_t buf_size; + char *ref_name = NULL; + const H5R_ref_t *ref_vp = (H5R_ref_t *)ref_p; + + UNUSED(container); + + if (!h5str_append(out_str, " \"")) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + buf_size = H5Rget_file_name(ref_vp, NULL, 0); + if (buf_size) { + ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); + if (H5Rget_file_name(ref_vp, ref_name, buf_size + 1) >= 0) { + ref_name[buf_size] = '\0'; + if (!h5str_append(out_str, ref_name)) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + HDfree(ref_name); + ref_name = NULL; + } + + buf_size = H5Rget_obj_name(ref_vp, H5P_DEFAULT, NULL, 0); + if (buf_size) { + ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); + if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, ref_name, buf_size + 1) >= 0) { + ref_name[buf_size] = '\0'; + if (!h5str_append(out_str, ref_name)) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + HDfree(ref_name); + ref_name = NULL; + } + + if (H5Rget_type(ref_vp) == H5R_ATTR) { + buf_size = H5Rget_attr_name(ref_vp, NULL, 0); + if (buf_size) { + ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); + if (H5Rget_attr_name(ref_vp, ref_name, buf_size + 1) >= 0) { + ref_name[buf_size] = '\0'; + if (!h5str_append(out_str, ref_name)) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + HDfree(ref_name); + ref_name = NULL; + } + } + if (!h5str_append(out_str, "\"")) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); +done: + if (ref_name) + HDfree(ref_name); +} + /* * Prints the value of a data point into a string. * @@ -639,8 +708,11 @@ h5str_sprintf unsigned char *ucptr = (unsigned char *) in_buf; static char fmt_llong[8], fmt_ullong[8]; H5T_class_t tclass = H5T_NO_CLASS; + H5T_str_t pad; size_t typeSize = 0; + H5T_sign_t nsign = H5T_SGN_ERROR; hid_t mtid = H5I_INVALID_HID; + hid_t obj = H5I_INVALID_HID; char *cptr = (char *) in_buf; char *this_str = NULL; int n; @@ -655,12 +727,14 @@ h5str_sprintf H5_LIBRARY_ERROR(ENVONLY); if (!(typeSize = H5Tget_size(tid))) H5_LIBRARY_ERROR(ENVONLY); + if (!(nsign = H5Tget_sign(tid))) + H5_LIBRARY_ERROR(ENVONLY); /* Build default formats for long long types */ if (!fmt_llong[0]) { - if (HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH) < 0) + if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); - if (HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH) < 0) + if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); } /* end if */ @@ -670,7 +744,7 @@ h5str_sprintf switch (typeSize) { case sizeof(float): { - float tmp_float = 0.0; + float tmp_float = 0.0f; HDmemcpy(&tmp_float, cptr, sizeof(float)); @@ -724,27 +798,28 @@ h5str_sprintf case H5T_STRING: { - htri_t is_variable; - char *tmp_str; - - typeSize = 0; + htri_t is_variable; + char *tmp_str; if ((is_variable = H5Tis_variable_str(tid)) < 0) H5_LIBRARY_ERROR(ENVONLY); if (is_variable) { - if (NULL != (tmp_str = *(char **) in_buf)) + /* cp_vp is the pointer into the struct where a `char*' is stored. So we have + * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ + tmp_str = *(char **)in_buf; + if (NULL != tmp_str) typeSize = HDstrlen(tmp_str); } else { tmp_str = cptr; } + pad = H5Tget_strpad(tid); /* Check for NULL pointer for string */ if (!tmp_str) { if (NULL == (this_str = (char *) HDmalloc(5))) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - HDstrncpy(this_str, "NULL", 5); } else { @@ -762,7 +837,6 @@ h5str_sprintf case H5T_INTEGER: { - H5T_sign_t nsign = H5T_SGN_ERROR; if (H5T_SGN_ERROR == (nsign = H5Tget_sign(tid))) H5_LIBRARY_ERROR(ENVONLY); @@ -779,7 +853,7 @@ h5str_sprintf if (NULL == (this_str = (char *) HDmalloc(7))) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsprintf(this_str, "%u", tmp_uchar) < 0) + if (HDsprintf(this_str, "%hhu", tmp_uchar) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); } else { @@ -806,7 +880,7 @@ h5str_sprintf if (NULL == (this_str = (char *) HDmalloc(9))) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsprintf(this_str, "%u", tmp_ushort) < 0) + if (HDsprintf(this_str, "%hu", tmp_ushort) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); } else { @@ -815,7 +889,7 @@ h5str_sprintf if (NULL == (this_str = (char *) HDmalloc(9))) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsprintf(this_str, "%d", tmp_short) < 0) + if (HDsprintf(this_str, "%hd", tmp_short) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); } @@ -984,96 +1058,122 @@ h5str_sprintf break; } - if (H5R_DSET_REG_REF_BUF_SIZE == typeSize) { - H5S_sel_type region_type = H5S_SEL_ERROR; - hid_t region_obj = H5I_INVALID_HID; - hid_t region = H5I_INVALID_HID; - char ref_name[1024]; - - /* - * Dataset region reference -- - * show the type and the referenced object - */ - - /* Get name of the dataset the region reference points to using H5Rget_name */ - if ((region_obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, cptr)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if ((region = H5Rget_region(container, H5R_DATASET_REGION, cptr)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if (expand_data) { - if (H5S_SEL_ERROR == (region_type = H5Sget_select_type(region))) - H5_LIBRARY_ERROR(ENVONLY); - - if (H5S_SEL_POINTS == region_type) { - if (h5str_dump_region_points_data(ENVONLY, out_str, region, region_obj) < 0) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - else { - if (h5str_dump_region_blocks_data(ENVONLY, out_str, region, region_obj) < 0) + if (H5Tequal(tid, H5T_STD_REF)) { + H5O_type_t obj_type; /* Object type */ + H5R_type_t ref_type; /* Reference type */ + const H5R_ref_t *ref_vp = (H5R_ref_t *)cptr; + + ref_type = H5Rget_type(ref_vp); + H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type); + switch (ref_type) { + case H5R_OBJECT1: + { + /* Object references -- show the type and OID of the referenced object. */ + H5O_info_t oi; + + if((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + H5Oget_info2(obj, &oi, H5O_INFO_BASIC); + if(H5Oclose(obj) < 0) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + } + else CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - } - else { - if (H5Rget_name(region_obj, H5R_DATASET_REGION, cptr, (char *)ref_name, 1024) < 0) - H5_LIBRARY_ERROR(ENVONLY); - if (!h5str_append(out_str, ref_name)) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - if (H5S_SEL_ERROR == (region_type = H5Sget_select_type(region))) - H5_LIBRARY_ERROR(ENVONLY); - - if (H5S_SEL_POINTS == region_type) { - if (!h5str_append(out_str, " REGION_TYPE POINT")) + if (NULL == (this_str = (char *) HDmalloc(14))) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + if (HDsprintf(this_str, "%u-", (unsigned) oi.type) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + if (!h5str_append(out_str, this_str)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + HDfree(this_str); + this_str = NULL; + + switch (obj_type) { + case H5O_TYPE_GROUP: + if (!h5str_append(out_str, H5_TOOLS_GROUP)) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_DATASET: + if (!h5str_append(out_str, H5_TOOLS_DATASET)) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_NAMED_DATATYPE: + if (!h5str_append(out_str, H5_TOOLS_DATATYPE)) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + break; + } /* end switch */ + H5Oclose(obj); + h5str_sprint_reference(ENVONLY, out_str, container, ref_vp); + + /* Print OID */ + if (NULL == (this_str = (char *) HDmalloc(64))) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + if (HDsprintf(this_str, "%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + } - if (h5str_dump_region_points(ENVONLY, out_str, region, region_obj) < 0) + break; + case H5R_DATASET_REGION1: + if (!h5str_append(out_str, H5_TOOLS_DATASET)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - else { - if (!h5str_append(out_str, " REGION_TYPE BLOCK")) + h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr); + break; + case H5R_OBJECT2: + switch (obj_type) { + case H5O_TYPE_GROUP: + if (!h5str_append(out_str, H5_TOOLS_GROUP)) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_DATASET: + if (!h5str_append(out_str, H5_TOOLS_DATASET)) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_NAMED_DATATYPE: + if (!h5str_append(out_str, H5_TOOLS_DATATYPE)) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + break; + + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + break; + } /* end switch */ + h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr); + break; + case H5R_DATASET_REGION2: + if (!h5str_append(out_str, H5_TOOLS_DATASET)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - - if (h5str_dump_region_blocks(ENVONLY, out_str, region, region_obj) < 0) + h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr); + break; + case H5R_ATTR: + if (!h5str_append(out_str, H5_TOOLS_ATTRIBUTE)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - } - } - - if (H5Sclose(region) < 0) - H5_LIBRARY_ERROR(ENVONLY); - region = H5I_INVALID_HID; - - if (H5Dclose(region_obj) < 0) - H5_LIBRARY_ERROR(ENVONLY); - region_obj = H5I_INVALID_HID; + h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr); + break; + case H5R_BADTYPE: + case H5R_MAXTYPE: + default: + break; + } /* end switch */ } - else if (H5R_OBJ_REF_BUF_SIZE == typeSize) { - H5O_info_t oi; - hid_t obj = H5I_INVALID_HID; - - /* - * Object references -- show the type and OID of the referenced - * object. - */ - - if (NULL == (this_str = (char *) HDmalloc(64))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - - if ((obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, cptr)) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - if (H5Oget_info2(obj, &oi, H5O_INFO_ALL) < 0) - H5_LIBRARY_ERROR(ENVONLY); - - /* Print object data and close object */ - if (HDsprintf(this_str, "%u-%lu", (unsigned) oi.type, oi.addr) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); - - if (H5Oclose(obj) < 0) - H5_LIBRARY_ERROR(ENVONLY); - obj = H5I_INVALID_HID; + else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { + /* (H5R_DSET_REG_REF_BUF_SIZE == typeSize) */ + H5_LIBRARY_ERROR(ENVONLY); + } + else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { + /* (H5R_OBJ_REF_BUF_SIZE == typeSize) */ + H5_LIBRARY_ERROR(ENVONLY); } break; @@ -2204,20 +2304,28 @@ h5str_render_bin_output case H5T_REFERENCE: { - if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { + if (H5Tequal(tid, H5T_STD_REF)) { + hid_t region_id = H5I_INVALID_HID; + hid_t region_space = H5I_INVALID_HID; H5S_sel_type region_type; - hid_t region_id, region_space; /* Region data */ for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; - - if ((region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem)) < 0) + if((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) continue; - - if ((region_space = H5Rget_region(container, H5R_DATASET_REGION, mem)) < 0) { + else { + if((region_space = H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) { + region_type = H5Sget_select_type(region_space); + if (region_type == H5S_SEL_POINTS) + ret_value = render_bin_output_region_points(stream, region_space, region_id, container); + else + ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container); + } + H5Sclose(region_space); + } /* end if (region_space >= 0) */ H5Dclose(region_id); - continue; } if ((region_type = H5Sget_select_type(region_space)) < 0) { @@ -2225,19 +2333,13 @@ h5str_render_bin_output H5Dclose(region_id); continue; } - - if (region_type == H5S_SEL_POINTS) - ret_value = render_bin_output_region_points(stream, region_space, region_id, container); - else - ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container); - - H5Sclose(region_space); - H5Dclose(region_id); - if (ret_value < 0) break; } } + else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { + ; + } else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { ; } @@ -3091,15 +3193,15 @@ done: } /* end Java_hdf_hdf5lib_H5_H5Dcopy */ /* -///////////////////////////////////////////////////////////////////////////////// -// -// -// Add these methods so that we don't need to call H5Gget_objtype_by_idx -// in a loop to get information for all the objects in a group, which takes -// a lot of time to finish if the number of objects is more than 10,000 -// -///////////////////////////////////////////////////////////////////////////////// -*/ + * ///////////////////////////////////////////////////////////////////////////////// + * // + * // + * // Add these methods so that we don't need to call H5Gget_objtype_by_idx + * // in a loop to get information for all the objects in a group, which takes + * // a lot of time to finish if the number of objects is more than 10,000 + * // + * ///////////////////////////////////////////////////////////////////////////////// + */ #ifdef __cplusplus herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h index e5f0d0b..c26cd5d 100644 --- a/java/src/jni/h5util.h +++ b/java/src/jni/h5util.h @@ -40,6 +40,7 @@ extern void h5str_free(h5str_t *str); extern void h5str_resize(h5str_t *str, size_t new_len); extern char* h5str_append(h5str_t *str, const char* cstr); extern size_t h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset); +extern void h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p); extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, int expand_data); extern void h5str_array_free(char **strs, size_t len); extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order); diff --git a/java/src/jni/nativeData.c b/java/src/jni/nativeData.c index 947f843..ad01b01 100644 --- a/java/src/jni/nativeData.c +++ b/java/src/jni/nativeData.c @@ -101,7 +101,7 @@ JNIEXPORT jfloatArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B (JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ { - jfloatArray rarray; + jfloatArray rarray = NULL; jboolean bb; jfloat *farray = NULL; jfloat *iap = NULL; @@ -152,7 +152,7 @@ JNIEXPORT jshortArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B (JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ { - jshortArray rarray; + jshortArray rarray = NULL; jboolean bb; jshort *sarray = NULL; jshort *iap = NULL; @@ -203,7 +203,7 @@ JNIEXPORT jlongArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B (JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ { - jlongArray rarray; + jlongArray rarray = NULL; jboolean bb; jlong *larray = NULL; jlong *iap = NULL; @@ -254,7 +254,7 @@ JNIEXPORT jdoubleArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B (JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ { - jdoubleArray rarray; + jdoubleArray rarray = NULL; jboolean bb; jdouble *darray = NULL; jdouble *iap = NULL; @@ -305,7 +305,7 @@ JNIEXPORT jintArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ { - jintArray rarray; + jintArray rarray = NULL; jboolean bb; jint *iarray = NULL; jint *iap = NULL; @@ -357,7 +357,7 @@ JNIEXPORT jshortArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ { - jshortArray rarray; + jshortArray rarray = NULL; jboolean bb; jshort *sarray = NULL; jshort *iap = NULL; @@ -409,7 +409,7 @@ JNIEXPORT jfloatArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ { - jfloatArray rarray; + jfloatArray rarray = NULL; jboolean bb; jfloat *farray = NULL; jfloat *iap = NULL; @@ -461,7 +461,7 @@ JNIEXPORT jlongArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ { - jlongArray rarray; + jlongArray rarray = NULL; jboolean bb; jlong *larray = NULL; jlong *iap = NULL; @@ -513,7 +513,7 @@ JNIEXPORT jdoubleArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B (JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ { - jdoubleArray rarray; + jdoubleArray rarray = NULL; jboolean bb; jdouble *darray = NULL; jdouble *iap = NULL; @@ -565,7 +565,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I (JNIEnv *env, jclass clss, jint start, jint len, jintArray idata) /* IN: array of int */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jbyte *barray = NULL; jbyte *bap = NULL; @@ -627,7 +627,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S (JNIEnv *env, jclass clss, jint start, jint len, jshortArray sdata) /* IN: array of short */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jshort *ip = NULL; jshort *sarr = NULL; @@ -689,7 +689,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F (JNIEnv *env, jclass clss, jint start, jint len, jfloatArray fdata) /* IN: array of float */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jfloat *ip = NULL; jfloat *farr = NULL; @@ -751,7 +751,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D (JNIEnv *env, jclass clss, jint start, jint len, jdoubleArray ddata) /* IN: array of double */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jdouble *ip = NULL; jdouble *darr = NULL; @@ -813,7 +813,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J (JNIEnv *env, jclass clss, jint start, jint len, jlongArray ldata) /* IN: array of long */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jlong *ip = NULL; jlong *larr = NULL; @@ -875,7 +875,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_intToByte__I (JNIEnv *env, jclass clss, jint idata) /* IN: int */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jbyte *barray = NULL; jbyte *bap = NULL; @@ -911,7 +911,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_floatToByte__F (JNIEnv *env, jclass clss, jfloat fdata) /* IN: float */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jbyte *barray = NULL; jbyte *bap = NULL; @@ -947,7 +947,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_shortToByte__S (JNIEnv *env, jclass clss, jshort sdata) /* IN: short */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jbyte *barray = NULL; jbyte *bap = NULL; @@ -983,7 +983,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D (JNIEnv *env, jclass clss, jdouble ddata) /* IN: double */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jbyte *barray = NULL; jbyte *bap = NULL; @@ -1019,7 +1019,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_longToByte__J (JNIEnv *env, jclass clss, jlong ldata) /* IN: long */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jbyte *barray = NULL; jbyte *bap = NULL; @@ -1055,7 +1055,7 @@ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToByte__B (JNIEnv *env, jclass clss, jbyte bdata) /* IN: byte */ { - jbyteArray rarray; + jbyteArray rarray = NULL; jboolean bb; jbyte *barray = NULL; jbyte *bap = NULL; |