From c560e68258bef4235fac0cebfe65e8850e25b61d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 5 Feb 2007 17:26:44 -0500 Subject: [svn-r13240] Description: More cleanups on the object header message handling code, to make it easier to work with and move forward on the creation order coding. Various other minor cleanups & warning fixes. Tested on: FreeBSD/32 6.2 (duty) --- src/H5Adense.c | 4 +- src/H5Apkg.h | 2 +- src/H5D.c | 18 ++++---- src/H5Doh.c | 4 +- src/H5FD.c | 2 +- src/H5G.c | 12 ++--- src/H5Gdense.c | 14 ++---- src/H5Gdeprec.c | 2 +- src/H5Gnode.c | 16 +++---- src/H5Gobj.c | 34 +++++++-------- src/H5Goh.c | 4 +- src/H5Gpkg.h | 3 +- src/H5Gstab.c | 39 ++++++++--------- src/H5Gtest.c | 36 +++++++-------- src/H5Gtraverse.c | 4 +- src/H5O.c | 35 +++++++++------ src/H5Oalloc.c | 23 ++++++---- src/H5Oattr.c | 6 +-- src/H5Oattribute.c | 8 ++-- src/H5Ocont.c | 4 +- src/H5Ocopy.c | 18 ++++---- src/H5Olayout.c | 6 +-- src/H5Olinfo.c | 6 +-- src/H5Olink.c | 79 ++++++++++++++++----------------- src/H5Omessage.c | 126 +++++++++++++++++++---------------------------------- src/H5Opkg.h | 32 +++++++------- src/H5Oprivate.h | 13 +++--- src/H5Oshared.c | 11 +++-- src/H5Oshared.h | 6 +-- src/H5Ostab.c | 6 +-- src/H5S.c | 4 +- src/H5T.c | 56 ++++++++++++------------ src/H5Tcommit.c | 2 +- src/H5Toh.c | 2 +- src/H5Tpkg.h | 2 +- test/ohdr.c | 66 +++------------------------- 36 files changed, 306 insertions(+), 399 deletions(-) diff --git a/src/H5Adense.c b/src/H5Adense.c index b630166..f227730 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -1091,7 +1091,7 @@ H5A_dense_remove_bt2_cb(const void *_record, void *_bt2_udata) else { /* Perform the deletion action on the attribute */ /* (takes care of shared & committed datatype/dataspace components) */ - if(H5O_attr_delete(bt2_udata->f, bt2_udata->dxpl_id, *(H5A_t **)bt2_udata->found_op_data, TRUE) < 0) + if(H5O_attr_delete(bt2_udata->f, bt2_udata->dxpl_id, *(H5A_t **)bt2_udata->found_op_data) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") /* Remove record from fractal heap */ @@ -1327,7 +1327,7 @@ H5A_dense_delete_bt2_cb(const void *_record, void *_bt2_udata) else { /* Perform the deletion action on the attribute */ /* (takes care of shared/committed datatype & dataspace components) */ - if(H5O_attr_delete(bt2_udata->f, bt2_udata->dxpl_id, fh_udata.attr, TRUE) < 0) + if(H5O_attr_delete(bt2_udata->f, bt2_udata->dxpl_id, fh_udata.attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") } /* end else */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 9ac95cb..7f95a70 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -193,7 +193,7 @@ H5_DLL herr_t H5A_attr_release_table(H5A_attr_table_t *atable); /* Attribute object header routines */ H5_DLL herr_t H5O_attr_reset(void *_mesg); -H5_DLL herr_t H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); +H5_DLL herr_t H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, const void *_mesg); /* Attribute operations */ diff --git a/src/H5D.c b/src/H5D.c index b49d88a..fa7b19c 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1761,7 +1761,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open") /* Get the type and space */ - if(NULL == (dataset->shared->type = H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, 0, NULL, dxpl_id))) + if(NULL == (dataset->shared->type = H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header") if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load space info from dataset header") @@ -1776,7 +1776,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id) /* Get the optional filters message */ pline = &dataset->shared->dcpl_cache.pline; - if(NULL != H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, 0, pline, dxpl_id)) { + if(NULL != H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, pline, dxpl_id)) { if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, pline) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set pipeline") } /* end if */ @@ -1789,7 +1789,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id) * values are copied to the dataset create plist so the user can query * them. */ - if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, 0, &(dataset->shared->layout), dxpl_id)) + if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id)) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message") if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout.type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout") @@ -1854,11 +1854,11 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id) fill_prop = &dataset->shared->dcpl_cache.fill; /* Try to get the new fill value message from the object header */ - if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, 0, fill_prop, dxpl_id)) { + if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, fill_prop, dxpl_id)) { H5E_clear_stack(NULL); /* For backward compatibility, try to retrieve the old fill value message */ - if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, 0, fill_prop, dxpl_id)) { + if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, fill_prop, dxpl_id)) { H5E_clear_stack(NULL); /* Set the space allocation time appropriately, based on the type of dataset storage */ @@ -1902,7 +1902,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id) * also undefined when space allocate time is H5D_ALLOC_TIME_LATE. */ if((dataset->shared->layout.type == H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr)) || (dataset->shared->layout.type == H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr))) { - if(NULL != H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, 0, &dataset->shared->dcpl_cache.efl, dxpl_id)) { + if(NULL != H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl, dxpl_id)) { if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->dcpl_cache.efl) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set external file list") @@ -2012,7 +2012,7 @@ H5D_close(H5D_t *dataset) case H5D_COMPACT: /* Update header message of layout for compact dataset. */ if(dataset->shared->layout.u.compact.dirty) { - if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), H5AC_dxpl_id) < 0) + if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to update layout message") dataset->shared->layout.u.compact.dirty = FALSE; } /* end if */ @@ -2403,7 +2403,7 @@ H5D_alloc_storage(H5F_t *f, hid_t dxpl_id, H5D_t *dset/*in,out*/, H5D_time_alloc * set the address. (this is improves forward compatibility). */ if(time_alloc != H5D_ALLOC_CREATE && addr_set) - if(H5O_msg_write(&dset->oloc, H5O_LAYOUT_ID, 0, H5O_MSG_FLAG_CONSTANT, update_time, &dset->shared->layout, dxpl_id) < 0) + if(H5O_msg_write(&dset->oloc, H5O_LAYOUT_ID, H5O_MSG_FLAG_CONSTANT, update_time, &dset->shared->layout, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout message") } /* end if */ @@ -3306,7 +3306,7 @@ H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags) case H5D_COMPACT: if(dataset->shared->layout.u.compact.dirty) { - if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id) < 0) + if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message") dataset->shared->layout.u.compact.dirty = FALSE; } /* end if */ diff --git a/src/H5Doh.c b/src/H5Doh.c index 5c8797e..3cfc783 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -177,13 +177,13 @@ H5O_dset_isa(H5O_t *oh) HDassert(oh); /* Datatype */ - if((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID, 0)) < 0) + if((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") else if(!exists) HGOTO_DONE(FALSE) /* Layout */ - if((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID, 0)) < 0) + if((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") else if(!exists) HGOTO_DONE(FALSE) diff --git a/src/H5FD.c b/src/H5FD.c index a2e0cb1..97be6b9 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -2942,7 +2942,7 @@ H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) if(!file || !file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") if(type= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file type") if(!H5F_addr_defined(addr) || addr>file->maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value") diff --git a/src/H5G.c b/src/H5G.c index 602db88..588e923 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -539,13 +539,13 @@ H5Gget_create_plist(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object creation info") /* Check for the group having a group info message */ - if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, 0, H5AC_ind_dxpl_id)) < 0) + if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(ginfo_exists) { H5O_ginfo_t ginfo; /* Group info message */ /* Read the group info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, 0, &ginfo, H5AC_ind_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_ind_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") /* Set the group info for the property list */ @@ -554,13 +554,13 @@ H5Gget_create_plist(hid_t group_id) } /* end if */ /* Check for the group having a link info message */ - if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_ind_dxpl_id)) < 0) + if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(linfo_exists) { H5O_linfo_t linfo; /* Link info message */ /* Read the link info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_ind_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, &linfo, H5AC_ind_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Set the link info for the property list */ @@ -1285,8 +1285,8 @@ H5G_open_oid(H5G_t *grp, hid_t dxpl_id) obj_opened = TRUE; /* Check if this object has the right message(s) to be treated as a group */ - if((H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, 0, dxpl_id) <= 0) - && (H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, 0, dxpl_id) <= 0)) + if((H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, dxpl_id) <= 0) + && (H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, dxpl_id) <= 0)) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group") done: diff --git a/src/H5Gdense.c b/src/H5Gdense.c index abc7fcc..4da0be4 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -118,7 +118,6 @@ typedef struct { typedef struct { /* downward */ H5G_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */ - hbool_t adj_link; /* Whether to adjust link count on object */ hbool_t rem_from_fheap; /* Whether to remove the link from the fractal heap */ hbool_t rem_from_corder_index; /* Whether to remove the link from the creation order index */ haddr_t corder_bt2_addr; /* Address of v2 B-tree indexing creation order */ @@ -134,7 +133,6 @@ typedef struct { /* downward */ H5F_t *f; /* Pointer to file that fractal heap is in */ hid_t dxpl_id; /* DXPL for operation */ - hbool_t adj_link; /* Whether to adjust link count on object */ hbool_t rem_from_corder_index; /* Whether to remove the link from the creation order index */ haddr_t corder_bt2_addr; /* Address of v2 B-tree indexing creation order */ H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */ @@ -1367,9 +1365,9 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata) if(H5G_link_name_replace(udata->f, udata->dxpl_id, udata->grp_full_path_r, lnk->name, lnk->type, lnk->u.hard.addr) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRENAME, FAIL, "unable to rename open objects") - /* Perform the deletion action on the link */ + /* Perform the deletion action on the link, if requested */ /* (call message "delete" callback directly: *ick* - QAK) */ - if(H5O_link_delete(udata->f, udata->dxpl_id, lnk, udata->adj_link) < 0) + if(H5O_link_delete(udata->f, udata->dxpl_id, lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -1407,7 +1405,6 @@ H5G_dense_remove_bt2_cb(const void *_record, void *_bt2_udata) /* Set up the user data for fractal heap 'op' callback */ fh_udata.f = bt2_udata->common.f; fh_udata.dxpl_id = bt2_udata->common.dxpl_id; - fh_udata.adj_link = bt2_udata->adj_link; fh_udata.rem_from_corder_index = bt2_udata->rem_from_corder_index; fh_udata.corder_bt2_addr = bt2_udata->corder_bt2_addr; fh_udata.grp_full_path_r = bt2_udata->grp_full_path_r; @@ -1470,7 +1467,6 @@ H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, udata.common.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0); udata.common.found_op = NULL; udata.common.found_op_data = NULL; - udata.adj_link = TRUE; udata.rem_from_fheap = TRUE; udata.rem_from_corder_index = H5F_addr_defined(linfo->corder_bt2_addr); udata.corder_bt2_addr = linfo->corder_bt2_addr; @@ -1478,8 +1474,7 @@ H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, udata.replace_names = TRUE; /* Remove the record from the name index v2 B-tree */ - if(H5B2_remove(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, - &udata, H5G_dense_remove_bt2_cb, &udata) < 0) + if(H5B2_remove(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, &udata, H5G_dense_remove_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from name index v2 B-tree") done: @@ -1616,7 +1611,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) /* Perform the deletion action on the link */ /* (call link message "delete" callback directly: *ick* - QAK) */ - if(H5O_link_delete(bt2_udata->f, bt2_udata->dxpl_id, fh_udata.lnk, TRUE) < 0) + if(H5O_link_delete(bt2_udata->f, bt2_udata->dxpl_id, fh_udata.lnk) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") /* Release the space allocated for the link */ @@ -1781,7 +1776,6 @@ H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link) udata.common.name_hash = 0; udata.common.found_op = NULL; udata.common.found_op_data = NULL; - udata.adj_link = TRUE; udata.rem_from_fheap = FALSE; /* handled in "bulk" below by deleting entire heap */ udata.rem_from_corder_index = FALSE; udata.grp_full_path_r = NULL; diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 108e48c..8a6676b 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -670,7 +670,7 @@ H5G_get_comment(H5G_loc_t *loc, const char *name, size_t bufsize, char *buf, hid /* Get the message */ comment.s = NULL; - if(NULL == H5O_msg_read(obj_loc.oloc, H5O_NAME_ID, 0, &comment, dxpl_id)) { + if(NULL == H5O_msg_read(obj_loc.oloc, H5O_NAME_ID, &comment, dxpl_id)) { if(buf && bufsize > 0) buf[0] = '\0'; ret_value = 0; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 0c23524..ee22ef2 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1276,8 +1276,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, if(H5G_link_name_replace(f, dxpl_id, udata->grp_full_path_r, s, lnk_type, lnk_addr) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object type") - /* Decrement the ref. count for hard links, if requested */ - if(lnk_type == H5L_TYPE_HARD && udata->adj_link) { + /* Decrement the ref. count for hard links */ + if(lnk_type == H5L_TYPE_HARD) { H5O_loc_t tmp_oloc; /* Temporary object location */ /* Build temporary object location */ @@ -1359,14 +1359,12 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, /* Reduce the link count for all entries in this node */ for(idx = 0; idx < sn->nsyms; idx++) { if(!(H5G_CACHED_SLINK == sn->entry[idx].type)) { - /* Decrement the reference count, if requested */ - if(udata->adj_link) { - HDassert(H5F_addr_defined(sn->entry[idx].header)); - tmp_oloc.addr = sn->entry[idx].header; + /* Decrement the reference count */ + HDassert(H5F_addr_defined(sn->entry[idx].header)); + tmp_oloc.addr = sn->entry[idx].header; - if(H5O_link(&tmp_oloc, -1, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to decrement object link count") - } /* end if */ + if(H5O_link(&tmp_oloc, -1, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to decrement object link count") } /* end if */ } /* end for */ diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 189adf9..fe0f99e 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -413,14 +413,14 @@ H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Check if we have information about the number of objects in this group */ /* (by attempting to get the link info message for this group) */ - if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) { + if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, &linfo, dxpl_id)) { size_t link_msg_size; /* Size of new link message in the file */ /* Using the new format for groups */ use_old_format = FALSE; /* Get the group info */ - if(NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id)) + if(NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, &ginfo, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") /* Check for tracking creation order on this group's links */ @@ -541,7 +541,7 @@ H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Increment the number of objects in this group */ if(!use_old_format) { linfo.nlinks++; - if(H5O_msg_write(grp_oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0) + if(H5O_msg_write(grp_oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message") } /* end if */ @@ -606,7 +606,7 @@ H5G_obj_iterate(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "bad group ID") /* Attempt to get the link info for this group */ - if(H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, dxpl_id)) { + if(H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, &linfo, dxpl_id)) { /* Check for going out of bounds */ if(skip > 0 && (size_t)skip >= linfo.nlinks) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound") @@ -616,7 +616,7 @@ H5G_obj_iterate(hid_t loc_id, const char *group_name, H5O_ginfo_t ginfo; /* Group info message */ /* Get group info message, to see if creation order is tracked for links in this group */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, 0, &ginfo, dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info message for group") /* Check if creation order is tracked */ @@ -682,7 +682,7 @@ H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id) HDassert(grp_info); /* Attempt to get the link info for this group */ - if(H5O_msg_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) { + if(H5O_msg_read(oloc, H5O_LINFO_ID, &linfo, dxpl_id)) { /* Retrieve the information about the links */ grp_info->nlinks = linfo.nlinks; grp_info->min_corder = linfo.min_corder; @@ -740,13 +740,13 @@ H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5_index_t idx_type, HDassert(oloc && oloc->file); /* Attempt to get the link info for this group */ - if(H5O_msg_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) { + if(H5O_msg_read(oloc, H5O_LINFO_ID, &linfo, dxpl_id)) { /* Check for creation order tracking, if creation order index lookup requested */ if(idx_type == H5_INDEX_CRT_ORDER) { H5O_ginfo_t ginfo; /* Group info message */ /* Get group info message, to see if creation order is tracked for links in this group */ - if(NULL == H5O_msg_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id)) + if(NULL == H5O_msg_read(oloc, H5O_GINFO_ID, &ginfo, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info message for group") /* Check if creation order is tracked */ @@ -811,7 +811,7 @@ H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) HDassert(oloc); /* Attempt to get the link info for this group */ - if(H5O_msg_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) { + if(H5O_msg_read(oloc, H5O_LINFO_ID, &linfo, dxpl_id)) { if(H5F_addr_defined(linfo.link_fheap_addr)) { /* Get the object's name from the dense link storage */ if((ret_value = H5G_dense_get_type_by_idx(oloc->file, dxpl_id, &linfo, idx)) < 0) @@ -881,7 +881,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) H5O_ginfo_t ginfo; /* Group info message */ /* Get the group info */ - if(NULL == H5O_msg_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id)) + if(NULL == H5O_msg_read(oloc, H5O_GINFO_ID, &ginfo, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") /* Check if we should switch from dense storage back to link messages */ @@ -940,7 +940,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id) } /* end if */ /* Update link info in the object header */ - if(H5O_msg_write(oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, linfo, dxpl_id) < 0) + if(H5O_msg_write(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, linfo, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message") done: @@ -975,7 +975,7 @@ H5G_obj_remove(H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name, h HDassert(name && *name); /* Attempt to get the link info for this group */ - if(H5O_msg_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) { + if(H5O_msg_read(oloc, H5O_LINFO_ID, &linfo, dxpl_id)) { /* Using the new format for groups */ use_old_format = FALSE; @@ -1040,13 +1040,13 @@ H5G_obj_remove_by_idx(H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, HDassert(grp_oloc && grp_oloc->file); /* Attempt to get the link info for this group */ - if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) { + if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, &linfo, dxpl_id)) { /* Check for creation order tracking, if creation order index lookup requested */ if(idx_type == H5_INDEX_CRT_ORDER) { H5O_ginfo_t ginfo; /* Group info message */ /* Get group info message, to see if creation order is tracked for links in this group */ - if(NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id)) + if(NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, &ginfo, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info message for group") /* Check if creation order is tracked */ @@ -1123,7 +1123,7 @@ H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, HDassert(name && *name); /* Attempt to get the link info message for this group */ - if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) { + if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, &linfo, dxpl_id)) { /* Check for dense link storage */ if(H5F_addr_defined(linfo.link_fheap_addr)) { /* Get the object's info from the dense link storage */ @@ -1177,13 +1177,13 @@ H5G_obj_lookup_by_idx(H5O_loc_t *grp_oloc, H5_index_t idx_type, HDassert(grp_oloc && grp_oloc->file); /* Attempt to get the link info message for this group */ - if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) { + if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, &linfo, dxpl_id)) { /* Check for creation order tracking, if creation order index lookup requested */ if(idx_type == H5_INDEX_CRT_ORDER) { H5O_ginfo_t ginfo; /* Group info message */ /* Get group info message, to see if creation order is tracked for links in this group */ - if(NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id)) + if(NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, &ginfo, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info message for group") /* Check if creation order is tracked */ diff --git a/src/H5Goh.c b/src/H5Goh.c index 2b51d0a..dc8c19b 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -99,9 +99,9 @@ H5O_group_isa(struct H5O_t *oh) HDassert(oh); /* Check for any of the messages that indicate a group */ - if((stab_exists = H5O_msg_exists_oh(oh, H5O_STAB_ID, 0)) < 0) + if((stab_exists = H5O_msg_exists_oh(oh, H5O_STAB_ID)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") - if((linfo_exists = H5O_msg_exists_oh(oh, H5O_LINFO_ID, 0)) < 0) + if((linfo_exists = H5O_msg_exists_oh(oh, H5O_LINFO_ID)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") ret_value = (stab_exists > 0 || linfo_exists > 0); diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index fbf1b44..d21b15a 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -179,7 +179,6 @@ typedef struct H5G_bt_ins_t { typedef struct H5G_bt_rm_t { /* downward */ H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ - hbool_t adj_link; /* Whether to adjust the link count on objects */ H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */ } H5G_bt_rm_t; @@ -380,7 +379,7 @@ H5_DLL herr_t H5G_stab_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, hid_t dxpl_id); H5_DLL herr_t H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name, H5O_link_t *obj_lnk, hid_t dxpl_id); -H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_link); +H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab); H5_DLL herr_t H5G_stab_iterate(H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, hid_t gid, H5G_link_iterate_t *lnk_op, void *op_data); diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 6079427..de39441 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -268,7 +268,7 @@ H5G_stab_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, HDassert(obj_lnk); /* Retrieve symbol table message */ - if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id)) + if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table") if(H5G_stab_insert_real(grp_oloc->file, &stab, name, obj_lnk, dxpl_id) < 0) @@ -305,13 +305,12 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, HDassert(name && *name); /* Read in symbol table message */ - if(NULL == H5O_msg_read(loc, H5O_STAB_ID, 0, &stab, dxpl_id)) + if(NULL == H5O_msg_read(loc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table") /* Initialize data to pass through B-tree */ udata.common.name = name; udata.common.heap_addr = stab.heap_addr; - udata.adj_link = TRUE; udata.grp_full_path_r = grp_full_path_r; /* Remove from symbol table */ @@ -355,13 +354,12 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_ lnk_copied = TRUE; /* Read in symbol table message */ - if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id)) + if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table") /* Initialize data to pass through B-tree */ udata.common.name = obj_lnk.name; udata.common.heap_addr = stab.heap_addr; - udata.adj_link = TRUE; udata.grp_full_path_r = grp_full_path_r; /* Remove link from symbol table */ @@ -392,33 +390,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_link) +H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) { H5G_bt_rm_t udata; /*data to pass through B-tree */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5G_stab_delete, FAIL); + FUNC_ENTER_NOAPI(H5G_stab_delete, FAIL) - assert(f); - assert(stab); - assert(H5F_addr_defined(stab->btree_addr)); - assert(H5F_addr_defined(stab->heap_addr)); + HDassert(f); + HDassert(stab); + HDassert(H5F_addr_defined(stab->btree_addr)); + HDassert(H5F_addr_defined(stab->heap_addr)); /* Set up user data for B-tree deletion */ udata.common.name = NULL; udata.common.heap_addr = stab->heap_addr; - udata.adj_link = adj_link; /* Delete entire B-tree */ if(H5B_delete(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree"); + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree") /* Delete local heap for names */ if(H5HL_delete(f, dxpl_id, stab->heap_addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table heap"); + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table heap") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_stab_delete() */ @@ -450,7 +447,7 @@ H5G_stab_iterate(H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, HDassert(lnk_op && lnk_op->u.old_op); /* Get the B-tree info */ - if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id)) + if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Check on iteration order */ @@ -539,7 +536,7 @@ H5G_stab_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id) *num_objs = 0; /* Get the B-tree info */ - if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id)) + if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Iterate over the group members */ @@ -627,7 +624,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, HDassert(oloc); /* Get the B-tree & local heap info */ - if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id)) + if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Remap index for decreasing iteration order */ @@ -761,7 +758,7 @@ H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) HDassert(oloc); /* Get the B-tree & local heap info */ - if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id)) + if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") /* Set iteration information */ @@ -859,7 +856,7 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, udata.lnk = lnk; /* Set up the user data for actual B-tree find operation */ - if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id)) + if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't read message") bt_udata.common.name = name; bt_udata.common.heap_addr = stab.heap_addr; @@ -956,7 +953,7 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, HDassert(lnk); /* Get the B-tree & local heap info */ - if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id)) + if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Remap index for decreasing iteration order */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 8852adf..a2286c2 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -107,11 +107,11 @@ H5G_is_empty_test(hid_t gid) /* "New format" checks */ /* Check if the group has any link messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { /* Sanity check that new group format shouldn't have old messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") @@ -120,19 +120,19 @@ H5G_is_empty_test(hid_t gid) } /* end if */ /* Check for a link info message */ - if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_id)) < 0) + if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(linfo_exists > 0) { H5O_linfo_t linfo; /* Link info message */ /* Sanity check that new group format shouldn't have old messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found") /* Get the link info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, &linfo, H5AC_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ @@ -151,7 +151,7 @@ H5G_is_empty_test(hid_t gid) /* "Old format" checks */ /* Check if the group has a symbol table message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_stab_t stab; /* Info about local heap & B-tree */ @@ -160,13 +160,13 @@ H5G_is_empty_test(hid_t gid) /* Sanity check that old group format shouldn't have new messages */ if(linfo_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found") - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and group info messages found") /* Get the B-tree & local heap info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab, H5AC_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message") /* Get the count of links in the group */ @@ -216,13 +216,13 @@ H5G_has_links_test(hid_t gid, unsigned *nmsgs) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Check if the group has any link messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has a symbol table message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") @@ -274,13 +274,13 @@ H5G_has_stab_test(hid_t gid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Check if the group has a symbol table message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") @@ -324,25 +324,25 @@ H5G_is_new_dense_test(hid_t gid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Check if the group has a symbol table message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has link info message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, 0, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_linfo_t linfo; /* Link info message */ /* Get the link info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, &linfo, H5AC_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ @@ -392,7 +392,7 @@ H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Get the link info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, &linfo, H5AC_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ @@ -452,7 +452,7 @@ H5G_lheap_size_test(hid_t gid, size_t *lheap_size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Make certain the group has a symbol table message */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab, H5AC_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message") /* Check the size of the local heap for the group */ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index ad39402..80e1a6f 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -700,7 +700,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Get the group info for parent group */ /* (OK if not found) */ - if(NULL == H5O_msg_read(grp_loc.oloc, H5O_GINFO_ID, 0, &par_ginfo, dxpl_id)) { + if(NULL == H5O_msg_read(grp_loc.oloc, H5O_GINFO_ID, &par_ginfo, dxpl_id)) { /* Clear error stack from not finding the group info message */ H5E_clear_stack(NULL); @@ -712,7 +712,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Get the link info for parent group */ /* (OK if not found) */ - if(NULL == H5O_msg_read(grp_loc.oloc, H5O_LINFO_ID, 0, &par_linfo, dxpl_id)) { + if(NULL == H5O_msg_read(grp_loc.oloc, H5O_LINFO_ID, &par_linfo, dxpl_id)) { /* Clear error stack from not finding the link info message */ H5E_clear_stack(NULL); diff --git a/src/H5O.c b/src/H5O.c index be16c6a..74edeca 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1108,15 +1108,18 @@ H5O_touch_oh(H5F_t *f, /* Create a new message, if necessary */ if(idx == oh->nmesgs) { - size_t size; /* New modification time message size */ + unsigned mesg_flags = 0; /* Flags for message in object header */ /* If we would have to create a new message, but we aren't 'forcing' it, get out now */ if(!force) HGOTO_DONE(SUCCEED); /*nothing to do*/ - size = (H5O_MSG_MTIME_NEW->raw_size)(f, FALSE, &now); - if((idx = H5O_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, size, oh_flags_ptr)) == UFAIL) + /* Allocate space for the modification time message */ + if((idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now, oh_flags_ptr)) == UFAIL) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message") + + /* Set the message's flags if appropriate */ + oh->mesg[idx].flags = mesg_flags; } /* end if */ /* Allocate 'native' space, if necessary */ @@ -1225,20 +1228,26 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t * oh_flags_ptr) /* Create a new message */ if(idx == oh->nmesgs) { - size_t size = (H5O_MSG_BOGUS->raw_size)(f, NULL); - - if((idx = H5O_alloc(f, dxpl_id, oh, H5O_MSG_BOGUS, size, oh_flags_ptr)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") + H5O_bogus_t *bogus; /* Pointer to the bogus information */ + unsigned mesg_flags = 0; /* Flags for message in object header */ /* Allocate the native message in memory */ - if(NULL == (oh->mesg[idx].native = H5MM_malloc(sizeof(H5O_bogus_t)))) + if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t)))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message") - /* Update the native part */ - ((H5O_bogus_t *)(oh->mesg[idx].native))->u = H5O_BOGUS_VALUE; + /* Update the native value */ + bogus->u = H5O_BOGUS_VALUE; + + /* Allocate space in the object header for bogus message */ + if((idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_BOGUS, &mesg_flags, bogus, oh_flags_ptr)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") + + /* Point to "bogus" information (take it over) */ + oh->mesg[idx].native = bogus; /* Mark the message and object header as dirty */ *oh_flags_ptr = TRUE; + oh->mesg[idx].flags = mesg_flags; oh->mesg[idx].dirty = TRUE; oh->dirty = TRUE; } /* end if */ @@ -1375,7 +1384,7 @@ H5O_delete_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh) */ for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) { /* Free any space referred to in the file from this message */ - if(H5O_delete_mesg(f, dxpl_id, curr_msg, TRUE) < 0) + if(H5O_delete_mesg(f, dxpl_id, curr_msg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message") } /* end for */ @@ -1812,9 +1821,9 @@ H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id) oinfo->btime = 0; /* Might be information for modification time */ - if(NULL == H5O_msg_read_real(oloc->file, oh, H5O_MTIME_ID, 0, &oinfo->ctime, dxpl_id)) { + if(NULL == H5O_msg_read_real(oloc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime)) { H5E_clear_stack(NULL); - if(NULL == H5O_msg_read_real(oloc->file, oh, H5O_MTIME_NEW_ID, 0, &oinfo->ctime, dxpl_id)) { + if(NULL == H5O_msg_read_real(oloc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) { H5E_clear_stack(NULL); oinfo->ctime = 0; } /* end if */ diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 9c29783..eecb405 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -839,9 +839,10 @@ done: */ unsigned H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, - size_t size, unsigned * oh_flags_ptr) + const void *mesg, unsigned * oh_flags_ptr) { - size_t aligned_size = H5O_ALIGN_OH(oh, size); + size_t raw_size; /* Raw size of message */ + size_t aligned_size; /* Size of message including alignment */ unsigned idx; /* Index of message which fits allocation */ unsigned ret_value; /* Return value */ @@ -850,8 +851,14 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, /* check args */ HDassert(oh); HDassert(type); + HDassert(mesg); HDassert(oh_flags_ptr); + /* Compute the size needed to store the message in the object header */ + if((raw_size = (type->raw_size)(f, FALSE, mesg)) >= H5O_MESG_MAX_SIZE) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large") + aligned_size = H5O_ALIGN_OH(oh, raw_size); + /* look for a null message which is large enough */ for(idx = 0; idx < oh->nmesgs; idx++) if(H5O_NULL_ID == oh->mesg[idx].type->id && oh->mesg[idx].raw_size >= aligned_size) @@ -872,7 +879,7 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, HDassert(H5F_addr_defined(oh->chunk[chunkno].addr)); - tri_result = H5O_alloc_extend_chunk(f, oh, chunkno, size, &idx); + tri_result = H5O_alloc_extend_chunk(f, oh, chunkno, raw_size, &idx); if(tri_result == TRUE) break; else if(tri_result == FALSE) @@ -885,7 +892,7 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, * create a new one. */ if(idx == UFAIL) - if((idx = H5O_alloc_new_chunk(f, dxpl_id, oh, size)) == UFAIL) + if((idx = H5O_alloc_new_chunk(f, dxpl_id, oh, raw_size)) == UFAIL) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, UFAIL, "unable to create a new object header data chunk") } /* end if */ @@ -920,7 +927,7 @@ done: */ herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg, - hbool_t delete_mesg, hbool_t adj_link) + hbool_t adj_link) { herr_t ret_value = SUCCEED; /* Return value */ @@ -932,9 +939,9 @@ H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg, HDassert(mesg); /* Check if we should operate on the message */ - if(delete_mesg) { + if(adj_link) { /* Free any space referred to in the file from this message */ - if(H5O_delete_mesg(f, dxpl_id, mesg, adj_link) < 0) + if(H5O_delete_mesg(f, dxpl_id, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message") } /* end if */ @@ -1368,7 +1375,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id) deleted_chunkno = null_msg->chunkno; /* Convert continuation message into a null message */ - if(H5O_release_mesg(f, dxpl_id, oh, cont_msg, TRUE, TRUE) < 0) + if(H5O_release_mesg(f, dxpl_id, oh, cont_msg, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") /* diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 35c52ef..ad617aa 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -588,7 +588,7 @@ H5O_attr_free(void *mesg) *------------------------------------------------------------------------- */ herr_t -H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) +H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg) { const H5A_t *attr = (const H5A_t *) _mesg; herr_t ret_value = SUCCEED; /* Return value */ @@ -600,11 +600,11 @@ H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) HDassert(attr); /* Decrement reference count on datatype in file */ - if((H5O_MSG_DTYPE->del)(f, dxpl_id, attr->dt, adj_link) < 0) + if((H5O_MSG_DTYPE->del)(f, dxpl_id, attr->dt) < 0) HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust datatype link count") /* Decrement reference count on dataspace in file */ - if((H5O_MSG_SDSPACE->del)(f, dxpl_id, attr->ds, adj_link) < 0) + if((H5O_MSG_SDSPACE->del)(f, dxpl_id, attr->ds) < 0) HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust dataspace link count") done: diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 5e2c4df..feb2da0 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -176,7 +176,7 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* Convert message into a null message in the header */ /* (don't delete attribute's space in the file though) */ - if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE, FALSE) < 0) + if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") /* Indicate that the object header was modified */ @@ -294,7 +294,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) * *ick* -QAK, 2007/01/08 */ if(attr_rc > 1) { - if(H5O_attr_delete(loc->file, dxpl_id, attr, TRUE) < 0) + if(H5O_attr_delete(loc->file, dxpl_id, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") } /* end if */ } /* end if */ @@ -815,7 +815,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* (doesn't decrement the link count on shared components becuase * the "native" pointer has been reset) */ - if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE, FALSE) < 0) + if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release previous attribute") /* Increment attribute count */ @@ -1054,7 +1054,7 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, oh->nattrs--; /* Convert message into a null message (i.e. delete it) */ - if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, TRUE, TRUE) < 0) + if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") /* Indicate that the object header was modified */ diff --git a/src/H5Ocont.c b/src/H5Ocont.c index f378611..8e489a8 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -40,7 +40,7 @@ static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, const 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); -static herr_t H5O_cont_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); +static herr_t H5O_cont_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); static herr_t H5O_cont_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -222,7 +222,7 @@ H5O_cont_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_cont_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t UNUSED adj_link) +H5O_cont_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg) { const H5O_cont_t *mesg = (const H5O_cont_t *) _mesg; herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index b50ecd9..1592278 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -454,12 +454,9 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, mesg_src = &(oh_src->mesg[mesgno + null_msgs]); mesg_dst = &(oh_dst->mesg[mesgno]); - /* Initialize on destination message */ - mesg_dst->chunkno = 0; - mesg_dst->dirty = FALSE; + /* Initialize non-zero components of destination message */ + mesg_dst->crt_idx = mesg_src->crt_idx; mesg_dst->flags = mesg_src->flags; - mesg_dst->native = NULL; - mesg_dst->raw = NULL; mesg_dst->raw_size = mesg_src->raw_size; mesg_dst->type = mesg_src->type; @@ -481,6 +478,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* copy this message into destination file */ if(copy_type->copy_file) { + hbool_t recompute_size = FALSE; /* Whether to recompute the destination message's size */ + /* Decode the message if necessary. */ H5O_LOAD_NATIVE(oloc_src->file, dxpl_id, mesg_src, FAIL) @@ -501,8 +500,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* Recompute shared message size (mesg_dst->native is really * shared) */ - mesg_dst->raw_size = H5O_ALIGN_OH(oh_dst, - H5O_msg_raw_size(oloc_dst->file, mesg_dst->type->id, FALSE, mesg_dst->native)); + recompute_size = TRUE; } /* end if */ else if(shared == FALSE && (mesg_dst->flags & H5O_MSG_FLAG_SHARED)) { /* Unset shared flag */ @@ -511,9 +509,11 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* Recompute native message size (msg_dest->native is no longer * shared) */ + recompute_size = TRUE; + } /* end else */ + if(recompute_size) mesg_dst->raw_size = H5O_ALIGN_OH(oh_dst, H5O_msg_raw_size(oloc_dst->file, mesg_dst->type->id, FALSE, mesg_dst->native)); - } /* end else */ /* Mark the message in the destination as dirty, so it'll get encoded when the object header is flushed */ mesg_dst->dirty = TRUE; @@ -585,7 +585,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, mesg_src = &(oh_src->mesg[mesgno + null_msgs]); mesg_dst = &(oh_dst->mesg[mesgno]); - if(! mesg_dst->dirty) { + if(!mesg_dst->dirty) { /* Copy the message header plus the message's raw data. */ HDmemcpy(current_pos, mesg_src->raw - msghdr_size, msghdr_size + mesg_src->raw_size); diff --git a/src/H5Olayout.c b/src/H5Olayout.c index a542a7d..3736b8b 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -38,8 +38,7 @@ 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); static herr_t H5O_layout_reset(void *_mesg); static herr_t H5O_layout_free(void *_mesg); -static herr_t H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, - hbool_t adj_link); +static herr_t H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); static void *H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata); static herr_t H5O_layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, @@ -554,8 +553,7 @@ H5O_layout_free (void *_mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, - hbool_t UNUSED adj_link) +H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index b5c4041..abbb411 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -39,7 +39,7 @@ static herr_t H5O_linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, con 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); static herr_t H5O_linfo_free(void *_mesg); -static herr_t H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); +static herr_t H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); static void *H5O_linfo_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata); @@ -341,7 +341,7 @@ H5O_linfo_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) +H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; herr_t ret_value = SUCCEED; /* Return value */ @@ -354,7 +354,7 @@ H5O_linfo_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) /* If the group is using "dense" link storage, delete it */ if(H5F_addr_defined(linfo->link_fheap_addr)) - if(H5G_dense_delete(f, dxpl_id, (H5O_linfo_t *)linfo, adj_link) < 0) /* Casting away const OK - QAK */ + if(H5G_dense_delete(f, dxpl_id, (H5O_linfo_t *)linfo, TRUE) < 0) /* Casting away const OK - QAK */ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense link storage") done: diff --git a/src/H5Olink.c b/src/H5Olink.c index 47ebfdb..628ce56 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -43,7 +43,6 @@ 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); static herr_t H5O_link_reset(void *_mesg); static herr_t H5O_link_free(void *_mesg); -/* static herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); */ static herr_t H5O_link_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata); static void *H5O_link_copy_file(H5F_t *file_src, void *native_src, @@ -494,7 +493,7 @@ H5O_link_free(void *_mesg) *------------------------------------------------------------------------- */ herr_t -H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) +H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; herr_t ret_value = SUCCEED; /* Return value */ @@ -506,47 +505,45 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) HDassert(lnk); /* Check for adjusting the link count when the link is removed */ - if(adj_link) { - /* Adjust the reference count of the object when a hard link is removed */ - if(lnk->type == H5L_TYPE_HARD) { - H5O_loc_t oloc; - - /* Construct object location for object, in order to decrement it's ref count */ - H5O_loc_reset(&oloc); - oloc.file = f; - HDassert(H5F_addr_defined(lnk->u.hard.addr)); - oloc.addr = lnk->u.hard.addr; - - /* Decrement the ref count for the object */ - if(H5O_link(&oloc, -1, dxpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count") - } /* end if */ - /* Perform the "delete" callback when a user-defined link is removed */ - else if(lnk->type >= H5L_TYPE_UD_MIN) { - const H5L_class_t *link_class; /* User-defined link class */ - - /* Get the link class for this type of link. */ - if(NULL == (link_class = H5L_find_class(lnk->type))) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class not registered") - - /* Check for delete callback */ - if(link_class->del_func) { - hid_t file_id; /* ID for the file the link is located in (passed to user callback) */ - - /* Get a file ID for the file the link is in */ - if((file_id = H5F_get_id(f)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") - - /* Call user-defined link's 'delete' callback */ - if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) { - H5I_dec_ref(file_id); - HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure") - } /* end if */ + /* Adjust the reference count of the object when a hard link is removed */ + if(lnk->type == H5L_TYPE_HARD) { + H5O_loc_t oloc; + + /* Construct object location for object, in order to decrement it's ref count */ + H5O_loc_reset(&oloc); + oloc.file = f; + HDassert(H5F_addr_defined(lnk->u.hard.addr)); + oloc.addr = lnk->u.hard.addr; + + /* Decrement the ref count for the object */ + if(H5O_link(&oloc, -1, dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count") + } /* end if */ + /* Perform the "delete" callback when a user-defined link is removed */ + else if(lnk->type >= H5L_TYPE_UD_MIN) { + const H5L_class_t *link_class; /* User-defined link class */ - /* Release the file ID */ - if(H5I_dec_ref(file_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") + /* Get the link class for this type of link. */ + if(NULL == (link_class = H5L_find_class(lnk->type))) + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class not registered") + + /* Check for delete callback */ + if(link_class->del_func) { + hid_t file_id; /* ID for the file the link is located in (passed to user callback) */ + + /* Get a file ID for the file the link is in */ + if((file_id = H5F_get_id(f)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") + + /* Call user-defined link's 'delete' callback */ + if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) { + H5I_dec_ref(file_id); + HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure") } /* end if */ + + /* Release the file ID */ + if(H5I_dec_ref(file_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") } /* end if */ } /* end if */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 99cbed6..d598819 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -71,18 +71,16 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5O_msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, - unsigned overwrite, unsigned mesg_flags, unsigned update_flags, - void *mesg, hid_t dxpl_id, unsigned *oh_flags_ptr); +static 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, unsigned *oh_flags_ptr); static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native); static herr_t H5O_msg_remove_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id); static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/); -static unsigned H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, - const H5O_msg_class_t *type, void *mesg, hid_t dxpl_id, unsigned *oh_flags_ptr); 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 flags, + const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags, unsigned update_flags, unsigned *oh_flags_ptr); @@ -232,8 +230,8 @@ H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *t HDassert(mesg); HDassert(oh_flags_ptr); - /* Create a new message */ - if((idx = H5O_new_mesg(f, oh, &mesg_flags, type, mesg, dxpl_id, oh_flags_ptr)) == UFAIL) + /* Allocate space for a new message */ + if((idx = H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, mesg, oh_flags_ptr)) == UFAIL) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create new message") /* Copy the information for the message */ @@ -253,11 +251,6 @@ done: * * Purpose: Modifies an existing message or creates a new message. * - * The OVERWRITE argument is a sequence number of a - * message to overwrite (usually zero). - * If the message to overwrite doesn't exist then this routine - * fails. - * * The UPDATE_FLAGS argument are flags that allow the caller * to skip updating the modification time or reseting the message * data. This is useful when several calls to H5O_msg_write will be @@ -274,8 +267,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_write(H5O_loc_t *loc, unsigned type_id, unsigned overwrite, - unsigned mesg_flags, unsigned update_flags, void *mesg, hid_t dxpl_id) +H5O_msg_write(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 */ unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotect object header */ @@ -304,7 +297,7 @@ H5O_msg_write(H5O_loc_t *loc, unsigned type_id, unsigned overwrite, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Call the "real" modify routine */ - if(H5O_msg_write_real(loc->file, oh, type, overwrite, mesg_flags, update_flags, mesg, dxpl_id, &oh_flags) < 0) + if(H5O_msg_write_real(loc->file, dxpl_id, oh, type, mesg_flags, update_flags, mesg, &oh_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message") done: @@ -320,11 +313,6 @@ done: * * Purpose: Modifies an existing message or creates a new message. * - * The OVERWRITE argument is a sequence number of a - * message to overwrite (usually zero). - * If the message to overwrite doesn't exist then this routine - * fails. - * * The UPDATE_FLAGS argument are flags that allow the caller * to skip updating the modification time or reseting the message * data. This is useful when several calls to H5O_msg_write will be @@ -341,12 +329,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, - unsigned overwrite, unsigned mesg_flags, unsigned update_flags, - void *mesg, hid_t dxpl_id, unsigned *oh_flags_ptr) +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, unsigned *oh_flags_ptr) { H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - int sequence; /* Sequence # of message type to modify */ unsigned idx; /* Index of message to modify */ herr_t ret_value = SUCCEED; /* Return value */ @@ -361,16 +347,11 @@ H5O_msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, HDassert(oh_flags_ptr); /* Count similar messages */ - for(idx = 0, sequence = -1, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) { - if(type->id != idx_msg->type->id) - continue; - if(++sequence == (int)overwrite) + for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) + if(type->id == idx_msg->type->id) break; - } /* end for */ - - /* Was the right message found? */ - if(sequence != (int)overwrite) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message not found") + if(idx == oh->nmesgs) + 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) @@ -437,7 +418,7 @@ done: *------------------------------------------------------------------------- */ void * -H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, int sequence, void *mesg, +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 */ @@ -450,14 +431,13 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, int sequence, void *mesg, HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); HDassert(type_id < NELMTS(H5O_msg_class_g)); - HDassert(sequence >= 0); /* Get the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header") /* Call the "real" read routine */ - if((ret_value = H5O_msg_read_real(loc->file, oh, type_id, sequence, mesg, dxpl_id)) == NULL) + if((ret_value = H5O_msg_read_real(loc->file, dxpl_id, oh, type_id, mesg)) == NULL) HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to load object header") done: @@ -492,8 +472,8 @@ done: *------------------------------------------------------------------------- */ void * -H5O_msg_read_real(H5F_t *f, H5O_t *oh, unsigned type_id, int sequence, - void *mesg, hid_t dxpl_id) +H5O_msg_read_real(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 */ @@ -507,17 +487,13 @@ H5O_msg_read_real(H5F_t *f, H5O_t *oh, unsigned type_id, int sequence, HDassert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); - HDassert(sequence >= 0); /* Scan through the messages looking for the right one */ - for(idx = 0; idx < oh->nmesgs; idx++) { - if(type_id != oh->mesg[idx].type->id) - continue; - if(--sequence < 0) + for(idx = 0; idx < oh->nmesgs; idx++) + if(type_id == oh->mesg[idx].type->id) break; - } /* end for */ - if(sequence >= 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "unable to find object header message") + if(idx == oh->nmesgs) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "message type not found") /* * Decode the message if necessary. If the message is shared then retrieve @@ -821,7 +797,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5O_msg_exists(H5O_loc_t *loc, unsigned type_id, int sequence, hid_t dxpl_id) +H5O_msg_exists(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 */ @@ -831,14 +807,13 @@ H5O_msg_exists(H5O_loc_t *loc, unsigned type_id, int sequence, hid_t dxpl_id) HDassert(loc); HDassert(loc->file); HDassert(type_id < NELMTS(H5O_msg_class_g)); - HDassert(sequence >= 0); /* Load the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") /* Call the "real" exists routine */ - if((ret_value = H5O_msg_exists_oh(oh, type_id, sequence)) < 0) + 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: @@ -868,11 +843,11 @@ done: *------------------------------------------------------------------------- */ htri_t -H5O_msg_exists_oh(H5O_t *oh, unsigned type_id, int sequence) +H5O_msg_exists_oh(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; /* 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_NOFUNC(H5O_msg_exists_oh) @@ -880,19 +855,13 @@ H5O_msg_exists_oh(H5O_t *oh, unsigned type_id, int sequence) HDassert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ HDassert(type); - HDassert(sequence >= 0); /* Scan through the messages looking for the right one */ - for(u = 0; u < oh->nmesgs; u++) { - if(type->id != oh->mesg[u].type->id) - continue; - if(--sequence < 0) - break; - } /* end for */ - - /* Set return value */ - ret_value = (sequence < 0); + for(u = 0; u < oh->nmesgs; u++) + if(type->id == oh->mesg[u].type->id) + HGOTO_DONE(TRUE) +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_exists_oh() */ @@ -1038,7 +1007,7 @@ H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, udata->nfailed++; else { /* Convert message into a null message */ - if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, TRUE, 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 */ @@ -1698,7 +1667,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_new_mesg + * Function: H5O_msg_alloc * * Purpose: Create a new message in an object header * @@ -1710,15 +1679,14 @@ done: * *------------------------------------------------------------------------- */ -static unsigned -H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *type, - void *mesg, hid_t dxpl_id, unsigned *oh_flags_ptr) +unsigned +H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, + unsigned *mesg_flags, void *mesg, unsigned *oh_flags_ptr) { - size_t size; /* Size of space allocated for object header */ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ unsigned ret_value = UFAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_new_mesg) + FUNC_ENTER_NOAPI_NOINIT(H5O_msg_alloc) /* check args */ HDassert(f); @@ -1750,12 +1718,8 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *t } /* end if */ } /* end else */ - /* Compute the size needed to store the message on disk */ - if((size = (type->raw_size)(f, FALSE, mesg)) >= H5O_MESG_MAX_SIZE) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large") - /* Allocate space in the object header for the message */ - if((ret_value = H5O_alloc(f, dxpl_id, oh, type, size, oh_flags_ptr)) == UFAIL) + if((ret_value = H5O_alloc(f, dxpl_id, oh, type, mesg, oh_flags_ptr)) == UFAIL) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message") /* Get the message's "creation index", if it has one */ @@ -1767,7 +1731,7 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *t done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_new_mesg() */ +} /* end H5O_msg_alloc() */ /*------------------------------------------------------------------------- @@ -1857,7 +1821,7 @@ H5O_msg_delete(H5F_t *f, hid_t dxpl_id, unsigned type_id, const void *mesg) HDassert(type); /* delete */ - if((type->del) && (type->del)(f, dxpl_id, mesg, TRUE) < 0) + if((type->del) && (type->del)(f, dxpl_id, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message") done: @@ -1881,7 +1845,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg, hbool_t adj_link) +H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg) { const H5O_msg_class_t *type = mesg->type; /* Type of object to free */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1897,11 +1861,11 @@ H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg, hbool_t adj_link) /* Decode the message if necessary. */ H5O_LOAD_NATIVE(f, dxpl_id, mesg, FAIL) - if((type->del)(f, dxpl_id, mesg->native, adj_link) < 0) + if((type->del)(f, dxpl_id, 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_msg() */ +} /* end H5O_delete_mesg() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 0f5a7ae..86ad44b 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -161,17 +161,17 @@ /* (Only works for messages with decode callback) */ #define H5O_LOAD_NATIVE(F, DXPL, MSG, ERR) \ if(NULL == (MSG)->native) { \ - const H5O_msg_class_t *decode_type = (MSG)->type; \ + const H5O_msg_class_t *msg_type = (MSG)->type; \ \ /* Decode the message */ \ - HDassert(decode_type->decode); \ - if(NULL == ((MSG)->native = (decode_type->decode)((F), (DXPL), (MSG)->flags, (MSG)->raw))) \ + HDassert(msg_type->decode); \ + if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (MSG)->flags, (MSG)->raw))) \ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \ \ /* Set the message's "creation index", if it has one */ \ - if((MSG)->type->set_crt_index) { \ + if(msg_type->set_crt_index) { \ /* Set the creation index for the message */ \ - if((decode_type->set_crt_index)((MSG)->native, (MSG)->crt_idx) < 0) \ + if((msg_type->set_crt_index)((MSG)->native, (MSG)->crt_idx) < 0) \ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, ERR, "unable to set creation index") \ } /* end if */ \ } /* end if */ @@ -189,8 +189,8 @@ struct H5O_msg_class_t { size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */ herr_t (*reset)(void *); /*free nested data structs */ herr_t (*free)(void *); /*free main data struct */ - herr_t (*del)(H5F_t *, hid_t, const void *, hbool_t); /* Delete space in file referenced by this message */ - herr_t (*link)(H5F_t *, hid_t, const void *); /* Increment any links in file reference by this message */ + herr_t (*del)(H5F_t *, hid_t, const void *); /* Delete space in file referenced by this message */ + herr_t (*link)(H5F_t *, hid_t, const void *); /* Increment any links in file reference by this message */ herr_t (*set_share)(void*, const H5O_shared_t*); /* Set shared information */ htri_t (*can_share)(const void *); /* Is message allowed to be shared? */ herr_t (*pre_copy_file)(H5F_t *, const void *, hbool_t *, const H5O_copy_t *, void *); /*"pre copy" action when copying native value to file */ @@ -418,19 +418,21 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh); -H5_DLL herr_t H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg, - hbool_t adj_link); +H5_DLL herr_t H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg); H5_DLL const H5O_obj_class_t *H5O_obj_class_real(H5O_t *oh); /* Object header message routines */ +H5_DLL unsigned H5O_msg_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, + const H5O_msg_class_t *type, unsigned *mesg_flags, void *mesg, + unsigned *oh_flags_ptr); H5_DLL 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, unsigned *oh_flags_ptr); -H5_DLL void *H5O_msg_read_real(H5F_t *f, H5O_t *oh, unsigned type_id, - int sequence, void *mesg, hid_t dxpl_id); +H5_DLL void *H5O_msg_read_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, + unsigned type_id, void *mesg); H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg); H5_DLL herr_t H5O_msg_free_mesg(H5O_mesg_t *mesg); -H5_DLL htri_t H5O_msg_exists_oh(struct H5O_t *oh, unsigned type_id, int sequence); +H5_DLL htri_t H5O_msg_exists_oh(struct H5O_t *oh, unsigned type_id); H5_DLL void *H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hid_t dxpl_id, hbool_t *shared, H5O_copy_t *cpy_info, void *udata); @@ -440,17 +442,17 @@ H5_DLL herr_t H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t /* Object header allocation routines */ H5_DLL unsigned H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - const H5O_msg_class_t *type, size_t size, hbool_t * oh_dirtied_ptr); + const H5O_msg_class_t *type, const void *mesg, hbool_t *oh_dirtied_ptr); H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh, hid_t dxpl_id); H5_DLL herr_t H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, - H5O_mesg_t *mesg, hbool_t delete_mesg, hbool_t adj_link); + H5O_mesg_t *mesg, hbool_t adj_link); /* Shared object operators */ H5_DLL void * H5O_shared_decode(H5F_t *f, hid_t dxpl_id, 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, const H5O_shared_t *sh_mesg, - const H5O_msg_class_t *mesg_type, hbool_t adj_link); + const H5O_msg_class_t *mesg_type); H5_DLL herr_t H5O_shared_link(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *sh_mesg, const H5O_msg_class_t *mesg_type); H5_DLL herr_t H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst, hid_t dxpl_id, diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 76d5dd0..9cb0a0e 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -406,16 +406,15 @@ H5_DLL herr_t H5O_msg_create(H5O_loc_t *loc, unsigned type_id, unsigned mesg_fla H5_DLL herr_t H5O_msg_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg, unsigned *oh_flags_ptr); -H5_DLL herr_t H5O_msg_write(H5O_loc_t *loc, unsigned type_id, unsigned overwrite, - unsigned flags, unsigned update_flags, void *mesg, hid_t dxpl_id); -H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, int sequence, - void *mesg, hid_t dxpl_id); +H5_DLL herr_t H5O_msg_write(H5O_loc_t *loc, unsigned type_id, unsigned flags, + unsigned update_flags, void *mesg, hid_t dxpl_id); +H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, + hid_t dxpl_id); H5_DLL herr_t H5O_msg_reset(unsigned type_id, void *native); H5_DLL void *H5O_msg_free(unsigned type_id, void *mesg); H5_DLL void *H5O_msg_copy(unsigned type_id, const void *mesg, void *dst); H5_DLL int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id); -H5_DLL htri_t H5O_msg_exists(H5O_loc_t *loc, unsigned type_id, int sequence, - hid_t dxpl_id); +H5_DLL htri_t H5O_msg_exists(H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id); H5_DLL herr_t H5O_msg_remove(H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj_link, hid_t dxpl_id); H5_DLL herr_t H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, @@ -465,7 +464,7 @@ H5_DLL herr_t H5O_fill_reset_dyn(H5O_fill_t *fill); H5_DLL herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *type, hbool_t *fill_changed, hid_t dxpl_id); /* Link operators */ -H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); +H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); /* Shared message operators */ H5_DLL herr_t H5O_shared_copy(void *dst, const H5O_shared_t *src); diff --git a/src/H5Oshared.c b/src/H5Oshared.c index dafe3d2..ff31b52 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -134,7 +134,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *shared, HDassert(shared->flags & H5O_COMMITTED_FLAG); /* Get the shared message from an object header */ - if(NULL == (ret_value = H5O_msg_read(&(shared->u.oloc), type->id, 0, NULL, dxpl_id))) + if(NULL == (ret_value = H5O_msg_read(&(shared->u.oloc), type->id, NULL, dxpl_id))) HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message") } /* end else */ @@ -440,7 +440,7 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) */ herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *sh_mesg, - const H5O_msg_class_t *type, hbool_t adj_link) + const H5O_msg_class_t *type) { herr_t ret_value = SUCCEED; /* Return value */ @@ -459,10 +459,9 @@ H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *sh_mesg, * be decremented when they're deleted (in H5O_shared_link_adj). */ - /* Decrement the reference count on the shared object, if requested */ - if(adj_link) - if(H5O_shared_link_adj(f, dxpl_id, sh_mesg, type, -1) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") + /* Decrement the reference count on the shared object */ + if(H5O_shared_link_adj(f, dxpl_id, sh_mesg, type, -1) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 96fb938..3a8785b0 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -203,7 +203,7 @@ done: *------------------------------------------------------------------------- */ static H5_inline herr_t -H5O_SHARED_DELETE(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) +H5O_SHARED_DELETE(H5F_t *f, hid_t dxpl_id, const void *_mesg) { const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */ herr_t ret_value = SUCCEED; /* Return value */ @@ -220,13 +220,13 @@ H5O_SHARED_DELETE(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) /* Check for shared message */ if(H5O_IS_SHARED(sh_mesg->flags)) { /* Decrement the reference count on the shared message/object */ - if(H5O_shared_delete(f, dxpl_id, sh_mesg, H5O_SHARED_TYPE, adj_link) < 0) + if(H5O_shared_delete(f, dxpl_id, sh_mesg, H5O_SHARED_TYPE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message") } /* end if */ #ifdef H5O_SHARED_DELETE_REAL else { /* Decrement the reference count on the native message directly */ - if(H5O_SHARED_DELETE_REAL(f, dxpl_id, _mesg, adj_link) < 0) + if(H5O_SHARED_DELETE_REAL(f, dxpl_id, _mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message") } /* end else */ #endif /* H5O_SHARED_DELETE_REAL */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 822e7a3..75dc35c 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -40,7 +40,7 @@ static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, cons 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); static herr_t H5O_stab_free(void *_mesg); -static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); +static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); static void *H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata); static herr_t H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc, @@ -269,7 +269,7 @@ H5O_stab_free (void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *mesg, hbool_t adj_link) +H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *mesg) { herr_t ret_value = SUCCEED; /* Return value */ @@ -280,7 +280,7 @@ H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *mesg, hbool_t adj_link) HDassert(mesg); /* Free the file space for the symbol table */ - if(H5G_stab_delete(f, dxpl_id, mesg, adj_link) < 0) + if(H5G_stab_delete(f, dxpl_id, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table") done: diff --git a/src/H5S.c b/src/H5S.c index 6cfb635..f59a5df 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1053,7 +1053,7 @@ H5S_write(H5O_loc_t *loc, const H5S_t *ds, hbool_t update_time, hid_t dxpl_id) case H5S_NULL: case H5S_SCALAR: case H5S_SIMPLE: - if(H5O_msg_write(loc, H5O_SDSPACE_ID, 0, 0, update_time, &(ds->extent), dxpl_id) < 0) + if(H5O_msg_write(loc, H5O_SDSPACE_ID, 0, update_time, &(ds->extent), dxpl_id) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple dataspace message") break; @@ -1146,7 +1146,7 @@ H5S_read(const H5O_loc_t *loc, hid_t dxpl_id) if(NULL == (ds = H5FL_CALLOC(H5S_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - if(H5O_msg_read(loc, H5O_SDSPACE_ID, 0, &(ds->extent), dxpl_id) == NULL) + if(H5O_msg_read(loc, H5O_SDSPACE_ID, &(ds->extent), dxpl_id) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to load dataspace info from dataset header") /* Default to entire dataspace being selected */ diff --git a/src/H5T.c b/src/H5T.c index f0cea46..7981606 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2455,36 +2455,38 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, { H5T_path_t *path = NULL; /*conversion path */ H5T_soft_t *soft = NULL; /*soft conversion information */ - int nprint=0; /*number of paths shut down */ + int nprint = 0; /*number of paths shut down */ int i; /*counter */ - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5T_unregister); + FUNC_ENTER_NOAPI_NOINIT(H5T_unregister) /* Remove matching entries from the soft list */ - if (H5T_PERS_DONTCARE==pers || H5T_PERS_SOFT==pers) { - for (i=H5T_g.nsoft-1; i>=0; --i) { - soft = H5T_g.soft+i; - assert(soft); - if (name && *name && HDstrcmp(name, soft->name)) continue; - if (src && src->shared->type!=soft->src) continue; - if (dst && dst->shared->type!=soft->dst) continue; - if (func && func!=soft->func) continue; - - HDmemmove(H5T_g.soft+i, H5T_g.soft+i+1, - (H5T_g.nsoft-(i+1)) * sizeof(H5T_soft_t)); + if(H5T_PERS_DONTCARE == pers || H5T_PERS_SOFT == pers) { + for(i = H5T_g.nsoft - 1; i >= 0; --i) { + soft = H5T_g.soft + i; + HDassert(soft); + if(name && *name && HDstrcmp(name, soft->name)) + continue; + if(src && src->shared->type != soft->src) + continue; + if(dst && dst->shared->type != soft->dst) + continue; + if(func && func != soft->func) + continue; + + HDmemmove(H5T_g.soft + i, H5T_g.soft + i + 1, (H5T_g.nsoft - (i + 1)) * sizeof(H5T_soft_t)); --H5T_g.nsoft; - } - } + } /* end for */ + } /* end if */ /* Remove matching conversion paths, except no-op path */ - for (i=H5T_g.npaths-1; i>0; --i) { + for(i = H5T_g.npaths - 1; i > 0; --i) { path = H5T_g.path[i]; - assert(path); + HDassert(path); /* Not a match */ - if (((H5T_PERS_SOFT==pers && path->is_hard) || - (H5T_PERS_HARD==pers && !path->is_hard)) || + if(((H5T_PERS_SOFT == pers && path->is_hard) || + (H5T_PERS_HARD == pers && !path->is_hard)) || (name && *name && HDstrcmp(name, path->name)) || (src && H5T_cmp(src, path->src, FALSE)) || (dst && H5T_cmp(dst, path->dst, FALSE)) || @@ -2500,17 +2502,16 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, } /* end if */ else { /* Remove from table */ - HDmemmove(H5T_g.path+i, H5T_g.path+i+1, - (H5T_g.npaths-(i+1))*sizeof(H5T_path_t*)); + HDmemmove(H5T_g.path + i, H5T_g.path + i + 1, (H5T_g.npaths - (i + 1)) * sizeof(H5T_path_t*)); --H5T_g.npaths; /* Shut down path */ H5T_print_stats(path, &nprint); path->cdata.command = H5T_CONV_FREE; - if ((path->func)(FAIL, FAIL, &(path->cdata), - (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id)<0) { + if((path->func)(FAIL, FAIL, &(path->cdata), + (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { #ifdef H5T_DEBUG - if (H5DEBUG(T)) { + if(H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " "to free private data for %s (ignored)\n", (unsigned long)(path->func), path->name); @@ -2524,9 +2525,8 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, } /* end else */ } /* end for */ -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5T_unregister() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5T_unregister() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index bc213ae..81bac02 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -786,7 +786,7 @@ H5T_open_oid(H5G_loc_t *loc, hid_t dxpl_id) if(H5O_open(loc->oloc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") - if(NULL == (dt = H5O_msg_read(loc->oloc, H5O_DTYPE_ID, 0, NULL, dxpl_id))) + if(NULL == (dt = H5O_msg_read(loc->oloc, H5O_DTYPE_ID, NULL, dxpl_id))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header") /* Mark the type as named and open */ diff --git a/src/H5Toh.c b/src/H5Toh.c index f6854e9..784e127 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -98,7 +98,7 @@ H5O_dtype_isa(struct H5O_t *oh) HDassert(oh); - if((ret_value = H5O_msg_exists_oh(oh, H5O_DTYPE_ID, 0)) < 0) + if((ret_value = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to read object header") done: diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 9232196..61dd745 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -120,7 +120,7 @@ * compiler tries to do the conversion. For Cygwin, compiler doesn't do rounding correctly. * Mac OS 10.4 gives some incorrect result. */ #if (H5_WANT_DATA_ACCURACY && H5_ULLONG_TO_FP_CAST_WORKS && H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE && \ - H5_ULLONG_TO_LDOUBLE_PRECISION && defined(H5_LLONG_TO_LDOUBLE_CORRECT)) || (!H5_WANT_DATA_ACCURACY && \ + defined(H5_ULLONG_TO_LDOUBLE_PRECISION) && defined(H5_LLONG_TO_LDOUBLE_CORRECT)) || (!H5_WANT_DATA_ACCURACY && \ H5_ULLONG_TO_FP_CAST_WORKS) #define H5T_CONV_INTERNAL_ULLONG_LDOUBLE 1 #endif diff --git a/test/ohdr.c b/test/ohdr.c index 67d07a6..97501ef 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -105,7 +105,7 @@ main(void) H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } - if (NULL==H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; @@ -123,7 +123,7 @@ main(void) */ TESTING("message modification"); time_new = 33333333; - if (H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { + if (H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; @@ -133,7 +133,7 @@ main(void) H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } - if (NULL==H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; @@ -148,62 +148,6 @@ main(void) /* - * Test creation of a second message of the same type. - */ - TESTING("duplicate message creation"); - time_new = 55555555; - if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) { - H5_FAILED(); - H5Eprint_stack(H5E_DEFAULT, stdout); - goto error; - } - if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE)<0) { - H5_FAILED(); - H5Eprint_stack(H5E_DEFAULT, stdout); - goto error; - } - if (NULL==H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { - H5_FAILED(); - H5Eprint_stack(H5E_DEFAULT, stdout); - goto error; - } - if (ro!=time_new) { - H5_FAILED(); - HDfprintf(stdout, " got: {%ld}\n", (long)ro); - HDfprintf(stdout, " ans: {%ld}\n", (long)time_new); - goto error; - } - PASSED(); - - /* - * Test modification of the second message with a symbol table. - */ - TESTING("duplicate message modification"); - time_new = 77777777; - if (H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 1, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { - H5_FAILED(); - H5Eprint_stack(H5E_DEFAULT, stdout); - goto error; - } - if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE)<0) { - H5_FAILED(); - H5Eprint_stack(H5E_DEFAULT, stdout); - goto error; - } - if (NULL==H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { - H5_FAILED(); - H5Eprint_stack(H5E_DEFAULT, stdout); - goto error; - } - if (ro!=time_new) { - H5_FAILED(); - HDfprintf(stdout, " got: {%ld}\n", (long)ro); - HDfprintf(stdout, " ans: {%ld}\n", (long)time_new); - goto error; - } - PASSED(); - - /* * Test creation of a bunch of messages one after another to see * what happens when the object header overflows in core. * (Use 'old' MTIME message here, because it is large enough to be @@ -261,13 +205,13 @@ main(void) H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } - if (H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if(H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); puts(" H5O_msg_read() should have failed but didn't"); H5Eclear_stack(H5E_DEFAULT); goto error; } - if (H5O_msg_read(&oh_loc, H5O_MTIME_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if(H5O_msg_read(&oh_loc, H5O_MTIME_ID, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); puts(" H5O_msg_read() should have failed but didn't"); H5Eclear_stack(H5E_DEFAULT); -- cgit v0.12