From 651b728a62bf2cda702270a9ccb78233051da638 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 20 Jun 2018 16:06:18 -0500 Subject: HDFVIEW compound vlen needed vlen_t size --- java/src/hdf/hdf5lib/HDF5Constants.java | 3 +++ java/src/jni/h5Constants.c | 2 ++ java/src/jni/h5dImp.c | 30 ++++++++++++++++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 43109f2..7eddac0 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -623,6 +623,7 @@ public class HDF5Constants { public static final long H5T_UNIX_D64LE = H5T_UNIX_D64LE(); public static final long H5T_VARIABLE = H5T_VARIABLE(); public static final int H5T_VLEN = H5T_VLEN(); + public static final int H5T_VL_T = H5T_VL_T(); public static final int H5Z_CB_CONT = H5Z_CB_CONT(); public static final int H5Z_CB_ERROR = H5Z_CB_ERROR(); public static final int H5Z_CB_FAIL = H5Z_CB_FAIL(); @@ -1825,6 +1826,8 @@ public class HDF5Constants { private static native final int H5T_VLEN(); + private static native final int H5T_VL_T(); + private static native final int H5Z_CB_CONT(); private static native final int H5Z_CB_ERROR(); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 0f4361f..c99745d 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -1231,6 +1231,8 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1VARIABLE(JNIEnv *env, jclass cls) { return (int)H5T_VARIABLE; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1VLEN(JNIEnv *env, jclass cls) { return H5T_VLEN; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5T_1VL_1T(JNIEnv *env, jclass cls) { return sizeof(hvl_t); } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1CONT(JNIEnv *env, jclass cls) { return H5Z_CB_CONT; } diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index 9784055..19013db 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -1002,20 +1002,38 @@ Java_hdf_hdf5lib_H5_H5DreadVL jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) { herr_t status = -1; - htri_t isVlenStr=0; + htri_t isStr = 0; + htri_t isVlenStr = 0; + htri_t isComplex = 0; if (buf == NULL) { h5nullArgument(env, "H5DreadVL: buf is NULL"); } /* end if */ else { - isVlenStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING); - - if (isVlenStr) - h5badArgument(env, "H5DreadVL: type is not variable length non-string"); - else + isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING); + if (H5Tget_class((hid_t)mem_type_id) == H5T_COMPOUND) { + unsigned i; + int nm = H5Tget_nmembers(mem_type_id); + for(i = 0; i 0 || isVlenStr) { status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf); + } + else if (isStr > 0) { + status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, + (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, buf); + } } /* end else */ return (jint)status; -- cgit v0.12