diff options
Diffstat (limited to 'src/H5Omessage.c')
-rw-r--r-- | src/H5Omessage.c | 866 |
1 files changed, 402 insertions, 464 deletions
diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 970fda6..d0347b5 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -26,75 +26,65 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared object header messages */ - +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMprivate.h" /* Shared object header messages */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ /* User data for iteration while removing a message */ typedef struct { - H5F_t *f; /* Pointer to file for insertion */ - hid_t dxpl_id; /* DXPL during iteration */ - int sequence; /* Sequence # to search for */ - unsigned nfailed; /* # of failed message removals */ - H5O_operator_t op; /* Callback routine for removal operations */ - void *op_data; /* Callback data for removal operations */ - hbool_t adj_link; /* Whether to adjust links when removing messages */ + H5F_t * f; /* Pointer to file for insertion */ + hid_t dxpl_id; /* DXPL during iteration */ + int sequence; /* Sequence # to search for */ + unsigned nfailed; /* # of failed message removals */ + H5O_operator_t op; /* Callback routine for removal operations */ + void * op_data; /* Callback data for removal operations */ + hbool_t adj_link; /* Whether to adjust links when removing messages */ } H5O_iter_rm_t; - /********************/ /* Package Typedefs */ /********************/ - /********************/ /* Local Prototypes */ /********************/ 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*/, - unsigned sequence, unsigned *oh_modified, void *_udata/*in,out*/); -static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, - const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, - unsigned update_flags); - +static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, + unsigned *oh_modified, void *_udata /*in,out*/); +static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, + const void *mesg, unsigned mesg_flags, unsigned update_flags); /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - - /*------------------------------------------------------------------------- * Function: H5O_msg_create * @@ -111,11 +101,11 @@ static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, *------------------------------------------------------------------------- */ herr_t -H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, - unsigned update_flags, void *mesg, hid_t dxpl_id) +H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg, + hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t *oh = NULL; /* Object header */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -126,21 +116,20 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, HDassert(mesg); /* Pin the object header */ - if(NULL == (oh = H5O_pin(loc, dxpl_id))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + if (NULL == (oh = H5O_pin(loc, dxpl_id))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Go append message to object header */ - if(H5O_msg_append_oh(loc->file, dxpl_id, oh, type_id, mesg_flags, update_flags, mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header") + if (H5O_msg_append_oh(loc->file, dxpl_id, oh, type_id, mesg_flags, update_flags, mesg) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header") done: - if(oh && H5O_unpin(oh) < 0) + if (oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_create() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_append_oh * @@ -159,33 +148,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_append_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, - unsigned mesg_flags, unsigned update_flags, void *mesg) +H5O_msg_append_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, unsigned mesg_flags, + unsigned update_flags, void *mesg) { - const H5O_msg_class_t *type; /* Original H5O class type for the ID */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5O_msg_class_t *type; /* Original H5O class type for the ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* check args */ HDassert(f); HDassert(oh); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); HDassert(mesg); /* Append new message to object header */ - if(H5O_msg_append_real(f, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0) + if (H5O_msg_append_real(f, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new message in header") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_append_oh() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_append_real * @@ -202,11 +190,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, - unsigned mesg_flags, unsigned update_flags, void *mesg) +H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, unsigned mesg_flags, + unsigned update_flags, void *mesg) { - size_t idx; /* Index of message to modify */ - herr_t ret_value = SUCCEED; /* Return value */ + size_t idx; /* Index of message to modify */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -218,21 +206,20 @@ H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *t HDassert(mesg); /* Allocate space for a new message */ - if(H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, mesg, &idx) < 0) + if (H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, mesg, &idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create new message") /* Copy the information for the message */ - if(H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) + if (H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message") #ifdef H5O_DEBUG -H5O_assert(oh); + H5O_assert(oh); #endif /* H5O_DEBUG */ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_append_real() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_write * @@ -254,12 +241,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, - unsigned update_flags, void *mesg, hid_t dxpl_id) +H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg, + hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header to use */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t * oh = NULL; /* Object header to use */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -267,29 +254,28 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, HDassert(loc); HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(mesg); HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); /* Pin the object header */ - if(NULL == (oh = H5O_pin(loc, dxpl_id))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + if (NULL == (oh = H5O_pin(loc, dxpl_id))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Call the "real" modify routine */ - if(H5O_msg_write_real(loc->file, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0) + if (H5O_msg_write_real(loc->file, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message") done: - if(oh && H5O_unpin(oh) < 0) + if (oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_write() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_write_oh * @@ -310,33 +296,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_write_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, - unsigned mesg_flags, unsigned update_flags, void *mesg) +H5O_msg_write_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, unsigned mesg_flags, + unsigned update_flags, void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* check args */ HDassert(f); HDassert(oh); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(mesg); HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); /* Call the "real" modify routine */ - if(H5O_msg_write_real(f, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0) + if (H5O_msg_write_real(f, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_write_oh() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_write_real * @@ -358,12 +343,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, - unsigned mesg_flags, unsigned update_flags, void *mesg) +H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, unsigned mesg_flags, + unsigned update_flags, void *mesg) { - H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - size_t idx; /* Index of message to modify */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_mesg_t *idx_msg; /* Pointer to message to modify */ + size_t idx; /* Index of message to modify */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -376,22 +361,22 @@ H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *ty HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); /* Locate message of correct type */ - for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(type == idx_msg->type) + for (idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) + if (type == idx_msg->type) break; - if(idx == oh->nmesgs) + if (idx == oh->nmesgs) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") /* Check for modifying a constant message */ - 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") + 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)) { - htri_t status; /* Status of "try share" call */ + else if ((idx_msg->flags & H5O_MSG_FLAG_SHARED) || (idx_msg->flags & H5O_MSG_FLAG_SHAREABLE)) { + htri_t status; /* Status of "try share" call */ - /* First, sanity check to make sure it's not a committed message; - * these can't ever be modified. - */ + /* First, sanity check to make sure it's not a committed message; + * these can't ever be modified. + */ HDassert(((H5O_shared_t *)idx_msg->native)->type != H5O_SHARE_TYPE_COMMITTED); /* Also, sanity check that a message doesn't switch status from being @@ -407,7 +392,7 @@ H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *ty * the location of the object changes (from in another object's * header to the SOHM heap), so just delete it first -QAK) */ - if(H5SM_delete(f, dxpl_id, oh, (H5O_shared_t *)idx_msg->native) < 0) + if (H5SM_delete(f, dxpl_id, oh, (H5O_shared_t *)idx_msg->native) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete message from SOHM index") /* If we're replacing a shared message, the new message must be shared @@ -417,24 +402,24 @@ H5O_msg_write_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *ty * XXX: This doesn't handle freeing extra space in object header from * a message shrinking. */ - if((status = H5SM_try_share(f, dxpl_id, ((mesg_flags & H5O_MSG_FLAG_SHARED) ? NULL : oh), 0, idx_msg->type->id, mesg, &mesg_flags)) < 0) + if ((status = H5SM_try_share(f, dxpl_id, ((mesg_flags & H5O_MSG_FLAG_SHARED) ? NULL : oh), 0, + idx_msg->type->id, mesg, &mesg_flags)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "error while trying to share message") - if(status == FALSE && (mesg_flags & H5O_MSG_FLAG_SHARED)) + if (status == FALSE && (mesg_flags & H5O_MSG_FLAG_SHARED)) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "message changed sharing status") } /* end if */ /* Copy the information for the message */ - if(H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) + if (H5O_copy_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message") #ifdef H5O_DEBUG -H5O_assert(oh); + H5O_assert(oh); #endif /* H5O_DEBUG */ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_write_real() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_read * @@ -459,11 +444,10 @@ done: *------------------------------------------------------------------------- */ void * -H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, - hid_t dxpl_id) +H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header to use */ - void *ret_value; /* Return value */ + H5O_t *oh = NULL; /* Object header to use */ + void * ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -474,21 +458,20 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, HDassert(type_id < NELMTS(H5O_msg_class_g)); /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") /* Call the "real" read routine */ - 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 read object header message") + 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 read object header message") done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_read() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_read_oh * @@ -513,12 +496,11 @@ done: *------------------------------------------------------------------------- */ void * -H5O_msg_read_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, - void *mesg) +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; + 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 @@ -526,14 +508,14 @@ H5O_msg_read_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, HDassert(f); HDassert(oh); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Scan through the messages looking for the right one */ - for(idx = 0; idx < oh->nmesgs; idx++) - if(type == oh->mesg[idx].type) + for (idx = 0; idx < oh->nmesgs; idx++) + if (type == oh->mesg[idx].type) break; - if(idx == oh->nmesgs) + if (idx == oh->nmesgs) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "message type not found") /* @@ -547,14 +529,13 @@ H5O_msg_read_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, * the raw message) so we must copy the native message before * returning. */ - if(NULL == (ret_value = (type->copy)(oh->mesg[idx].native, mesg))) + if (NULL == (ret_value = (type->copy)(oh->mesg[idx].native, mesg))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_read_oh() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_reset * @@ -573,25 +554,24 @@ done: herr_t H5O_msg_reset(unsigned type_id, void *native) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Call the "real" reset routine */ - if(H5O_msg_reset_real(type, native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header") + if (H5O_msg_reset_real(type, native) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_reset() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_reset_real * @@ -610,27 +590,26 @@ done: static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* check args */ HDassert(type); - if(native) { - if(type->reset) { - if((type->reset)(native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed") - } /* end if */ + if (native) { + if (type->reset) { + if ((type->reset)(native) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed") + } /* end if */ else - HDmemset(native, 0, type->native_size); + HDmemset(native, 0, type->native_size); } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_reset_real() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_free * @@ -649,14 +628,14 @@ done: void * H5O_msg_free(unsigned type_id, void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - void * ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + void * ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Call the "real" free routine */ @@ -665,7 +644,6 @@ H5O_msg_free(unsigned type_id, void *mesg) FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_free() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_free_mesg * @@ -692,7 +670,6 @@ H5O_msg_free_mesg(H5O_mesg_t *mesg) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_msg_free_mesg() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_free_real * @@ -716,9 +693,9 @@ H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) /* check args */ HDassert(type); - if(msg_native) { + if (msg_native) { H5O_msg_reset_real(type, msg_native); - if(NULL != (type->free)) + if (NULL != (type->free)) (type->free)(msg_native); else H5MM_xfree(msg_native); @@ -727,7 +704,6 @@ H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) FUNC_LEAVE_NOAPI(NULL) } /* end H5O_msg_free_real() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_copy * @@ -746,26 +722,25 @@ H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) void * H5O_msg_copy(unsigned type_id, const void *mesg, void *dst) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - void *ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + void * ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* check args */ HDassert(mesg); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Call the message class's copy routine */ - if(NULL == (ret_value = (type->copy)(mesg, dst))) + if (NULL == (ret_value = (type->copy)(mesg, dst))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_copy() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_count * @@ -784,10 +759,10 @@ done: int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header to operate on */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - unsigned msg_count; /* Message count */ - int ret_value; /* Return value */ + H5O_t * oh = NULL; /* Object header to operate on */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + unsigned msg_count; /* Message count */ + int ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -796,25 +771,24 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Load the object header */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Count the messages of the correct type */ msg_count = H5O_msg_count_real(oh, type); H5_CHECKED_ASSIGN(ret_value, int, msg_count, unsigned); done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_count() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_count_real * @@ -833,8 +807,8 @@ done: unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) { - unsigned u; /* Local index variable */ - unsigned ret_value; /* Return value */ + unsigned u; /* Local index variable */ + unsigned ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -843,14 +817,13 @@ H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) HDassert(type); /* Loop over all messages, counting the ones of the type looked for */ - for(u = ret_value = 0; u < oh->nmesgs; u++) - if(oh->mesg[u].type == type) + for (u = ret_value = 0; u < oh->nmesgs; u++) + if (oh->mesg[u].type == type) ret_value++; FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_count_real() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_exists * @@ -872,8 +845,8 @@ H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header for location */ - htri_t ret_value; /* Return value */ + H5O_t *oh = NULL; /* Object header for location */ + htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -882,21 +855,20 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) HDassert(type_id < NELMTS(H5O_msg_class_g)); /* Load the object header */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Call the "real" exists routine */ - if((ret_value = H5O_msg_exists_oh(oh, type_id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to verify object header message") + if ((ret_value = H5O_msg_exists_oh(oh, type_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to verify object header message") done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_exists() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_exists_oh * @@ -918,27 +890,26 @@ done: htri_t H5O_msg_exists_oh(const H5O_t *oh, unsigned type_id) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - unsigned u; /* Local index variable */ - htri_t ret_value = FALSE; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + unsigned u; /* Local index variable */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(oh); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Scan through the messages looking for the right one */ - for(u = 0; u < oh->nmesgs; u++) - if(type == oh->mesg[u].type) + for (u = 0; u < oh->nmesgs; u++) + if (type == oh->mesg[u].type) HGOTO_DONE(TRUE) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_exists_oh() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_remove * @@ -960,12 +931,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj_link, - hid_t dxpl_id) +H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj_link, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -973,27 +943,26 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj HDassert(loc); HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Pin the object header */ - if(NULL == (oh = H5O_pin(loc, dxpl_id))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + if (NULL == (oh = H5O_pin(loc, dxpl_id))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Call the "real" remove routine */ - if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link, dxpl_id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") + if ((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link, dxpl_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") done: - if(oh && H5O_unpin(oh) < 0) + if (oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_remove_op * @@ -1012,12 +981,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, - H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id) +H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, H5O_operator_t op, void *op_data, + hbool_t adj_link, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1025,27 +994,26 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, HDassert(loc); HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Pin the object header */ - if(NULL == (oh = H5O_pin(loc, dxpl_id))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + if (NULL == (oh = H5O_pin(loc, dxpl_id))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Call the "real" remove routine */ - if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link, dxpl_id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") + if ((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link, dxpl_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") done: - if(oh && H5O_unpin(oh) < 0) + if (oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove_op() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_remove_cb * @@ -1062,16 +1030,16 @@ done: * Modifications: * Vailin Choi; Sept 2011 * Indicate that the object header is modified and might possibly need - * to condense messages in the object header + * to condense messages in the object header *------------------------------------------------------------------------- */ static herr_t -H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, - unsigned *oh_modified, void *_udata/*in,out*/) +H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, unsigned *oh_modified, + void *_udata /*in,out*/) { - H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ - htri_t try_remove = FALSE; /* Whether to try removing a message */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ + htri_t try_remove = FALSE; /* Whether to try removing a message */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1079,33 +1047,34 @@ H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, HDassert(mesg); /* Check for callback routine */ - if(udata->op) { + if (udata->op) { /* Call the iterator callback */ - if((try_remove = (udata->op)(mesg->native, sequence, udata->op_data)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "object header message deletion callback failed") + if ((try_remove = (udata->op)(mesg->native, sequence, udata->op_data)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, + "object header message deletion callback failed") } /* end if */ else { /* If there's no callback routine, does the sequence # match? */ - if((int)sequence == udata->sequence || H5O_ALL == udata->sequence) + if ((int)sequence == udata->sequence || H5O_ALL == udata->sequence) try_remove = TRUE; } /* end else */ /* Try removing the message, if indicated */ - if(try_remove) { + if (try_remove) { /* * Keep track of how many times we failed trying to remove constant * messages. * (OK to remove constant messages - QAK) */ /* Convert message into a null message */ - if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, udata->adj_link) < 0) + if (H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, udata->adj_link) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message") /* Indicate that the object header was modified & might need to condense messages in object header */ *oh_modified = H5O_MODIFY_CONDENSE; /* Break out now, if we've found the correct message */ - if(udata->sequence == H5O_FIRST || udata->sequence != H5O_ALL) + if (udata->sequence == H5O_FIRST || udata->sequence != H5O_ALL) HGOTO_DONE(H5_ITER_STOP) } /* end if */ @@ -1113,7 +1082,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove_cb() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_remove_real * @@ -1132,13 +1100,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, - int sequence, H5O_operator_t app_op, void *op_data, hbool_t adj_link, - hid_t dxpl_id) +H5O_msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, int sequence, H5O_operator_t app_op, + void *op_data, hbool_t adj_link, hid_t dxpl_id) { - H5O_iter_rm_t udata; /* User data for iterator */ - H5O_mesg_operator_t op; /* Wrapper for operator */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_iter_rm_t udata; /* User data for iterator */ + H5O_mesg_operator_t op; /* Wrapper for operator */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1148,33 +1115,32 @@ H5O_msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, HDassert(type); /* Make certain we are allowed to modify the file */ - if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file") + if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file") /* Set up iterator operator data */ - udata.f = f; - udata.dxpl_id = dxpl_id; + udata.f = f; + udata.dxpl_id = dxpl_id; udata.sequence = sequence; - udata.nfailed = 0; - udata.op = app_op; - udata.op_data = op_data; + udata.nfailed = 0; + udata.op = app_op; + udata.op_data = op_data; udata.adj_link = adj_link; /* Iterate over the messages, deleting appropriate one(s) */ - op.op_type = H5O_MESG_OP_LIB; + op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O_msg_remove_cb; - if(H5O_msg_iterate_real(f, oh, type, &op, &udata, dxpl_id) < 0) + if (H5O_msg_iterate_real(f, oh, type, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error iterating over messages") /* Fail if we tried to remove any constant messages */ - if(udata.nfailed) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to remove constant message(s)") + if (udata.nfailed) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to remove constant message(s)") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove_real() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_iterate * @@ -1207,12 +1173,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, - const H5O_mesg_operator_t *op, void *op_data, hid_t dxpl_id) +H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, const H5O_mesg_operator_t *op, void *op_data, + hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1221,26 +1187,25 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(op); /* Protect the object header to iterate over */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Call the "real" iterate routine */ - if((ret_value = H5O_msg_iterate_real(loc->file, oh, type, op, op_data, dxpl_id)) < 0) + if ((ret_value = H5O_msg_iterate_real(loc->file, oh, type, op, op_data, dxpl_id)) < 0) HERROR(H5E_OHDR, H5E_BADITER, "unable to iterate over object header messages"); done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_iterate() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_iterate_real * @@ -1279,14 +1244,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, - const H5O_mesg_operator_t *op, void *op_data, hid_t dxpl_id) +H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const H5O_mesg_operator_t *op, + void *op_data, hid_t dxpl_id) { - H5O_mesg_t *idx_msg; /* Pointer to current message */ - unsigned idx; /* Absolute index of current message in all messages */ - unsigned sequence; /* Relative index of current message for messages of type */ - unsigned oh_modified = 0; /* Whether the callback modified the object header */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5O_mesg_t *idx_msg; /* Pointer to current message */ + unsigned idx; /* Absolute index of current message in all messages */ + unsigned sequence; /* Relative index of current message for messages of type */ + unsigned oh_modified = 0; /* Whether the callback modified the object header */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1298,56 +1263,55 @@ H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, HDassert(op->u.app_op); /* Iterate over messages */ - for(sequence = 0, idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs && !ret_value; idx++, idx_msg++) { - if(type == idx_msg->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, 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) + if (op->op_type == H5O_MESG_OP_LIB) ret_value = (op->u.lib_op)(oh, idx_msg, sequence, &oh_modified, op_data); else ret_value = (op->u.app_op)(idx_msg->native, sequence, op_data); /* Check for iterator callback indicating to get out of loop */ - if(ret_value != 0) + if (ret_value != 0) break; /* Increment sequence value for message type */ sequence++; } /* end if */ - } /* end for */ + } /* end for */ /* Check for error from iterator */ - if(ret_value < 0) + if (ret_value < 0) HERROR(H5E_OHDR, H5E_CANTLIST, "iterator function failed"); done: /* Check if object message was modified */ - if(oh_modified) { + if (oh_modified) { /* Try to condense object header info if the flag indicates so */ /* (Since this routine is used to remove messages from an * object header, the header will be condensed after each * message removal) */ - if(oh_modified & H5O_MODIFY_CONDENSE) { - if(H5O_condense_header(f, oh, dxpl_id) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") - } + if (oh_modified & H5O_MODIFY_CONDENSE) { + if (H5O_condense_header(f, oh, dxpl_id) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") + } /* Mark object header as changed */ - if(H5O_touch_oh(f, dxpl_id, oh, FALSE) < 0) + if (H5O_touch_oh(f, dxpl_id, oh, FALSE) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object") /* Mark object header as dirty in cache */ - if(H5AC_mark_entry_dirty(oh) < 0) + if (H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_iterate_real() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_raw_size * @@ -1363,31 +1327,29 @@ done: *------------------------------------------------------------------------- */ size_t -H5O_msg_raw_size(const H5F_t *f, unsigned type_id, hbool_t disable_shared, - const void *mesg) +H5O_msg_raw_size(const H5F_t *f, unsigned type_id, hbool_t disable_shared, const void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - size_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + size_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(0) /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(type->raw_size); HDassert(f); HDassert(mesg); /* Compute the raw data size for the mesg */ - if(0 == (ret_value = (type->raw_size)(f, disable_shared, mesg))) + if (0 == (ret_value = (type->raw_size)(f, disable_shared, mesg))) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_raw_size() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_size_f * @@ -1406,35 +1368,33 @@ done: *------------------------------------------------------------------------- */ size_t -H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, - const void *mesg, size_t extra_raw) +H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, const void *mesg, size_t extra_raw) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - H5P_genplist_t *ocpl; /* Object Creation Property list */ - uint8_t oh_flags; /* Object header status flags */ - size_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + H5P_genplist_t * ocpl; /* Object Creation Property list */ + uint8_t oh_flags; /* Object header status flags */ + size_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(0) /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(type->raw_size); HDassert(f); HDassert(mesg); /* Get the property list */ - if(NULL == (ocpl = (H5P_genplist_t *)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 */ - if(H5P_get(ocpl, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0) + if (H5P_get(ocpl, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get object header flags") - /* Compute the raw data size for the mesg */ - if((ret_value = (type->raw_size)(f, FALSE, mesg)) == 0) + if ((ret_value = (type->raw_size)(f, FALSE, mesg)) == 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message") /* Add in "extra" raw space */ @@ -1444,14 +1404,13 @@ H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, ret_value = (size_t)H5O_ALIGN_F(f, ret_value); /* Add space for message header */ - ret_value += (size_t)H5O_SIZEOF_MSGHDR_F(f, - (H5F_STORE_MSG_CRT_IDX(f) || oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)); + ret_value += (size_t)H5O_SIZEOF_MSGHDR_F( + f, (H5F_STORE_MSG_CRT_IDX(f) || oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_size_f() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_size_oh * @@ -1470,24 +1429,23 @@ done: *------------------------------------------------------------------------- */ size_t -H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id, - const void *mesg, size_t extra_raw) +H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id, const void *mesg, size_t extra_raw) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - size_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + size_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(0) /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(type->raw_size); HDassert(f); HDassert(mesg); /* Compute the raw data size for the mesg */ - if((ret_value = (type->raw_size)(f, FALSE, mesg)) == 0) + if ((ret_value = (type->raw_size)(f, FALSE, mesg)) == 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message") /* Add in "extra" raw space */ @@ -1503,7 +1461,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_size_oh() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_can_share * @@ -1524,19 +1481,19 @@ done: htri_t H5O_msg_can_share(unsigned type_id, const void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - htri_t ret_value; + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + htri_t ret_value; FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(mesg); /* If there is a can_share callback, use it */ - if(type->can_share) + if (type->can_share) ret_value = (type->can_share)(mesg); else { /* Otherwise, the message can be shared if messages of this type are @@ -1553,7 +1510,6 @@ H5O_msg_can_share(unsigned type_id, const void *mesg) FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_can_share() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_can_share_in_ohdr * @@ -1571,14 +1527,14 @@ H5O_msg_can_share(unsigned type_id, const void *mesg) htri_t H5O_msg_can_share_in_ohdr(unsigned type_id) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - htri_t ret_value; + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + htri_t ret_value; FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Otherwise, the message can be shared if messages of this type are @@ -1590,7 +1546,6 @@ H5O_msg_can_share_in_ohdr(unsigned type_id) FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_can_share_in_ohdr() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_is_shared * @@ -1609,25 +1564,25 @@ H5O_msg_can_share_in_ohdr(unsigned type_id) htri_t H5O_msg_is_shared(unsigned type_id, const void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - htri_t ret_value; + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + htri_t ret_value; FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ #ifdef H5O_ENABLE_BOGUS - if(type_id >= NELMTS(H5O_msg_class_g)) + if (type_id >= NELMTS(H5O_msg_class_g)) ret_value = FALSE; else #endif /* H5O_ENABLE_BOGUS */ { HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(mesg); /* If messages in a class aren't sharable, then obviously this message isn't shared! :-) */ - if(type->share_flags & H5O_SHARE_IS_SHARABLE) + if (type->share_flags & H5O_SHARE_IS_SHARABLE) ret_value = H5O_IS_STORED_SHARED(((const H5O_shared_t *)mesg)->type); else ret_value = FALSE; @@ -1636,7 +1591,6 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg) FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_is_shared() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_set_share * @@ -1654,14 +1608,14 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg) herr_t H5O_msg_set_share(unsigned type_id, const H5O_shared_t *share, void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(type->share_flags & H5O_SHARE_IS_SHARABLE); HDassert(mesg); @@ -1671,15 +1625,15 @@ H5O_msg_set_share(unsigned type_id, const H5O_shared_t *share, void *mesg) /* 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) { - if((type->set_share)(mesg, share) < 0) + if (type->set_share) { + if ((type->set_share)(mesg, share) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set shared message information") } /* end if */ else { /* Set this message as the shared component for the message, wiping out * any information that was there before */ - if(H5O_set_shared((H5O_shared_t *)mesg, share) < 0) + if (H5O_set_shared((H5O_shared_t *)mesg, share) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set shared message information") } /* end else */ @@ -1687,7 +1641,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_set_share() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_reset_share * @@ -1705,13 +1658,13 @@ done: herr_t H5O_msg_reset_share(unsigned type_id, void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(type->share_flags & H5O_SHARE_IS_SHARABLE); HDassert(mesg); @@ -1722,7 +1675,6 @@ H5O_msg_reset_share(unsigned type_id, void *mesg) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_msg_reset_share() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_get_crt_index * @@ -1739,22 +1691,22 @@ H5O_msg_reset_share(unsigned type_id, void *mesg) herr_t H5O_msg_get_crt_index(unsigned type_id, const void *mesg, H5O_msg_crt_idx_t *crt_idx) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value = SUCCEED; + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); HDassert(mesg); HDassert(crt_idx); /* If there is a "get_crt_index callback, use it */ - if(type->get_crt_index) { + if (type->get_crt_index) { /* Retrieve the creation index from the native message */ - if((type->get_crt_index)(mesg, crt_idx) < 0) + if ((type->get_crt_index)(mesg, crt_idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve creation index") } /* end if */ else @@ -1764,7 +1716,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_get_crt_index() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_encode * @@ -1782,29 +1733,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared, - unsigned char *buf, const void *mesg) +H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared, unsigned char *buf, const void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* check args */ HDassert(f); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Encode */ - if((type->encode)(f, disable_shared, buf, mesg) < 0) + if ((type->encode)(f, disable_shared, buf, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_encode() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_decode * @@ -1827,30 +1776,29 @@ done: *------------------------------------------------------------------------- */ void * -H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, - size_t buf_size, const unsigned char *buf) +H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, size_t buf_size, + 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 */ + 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(NULL) /* check args */ HDassert(f); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* decode */ - if((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf_size, buf)) == NULL) + if ((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf_size, buf)) == NULL) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_decode() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_copy_file * @@ -1870,11 +1818,11 @@ done: *------------------------------------------------------------------------- */ void * -H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, - void *native_src, H5F_t *file_dst, hbool_t *recompute_size, - unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id) +H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, void *native_src, H5F_t *file_dst, + hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata, + hid_t dxpl_id) { - void *ret_value; + void *ret_value; FUNC_ENTER_NOAPI_NOINIT @@ -1890,14 +1838,14 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, /* The copy_file callback will return an H5O_shared_t only if the message * to be copied is a committed datatype. */ - if(NULL == (ret_value = (type->copy_file)(file_src, native_src, file_dst, recompute_size, mesg_flags, cpy_info, udata, dxpl_id))) + if (NULL == (ret_value = (type->copy_file)(file_src, native_src, file_dst, recompute_size, mesg_flags, + cpy_info, udata, dxpl_id))) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message to file") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_copy_file() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_alloc * @@ -1912,8 +1860,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, - unsigned *mesg_flags, void *native, size_t *mesg_idx) +H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, unsigned *mesg_flags, + void *native, size_t *mesg_idx) { size_t new_idx; /* New index for message */ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ @@ -1931,28 +1879,28 @@ H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, HDassert(mesg_idx); /* Check if message is already shared */ - if((shared_mesg = H5O_msg_is_shared(type->id, native)) < 0) + if ((shared_mesg = H5O_msg_is_shared(type->id, native)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "error determining if message is shared") - else if(shared_mesg > 0) { + else if (shared_mesg > 0) { /* Increment message's reference count */ - if(type->link && (type->link)(f, dxpl_id, oh, native) < 0) + if (type->link && (type->link)(f, dxpl_id, oh, native) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared message ref count") *mesg_flags |= H5O_MSG_FLAG_SHARED; } /* end if */ else { /* Attempt to share message */ - if(H5SM_try_share(f, dxpl_id, oh, 0, type->id, native, mesg_flags) < 0) + if (H5SM_try_share(f, dxpl_id, oh, 0, type->id, native, mesg_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") } /* end else */ /* Allocate space in the object header for the message */ - if(H5O_alloc(f, dxpl_id, oh, type, native, &new_idx) < 0) + if (H5O_alloc(f, dxpl_id, oh, type, native, &new_idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for message") /* Get the message's "creation index", if it has one */ - if(type->get_crt_index) { + if (type->get_crt_index) { /* Retrieve the creation index from the native message */ - if((type->get_crt_index)(native, &oh->mesg[new_idx].crt_idx) < 0) + if ((type->get_crt_index)(native, &oh->mesg[new_idx].crt_idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve creation index") } /* end if */ @@ -1963,7 +1911,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_alloc() */ - /*------------------------------------------------------------------------- * Function: H5O_copy_mesg * @@ -1978,14 +1925,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, - const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, - unsigned update_flags) +H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, const void *mesg, + unsigned mesg_flags, unsigned update_flags) { - H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ - H5O_mesg_t *idx_msg = &oh->mesg[idx]; /* Pointer to message to modify */ - hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ + H5O_mesg_t * idx_msg = &oh->mesg[idx]; /* Pointer to message to modify */ + hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1997,14 +1943,14 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, HDassert(mesg); /* Protect chunk */ - if(NULL == (chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, idx_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + if (NULL == (chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, idx_msg->chunkno))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") /* Reset existing native information for the header's message */ H5O_msg_reset_real(type, idx_msg->native); /* Copy the native object for the message */ - if(NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native))) + if (NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header") /* Update the message flags */ @@ -2012,27 +1958,26 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t idx, /* Mark the message as modified */ idx_msg->dirty = TRUE; - chk_dirtied = TRUE; + chk_dirtied = TRUE; /* Release chunk */ - if(H5O_chunk_unprotect(f, dxpl_id, chk_proxy, chk_dirtied) < 0) + if (H5O_chunk_unprotect(f, dxpl_id, chk_proxy, chk_dirtied) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") chk_proxy = NULL; /* Update the modification time, if requested */ - if(update_flags & H5O_UPDATE_TIME) - if(H5O_touch_oh(f, dxpl_id, oh, FALSE) < 0) + if (update_flags & H5O_UPDATE_TIME) + if (H5O_touch_oh(f, dxpl_id, oh, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: /* Release chunk, if not already released */ - if(chk_proxy && H5O_chunk_unprotect(f, dxpl_id, chk_proxy, chk_dirtied) < 0) + if (chk_proxy && H5O_chunk_unprotect(f, dxpl_id, chk_proxy, chk_dirtied) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_copy_mesg() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_delete * @@ -2056,29 +2001,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, - void *mesg) +H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* check args */ HDassert(f); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* delete */ - if((type->del) && (type->del)(f, dxpl_id, open_oh, mesg) < 0) + if ((type->del) && (type->del)(f, dxpl_id, open_oh, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_delete() */ - /*------------------------------------------------------------------------- * Function: H5O_delete_mesg * @@ -2097,8 +2040,8 @@ done: herr_t H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg) { - const H5O_msg_class_t *type = mesg->type; /* Type of object to free */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5O_msg_class_t *type = mesg->type; /* Type of object to free */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2108,19 +2051,19 @@ H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg) HDassert(oh); /* Check if there is a file space deletion callback for this type of message */ - if(type->del) { + if (type->del) { /* Decode the message if necessary. */ 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") + 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") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_delete_mesg() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_flush * @@ -2137,9 +2080,9 @@ done: herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) { - uint8_t *p; /* Temporary pointer to encode with */ - unsigned msg_id; /* ID for message */ - herr_t ret_value = SUCCEED; /* Return value */ + uint8_t *p; /* Temporary pointer to encode with */ + unsigned msg_id; /* ID for message */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2151,13 +2094,13 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) p = mesg->raw - H5O_SIZEOF_MSGHDR_OH(oh); /* Retrieve actual message ID, for unknown messages */ - if(mesg->type == H5O_MSG_UNKNOWN) + if (mesg->type == H5O_MSG_UNKNOWN) msg_id = *(H5O_unknown_t *)(mesg->native); else msg_id = (uint8_t)mesg->type->id; /* Encode the message prefix */ - if(oh->version == H5O_VERSION_1) + if (oh->version == H5O_VERSION_1) UINT16ENCODE(p, msg_id) else *p++ = (uint8_t)msg_id; @@ -2166,22 +2109,22 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) *p++ = mesg->flags; /* Only encode reserved bytes for version 1 of format */ - if(oh->version == H5O_VERSION_1) { + if (oh->version == H5O_VERSION_1) { *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ - } /* end for */ + } /* end for */ /* Only encode creation index for version 2+ of format */ else { /* Only encode creation index if they are being tracked */ - if(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) + if (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) UINT16ENCODE(p, mesg->crt_idx); } /* end else */ HDassert(p == mesg->raw); #ifndef NDEBUG /* Make certain that null messages aren't in chunks w/gaps */ - if(H5O_NULL_ID == msg_id) + if (H5O_NULL_ID == msg_id) HDassert(oh->chunk[mesg->chunkno].gap == 0); else /* Non-null messages should always have a native pointer */ @@ -2189,7 +2132,7 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) #endif /* NDEBUG */ /* Encode the message itself, if it's not an "unknown" message */ - if(mesg->native && mesg->type != H5O_MSG_UNKNOWN) { + if (mesg->native && mesg->type != H5O_MSG_UNKNOWN) { /* * Encode the message. If the message is shared then we * encode a Shared Object message instead of the object @@ -2198,19 +2141,19 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) HDassert(mesg->raw >= oh->chunk[mesg->chunkno].image); HDassert(mesg->raw_size == H5O_ALIGN_OH(oh, mesg->raw_size)); HDassert(mesg->raw + mesg->raw_size <= - oh->chunk[mesg->chunkno].image + (oh->chunk[mesg->chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh))); + oh->chunk[mesg->chunkno].image + (oh->chunk[mesg->chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh))); #ifndef NDEBUG -/* Sanity check that the message won't overwrite past it's allocated space */ -{ - size_t msg_size; - - msg_size = mesg->type->raw_size(f, FALSE, mesg->native); - msg_size = H5O_ALIGN_OH(oh, msg_size); - HDassert(msg_size <= mesg->raw_size); -} + /* Sanity check that the message won't overwrite past it's allocated space */ + { + size_t msg_size; + + msg_size = mesg->type->raw_size(f, FALSE, mesg->native); + msg_size = H5O_ALIGN_OH(oh, msg_size); + HDassert(msg_size <= mesg->raw_size); + } #endif /* NDEBUG */ HDassert(mesg->type->encode); - if((mesg->type->encode)(f, FALSE, mesg->raw, mesg->native) < 0) + if ((mesg->type->encode)(f, FALSE, mesg->raw, mesg->native) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message") } /* end if */ @@ -2221,7 +2164,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_flush() */ - /*------------------------------------------------------------------------- * Function: H5O_flush_msgs * @@ -2238,9 +2180,9 @@ done: herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh) { - H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2249,26 +2191,25 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh) HDassert(oh); /* Encode any dirty messages */ - for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) - if(curr_msg->dirty) - if(H5O_msg_flush(f, oh, curr_msg) < 0) + for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) + if (curr_msg->dirty) + if (H5O_msg_flush(f, oh, curr_msg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message") /* Sanity check for the correct # of messages in object header */ - if(oh->nmesgs != u) + 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; + /* 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() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_chunkno * @@ -2287,11 +2228,11 @@ done: int H5O_msg_get_chunkno(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header to use */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - unsigned idx; /* Index of message to modify */ - int ret_value; /* Return value */ + H5O_t * oh = NULL; /* Object header to use */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + H5O_mesg_t * idx_msg; /* Pointer to message to modify */ + unsigned idx; /* Index of message to modify */ + int ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2300,31 +2241,30 @@ H5O_msg_get_chunkno(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Locate message of correct type */ - for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(type == idx_msg->type) + for (idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) + if (type == idx_msg->type) break; - if(idx == oh->nmesgs) + if (idx == oh->nmesgs) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") /* Set return value */ H5_CHECKED_ASSIGN(ret_value, int, idx_msg->chunkno, unsigned); done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_get_chunkno() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_lock * @@ -2342,11 +2282,11 @@ done: herr_t H5O_msg_lock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header to use */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - unsigned idx; /* Index of message to modify */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t * oh = NULL; /* Object header to use */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + H5O_mesg_t * idx_msg; /* Pointer to message to modify */ + unsigned idx; /* Index of message to modify */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2355,35 +2295,34 @@ H5O_msg_lock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Locate message of correct type */ - for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(type == idx_msg->type) + for (idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) + if (type == idx_msg->type) break; - if(idx == oh->nmesgs) + if (idx == oh->nmesgs) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") /* Fail if the message is already locked */ - if(idx_msg->locked) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOCK, FAIL, "message already locked") + if (idx_msg->locked) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOCK, FAIL, "message already locked") /* Make the message locked */ idx_msg->locked = TRUE; done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_lock() */ - /*------------------------------------------------------------------------- * Function: H5O_msg_unlock * @@ -2400,11 +2339,11 @@ done: herr_t H5O_msg_unlock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header to use */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - unsigned idx; /* Index of message to modify */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t * oh = NULL; /* Object header to use */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + H5O_mesg_t * idx_msg; /* Pointer to message to modify */ + unsigned idx; /* Index of message to modify */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2413,31 +2352,30 @@ H5O_msg_unlock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Locate message of correct type */ - for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(type == idx_msg->type) + for (idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) + if (type == idx_msg->type) break; - if(idx == oh->nmesgs) + if (idx == oh->nmesgs) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") /* Fail if the message is not locked */ - if(!idx_msg->locked) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNLOCK, FAIL, "message not locked") + if (!idx_msg->locked) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNLOCK, FAIL, "message not locked") /* Make the message unlocked */ idx_msg->locked = FALSE; done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_unlock() */ - |