diff options
-rw-r--r-- | release_docs/RELEASE.txt | 5 | ||||
-rw-r--r-- | src/H5Abtree2.c | 2 | ||||
-rw-r--r-- | src/H5Adense.c | 2 | ||||
-rw-r--r-- | src/H5Gbtree2.c | 2 | ||||
-rw-r--r-- | src/H5Gdense.c | 10 | ||||
-rw-r--r-- | src/H5HFcache.c | 2 | ||||
-rw-r--r-- | src/H5O.c | 89 | ||||
-rw-r--r-- | src/H5Oainfo.c | 8 | ||||
-rw-r--r-- | src/H5Oattr.c | 12 | ||||
-rw-r--r-- | src/H5Obogus.c | 8 | ||||
-rw-r--r-- | src/H5Obtreek.c | 8 | ||||
-rw-r--r-- | src/H5Ocache.c | 4 | ||||
-rw-r--r-- | src/H5Ocont.c | 8 | ||||
-rw-r--r-- | src/H5Odrvinfo.c | 8 | ||||
-rw-r--r-- | src/H5Odtype.c | 6 | ||||
-rw-r--r-- | src/H5Oefl.c | 8 | ||||
-rw-r--r-- | src/H5Ofill.c | 16 | ||||
-rw-r--r-- | src/H5Oginfo.c | 8 | ||||
-rw-r--r-- | src/H5Olayout.c | 8 | ||||
-rw-r--r-- | src/H5Olinfo.c | 8 | ||||
-rw-r--r-- | src/H5Olink.c | 8 | ||||
-rw-r--r-- | src/H5Omessage.c | 10 | ||||
-rw-r--r-- | src/H5Omtime.c | 16 | ||||
-rw-r--r-- | src/H5Oname.c | 8 | ||||
-rw-r--r-- | src/H5Opkg.h | 8 | ||||
-rw-r--r-- | src/H5Opline.c | 8 | ||||
-rw-r--r-- | src/H5Oprivate.h | 5 | ||||
-rw-r--r-- | src/H5Orefcount.c | 8 | ||||
-rw-r--r-- | src/H5Osdspace.c | 8 | ||||
-rw-r--r-- | src/H5Oshared.c | 45 | ||||
-rw-r--r-- | src/H5Oshared.h | 6 | ||||
-rw-r--r-- | src/H5Oshmesg.c | 8 | ||||
-rw-r--r-- | src/H5Ostab.c | 8 | ||||
-rw-r--r-- | src/H5S.c | 2 | ||||
-rwxr-xr-x | src/H5SM.c | 2 | ||||
-rw-r--r-- | src/H5T.c | 2 | ||||
-rw-r--r-- | test/tattr.c | 131 |
37 files changed, 352 insertions, 153 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 72df169..322e56b 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -61,7 +61,7 @@ New Features Library ------- - - Added support for dense attributes to H5Ocopy. (XCao/NAF - 2009/01/29) + - Added support for dense attributes to H5Ocopy. XCao/NAF - 2009/01/29 - Added H5Pset_elink_cb and H5Pget_elink_cb functions to support a user-defined callback function for external link traversal. NAF - 2009/01/08 @@ -114,6 +114,9 @@ Bug Fixes since HDF5-1.8.2 Library ------- + - Fixed a bug that could cause problems when an attribute was added to a + committed datatype using the committed datatype's datatype. + NAF - 2009/02/12 - Fixed a bug that could cause problems when copying an object with a shared message in its own object header. NAF - 2009/01/29 - Changed H5Tset_order to properly reject H5T_ORDER_NONE for most datatypes. diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 07550da..da4ad86 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -168,7 +168,7 @@ H5A_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5A_dense_fh_name_cmp) /* Decode attribute information */ - if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_ATTR_ID, (const unsigned char *)obj))) + if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute") /* Compare the string values */ diff --git a/src/H5Adense.c b/src/H5Adense.c index 76ab95d..bc5ddfb 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -806,7 +806,7 @@ H5A_dense_copy_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) * HDF5 routine, it could attempt to re-protect that direct block for the * heap, causing the HDF5 routine called to fail) */ - if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_ATTR_ID, (const unsigned char *)obj))) + if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, FAIL, "can't decode attribute") /* Set the creation order index for the attribute */ diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index d060a11..c16fc16 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -164,7 +164,7 @@ H5G_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5G_dense_fh_name_cmp) /* Decode link information */ - if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Compare the string values */ diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 6c3a171..2bca4fa 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -566,7 +566,7 @@ H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_uda FUNC_ENTER_NOAPI_NOINIT(H5G_dense_lookup_by_idx_fh_cb) /* Decode link information & keep a copy */ - if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Copy link information */ @@ -852,7 +852,7 @@ H5G_dense_iterate_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) * HDF5 routine, it could attempt to re-protect that direct block for the * heap, causing the HDF5 routine called to fail - QAK) */ - if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") done: @@ -1047,7 +1047,7 @@ H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_u FUNC_ENTER_NOAPI_NOINIT(H5G_dense_get_name_by_idx_fh_cb) /* Decode link information */ - if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Get the length of the name */ @@ -1245,7 +1245,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_fh_cb) /* Decode link information */ - if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") /* Check for removing the link from the creation order index */ @@ -1408,7 +1408,7 @@ H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_uda FUNC_ENTER_NOAPI_NOINIT(H5G_dense_remove_by_idx_fh_cb) /* Decode link information */ - if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, H5O_LINK_ID, (const unsigned char *)obj))) + if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj))) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5_ITER_ERROR, "can't decode link") /* Can't operate on link here because the fractal heap block is locked */ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 8b29bc7..96ffe2d 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -387,7 +387,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); UINT32DECODE(p, hdr->pline_root_direct_filter_mask); /* Decode I/O filter information */ - if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, dxpl_id, H5O_PLINE_ID, p))) + if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, dxpl_id, NULL, H5O_PLINE_ID, p))) HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters") p += hdr->filter_len; @@ -1393,9 +1393,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_link + * Function: H5O_link_oh * - * Purpose: Adjust the link count for an object header by adding + * Purpose: Adjust the link count for an open object header by adding * ADJUST to the link count. * * Return: Success: New link count @@ -1409,24 +1409,12 @@ done: *------------------------------------------------------------------------- */ int -H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) +H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) { - H5O_t *oh = NULL; - H5AC_protect_t oh_acc; /* Access mode for protecting object header */ - unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Whether the object was deleted */ + haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_link, FAIL) - - /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - - /* get header */ - oh_acc = adjust ? H5AC_WRITE : H5AC_READ; - if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + FUNC_ENTER_NOAPI(H5O_link_oh, FAIL) /* Check for adjusting link count */ if(adjust) { @@ -1435,38 +1423,38 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) if((unsigned)(-adjust) > oh->nlink) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative") oh->nlink += adjust; - oh_flags |= H5AC__DIRTIED_FLAG; + *oh_flags |= H5AC__DIRTIED_FLAG; /* Check if the object should be deleted */ if(oh->nlink == 0) { /* Check if the object is still open by the user */ - if(H5FO_opened(loc->file, loc->addr) != NULL) { + if(H5FO_opened(f, addr) != NULL) { /* Flag the object to be deleted when it's closed */ - if(H5FO_mark(loc->file, loc->addr, TRUE) < 0) + if(H5FO_mark(f, addr, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion") } /* end if */ else { /* Delete object right now */ - if(H5O_delete_oh(loc->file, dxpl_id, oh) < 0) + if(H5O_delete_oh(f, dxpl_id, oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file") /* Mark the object header as deleted */ - oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; + *oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; } /* end else */ } /* end if */ } else { /* A new object, or one that will be deleted */ if(oh->nlink == 0) { /* Check if the object is current open, but marked for deletion */ - if(H5FO_marked(loc->file, loc->addr) > 0) { + if(H5FO_marked(f, addr) > 0) { /* Remove "delete me" flag on the object */ - if(H5FO_mark(loc->file, loc->addr, FALSE) < 0) + if(H5FO_mark(f, addr, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion") } /* end if */ } /* end if */ oh->nlink += adjust; - oh_flags |= H5AC__DIRTIED_FLAG; + *oh_flags |= H5AC__DIRTIED_FLAG; } /* end if */ /* Check for operations on refcount message */ @@ -1475,7 +1463,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) if(oh->has_refcount_msg) { /* Check for removing refcount message */ if(oh->nlink <= 1) { - if(H5O_msg_remove_real(loc->file, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0) + if(H5O_msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete refcount message") oh->has_refcount_msg = FALSE; } /* end if */ @@ -1483,7 +1471,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) else { H5O_refcount_t refcount = oh->nlink; - if(H5O_msg_write_real(loc->file, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) + if(H5O_msg_write_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update refcount message") } /* end else */ } /* end if */ @@ -1492,7 +1480,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) if(oh->nlink > 1) { H5O_refcount_t refcount = oh->nlink; - if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) + if(H5O_msg_append_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new refcount message") oh->has_refcount_msg = TRUE; } /* end if */ @@ -1504,6 +1492,51 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) ret_value = oh->nlink; done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_link_oh() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_link + * + * Purpose: Adjust the link count for an object header by adding + * ADJUST to the link count. + * + * Return: Success: New link count + * + * Failure: Negative + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 5 1997 + * + *------------------------------------------------------------------------- + */ +int +H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) +{ + H5O_t *oh = NULL; + H5AC_protect_t oh_acc; /* Access mode for protecting object header */ + unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Whether the object was deleted */ + int ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_link, FAIL) + + /* check args */ + HDassert(loc); + HDassert(loc->file); + HDassert(H5F_addr_defined(loc->addr)); + + /* get header */ + oh_acc = adjust ? H5AC_WRITE : H5AC_READ; + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + + /* Call the "real" link routine */ + if((ret_value = H5O_link_oh(loc->file, adjust, dxpl_id, oh, &oh_flags)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust object link count") + +done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 7f6a55d..667f28c 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -35,8 +35,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_ainfo_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_ainfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_ainfo_copy(const void *_mesg, void *_dest); static size_t H5O_ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -105,8 +105,8 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t); *------------------------------------------------------------------------- */ static void * -H5O_ainfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_ainfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_ainfo_t *ainfo = NULL; /* Attribute info */ unsigned char flags; /* Flags for encoding attribute info */ 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 */ diff --git a/src/H5Obogus.c b/src/H5Obogus.c index c257ca4..cee3199 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -38,8 +38,8 @@ #ifdef H5O_ENABLE_BOGUS /* PRIVATE PROTOTYPES */ -static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_bogus_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static size_t H5O_bogus_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, @@ -87,8 +87,8 @@ const H5O_msg_class_t H5O_MSG_BOGUS[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_bogus_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_bogus_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_bogus_t *mesg = NULL; void *ret_value; /* Return value */ diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index 36e4c1a..99e6bdd 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -28,8 +28,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void *H5O_btreek_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_btreek_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_btreek_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_btreek_copy(const void *_mesg, void *_dest); static size_t H5O_btreek_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -79,8 +79,8 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_btreek_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_btreek_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_btreek_t *mesg; /* Native message */ void *ret_value; /* Return value */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index db093a4..551eca8 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -536,7 +536,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, unsigned ioflags = 0; /* Flags for decode routine */ /* Decode continuation message */ - cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(f, dxpl_id, 0, &ioflags, oh->mesg[curmesg].raw); + cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(f, dxpl_id, NULL, 0, &ioflags, oh->mesg[curmesg].raw); cont->chunkno = oh->nchunks; /*the next chunk to allocate */ /* Save 'native' form of continuation message */ @@ -559,7 +559,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, /* Decode ref. count message */ HDassert(oh->version > H5O_VERSION_1); - refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(f, dxpl_id, 0, &ioflags, oh->mesg[curmesg].raw); + refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(f, dxpl_id, NULL, 0, &ioflags, oh->mesg[curmesg].raw); /* Save 'native' form of ref. count message */ oh->mesg[curmesg].native = refcount; diff --git a/src/H5Ocont.c b/src/H5Ocont.c index b3f178d..df336dd 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -37,8 +37,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O_cont_free(void *mesg); @@ -90,8 +90,8 @@ H5FL_DEFINE(H5O_cont_t); *------------------------------------------------------------------------- */ static void * -H5O_cont_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_cont_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_cont_t *cont = NULL; void *ret_value; diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 9aafe41..864fe9e 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -28,8 +28,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void *H5O_drvinfo_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_drvinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_drvinfo_copy(const void *_mesg, void *_dest); static size_t H5O_drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -80,8 +80,8 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_drvinfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_drvinfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_drvinfo_t *mesg; /* Native message */ void *ret_value; /* Return value */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 71692c1..24e443c 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -29,8 +29,8 @@ /* PRIVATE PROTOTYPES */ static herr_t H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static void *H5O_dtype_copy(const void *_mesg, void *_dest); static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg); static herr_t H5O_dtype_reset(void *_mesg); @@ -990,7 +990,7 @@ done: function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_dtype_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, +H5O_dtype_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, unsigned UNUSED mesg_flags, unsigned *ioflags/*in,out*/, const uint8_t *p) { H5T_t *dt = NULL; diff --git a/src/H5Oefl.c b/src/H5Oefl.c index ee51e1c..5702b34 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -29,8 +29,8 @@ #include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ -static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_efl_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_efl_copy(const void *_mesg, void *_dest); static size_t H5O_efl_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -84,8 +84,8 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_efl_decode(H5F_t *f, hid_t dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_efl_t *mesg = NULL; int version; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 02706ec..d5345aa 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -33,12 +33,12 @@ #include "H5Sprivate.h" /* Dataspaces */ -static void *H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_fill_old_encode(H5F_t *f, uint8_t *p, const void *_mesg); static size_t H5O_fill_old_size(const H5F_t *f, const void *_mesg); -static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg); static void *H5O_fill_copy(const void *_mesg, void *_dest); @@ -182,8 +182,8 @@ H5FL_BLK_EXTERN(type_conv); *------------------------------------------------------------------------- */ static void * -H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_fill_t *fill = NULL; void *ret_value; @@ -296,8 +296,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_fill_old_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_fill_old_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_fill_t *fill = NULL; /* Decoded fill value message */ void *ret_value; /* Return value */ diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 2323fff..83a6085 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -33,8 +33,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_ginfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_ginfo_copy(const void *_mesg, void *_dest); static size_t H5O_ginfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -95,8 +95,8 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t); *------------------------------------------------------------------------- */ static void * -H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */ unsigned char flags; /* Flags for encoding group info */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index f914006..73d2c81 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -33,8 +33,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_layout_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_layout_copy(const void *_mesg, void *_dest); static size_t H5O_layout_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -93,8 +93,8 @@ H5FL_DEFINE(H5O_layout_t); *------------------------------------------------------------------------- */ static void * -H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_layout_t *mesg = NULL; unsigned u; diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index d1eb2c0..5ba237a 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -35,8 +35,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_linfo_copy(const void *_mesg, void *_dest); static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -111,8 +111,8 @@ H5FL_DEFINE_STATIC(H5O_linfo_t); *------------------------------------------------------------------------- */ static void * -H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_linfo_t *linfo = NULL; /* Link info */ unsigned char index_flags; /* Flags for encoding link index info */ diff --git a/src/H5Olink.c b/src/H5Olink.c index a4449f0..96d4747 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -38,8 +38,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_link_copy(const void *_mesg, void *_dest); static size_t H5O_link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -116,8 +116,8 @@ H5FL_DEFINE_STATIC(H5O_link_t); *------------------------------------------------------------------------- */ static void * -H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_link_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_link_t *lnk = NULL; /* Pointer to link message */ size_t len = 0; /* Length of a string in the message */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index a63299a..286240c 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1804,10 +1804,16 @@ done: * slu@ncsa.uiuc.edu * July 14, 2004 * + * Modifications: Neil Fortner + * Feb 4 2009 + * Added open_oh parameter. This parameter is optional and + * contains this message's protected object header + * *------------------------------------------------------------------------- */ void * -H5O_msg_decode(H5F_t *f, hid_t dxpl_id, unsigned type_id, const unsigned char *buf) +H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, + const unsigned char *buf) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ void *ret_value; /* Return value */ @@ -1822,7 +1828,7 @@ H5O_msg_decode(H5F_t *f, hid_t dxpl_id, unsigned type_id, const unsigned char *b HDassert(type); /* decode */ - if((ret_value = (type->decode)(f, dxpl_id, 0, &ioflags, buf)) == NULL) + if((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf)) == NULL) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message") done: diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 46272a0..1bbcfe3 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -28,13 +28,13 @@ #include "H5Opkg.h" /* Object headers */ -static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static size_t H5O_mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); -static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_mtime_copy(const void *_mesg, void *_dest); static size_t H5O_mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -119,8 +119,8 @@ H5FL_DEFINE(time_t); *------------------------------------------------------------------------- */ static void * -H5O_mtime_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_mtime_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { time_t *mesg; uint32_t tmp_time; /* Temporary copy of the time */ @@ -172,8 +172,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { time_t *mesg, the_time; int i; diff --git a/src/H5Oname.c b/src/H5Oname.c index 915546b..5ffa870 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -33,8 +33,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_name_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_name_copy(const void *_mesg, void *_dest); static size_t H5O_name_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -84,8 +84,8 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_name_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_name_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_name_t *mesg; void *ret_value; /* Return value */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index fa69b93..4bc6d26 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -187,7 +187,7 @@ \ /* Decode the message */ \ HDassert(msg_type->decode); \ - if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (MSG)->flags, &ioflags, (MSG)->raw))) \ + if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw))) \ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \ \ /* Mark the message dirty if it was changed by decoding */ \ @@ -222,7 +222,7 @@ struct H5O_msg_class_t { const char *name; /*for debugging */ size_t native_size; /*size of native message */ unsigned share_flags; /* Message sharing settings */ - void *(*decode)(H5F_t*, hid_t, unsigned, unsigned *, const uint8_t *); + void *(*decode)(H5F_t*, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *); herr_t (*encode)(H5F_t*, hbool_t, uint8_t*, const void *); void *(*copy)(const void *, void *); /*copy native value */ size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */ @@ -515,8 +515,8 @@ H5_DLL herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link); /* Shared object operators */ -H5_DLL void * H5O_shared_decode(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, - const uint8_t *buf, const H5O_msg_class_t *type); +H5_DLL void * H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type); H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg); H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); H5_DLL herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, diff --git a/src/H5Opline.c b/src/H5Opline.c index fed2861..20a9d26 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -33,8 +33,8 @@ /* PRIVATE PROTOTYPES */ static herr_t H5O_pline_encode(H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_pline_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_pline_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static void *H5O_pline_copy(const void *_mesg, void *_dest); static size_t H5O_pline_size(const H5F_t *f, const void *_mesg); static herr_t H5O_pline_reset(void *_mesg); @@ -107,8 +107,8 @@ H5FL_DEFINE(H5O_pline_t); *------------------------------------------------------------------------- */ static void * -H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_pline_t *pline = NULL; /* Pipeline message */ H5Z_filter_info_t *filter; /* Filter to decode */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index fe04df1..fd6f265 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -567,6 +567,7 @@ H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5_DLL herr_t H5O_open(H5O_loc_t *loc); H5_DLL herr_t H5O_close(H5O_loc_t *loc); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id); +H5_DLL int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags); H5_DLL H5O_t *H5O_protect(H5O_loc_t *loc, hid_t dxpl_id); H5_DLL herr_t H5O_unprotect(H5O_loc_t *loc, H5O_t *oh); H5_DLL herr_t H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id); @@ -627,8 +628,8 @@ H5_DLL herr_t H5O_msg_get_crt_index(unsigned type_id, const void *mesg, H5O_msg_crt_idx_t *crt_idx); H5_DLL herr_t H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared, unsigned char *buf, const void *obj); -H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, unsigned type_id, - const unsigned char *buf); +H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned type_id, const unsigned char *buf); H5_DLL herr_t H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, void *mesg); diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index b2f02b2..2f00e86 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -33,8 +33,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_refcount_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_refcount_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_refcount_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_refcount_copy(const void *_mesg, void *_dest); static size_t H5O_refcount_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -90,8 +90,8 @@ H5FL_DEFINE_STATIC(H5O_refcount_t); *------------------------------------------------------------------------- */ static void * -H5O_refcount_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_refcount_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_refcount_t *refcount = NULL; /* Reference count */ void *ret_value; /* Return value */ diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index fe7bf02..23af101 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -26,8 +26,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_sdspace_copy(const void *_mesg, void *_dest); static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg); @@ -109,8 +109,8 @@ H5FL_ARR_EXTERN(hsize_t); within this function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5S_extent_t *sdim = NULL;/* New extent dimensionality structure */ void *ret_value; diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 062443a..e22a105 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -107,7 +107,7 @@ *------------------------------------------------------------------------- */ static void * -H5O_shared_read(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, +H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t *shared, const H5O_msg_class_t *type) { H5HF_t *fheap = NULL; @@ -159,7 +159,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "can't read message from fractal heap.") /* Decode the message */ - if(NULL == (ret_value = (type->decode)(f, dxpl_id, 0, ioflags, mesg_ptr))) + if(NULL == (ret_value = (type->decode)(f, dxpl_id, open_oh, 0, ioflags, mesg_ptr))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message.") } /* end if */ else { @@ -167,12 +167,22 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, HDassert(shared->type == H5O_SHARE_TYPE_COMMITTED); - /* Get the shared message from an object header */ + /* Build the object location for the shared message's object header */ oloc.file = f; oloc.addr = shared->u.loc.oh_addr; oloc.holding_file = FALSE; - if(NULL == (ret_value = H5O_msg_read(&oloc, type->id, NULL, dxpl_id))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message") + + if(open_oh && oloc.addr == H5O_OH_GET_ADDR(open_oh)) { + /* The shared message is in the already opened object header. This + * is possible, for example, if an attribute's datatype is shared in + * the same object header the attribute is in. Read the message + * directly. */ + if(NULL == (ret_value = H5O_msg_read_oh(f, dxpl_id, open_oh, type->id, NULL))) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message") + } else + /* The shared message is in another object header */ + if(NULL == (ret_value = H5O_msg_read(&oloc, type->id, NULL, dxpl_id))) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message") } /* end else */ /* Mark the message as shared */ @@ -228,7 +238,7 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_loc_t oloc; /* Location for object header where message is stored */ /* - * The shared message is stored in some other object header. + * The shared message is stored in some object header. * The other object header must be in the same file as the * new object header. Adjust the reference count on that * object header. @@ -236,13 +246,26 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, if(shared->file->shared != f->shared) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "interfile hard links are not allowed") - /* Get the shared message from an object header */ + /* Build the object location for the shared message's object header */ oloc.file = f; oloc.addr = shared->u.loc.oh_addr; oloc.holding_file = FALSE; - if(H5O_link(&oloc, adjust, dxpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") + if(open_oh && oloc.addr == H5O_OH_GET_ADDR(open_oh)) { + /* The shared message is in the already opened object header. This + * is possible, for example, if an attribute's datatype is shared in + * the same object header the attribute is in. Adjust the link + * count directly. */ + unsigned oh_flags = H5AC__NO_FLAGS_SET; /* This is used only to satisfy H5O_link_oh */ + + if(H5O_link_oh(f, adjust, dxpl_id, open_oh, &oh_flags) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") + + HDassert(!(oh_flags & H5AC__DELETED_FLAG)); + } else + /* The shared message is in another object header */ + if(H5O_link(&oloc, adjust, dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") } /* end if */ else { HDassert(shared->type == H5O_SHARE_TYPE_SOHM || shared->type == H5O_SHARE_TYPE_HERE); @@ -277,7 +300,7 @@ done: *------------------------------------------------------------------------- */ void * -H5O_shared_decode(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, +H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type) { H5O_shared_t sh_mesg; /* Shared message info */ @@ -344,7 +367,7 @@ H5O_shared_decode(H5F_t *f, hid_t dxpl_id, unsigned *ioflags, sh_mesg.msg_type_id = type->id; /* Retrieve actual message, through decoded shared message info */ - if(NULL == (ret_value = H5O_shared_read(f, dxpl_id, ioflags, &sh_mesg, type))) + if(NULL == (ret_value = H5O_shared_read(f, dxpl_id, open_oh, ioflags, &sh_mesg, type))) HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message") done: diff --git a/src/H5Oshared.h b/src/H5Oshared.h index d52cd8f..c0f5cd6 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -48,7 +48,7 @@ *------------------------------------------------------------------------- */ static H5_inline void * -H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, +H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, const uint8_t *p) { void *ret_value; /* Return value */ @@ -68,7 +68,7 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, /* Check for shared message */ if(mesg_flags & H5O_MSG_FLAG_SHARED) { /* Retrieve native message info indirectly through shared message */ - if(NULL == (ret_value = H5O_shared_decode(f, dxpl_id, ioflags, p, H5O_SHARED_TYPE))) + if(NULL == (ret_value = H5O_shared_decode(f, dxpl_id, open_oh, ioflags, p, H5O_SHARED_TYPE))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message") /* We currently do not support automatically fixing shared messages */ @@ -81,7 +81,7 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, } /* end if */ else { /* Decode native message directly */ - if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, mesg_flags, ioflags, p))) + if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, open_oh, mesg_flags, ioflags, p))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message") } /* end else */ diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index 74fe739..51c1c55 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -28,8 +28,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void *H5O_shmesg_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_shmesg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_shmesg_copy(const void *_mesg, void *_dest); static size_t H5O_shmesg_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -76,8 +76,8 @@ const H5O_msg_class_t H5O_MSG_SHMESG[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_shmesg_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_shmesg_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_shmesg_table_t *mesg; /* Native message */ void *ret_value; /* Return value */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 9524f43..a93a46d 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -36,8 +36,8 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, - unsigned *ioflags, const uint8_t *p); +static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, + unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); static void *H5O_stab_copy(const void *_mesg, void *_dest); static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); @@ -96,8 +96,8 @@ H5FL_DEFINE_STATIC(H5O_stab_t); *------------------------------------------------------------------------- */ static void * -H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, - unsigned UNUSED *ioflags, const uint8_t *p) +H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, + unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) { H5O_stab_t *stab = NULL; void *ret_value; /* Return value */ @@ -1565,7 +1565,7 @@ H5S_decode(const unsigned char *buf) /* Decode the extent part of dataspace */ /* (pass mostly bogus file pointer and bogus DXPL) */ - if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, H5O_SDSPACE_ID, buf))==NULL) + if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, buf))==NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object") buf += extent_size; @@ -1402,7 +1402,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg) * master table needs to be unprotected when we do this. */ if(mesg_buf) { - if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, type_id, (const unsigned char *)mesg_buf))) + if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, open_oh, type_id, (const unsigned char *)mesg_buf))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode shared message.") if(H5O_msg_delete(f, dxpl_id, open_oh, type_id, native_mesg) < 0) @@ -2920,7 +2920,7 @@ H5T_decode(const unsigned char *buf) HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype") /* Decode the serialized datatype message */ - if((ret_value = H5O_msg_decode(f, H5AC_dxpl_id, H5O_DTYPE_ID, buf)) == NULL) + if((ret_value = H5O_msg_decode(f, H5AC_dxpl_id, NULL, H5O_DTYPE_ID, buf)) == NULL) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object") done: diff --git a/test/tattr.c b/test/tattr.c index 0f96039..d4fec9a 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -9777,6 +9777,135 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /**************************************************************** ** +** test_attr_bug3(): Test basic H5A (attribute) code. +** Tests creating and deleting attributes which use a +** datatype and/or dataspace stored in the same object +** header. +** +****************************************************************/ +static void +test_attr_bug3(hid_t fcpl, hid_t fapl) +{ + hid_t fid; /* File ID */ + hid_t aid1, aid2; /* Attribute IDs */ + hid_t sid1, sid2; /* Dataspace ID */ + hid_t tid1, tid2; /* Datatype IDs */ + hid_t did; /* Dataset ID */ + hsize_t dims1[2] = {2, 2}, + dims2[2] = {3, 3}; /* Dimensions */ + int wdata1[2][2]; + unsigned wdata2[3][3]; /* Write buffers */ + herr_t ret; /* Generic return status */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Attributes in the Same Header as their Datatypes\n")); + + /* Create dataspaces */ + sid1 = H5Screate_simple(2, dims1, NULL); + CHECK(sid1, FAIL, "H5Screate_simple"); + sid2 = H5Screate_simple(2, dims2, NULL); + CHECK(sid2, FAIL, "H5Screate_simple"); + + /* Create file to operate on */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create datatypes and commit tid1 */ + tid1 = H5Tcopy(H5T_STD_I16BE); + CHECK(tid1, FAIL, "H5Tcopy"); + tid2 = H5Tcopy(H5T_STD_U64LE); + CHECK(tid1, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "dtype", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + + /* Create dataset */ + did = H5Dcreate2(fid, "dset", tid2, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(did, FAIL, "H5Dcreate2"); + + /* Create attribute on datatype, using that datatype as its datatype */ + aid1 = H5Acreate2(tid1, "attr", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid1, FAIL, "H5Acreate2"); + + /* Create attribute on dataset, using its datatype and dataspace */ + aid2 = H5Acreate2(did, "attr", tid2, sid2, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid2, FAIL, "H5Acreate2"); + + /* Close attributes */ + ret = H5Aclose(aid1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aid2); + CHECK(ret, FAIL, "H5Aclose"); + + /* Reopen attributes */ + aid1 = H5Aopen(tid1, "attr", H5P_DEFAULT); + CHECK(aid1, FAIL, "H5Aopen"); + aid2 = H5Aopen(did, "attr", H5P_DEFAULT); + CHECK(aid2, FAIL, "H5Aopen"); + + /* Write data to the attributes (the data is uninitialized, we only care + * that H5Awrite succeeds for now) */ + ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1[0]); + CHECK(ret, FAIL, "H5Awrite"); + ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2[0]); + CHECK(ret, FAIL, "H5Awrite"); + + /* Close attributes */ + ret = H5Aclose(aid1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aid2); + CHECK(ret, FAIL, "H5Aclose"); + + /* Delete attributes */ + ret = H5Adelete(tid1, "attr"); + CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete(did, "attr"); + CHECK(ret, FAIL, "H5Adelete"); + + /* Recreate attributes */ + aid1 = H5Acreate2(tid1, "attr", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid1, FAIL, "H5Acreate2"); + aid2 = H5Acreate2(did, "attr", tid2, sid2, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid2, FAIL, "H5Acreate2"); + + /* Delete attributes (note they are still open) */ + ret = H5Adelete(tid1, "attr"); + CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete(did, "attr"); + CHECK(ret, FAIL, "H5Adelete"); + + /* Close dataspaces and transient datatype */ + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Tclose(tid2); + CHECK(ret, FAIL, "H5Tclose"); + + /* Close dataset and committed datatype */ + ret = H5Tclose(tid1); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + /* Delete dataset and committed datatype */ + ret = H5Ldelete(fid, "dtype", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Ldelete(fid, "dset", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close attributes */ + ret = H5Aclose(aid1); + CHECK(ret, FAIL, "H5Aclose"); + ret = H5Aclose(aid2); + CHECK(ret, FAIL, "H5Aclose"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); +} /* test_attr_bug3() */ + +/**************************************************************** +** ** test_attr(): Main H5A (attribute) testing routine. ** ****************************************************************/ @@ -9917,6 +10046,7 @@ test_attr(void) /* Tests that address specific bugs */ test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */ test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */ + test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */ } /* end for */ } /* end if */ else { @@ -9937,6 +10067,7 @@ test_attr(void) /* Tests that address specific bugs */ test_attr_bug1(fcpl, my_fapl); /* Test odd allocation operations */ test_attr_bug2(fcpl, my_fapl); /* Test many deleted attributes */ + test_attr_bug3(fcpl, my_fapl); /* Test "self referential" attributes */ } /* end else */ } /* end for */ |