summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java3
-rw-r--r--java/src/jni/h5Constants.c2
-rw-r--r--java/src/jni/h5dImp.c30
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 <nm; i++) {
+ hid_t nested_tid = H5Tget_member_type((hid_t)mem_type_id, i);
+ isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND) ||
+ H5Tdetect_class((hid_t)nested_tid, H5T_VLEN);
+ H5Tclose(nested_tid);
+ }
+ }
+ else if (H5Tget_class((hid_t)mem_type_id) == H5T_VLEN) {
+ isVlenStr = 1; /* strings created by H5Tvlen_create( H5T_C_S1) */
+ }
+ if (isStr == 0 || isComplex>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;