summaryrefslogtreecommitdiffstats
path: root/src/H5Oattribute.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-01-10 04:01:31 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-01-10 04:01:31 (GMT)
commit1f3ffdab86a097c9845357c2f87174671234870e (patch)
tree659e43068677e7a54ab786a74c9bea06c9af9220 /src/H5Oattribute.c
parenta2a3e47d06ce348ce27718b4a3e0e4b156fba6f5 (diff)
downloadhdf5-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/H5Oattribute.c')
-rw-r--r--src/H5Oattribute.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 57cc4ae..237e352 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -957,15 +957,11 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
oh->nattrs++;
/* Append renamed attribute to object header */
- /* (increments the link count on shared components) */
+ /* (doesn't increment the link count on shared components because
+ * attributes no longer have a 'link' callback) */
if(H5O_msg_append_real(udata->f, udata->dxpl_id, oh, H5O_MSG_ATTR, 0, 0, attr, oh_flags_ptr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to relocate renamed attribute in header")
- /* Decrement the link count on shared components */
- /* (to balance all the link count adjustments out) */
- if(H5O_attr_delete(udata->f, udata->dxpl_id, attr, TRUE) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to delete attribute")
-
/* Release the local copy of the attribute */
H5O_msg_free_real(H5O_MSG_ATTR, attr);
} /* end if */
@@ -1324,6 +1320,12 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
if((shared_mesg = H5SM_try_share(loc->file, dxpl_id, H5O_ATTR_ID, &(atable.attrs[u]))) > 0)
/* Mark the message as shared */
mesg_flags |= H5O_MSG_FLAG_SHARED;
+ else if(shared_mesg == 0) {
+ /* Increment reference count on attribute components */
+ /* (so that they aren't deleted when the dense attribute storage is deleted) */
+ if(H5O_attr_link(loc->file, dxpl_id, &(atable.attrs[u])) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count")
+ } /* end if */
else if(shared_mesg < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")