HDFVIEW compound vlen needed vlen_t size

This commit is contained in:
Allen Byrne 2018-06-20 16:06:18 -05:00
parent 2ff00b1b93
commit 651b728a62
3 changed files with 29 additions and 6 deletions

View File

@ -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();

View File

@ -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; }

View File

@ -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;