diff options
Diffstat (limited to 'src/H5Omessage.c')
-rw-r--r-- | src/H5Omessage.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 6c6dfb1..4baa262 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -74,7 +74,7 @@ typedef struct { /********************/ static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native); -static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, hbool_t *oh_modified, void *_udata/*in,out*/); static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, @@ -393,7 +393,7 @@ H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *ty HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") /* Check for modifying a constant message */ - if(idx_msg->flags & H5O_MSG_FLAG_CONSTANT) + if(!(update_flags & H5O_UPDATE_FORCE) && (idx_msg->flags & H5O_MSG_FLAG_CONSTANT)) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message") /* This message is shared, but it's being modified. */ else if((idx_msg->flags & H5O_MSG_FLAG_SHARED) || (idx_msg->flags & H5O_MSG_FLAG_SHAREABLE)) { @@ -488,7 +488,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Call the "real" read routine */ - if(NULL == (ret_value = H5O_msg_read_real(loc->file, dxpl_id, oh, type_id, mesg))) + if(NULL == (ret_value = H5O_msg_read_oh(loc->file, dxpl_id, oh, type_id, mesg))) HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to load object header") done: @@ -500,7 +500,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_msg_read_real + * Function: H5O_msg_read_oh * * Purpose: Reads a message from an object header and returns a pointer * to it. The caller will usually supply the memory through @@ -523,14 +523,14 @@ done: *------------------------------------------------------------------------- */ void * -H5O_msg_read_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, +H5O_msg_read_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, void *mesg) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ unsigned idx; /* Message's index in object header */ void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT(H5O_msg_read_real) + FUNC_ENTER_NOAPI_NOINIT(H5O_msg_read_oh) /* check args */ HDassert(f); @@ -550,7 +550,7 @@ H5O_msg_read_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, * Decode the message if necessary. If the message is shared then retrieve * native message through the shared interface. */ - H5O_LOAD_NATIVE(f, dxpl_id, oh, &(oh->mesg[idx]), NULL) + H5O_LOAD_NATIVE(f, dxpl_id, 0, oh, &(oh->mesg[idx]), NULL) /* * The object header caches the native message (along with @@ -562,7 +562,7 @@ H5O_msg_read_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_read_real() */ +} /* end H5O_msg_read_oh() */ /*------------------------------------------------------------------------- @@ -1299,7 +1299,7 @@ H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, for(sequence = 0, idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs && !ret_value; idx++, idx_msg++) { if(type == idx_msg->type) { /* Decode the message if necessary. */ - H5O_LOAD_NATIVE(f, dxpl_id, oh, idx_msg, FAIL) + H5O_LOAD_NATIVE(f, dxpl_id, 0, oh, idx_msg, FAIL) /* Check for making an "internal" (i.e. within the H5O package) callback */ if(op->op_type == H5O_MESG_OP_LIB) @@ -1421,7 +1421,7 @@ H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, HDassert(mesg); /* Get the property list */ - if(NULL == (ocpl = H5I_object(ocpl_id))) + if(NULL == (ocpl = (H5P_genplist_t *)H5I_object(ocpl_id))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, 0, "not a property list") /* Get any object header status flags set by properties */ @@ -1653,7 +1653,7 @@ H5O_msg_set_share(unsigned type_id, const H5O_shared_t *share, void *mesg) HDassert(share); HDassert(share->type != H5O_SHARE_TYPE_UNSHARED); - /* If there's a special action for this class that needs to be performed + /* If there's a special action for this class that needs to be performed * when setting the shared component, do that */ if(type->set_share) { @@ -1804,13 +1804,20 @@ 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 */ + unsigned ioflags = 0; /* Flags for decode routine */ FUNC_ENTER_NOAPI(H5O_msg_decode, NULL) @@ -1821,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, 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: @@ -2078,7 +2085,7 @@ H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg) /* Check if there is a file space deletion callback for this type of message */ if(type->del) { /* Decode the message if necessary. */ - H5O_LOAD_NATIVE(f, dxpl_id, oh, mesg, FAIL) + H5O_LOAD_NATIVE(f, dxpl_id, H5O_DECODEIO_NOCHANGE, oh, mesg, FAIL) if((type->del)(f, dxpl_id, oh, mesg->native) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message") @@ -2228,6 +2235,12 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh) if(oh->nmesgs != u) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "corrupt object header - too few messages") +#ifndef NDEBUG + /* Reset the number of messages dirtied by decoding, as they have all + * been flushed */ + oh->ndecode_dirtied = 0; +#endif /* NDEBUG */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_flush_msgs() */ |