summaryrefslogtreecommitdiffstats
path: root/src/H5Oattribute.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-07-18 02:08:37 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-07-18 02:08:37 (GMT)
commitc55d0f4e1e09e813fec5fcaa0541150c1ee2a36f (patch)
tree9d288066d5140d72c7f27cef72b01274731ab5bd /src/H5Oattribute.c
parent2ed54543c8a45e3315d53ba5c1c44e33a98b5c73 (diff)
downloadhdf5-c55d0f4e1e09e813fec5fcaa0541150c1ee2a36f.zip
hdf5-c55d0f4e1e09e813fec5fcaa0541150c1ee2a36f.tar.gz
hdf5-c55d0f4e1e09e813fec5fcaa0541150c1ee2a36f.tar.bz2
[svn-r13988] Description:
Fix bug where the version of an attribute would change after it was created, causing the amount of space used to encode it to change. Tested on: Mac OS X/32 10.4.10 (amazon) FreeBSD/32 6.2 (duty)
Diffstat (limited to 'src/H5Oattribute.c')
-rw-r--r--src/H5Oattribute.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index b328f5b..2564386 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -878,10 +878,15 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
/* Find correct attribute message to rename */
if(HDstrcmp(((H5A_t *)mesg->native)->name, udata->old_name) == 0) {
+ unsigned old_version = ((H5A_t *)mesg->native)->version; /* Old version of the attribute */
+
/* Change the name for the attribute */
H5MM_xfree(((H5A_t *)mesg->native)->name);
((H5A_t *)mesg->native)->name = H5MM_xstrdup(udata->new_name);
+ /* Recompute the version to encode the attribute with */
+ ((H5A_t *)mesg->native)->version = H5A_get_version(udata->f, ((H5A_t *)mesg->native));
+
/* Mark message as dirty */
mesg->dirty = TRUE;
@@ -896,7 +901,8 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
HDassert(H5O_msg_is_shared(H5O_ATTR_ID, (H5A_t *)mesg->native) == FALSE);
/* Check for attribute message changing size */
- if(HDstrlen(udata->new_name) != HDstrlen(udata->old_name)) {
+ if(HDstrlen(udata->new_name) != HDstrlen(udata->old_name) ||
+ old_version != ((H5A_t *)mesg->native)->version) {
H5A_t *attr; /* Attribute to re-add */
/* Take ownership of the message's native info (the attribute)