diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-01-10 04:01:31 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-01-10 04:01:31 (GMT) |
commit | 1f3ffdab86a097c9845357c2f87174671234870e (patch) | |
tree | 659e43068677e7a54ab786a74c9bea06c9af9220 /src/H5Oattr.c | |
parent | a2a3e47d06ce348ce27718b4a3e0e4b156fba6f5 (diff) | |
download | hdf5-1f3ffdab86a097c9845357c2f87174671234870e.zip hdf5-1f3ffdab86a097c9845357c2f87174671234870e.tar.gz hdf5-1f3ffdab86a097c9845357c2f87174671234870e.tar.bz2 |
[svn-r13130] Description:
Further tests & bugfixes for shared/committed components of shared/un-
shared attributes using dense/compact storage.
Tested on:
Mac OS X/32 10.4.8 (amazon)
FreeBSD/32 6.1 (duty)
Diffstat (limited to 'src/H5Oattr.c')
-rw-r--r-- | src/H5Oattr.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/H5Oattr.c b/src/H5Oattr.c index aae4858..1358147 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -665,10 +665,19 @@ H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't tell if datatype is shared") if(tri_ret > 0) { - if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg)) - HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't get shared message from datatype") - if(H5SM_try_delete(f, dxpl_id, H5O_DTYPE_ID, &sh_mesg) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "can't remove datatype from heap") + /* Check whether datatype is shared */ + if(H5T_committed(attr->dt)) { + /* Decrement the reference count on the shared datatype, if requested */ + if(adj_link) + if(H5T_link(attr->dt, -1, dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count") + } /* end if */ + else { + if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg)) + HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't get shared message from datatype") + if(H5SM_try_delete(f, dxpl_id, H5O_DTYPE_ID, &sh_mesg) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "can't remove datatype from heap") + } /* end else */ } /* end if */ if((tri_ret = H5O_msg_is_shared(H5O_SDSPACE_ID, attr->ds)) < 0) @@ -681,14 +690,6 @@ H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) HGOTO_ERROR(H5E_ATTR, H5E_SOHM, FAIL, "can't remove dataspace from shared storage") } /* end if */ - /* Check whether datatype is shared */ - if(H5T_committed(attr->dt)) { - /* Decrement the reference count on the shared datatype, if requested */ - if(adj_link) - if(H5T_link(attr->dt, -1, dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count") - } /* end if */ - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_delete() */ @@ -724,17 +725,18 @@ H5O_attr_link(H5F_t *f, hid_t dxpl_id, const void *_mesg) * Otherwise they may be deleted when the attribute * message is deleted. */ - if(H5SM_try_share(f, dxpl_id, H5O_DTYPE_ID, attr->dt) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "error trying to re-share attribute datatype") - if(H5SM_try_share(f, dxpl_id, H5O_SDSPACE_ID, attr->ds) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "error trying to re-share attribute dataspace") - /* Check whether datatype is shared */ if(H5T_committed(attr->dt)) { /* Increment the reference count on the shared datatype */ if(H5T_link(attr->dt, 1, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count") } /* end if */ + else { + if(H5SM_try_share(f, dxpl_id, H5O_DTYPE_ID, attr->dt) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "error trying to re-share attribute datatype") + } /* end else */ + if(H5SM_try_share(f, dxpl_id, H5O_SDSPACE_ID, attr->ds) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "error trying to re-share attribute dataspace") done: FUNC_LEAVE_NOAPI(ret_value) |