diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Dio.c | 2 | ||||
-rw-r--r-- | src/H5T.c | 22 | ||||
-rw-r--r-- | src/H5Tcompound.c | 5 | ||||
-rw-r--r-- | src/H5Tnative.c | 2 | ||||
-rw-r--r-- | src/H5Tprivate.h | 2 |
5 files changed, 24 insertions, 9 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c index 7fda7b1..62afb22 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -919,7 +919,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, * to detect the type of the reference if it is nested... -QAK */ if (IS_H5FD_MPI(dataset->ent.file) && - H5T_get_class(mem_type)==H5T_REFERENCE && + H5T_get_class(mem_type, TRUE)==H5T_REFERENCE && H5T_get_ref_type(mem_type)==H5R_DATASET_REGION) HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing region reference datatypes yet") @@ -1752,7 +1752,7 @@ H5Tget_class(hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a data type"); /* Set return value */ - ret_value= H5T_get_class(dt); + ret_value= H5T_get_class(dt, FALSE); done: FUNC_LEAVE_API(ret_value); @@ -1778,7 +1778,7 @@ done: *------------------------------------------------------------------------- */ H5T_class_t -H5T_get_class(const H5T_t *dt) +H5T_get_class(const H5T_t *dt, htri_t internal) { H5T_class_t ret_value; @@ -1792,6 +1792,16 @@ H5T_get_class(const H5T_t *dt) else ret_value=dt->shared->type; + /* Externally, a VL string is a string; internally, a VL string is a VL. */ + if(internal) { + ret_value=dt->shared->type; + } else { + if(H5T_IS_VL_STRING(dt->shared)) + ret_value=H5T_STRING; + else + ret_value=dt->shared->type; + } + done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5T_get_class() */ @@ -1827,8 +1837,12 @@ H5Tdetect_class(hid_t type, H5T_class_t cls) if (!(cls>H5T_NO_CLASS && cls<H5T_NCLASSES)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a data type class"); - /* Set return value */ - ret_value=H5T_detect_class(dt,cls); + /* Set return value. Consider VL string as a string for API, as a VL for + * internal use. */ + if(H5T_IS_VL_STRING(dt->shared)) + ret_value = (H5T_STRING==cls); + else + ret_value=H5T_detect_class(dt,cls); done: FUNC_LEAVE_API(ret_value); diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index 46b1773..37c79ed 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -170,8 +170,9 @@ H5Tget_member_class(hid_t type_id, unsigned membno) if (membno >= dt->shared->u.compnd.nmembs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5T_NO_CLASS, "invalid member number") - /* Value */ - ret_value = dt->shared->u.compnd.memb[membno].type->shared->type; + /* Get the type's class. We have to use this function to get type class + * because of the concern of variable-length string. */ + ret_value = H5T_get_class(dt->shared->u.compnd.memb[membno].type, FALSE); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 1ffa45b..686e1e3 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -167,7 +167,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig assert(dtype); - if((h5_class = H5T_get_class(dtype))==H5T_NO_CLASS) + if((h5_class = H5T_get_class(dtype, FALSE))==H5T_NO_CLASS) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class") if((size = H5T_get_size(dtype))==0) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index e09be78..be4110c 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -71,7 +71,7 @@ H5_DLL H5T_t *H5T_open(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); H5_DLL herr_t H5T_close(H5T_t *dt); -H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt); +H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); H5_DLL htri_t H5T_detect_class (const H5T_t *dt, H5T_class_t cls); H5_DLL size_t H5T_get_size(const H5T_t *dt); H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2); |