From d7bb1d0c0752461dc0e4316c85c72867490b8532 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 10 Jul 2001 15:17:53 -0500 Subject: [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) --- src/H5T.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/H5T.c b/src/H5T.c index 91f7529..8f2862c 100644 --- a/src/H5T.c +++ b/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, -- cgit v0.12