mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
[svn-r4179] Purpose:
Documentation Description: H5Tget_member_type in v1.2.x returns the base type of array fields in compound datatypes, not an array type itself. Solution: Changed to emulate this behavior in v1.4.x when the --enable-hdf5v1_2 flag is given during configuration. Platforms tested: FreeBSD 4.3 (hawkwind)
This commit is contained in:
parent
a631467c1b
commit
d7bb1d0c07
23
src/H5T.c
23
src/H5T.c
@ -3548,12 +3548,35 @@ H5Tget_member_type(hid_t type_id, int membno)
|
||||
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number");
|
||||
}
|
||||
|
||||
#ifdef WANT_H5_V1_2_COMPAT
|
||||
/* HDF5-v1.2.x returns the base type of an array field, not the array
|
||||
* field itself. Emulate this difference. - QAK
|
||||
*/
|
||||
if(dt->u.compnd.memb[membno].type->type==H5T_ARRAY) {
|
||||
/* Copy parent's data type into an atom */
|
||||
if (NULL == (memb_dt = H5T_copy(dt->u.compnd.memb[membno].type->parent,
|
||||
H5T_COPY_REOPEN))) {
|
||||
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
|
||||
"unable to copy member data type");
|
||||
}
|
||||
} /* end if */
|
||||
else {
|
||||
/* Copy data type into an atom */
|
||||
if (NULL == (memb_dt = H5T_copy(dt->u.compnd.memb[membno].type,
|
||||
H5T_COPY_REOPEN))) {
|
||||
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
|
||||
"unable to copy member data type");
|
||||
}
|
||||
} /* end if */
|
||||
|
||||
#else /* WANT_H5_V1_2_COMPAT */
|
||||
/* Copy data type into an atom */
|
||||
if (NULL == (memb_dt = H5T_copy(dt->u.compnd.memb[membno].type,
|
||||
H5T_COPY_REOPEN))) {
|
||||
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
|
||||
"unable to copy member data type");
|
||||
}
|
||||
#endif /* WANT_H5_V1_2_COMPAT */
|
||||
if ((memb_type_id = H5I_register(H5I_DATATYPE, memb_dt)) < 0) {
|
||||
H5T_close(memb_dt);
|
||||
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL,
|
||||
|
Loading…
Reference in New Issue
Block a user