diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/src/hdf/hdf5lib/H5.java | 4 | ||||
-rw-r--r-- | java/src/jni/h5Constants.c | 13 | ||||
-rw-r--r-- | java/src/jni/h5pDCPLImp.c | 20 | ||||
-rw-r--r-- | java/src/jni/h5plImp.c | 26 | ||||
-rw-r--r-- | java/src/jni/h5rImp.c | 16 | ||||
-rw-r--r-- | java/src/jni/h5util.c | 10 | ||||
-rw-r--r-- | java/src/jni/h5vlImp.c | 60 | ||||
-rw-r--r-- | java/src/jni/h5vlImp.h | 22 | ||||
-rw-r--r-- | java/test/TestH5VL.java | 26 | ||||
-rw-r--r-- | java/test/testfiles/JUnit-TestH5VL.txt | 3 |
10 files changed, 145 insertions, 55 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 5b704dd..872fbc7 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -10895,9 +10895,11 @@ public class H5 implements java.io.Serializable { /// VOL Connector Functionality public synchronized static native long H5VLregister_connector_by_name(String connector_name, long vipl_id); public synchronized static native long H5VLregister_connector_by_value(int connector_value, long vipl_id); - public synchronized static native boolean H5VLis_connector_registered(String name); + public synchronized static native boolean H5VLis_connector_registered_by_name(String name); + public synchronized static native boolean H5VLis_connector_registered_by_value(int connector_value); public synchronized static native long H5VLget_connector_id(long object_id); public synchronized static native long H5VLget_connector_id_by_name(String name); + public synchronized static native long H5VLget_connector_id_by_value(int connector_value); public synchronized static native String H5VLget_connector_name(long object_id); public synchronized static native void H5VLclose(long connector_id); public synchronized static native void H5VLunregister_connector(long connector_id); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 77a5d18..8fdca35 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -26,9 +26,8 @@ extern "C" { #include <stdlib.h> #include "h5jni.h" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#pragma GCC diagnostic ignored "-Wunused-parameter" +H5_GCC_DIAG_OFF(missing-prototypes) +H5_GCC_DIAG_OFF(unused-parameter) JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1QUARTER_1HADDR_1MAX(JNIEnv *env, jclass cls) { return (hsize_t)HADDR_MAX/4; } @@ -366,8 +365,7 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1CANCELED(JNIEnv *env, jclass cls) { return H5ES_STATUS_CANCELED; } /* Java does not have unsigned native types */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" +H5_GCC_DIAG_OFF(sign-conversion) JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1CREAT(JNIEnv *env, jclass cls) { return H5F_ACC_CREAT; } JNIEXPORT jint JNICALL @@ -384,7 +382,7 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1READ(JNIEnv *env, jclass cls) { return H5F_ACC_SWMR_READ; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1WRITE(JNIEnv *env, jclass cls) { return H5F_ACC_SWMR_WRITE; } -#pragma GCC diagnostic pop +H5_GCC_DIAG_ON(sign-conversion) JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_CLOSE_DEFAULT; } @@ -1412,7 +1410,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5Z_1SCALEOFFSET_1USER_1NPARMS(JNIEnv *env, jclas JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ALL(JNIEnv *env, jclass cls) { return H5Z_FILTER_ALL; } -#pragma GCC diagnostic pop +H5_GCC_DIAG_ON(missing-prototypes) +H5_GCC_DIAG_ON(unused-parameter) #ifdef __cplusplus } /* end extern "C" */ diff --git a/java/src/jni/h5pDCPLImp.c b/java/src/jni/h5pDCPLImp.c index c43079f..f5bbcb1 100644 --- a/java/src/jni/h5pDCPLImp.c +++ b/java/src/jni/h5pDCPLImp.c @@ -1237,7 +1237,7 @@ done: */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname - (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) + (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx) { ssize_t buf_size; char *dname = NULL; @@ -1246,13 +1246,13 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname UNUSED(clss); /* get the length of the filename */ - if ((buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, NULL, 0)) < 0) + if ((buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t) idx, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); if (NULL == (dname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_dsetname: memory allocation failed"); - if (H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, dname, (size_t)buf_size + 1) < 0) + if (H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t) idx, dname, (size_t)buf_size + 1) < 0) H5_LIBRARY_ERROR(ENVONLY); dname[buf_size] = '\0'; @@ -1275,7 +1275,7 @@ done: */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename - (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) + (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx) { ssize_t buf_size; char *fname = NULL; @@ -1284,13 +1284,13 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename UNUSED(clss); /* get the length of the filename */ - if ((buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, NULL, 0)) < 0) + if ((buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t) idx, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); if (NULL == (fname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_filename: memory allocation failed"); - if (H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, fname, (size_t)buf_size + 1) < 0) + if (H5Pget_virtual_filename((hid_t)dcpl_id, (size_t) idx, fname, (size_t)buf_size + 1) < 0) H5_LIBRARY_ERROR(ENVONLY); fname[buf_size] = '\0'; @@ -1313,13 +1313,13 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace - (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) + (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx) { hid_t space_id = H5I_INVALID_HID; UNUSED(clss); - if ((space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t)index)) < 0) + if ((space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t) idx)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -1333,13 +1333,13 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace - (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) + (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx) { hid_t space_id = H5I_INVALID_HID; UNUSED(clss); - if ((space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t)index)) < 0) + if ((space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t) idx)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index b43b532..ce42842 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -129,7 +129,7 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLreplace - (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint index) + (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint idx) { const char *newPath = NULL; herr_t retVal = FAIL; @@ -139,12 +139,12 @@ Java_hdf_hdf5lib_H5_H5PLreplace if (NULL == plugin_path) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLreplace: new path is NULL"); - if (index < 0) + if (idx < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLreplace: index < 0"); PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLreplace: new path not pinned"); - if ((retVal = H5PLreplace(newPath, (unsigned) index)) < 0) + if ((retVal = H5PLreplace(newPath, (unsigned) idx)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -159,7 +159,7 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLinsert - (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint index) + (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint idx) { const char *newPath = NULL; herr_t retVal = FAIL; @@ -169,12 +169,12 @@ Java_hdf_hdf5lib_H5_H5PLinsert if (NULL == plugin_path) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLinsert: new path is NULL"); - if (index < 0) + if (idx < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLinsert: index < 0"); PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLinsert: new path not pinned"); - if ((retVal = H5PLinsert(newPath, (unsigned) index)) < 0) + if ((retVal = H5PLinsert(newPath, (unsigned) idx)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -189,14 +189,14 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLremove - (JNIEnv *env, jclass clss, jint index) + (JNIEnv *env, jclass clss, jint idx) { UNUSED(clss); - if (index < 0) + if (idx < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLremove: index < 0"); - if (H5PLremove((unsigned) index) < 0) + if (H5PLremove((unsigned) idx) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -210,7 +210,7 @@ done: */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5PLget - (JNIEnv *env, jclass clss, jint index) + (JNIEnv *env, jclass clss, jint idx) { jstring str = NULL; ssize_t buf_size; @@ -218,17 +218,17 @@ Java_hdf_hdf5lib_H5_H5PLget UNUSED(clss); - if (index < 0) + if (idx < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLget: index < 0"); /* Get the length of the name */ - if ((buf_size = H5PLget((unsigned) index, NULL, 0)) < 0) + if ((buf_size = H5PLget((unsigned) idx, NULL, 0)) < 0) H5_LIBRARY_ERROR(ENVONLY); if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5PLget: failed to allocate plugin name buffer"); - if ((H5PLget((unsigned) index, aName, (size_t)buf_size + 1)) < 0) + if ((H5PLget((unsigned) idx, aName, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); aName[buf_size] = '\0'; diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index def27f4..e24fc2a 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -50,7 +50,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1object 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))) + if (NULL == (refBuf = HDcalloc(1, H5R_REF_BUF_SIZE))) H5_OUT_OF_MEMORY_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) @@ -93,7 +93,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1region 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))) + if (NULL == (refBuf = HDcalloc(1, H5R_REF_BUF_SIZE))) H5_OUT_OF_MEMORY_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) @@ -140,7 +140,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1attr 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))) + if (NULL == (refBuf = HDcalloc(1, H5R_REF_BUF_SIZE))) H5_OUT_OF_MEMORY_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) @@ -314,7 +314,7 @@ Java_hdf_hdf5lib_H5_H5Rcopy 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))) + if (NULL == (dst_refBuf = HDcalloc(1, H5R_REF_BUF_SIZE))) H5_OUT_OF_MEMORY_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) @@ -504,7 +504,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1file_1name 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))) + if (NULL == (namePtr = HDmalloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_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) @@ -550,7 +550,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1obj_1name 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))) + if (NULL == (namePtr = HDmalloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_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) @@ -596,7 +596,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1attr_1name 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))) + if (NULL == (namePtr = HDmalloc(sizeof(char) * (size_t)buf_size + 1))) H5_OUT_OF_MEMORY_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) @@ -862,7 +862,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1name PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_name: reference buffer not pinned"); - if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)size + 1))) + if (NULL == (aName = HDmalloc(sizeof(char) * (size_t)size + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_name: failed to allocate referenced object name buffer"); if ((ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, aName, (size_t)size + 1)) < 0) diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 55f7571..f45902f 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -28,6 +28,8 @@ extern "C" { #include "hdf5.h" #include "h5util.h" +#define SKIP_UNUSED_DUMP_ROUTINES + /* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */ int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */ @@ -52,8 +54,10 @@ void *edata; /* Local Prototypes */ /********************/ +#ifndef SKIP_UNUSED_DUMP_ROUTINES static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj); +#endif static int h5str_is_zero(const void *_mem, size_t size); static hid_t h5str_get_native_type(hid_t type); static hid_t h5str_get_little_endian_type(hid_t type); @@ -708,7 +712,6 @@ 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; @@ -814,7 +817,6 @@ h5str_sprintf else { tmp_str = cptr; } - pad = H5Tget_strpad(tid); /* Check for NULL pointer for string */ if (!tmp_str) { @@ -1482,6 +1484,7 @@ done: return ret_value; } /* end h5str_dump_region_blocks_data */ +#ifndef SKIP_UNUSED_DUMP_ROUTINES static int h5str_dump_region_blocks (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) @@ -1569,6 +1572,7 @@ done: return ret_value; } /* end h5str_dump_region_blocks */ +#endif /*------------------------------------------------------------------------- * Purpose: Print the data values from a dataset referenced by region points. @@ -1701,6 +1705,7 @@ done: return ret_value; } /* end h5str_dump_region_points_data */ +#ifndef SKIP_UNUSED_DUMP_ROUTINES static int h5str_dump_region_points (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id) @@ -1776,6 +1781,7 @@ done: return ret_value; } /* end h5str_dump_region_points */ +#endif static int h5str_is_zero diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c index 0fee343..1ead30b 100644 --- a/java/src/jni/h5vlImp.c +++ b/java/src/jni/h5vlImp.c @@ -78,11 +78,11 @@ done: /* * Class: hdf_hdf5lib_H5 - * Method: H5VLis_connector_registered + * Method: H5VLis_connector_registered_by_name * Signature: (Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered +Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name (JNIEnv *env, jclass clss, jobject connector_name) { const char *volName = NULL; @@ -91,11 +91,11 @@ Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered UNUSED(clss); if (NULL == connector_name) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered: VOL connector name is NULL"); + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered_by_name: VOL connector name is NULL"); - PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLis_connector_registered: VOL connector name not pinned"); + PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLis_connector_registered_by_name: VOL connector name not pinned"); - if ((bval = H5VLis_connector_registered(volName)) < 0) + if ((bval = H5VLis_connector_registered_by_name(volName)) < 0) H5_LIBRARY_ERROR(ENVONLY); bval = (bval > 0) ? JNI_TRUE : JNI_FALSE; @@ -105,7 +105,32 @@ done: UNPIN_JAVA_STRING(ENVONLY, connector_name, volName); return (jboolean)bval; -} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered */ +} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLis_connector_registered_by_value + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value + (JNIEnv *env, jclass clss, jint connector_value) +{ + htri_t bval = JNI_FALSE; + + UNUSED(clss); + + if (connector_value < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered_by_value: VOL connector value < 0"); + + if ((bval = H5VLis_connector_registered_by_value((H5VL_class_value_t)connector_value)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + bval = (bval > 0) ? JNI_TRUE : JNI_FALSE; + +done: + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value */ /* * Class: hdf_hdf5lib_H5 @@ -158,6 +183,29 @@ done: /* * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_id_by_value + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value + (JNIEnv *env, jclass clss, jint connector_value) +{ + hid_t status = H5I_INVALID_HID; + + UNUSED(clss); + + if (connector_value < 0) + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5VLget_connector_id_by_value: VOL connector value < 0"); + + if ((status = H5VLget_connector_id_by_value((H5VL_class_value_t)connector_value)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value */ + +/* + * Class: hdf_hdf5lib_H5 * Method: H5VLget_connector_name * Signature: (J)Ljava/lang/String; */ diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h index 6dd7529..a58abef 100644 --- a/java/src/jni/h5vlImp.h +++ b/java/src/jni/h5vlImp.h @@ -40,15 +40,24 @@ Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value /* * Class: hdf_hdf5lib_H5 - * Method: H5VLis_connector_registered + * Method: H5VLis_connector_registered_by_name * Signature: (Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered +Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name (JNIEnv *, jclass, jobject); /* * Class: hdf_hdf5lib_H5 + * Method: H5VLis_connector_registered_by_value + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value + (JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5VLget_connector_id * Signature: (J)J */ @@ -67,6 +76,15 @@ Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name /* * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_id_by_value + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value + (JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5VLget_connector_name * Signature: (J)Ljava/lang/String; */ diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java index d774dbb..bd660d3 100644 --- a/java/test/TestH5VL.java +++ b/java/test/TestH5VL.java @@ -55,15 +55,18 @@ public class TestH5VL { try { boolean is_registered; - is_registered = H5.H5VLis_connector_registered(HDF5Constants.H5VL_NATIVE_NAME); - assertTrue("H5.H5VLis_connector_registered H5VL_NATIVE_NAME", is_registered); + is_registered = H5.H5VLis_connector_registered_by_name(HDF5Constants.H5VL_NATIVE_NAME); + assertTrue("H5.H5VLis_connector_registered_by_name H5VL_NATIVE_NAME", is_registered); - is_registered = H5.H5VLis_connector_registered("FAKE_VOL_NAME"); - assertFalse("H5.H5VLis_connector_registered FAKE_VOL_NAME", is_registered); + is_registered = H5.H5VLis_connector_registered_by_name("FAKE_VOL_NAME"); + assertFalse("H5.H5VLis_connector_registered_by_name FAKE_VOL_NAME", is_registered); + + is_registered = H5.H5VLis_connector_registered_by_value(HDF5Constants.H5VL_NATIVE_VALUE); + assertTrue("H5.H5VLis_connector_registered_by_value H5VL_NATIVE_VALUE", is_registered); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5VLis_connector_registered " + err); + fail("testH5VLnative_init(): " + err); } } @@ -113,6 +116,19 @@ public class TestH5VL { } @Test + public void testH5VLget_connector_id_by_value() { + try { + long native_id = H5.H5VLget_connector_id_by_value(HDF5Constants.H5VL_NATIVE_VALUE); + assertTrue("H5.H5VLget_connector_id_by_value H5VL_NATIVE_VALUE", native_id >= 0); + assertEquals(HDF5Constants.H5VL_NATIVE, native_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5VLget_connector_id_by_value " + err); + } + } + + @Test public void testH5VLget_connector_name() { String H5_FILE = "testFvl.h5"; diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt index f646009..ff94969 100644 --- a/java/test/testfiles/JUnit-TestH5VL.txt +++ b/java/test/testfiles/JUnit-TestH5VL.txt @@ -1,5 +1,6 @@ JUnit version 4.11 .testH5VLget_connector_id_by_name +.testH5VLget_connector_id_by_value .testH5VLget_connector_id .testH5VLnative_init .testH5VLget_connector_name @@ -8,5 +9,5 @@ JUnit version 4.11 Time: XXXX -OK (6 tests) +OK (7 tests) |