summaryrefslogtreecommitdiffstats
path: root/src/H5Oattr.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-02-12 18:47:04 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-02-12 18:47:04 (GMT)
commitfb81174e767b62bcccd45b68611255982e96d449 (patch)
tree55735c9f26b3e1720a061856cd14f497b356e16b /src/H5Oattr.c
parente52b18bf2c3ad7c2a58176617001d05e50cc3f51 (diff)
downloadhdf5-fb81174e767b62bcccd45b68611255982e96d449.zip
hdf5-fb81174e767b62bcccd45b68611255982e96d449.tar.gz
hdf5-fb81174e767b62bcccd45b68611255982e96d449.tar.bz2
[svn-r16473] Purpose: fix problems related to 'self-referential' attributes
Description: When an attribute was created with a datatype or dataspace that was shared in the same object header that the attribute was in, the attribute could not be deleted. Changes made to ensure that the attribute can be deleted both when the attribute is in the object header and when it is shared in the heap. Object header message decode routines now take an "open_oh" parameter to enable them to avoid opening the same object header twice. Tested: jam, smirom (h5committest)
Diffstat (limited to 'src/H5Oattr.c')
-rw-r--r--src/H5Oattr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index b875d02..b375791 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -27,8 +27,8 @@
/* PRIVATE PROTOTYPES */
static herr_t H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg);
-static void *H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags,
- unsigned *ioflags, const uint8_t *p);
+static void *H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
+ unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
static void *H5O_attr_copy(const void *_mesg, void *_dest);
static size_t H5O_attr_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_attr_free(void *mesg);
@@ -121,7 +121,7 @@ H5FL_EXTERN(H5S_extent_t);
function using malloc() and is returned to the caller.
--------------------------------------------------------------------------*/
static void *
-H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags,
+H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned UNUSED mesg_flags,
unsigned *ioflags, const uint8_t *p)
{
H5A_t *attr = NULL;
@@ -182,7 +182,8 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags,
p += name_len; /* advance the memory pointer */
/* Decode the attribute's datatype */
- if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)))
+ if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, open_oh,
+ ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
if(attr->shared->version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN_OLD(attr->shared->dt_size);
@@ -196,7 +197,8 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Decode attribute's dataspace extent */
- if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
+ if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, open_oh,
+ ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information to the dataspace */