diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2003-09-10 22:59:00 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2003-09-10 22:59:00 (GMT) |
commit | 81c68519658c984e4a0e225c5d54d8e4604f1729 (patch) | |
tree | 476754c48fbf41d92a791636216415ee8d624b41 /src/H5Tcompound.c | |
parent | 1f5e8c2e63a4f3cf34d8f187adc24133caa2d25d (diff) | |
download | hdf5-81c68519658c984e4a0e225c5d54d8e4604f1729.zip hdf5-81c68519658c984e4a0e225c5d54d8e4604f1729.tar.gz hdf5-81c68519658c984e4a0e225c5d54d8e4604f1729.tar.bz2 |
[svn-r7461] Purpose: bug #1017
Description: H5Tpack fails if called twice or datatype is locked. Compound
datatype wasn't expandable.
Platforms tested: h5committest
Diffstat (limited to 'src/H5Tcompound.c')
-rw-r--r-- | src/H5Tcompound.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index 790de46..a571d97 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -325,7 +325,9 @@ H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id) /* Insert */ if (H5T_insert(parent, name, offset, member) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "unable to insert member"); - + + parent->packed = FALSE; + done: FUNC_LEAVE_API(ret_value); } @@ -358,12 +360,18 @@ H5Tpack(hid_t type_id) /* Check args */ if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type"); + /* If datatype has been packed, skip this step and go to done */ + if(dt->packed == TRUE) + HGOTO_DONE(ret_value); if (H5T_STATE_TRANSIENT!=dt->state) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data type is read-only"); /* Pack */ if (H5T_pack(dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack compound data type"); + + /* Indicate datatype has been packed */ + dt->packed = TRUE; done: FUNC_LEAVE_API(ret_value); @@ -484,8 +492,6 @@ H5T_pack(H5T_t *dt) assert(dt); if (H5T_COMPOUND == dt->type) { - assert(H5T_STATE_TRANSIENT==dt->state); - /* Recursively pack the members */ for (i=0; i<dt->u.compnd.nmembs; i++) { if (H5T_pack(dt->u.compnd.memb[i].type) < 0) |