From 8830acb2cbc9384978c22a3e01f4dd15276290e5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 20 Nov 2015 15:24:23 -0500 Subject: [svn-r28422] Description: Revert most of r27549, since revise_chunks code requires debugging contexts for v2 B-trees. Also, misc. warning cleanups and alignments w/changes on revise_chunks branch. Tested on: MacOSX/64 10.11.1 (amazon) w/serial & parallel (h5committest forthcoming) --- src/H5Abtree2.c | 20 ++- src/H5B2cache.c | 2 +- src/H5B2dbg.c | 48 +++++- src/H5B2int.c | 7 +- src/H5B2private.h | 4 +- src/H5B2test.c | 50 +++++- src/H5Gbtree2.c | 20 ++- src/H5HFbtree2.c | 449 ++++++++++++++++++++++++++------------------------- src/H5HFdblock.c | 6 +- src/H5HFhdr.c | 19 +-- src/H5HFhuge.c | 58 +++---- src/H5HFiblock.c | 8 +- src/H5HFpkg.h | 76 ++++----- src/H5HFsection.c | 36 ++--- src/H5HFtest.c | 4 +- src/H5HFtiny.c | 12 +- src/H5SM.c | 4 +- src/H5SMbtree2.c | 99 ++++++++---- src/H5SMcache.c | 4 +- src/H5SMmessage.c | 26 +-- src/H5SMpkg.h | 6 +- src/H5Zscaleoffset.c | 2 +- src/H5private.h | 23 ++- src/H5system.c | 20 +-- 24 files changed, 584 insertions(+), 419 deletions(-) diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 28e49a6..972fb0b 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -85,7 +85,8 @@ static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /* v2 B-tree driver callbacks for 'name' index */ static herr_t H5A__dense_btree2_name_store(void *native, const void *udata); @@ -94,7 +95,8 @@ static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /* Fractal heap function callbacks */ static herr_t H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); @@ -114,7 +116,9 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */ H5A__dense_btree2_name_compare, /* Record comparison callback */ H5A__dense_btree2_name_encode, /* Record encoding callback */ H5A__dense_btree2_name_decode, /* Record decoding callback */ - H5A__dense_btree2_name_debug /* Record debugging callback */ + H5A__dense_btree2_name_debug, /* Record debugging callback */ + NULL, /* Create debugging context */ + NULL /* Destroy debugging context */ }}; /* v2 B-tree class for indexing 'creation order' field of attributes */ @@ -128,7 +132,9 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ H5A__dense_btree2_corder_compare, /* Record comparison callback */ H5A__dense_btree2_corder_encode, /* Record encoding callback */ H5A__dense_btree2_corder_decode, /* Record decoding callback */ - H5A__dense_btree2_corder_debug /* Record debugging callback */ + H5A__dense_btree2_corder_debug, /* Record debugging callback */ + NULL, /* Create debugging context */ + NULL /* Destroy debugging context */ }}; @@ -375,7 +381,8 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U *------------------------------------------------------------------------- */ static herr_t -H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord; @@ -532,7 +539,8 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR *------------------------------------------------------------------------- */ static herr_t -H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord; diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 421e24b..57f794b 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -517,7 +517,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, /* Version */ if(*image++ != H5B2_INT_VERSION) - HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree internal node version") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node version") /* B-tree type */ if(*image++ != (uint8_t)udata->hdr->cls->id) diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index f723d10..ad9f970 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -92,6 +92,7 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, const H5B2_class_t *type, haddr_t obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header info */ + void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ @@ -109,13 +110,22 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); + HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || + (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); + + /* Check for debugging context callback available */ + if(type->crt_dbg_ctx) { + /* Create debugging context */ + if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") + } /* end if */ /* * Load the B-tree header. */ cache_udata.f = f; cache_udata.addr = addr; - cache_udata.ctx_udata = f; + cache_udata.ctx_udata = dbg_ctx; if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") @@ -168,6 +178,8 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } /* end for */ done: + if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr) { hdr->f = NULL; if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0) @@ -197,6 +209,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_internal_t *internal = NULL; /* B-tree internal node */ + void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ @@ -213,16 +226,25 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); + HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || + (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); HDassert(H5F_addr_defined(hdr_addr)); HDassert(H5F_addr_defined(obj_addr)); HDassert(nrec > 0); + /* Check for debugging context callback available */ + if(type->crt_dbg_ctx) { + /* Create debugging context */ + if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") + } /* end if */ + /* * Load the B-tree header. */ cache_udata.f = f; cache_udata.addr = hdr_addr; - cache_udata.ctx_udata = f; + cache_udata.ctx_udata = dbg_ctx; if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") @@ -273,8 +295,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_INT_NREC(internal, hdr, u)); - (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), - H5B2_INT_NREC(internal, hdr, u)); + (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), dbg_ctx); } /* end for */ /* Print final node pointer */ @@ -286,6 +307,8 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, internal->node_ptrs[u].addr); done: + if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr) { hdr->f = NULL; if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) @@ -318,6 +341,7 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ + void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value = SUCCEED; /* Return value */ @@ -333,16 +357,25 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); + HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || + (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); HDassert(H5F_addr_defined(hdr_addr)); HDassert(H5F_addr_defined(obj_addr)); HDassert(nrec > 0); + /* Check for debugging context callback available */ + if(type->crt_dbg_ctx) { + /* Create debugging context */ + if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") + } /* end if */ + /* * Load the B-tree header. */ cache_udata.f = f; cache_udata.addr = hdr_addr; - cache_udata.ctx_udata = f; + cache_udata.ctx_udata = dbg_ctx; if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree header") @@ -384,11 +417,12 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_LEAF_NREC(leaf, hdr, u)); - (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), - H5B2_LEAF_NREC(leaf, hdr, u)); + (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), dbg_ctx); } /* end for */ done: + if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr) { hdr->f = NULL; if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5B2int.c b/src/H5B2int.c index f412260..b8c9634 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -76,8 +76,8 @@ static herr_t H5B2__merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx); static herr_t H5B2__swap_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, - H5B2_internal_t *internal, unsigned *internal_flags_ptr, - unsigned idx, void *swap_loc); + H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx, + void *swap_loc); static herr_t H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr, uint16_t depth); #ifdef H5B2_DEBUG @@ -571,6 +571,9 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, uint16_t new_left_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for left child */ uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */ + /* Sanity check */ + HDassert(*left_nrec > *right_nrec); + /* Slide records in right node up */ HDmemmove(H5B2_NAT_NREC(right_native, hdr, move_nrec), H5B2_NAT_NREC(right_native, hdr, 0), diff --git a/src/H5B2private.h b/src/H5B2private.h index 45b6737..9e3c2d7 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -93,7 +93,9 @@ struct H5B2_class_t { herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */ herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */ herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */ - const void *record); + const void *record, const void *ctx); + void *(*crt_dbg_ctx)(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); /* Create debugging context */ + herr_t (*dst_dbg_ctx)(void *dbg_ctx); /* Destroy debugging context */ }; /* v2 B-tree creation parameters */ diff --git a/src/H5B2test.c b/src/H5B2test.c index 8ed364e..87fddf7 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -67,7 +67,9 @@ static herr_t H5B2__test_store(void *nrecord, const void *udata); static herr_t H5B2__test_compare(const void *rec1, const void *rec2); static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx); static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx); -static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); +static void *H5B2__test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /*********************/ @@ -84,7 +86,9 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ H5B2__test_compare, /* Record comparison callback */ H5B2__test_encode, /* Record encoding callback */ H5B2__test_decode, /* Record decoding callback */ - H5B2__test_debug /* Record debugging callback */ + H5B2__test_debug, /* Record debugging callback */ + H5B2__test_crt_dbg_context, /* Create debugging context */ + H5B2__test_dst_context /* Destroy debugging context */ }}; @@ -291,7 +295,8 @@ H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record) +H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, + const void H5_ATTR_UNUSED *_udata) { FUNC_ENTER_STATIC_NOERR @@ -305,6 +310,45 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record) /*------------------------------------------------------------------------- + * Function: H5B2__test_crt_dbg_context + * + * Purpose: Create context for debugging callback + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Tuesday, December 1, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5B2__test_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) +{ + H5B2_test_ctx_t *ctx; /* Callback context structure */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context") + + /* Determine the size of addresses & lengths in the file */ + ctx->sizeof_size = H5F_SIZEOF_SIZE(f); + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2__test_crt_dbg_context() */ + + +/*------------------------------------------------------------------------- * Function: H5B2_get_root_addr_test * * Purpose: Retrieve the root node's address diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 104e6b3..b464930 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -83,7 +83,8 @@ static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /* v2 B-tree driver callbacks for 'name' index */ static herr_t H5G_dense_btree2_name_store(void *native, const void *udata); @@ -92,7 +93,8 @@ static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /* Fractal heap function callbacks */ static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); @@ -112,7 +114,9 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ H5G_dense_btree2_name_compare, /* Record comparison callback */ H5G_dense_btree2_name_encode, /* Record encoding callback */ H5G_dense_btree2_name_decode, /* Record decoding callback */ - H5G_dense_btree2_name_debug /* Record debugging callback */ + H5G_dense_btree2_name_debug, /* Record debugging callback */ + NULL, /* Create debugging context */ + NULL /* Destroy debugging context */ }}; /* v2 B-tree class for indexing 'creation order' field of links */ @@ -126,7 +130,9 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ H5G_dense_btree2_corder_compare, /* Record comparison callback */ H5G_dense_btree2_corder_encode, /* Record encoding callback */ H5G_dense_btree2_corder_decode, /* Record decoding callback */ - H5G_dense_btree2_corder_debug /* Record debugging callback */ + H5G_dense_btree2_corder_debug, /* Record debugging callback */ + NULL, /* Create debugging context */ + NULL /* Destroy debugging context */ }}; /*****************************/ @@ -356,7 +362,8 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord; unsigned u; /* Local index variable */ @@ -520,7 +527,8 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_ *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord; unsigned u; /* Local index variable */ diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index 2f3d0e4..d82de93 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -68,40 +68,50 @@ typedef struct H5HF_huge_bt2_ctx_t { /* v2 B-tree driver callbacks */ -static void *H5HF_huge_bt2_crt_context(void *udata); -static herr_t H5HF_huge_bt2_dst_context(void *ctx); - -static herr_t H5HF_huge_bt2_indir_store(void *native, const void *udata); -static herr_t H5HF_huge_bt2_indir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *native, +/* Common callbacks */ +static void *H5HF__huge_bt2_crt_context(void *udata); +static herr_t H5HF__huge_bt2_dst_context(void *ctx); +static void *H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); + +/* Callbacks for indirect objects */ +static herr_t H5HF__huge_bt2_indir_store(void *native, const void *udata); +static herr_t H5HF__huge_bt2_indir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_indir_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *native, +static herr_t H5HF__huge_bt2_indir_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); -static herr_t H5HF_huge_bt2_filt_indir_store(void *native, const void *udata); -static herr_t H5HF_huge_bt2_filt_indir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *native, +/* Callbacks for filtered indirect objects */ +static herr_t H5HF__huge_bt2_filt_indir_store(void *native, const void *udata); +static herr_t H5HF__huge_bt2_filt_indir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_filt_indir_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *native, +static herr_t H5HF__huge_bt2_filt_indir_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); -static herr_t H5HF_huge_bt2_dir_store(void *native, const void *udata); -static herr_t H5HF_huge_bt2_dir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *native, +/* Callbacks for direct objects */ +static herr_t H5HF__huge_bt2_dir_store(void *native, const void *udata); +static herr_t H5HF__huge_bt2_dir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_dir_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *native, +static herr_t H5HF__huge_bt2_dir_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); -static herr_t H5HF_huge_bt2_filt_dir_store(void *native, const void *udata); -static herr_t H5HF_huge_bt2_filt_dir_compare(const void *rec1, const void *rec2); -static herr_t H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *native, +/* Callbacks for filtered direct objects */ +static herr_t H5HF__huge_bt2_filt_dir_store(void *native, const void *udata); +static herr_t H5HF__huge_bt2_filt_dir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_filt_dir_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *native, +static herr_t H5HF__huge_bt2_filt_dir_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5HF_huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void *record); +static herr_t H5HF__huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /*********************/ /* Package Variables */ @@ -111,13 +121,15 @@ const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_INDIR_ID, /* Type of B-tree */ "H5B2_FHEAP_HUGE_INDIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_indir_rec_t), /* Size of native record */ - H5HF_huge_bt2_crt_context, /* Create client callback context */ - H5HF_huge_bt2_dst_context, /* Destroy client callback context */ - H5HF_huge_bt2_indir_store, /* Record storage callback */ - H5HF_huge_bt2_indir_compare, /* Record comparison callback */ - H5HF_huge_bt2_indir_encode, /* Record encoding callback */ - H5HF_huge_bt2_indir_decode, /* Record decoding callback */ - H5HF_huge_bt2_indir_debug /* Record debugging callback */ + H5HF__huge_bt2_crt_context, /* Create client callback context */ + H5HF__huge_bt2_dst_context, /* Destroy client callback context */ + H5HF__huge_bt2_indir_store, /* Record storage callback */ + H5HF__huge_bt2_indir_compare, /* Record comparison callback */ + H5HF__huge_bt2_indir_encode, /* Record encoding callback */ + H5HF__huge_bt2_indir_decode, /* Record decoding callback */ + H5HF__huge_bt2_indir_debug, /* Record debugging callback */ + H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF__huge_bt2_dst_context /* Destroy debugging context */ }}; /* v2 B-tree class for indirectly accessed, filtered 'huge' objects */ @@ -125,13 +137,15 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* Type of B-tree */ "H5B2_FHEAP_HUGE_FILT_INDIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_filt_indir_rec_t), /* Size of native record */ - H5HF_huge_bt2_crt_context, /* Create client callback context */ - H5HF_huge_bt2_dst_context, /* Destroy client callback context */ - H5HF_huge_bt2_filt_indir_store, /* Record storage callback */ - H5HF_huge_bt2_filt_indir_compare, /* Record comparison callback */ - H5HF_huge_bt2_filt_indir_encode, /* Record encoding callback */ - H5HF_huge_bt2_filt_indir_decode, /* Record decoding callback */ - H5HF_huge_bt2_filt_indir_debug /* Record debugging callback */ + H5HF__huge_bt2_crt_context, /* Create client callback context */ + H5HF__huge_bt2_dst_context, /* Destroy client callback context */ + H5HF__huge_bt2_filt_indir_store, /* Record storage callback */ + H5HF__huge_bt2_filt_indir_compare, /* Record comparison callback */ + H5HF__huge_bt2_filt_indir_encode, /* Record encoding callback */ + H5HF__huge_bt2_filt_indir_decode, /* Record decoding callback */ + H5HF__huge_bt2_filt_indir_debug, /* Record debugging callback */ + H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF__huge_bt2_dst_context /* Destroy debugging context */ }}; /* v2 B-tree class for directly accessed 'huge' objects */ @@ -139,13 +153,15 @@ const H5B2_class_t H5HF_HUGE_BT2_DIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_DIR_ID, /* Type of B-tree */ "H5B2_FHEAP_HUGE_DIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_dir_rec_t), /* Size of native record */ - H5HF_huge_bt2_crt_context, /* Create client callback context */ - H5HF_huge_bt2_dst_context, /* Destroy client callback context */ - H5HF_huge_bt2_dir_store, /* Record storage callback */ - H5HF_huge_bt2_dir_compare, /* Record comparison callback */ - H5HF_huge_bt2_dir_encode, /* Record encoding callback */ - H5HF_huge_bt2_dir_decode, /* Record decoding callback */ - H5HF_huge_bt2_dir_debug /* Record debugging callback */ + H5HF__huge_bt2_crt_context, /* Create client callback context */ + H5HF__huge_bt2_dst_context, /* Destroy client callback context */ + H5HF__huge_bt2_dir_store, /* Record storage callback */ + H5HF__huge_bt2_dir_compare, /* Record comparison callback */ + H5HF__huge_bt2_dir_encode, /* Record encoding callback */ + H5HF__huge_bt2_dir_decode, /* Record decoding callback */ + H5HF__huge_bt2_dir_debug, /* Record debugging callback */ + H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF__huge_bt2_dst_context /* Destroy debugging context */ }}; /* v2 B-tree class for directly accessed, filtered 'huge' objects */ @@ -153,13 +169,15 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1]={{ /* B-tree class information */ H5B2_FHEAP_HUGE_FILT_DIR_ID, /* Type of B-tree */ "H5B2_FHEAP_HUGE_FILT_DIR_ID", /* Name of B-tree class */ sizeof(H5HF_huge_bt2_filt_dir_rec_t), /* Size of native record */ - H5HF_huge_bt2_crt_context, /* Create client callback context */ - H5HF_huge_bt2_dst_context, /* Destroy client callback context */ - H5HF_huge_bt2_filt_dir_store, /* Record storage callback */ - H5HF_huge_bt2_filt_dir_compare, /* Record comparison callback */ - H5HF_huge_bt2_filt_dir_encode, /* Record encoding callback */ - H5HF_huge_bt2_filt_dir_decode, /* Record decoding callback */ - H5HF_huge_bt2_filt_dir_debug /* Record debugging callback */ + H5HF__huge_bt2_crt_context, /* Create client callback context */ + H5HF__huge_bt2_dst_context, /* Destroy client callback context */ + H5HF__huge_bt2_filt_dir_store, /* Record storage callback */ + H5HF__huge_bt2_filt_dir_compare, /* Record comparison callback */ + H5HF__huge_bt2_filt_dir_encode, /* Record encoding callback */ + H5HF__huge_bt2_filt_dir_decode, /* Record decoding callback */ + H5HF__huge_bt2_filt_dir_debug, /* Record debugging callback */ + H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ + H5HF__huge_bt2_dst_context /* Destroy debugging context */ }}; /*****************************/ @@ -177,7 +195,7 @@ H5FL_DEFINE_STATIC(H5HF_huge_bt2_ctx_t); /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_crt_context + * Function: H5HF__huge_bt2_crt_context * * Purpose: Create client callback context * @@ -192,13 +210,13 @@ H5FL_DEFINE_STATIC(H5HF_huge_bt2_ctx_t); *------------------------------------------------------------------------- */ static void * -H5HF_huge_bt2_crt_context(void *_f) +H5HF__huge_bt2_crt_context(void *_f) { H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -216,11 +234,11 @@ H5HF_huge_bt2_crt_context(void *_f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_crt_context() */ +} /* H5HF__huge_bt2_crt_context() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dst_context + * Function: H5HF__huge_bt2_dst_context * * Purpose: Destroy client callback context * @@ -235,11 +253,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dst_context(void *_ctx) +H5HF__huge_bt2_dst_context(void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -248,11 +266,51 @@ H5HF_huge_bt2_dst_context(void *_ctx) ctx = H5FL_FREE(H5HF_huge_bt2_ctx_t, ctx); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dst_context() */ +} /* H5HF__huge_bt2_dst_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF__huge_bt2_crt_dbg_context + * + * Purpose: Create context for debugging callback + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Tuesday, December 1, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) +{ + H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5HF_huge_bt2_ctx_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") + + /* Determine the size of addresses & lengths in the file */ + ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); + ctx->sizeof_size = H5F_SIZEOF_SIZE(f); + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF__huge_bt2_crt_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_found + * Function: H5HF__huge_bt2_indir_found * * Purpose: Retrieve record for indirectly accessed 'huge' object, when * it's found in the v2 B-tree @@ -266,24 +324,18 @@ H5HF_huge_bt2_dst_context(void *_ctx) *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data) +H5HF__huge_bt2_indir_found(const void *nrecord, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef QAK -HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_found", - ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->addr, - ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len, - ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->id); -#endif /* QAK */ + FUNC_ENTER_PACKAGE_NOERR + *(H5HF_huge_bt2_indir_rec_t *)op_data = *(const H5HF_huge_bt2_indir_rec_t *)nrecord; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_found() */ +} /* H5HF__huge_bt2_indir_found() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_remove + * Function: H5HF__huge_bt2_indir_remove * * Purpose: Free space for indirectly accessed 'huge' object, as v2 B-tree * is being deleted or v2 B-tree node is removed @@ -297,12 +349,12 @@ HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_found", *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_indir_remove(const void *nrecord, void *_udata) +H5HF__huge_bt2_indir_remove(const void *nrecord, void *_udata) { H5HF_huge_remove_ud_t *udata = (H5HF_huge_remove_ud_t *)_udata; /* User callback data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Free the space in the file for the object being removed */ if(H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, udata->dxpl_id, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len) < 0) @@ -313,11 +365,11 @@ H5HF_huge_bt2_indir_remove(const void *nrecord, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_indir_remove() */ +} /* H5HF__huge_bt2_indir_remove() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_store + * Function: H5HF__huge_bt2_indir_store * * Purpose: Store native information into record for v2 B-tree * @@ -330,18 +382,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_store(void *nrecord, const void *udata) +H5HF__huge_bt2_indir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR *(H5HF_huge_bt2_indir_rec_t *)nrecord = *(const H5HF_huge_bt2_indir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_store() */ +} /* H5HF__huge_bt2_indir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_compare + * Function: H5HF__huge_bt2_indir_compare * * Purpose: Compare two native information records, according to some key * @@ -355,25 +407,16 @@ H5HF_huge_bt2_indir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_compare(const void *_rec1, const void *_rec2) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef QAK +H5HF__huge_bt2_indir_compare(const void *_rec1, const void *_rec2) { -const H5HF_huge_bt2_indir_rec_t *rec1 = (const H5HF_huge_bt2_indir_rec_t *)_rec1; -const H5HF_huge_bt2_indir_rec_t *rec2 = (const H5HF_huge_bt2_indir_rec_t *)_rec2; + FUNC_ENTER_STATIC_NOERR -HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", rec1->addr, rec1->len, rec1->id); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", rec2->addr, rec2->len, rec2->id); -} -#endif /* QAK */ FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_indir_rec_t *)_rec2)->id)) -} /* H5HF_huge_bt2_indir_compare() */ +} /* H5HF__huge_bt2_indir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_encode + * Function: H5HF__huge_bt2_indir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -386,12 +429,12 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_indir_compare", *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5HF__huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_indir_rec_t *nrecord = (const H5HF_huge_bt2_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -402,11 +445,11 @@ H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) H5F_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_encode() */ +} /* H5HF__huge_bt2_indir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_decode + * Function: H5HF__huge_bt2_indir_decode * * Purpose: Decode raw disk form of record into native form * @@ -419,12 +462,12 @@ H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5HF__huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_indir_rec_t *nrecord = (H5HF_huge_bt2_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -435,11 +478,11 @@ H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) H5F_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_decode() */ +} /* H5HF__huge_bt2_indir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_indir_debug + * Function: H5HF__huge_bt2_indir_debug * * Purpose: Debug native form of record * @@ -452,21 +495,22 @@ H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5HF_huge_bt2_indir_rec_t *nrecord = (const H5HF_huge_bt2_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%a, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_indir_debug() */ +} /* H5HF__huge_bt2_indir_debug() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_found + * Function: H5HF__huge_bt2_filt_indir_found * * Purpose: Retrieve record for indirectly accessed, filtered 'huge' object, * when it's found in the v2 B-tree @@ -480,26 +524,18 @@ H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nre *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data) +H5HF__huge_bt2_filt_indir_found(const void *nrecord, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef QAK -HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_found", - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->addr, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->len, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->filter_mask, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->obj_size, - ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->id); -#endif /* QAK */ + FUNC_ENTER_PACKAGE_NOERR + *(H5HF_huge_bt2_filt_indir_rec_t *)op_data = *(const H5HF_huge_bt2_filt_indir_rec_t *)nrecord; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_found() */ +} /* H5HF__huge_bt2_filt_indir_found() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_remove + * Function: H5HF__huge_bt2_filt_indir_remove * * Purpose: Free space for indirectly accessed, filtered 'huge' object, as * v2 B-tree is being deleted or v2 B-tree node is removed @@ -513,12 +549,12 @@ HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *_udata) +H5HF__huge_bt2_filt_indir_remove(const void *nrecord, void *_udata) { H5HF_huge_remove_ud_t *udata = (H5HF_huge_remove_ud_t *)_udata; /* User callback data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Free the space in the file for the object being removed */ if(H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, udata->dxpl_id, ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->len) < 0) @@ -529,11 +565,11 @@ H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_filt_indir_remove() */ +} /* H5HF__huge_bt2_filt_indir_remove() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_store + * Function: H5HF__huge_bt2_filt_indir_store * * Purpose: Store native information into record for v2 B-tree * @@ -546,18 +582,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_store(void *nrecord, const void *udata) +H5HF__huge_bt2_filt_indir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR *(H5HF_huge_bt2_filt_indir_rec_t *)nrecord = *(const H5HF_huge_bt2_filt_indir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_store() */ +} /* H5HF__huge_bt2_filt_indir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_compare + * Function: H5HF__huge_bt2_filt_indir_compare * * Purpose: Compare two native information records, according to some key * @@ -571,25 +607,16 @@ H5HF_huge_bt2_filt_indir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR -#ifdef QAK -{ -const H5HF_huge_bt2_filt_indir_rec_t *rec1 = (const H5HF_huge_bt2_filt_indir_rec_t *)_rec1; -const H5HF_huge_bt2_filt_indir_rec_t *rec2 = (const H5HF_huge_bt2_filt_indir_rec_t *)_rec2; - -HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_compare", rec1->addr, rec1->len, rec1->filter_mask, rec1->obj_size, rec1->id); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_indir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size, rec2->id); -} -#endif /* QAK */ FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_filt_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_filt_indir_rec_t *)_rec2)->id)) -} /* H5HF_huge_bt2_filt_indir_compare() */ +} /* H5HF__huge_bt2_filt_indir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_encode + * Function: H5HF__huge_bt2_filt_indir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -602,12 +629,12 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu, %Hu}\n", "H5HF_huge_bt2_filt_in *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5HF__huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_filt_indir_rec_t *nrecord = (const H5HF_huge_bt2_filt_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -620,11 +647,11 @@ H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) H5F_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_encode() */ +} /* H5HF__huge_bt2_filt_indir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_decode + * Function: H5HF__huge_bt2_filt_indir_decode * * Purpose: Decode raw disk form of record into native form * @@ -637,12 +664,12 @@ H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5HF__huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_filt_indir_rec_t *nrecord = (H5HF_huge_bt2_filt_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -655,11 +682,11 @@ H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) H5F_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_decode() */ +} /* H5HF__huge_bt2_filt_indir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_indir_debug + * Function: H5HF__huge_bt2_filt_indir_debug * * Purpose: Debug native form of record * @@ -672,21 +699,22 @@ H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5HF_huge_bt2_filt_indir_rec_t *nrecord = (const H5HF_huge_bt2_filt_indir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_indir_debug() */ +} /* H5HF__huge_bt2_filt_indir_debug() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_remove + * Function: H5HF__huge_bt2_dir_remove * * Purpose: Free space for directly accessed 'huge' object, as v2 B-tree * is being deleted or v2 B-tree node is being removed @@ -700,12 +728,12 @@ H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_dir_remove(const void *nrecord, void *_udata) +H5HF__huge_bt2_dir_remove(const void *nrecord, void *_udata) { H5HF_huge_remove_ud_t *udata = (H5HF_huge_remove_ud_t *)_udata; /* User callback data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Free the space in the file for the object being removed */ if(H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, udata->dxpl_id, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len) < 0) @@ -716,11 +744,11 @@ H5HF_huge_bt2_dir_remove(const void *nrecord, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_dir_remove() */ +} /* H5HF__huge_bt2_dir_remove() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_store + * Function: H5HF__huge_bt2_dir_store * * Purpose: Store native information into record for v2 B-tree * @@ -733,18 +761,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_store(void *nrecord, const void *udata) +H5HF__huge_bt2_dir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR *(H5HF_huge_bt2_dir_rec_t *)nrecord = *(const H5HF_huge_bt2_dir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dir_store() */ +} /* H5HF__huge_bt2_dir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_compare + * Function: H5HF__huge_bt2_dir_compare * * Purpose: Compare two native information records, according to some key * @@ -758,18 +786,14 @@ H5HF_huge_bt2_dir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_dir_rec_t *rec1 = (const H5HF_huge_bt2_dir_rec_t *)_rec1; const H5HF_huge_bt2_dir_rec_t *rec2 = (const H5HF_huge_bt2_dir_rec_t *)_rec2; herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR -#ifdef QAK -HDfprintf(stderr, "%s: rec1 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec1->addr, rec1->len); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec2->addr, rec2->len); -#endif /* QAK */ if(rec1->addr < rec2->addr) ret_value = -1; else if(rec1->addr > rec2->addr) @@ -782,11 +806,11 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec2->a ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_dir_compare() */ +} /* H5HF__huge_bt2_dir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_encode + * Function: H5HF__huge_bt2_dir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -799,12 +823,12 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu}\n", "H5HF_huge_bt2_dir_compare", rec2->a *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5HF__huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_dir_rec_t *nrecord = (const H5HF_huge_bt2_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -814,11 +838,11 @@ H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dir_encode() */ +} /* H5HF__huge_bt2_dir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_decode + * Function: H5HF__huge_bt2_dir_decode * * Purpose: Decode raw disk form of record into native form * @@ -831,12 +855,12 @@ H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5HF__huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_dir_rec_t *nrecord = (H5HF_huge_bt2_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -846,11 +870,11 @@ H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dir_decode() */ +} /* H5HF__huge_bt2_dir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_dir_debug + * Function: H5HF__huge_bt2_dir_debug * * Purpose: Debug native form of record * @@ -863,21 +887,22 @@ H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5HF_huge_bt2_dir_rec_t *nrecord = (const H5HF_huge_bt2_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%a, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_dir_debug() */ +} /* H5HF__huge_bt2_dir_debug() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_found + * Function: H5HF__huge_bt2_filt_dir_found * * Purpose: Retrieve record for directly accessed, filtered 'huge' object, * when it's found in the v2 B-tree @@ -891,25 +916,18 @@ H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nreco *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data) +H5HF__huge_bt2_filt_dir_found(const void *nrecord, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef QAK -HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_found", - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->addr, - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->len, - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->filter_mask, - ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->obj_size); -#endif /* QAK */ + FUNC_ENTER_PACKAGE_NOERR + *(H5HF_huge_bt2_filt_dir_rec_t *)op_data = *(const H5HF_huge_bt2_filt_dir_rec_t *)nrecord; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_found() */ +} /* H5HF__huge_bt2_filt_dir_found() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_remove + * Function: H5HF__huge_bt2_filt_dir_remove * * Purpose: Free space for directly accessed, filtered 'huge' object, as * v2 B-tree is being deleted or v2 B-tree node is removed @@ -923,12 +941,12 @@ HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_ *------------------------------------------------------------------------- */ herr_t -H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *_udata) +H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *_udata) { H5HF_huge_remove_ud_t *udata = (H5HF_huge_remove_ud_t *)_udata; /* User callback data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Free the space in the file for the object being removed */ if(H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, udata->dxpl_id, ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->len) < 0) @@ -939,11 +957,11 @@ H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_filt_dir_remove() */ +} /* H5HF__huge_bt2_filt_dir_remove() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_store + * Function: H5HF__huge_bt2_filt_dir_store * * Purpose: Store native information into record for v2 B-tree * @@ -956,18 +974,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_store(void *nrecord, const void *udata) +H5HF__huge_bt2_filt_dir_store(void *nrecord, const void *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR *(H5HF_huge_bt2_filt_dir_rec_t *)nrecord = *(const H5HF_huge_bt2_filt_dir_rec_t *)udata; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_store() */ +} /* H5HF__huge_bt2_filt_dir_store() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_compare + * Function: H5HF__huge_bt2_filt_dir_compare * * Purpose: Compare two native information records, according to some key * @@ -981,18 +999,14 @@ H5HF_huge_bt2_filt_dir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_filt_dir_rec_t *rec1 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec1; const H5HF_huge_bt2_filt_dir_rec_t *rec2 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec2; herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR -#ifdef QAK -HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_compare", rec1->addr, rec1->len, rec1->filter_mask, rec1->obj_size); -HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_compare", rec2->addr, rec2->len, rec2->filter_mask, rec2->obj_size); -#endif /* QAK */ if(rec1->addr < rec2->addr) ret_value = -1; else if(rec1->addr > rec2->addr) @@ -1005,11 +1019,11 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_com ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_huge_bt2_filt_dir_compare() */ +} /* H5HF__huge_bt2_filt_dir_compare() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_encode + * Function: H5HF__huge_bt2_filt_dir_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -1022,12 +1036,12 @@ HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %x, %Hu}\n", "H5HF_huge_bt2_filt_dir_com *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5HF__huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5HF_huge_bt2_filt_dir_rec_t *nrecord = (const H5HF_huge_bt2_filt_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -1039,11 +1053,11 @@ H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) H5F_ENCODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_encode() */ +} /* H5HF__huge_bt2_filt_dir_encode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_decode + * Function: H5HF__huge_bt2_filt_dir_decode * * Purpose: Decode raw disk form of record into native form * @@ -1056,12 +1070,12 @@ H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5HF__huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5HF_huge_bt2_ctx_t *ctx = (H5HF_huge_bt2_ctx_t *)_ctx; /* Callback context structure */ H5HF_huge_bt2_filt_dir_rec_t *nrecord = (H5HF_huge_bt2_filt_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -1073,11 +1087,11 @@ H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) H5F_DECODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_decode() */ +} /* H5HF__huge_bt2_filt_dir_decode() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_bt2_filt_dir_debug + * Function: H5HF__huge_bt2_filt_dir_debug * * Purpose: Debug native form of record * @@ -1090,15 +1104,16 @@ H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5HF_huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord) +H5HF__huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, + const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5HF_huge_bt2_filt_dir_rec_t *nrecord = (const H5HF_huge_bt2_filt_dir_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_huge_bt2_filt_dir_debug() */ +} /* H5HF__huge_bt2_filt_dir_debug() */ diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 9461fc0..73db840 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -368,7 +368,7 @@ H5HF_man_dblock_new(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t request, } /* end else */ /* Adjust the size of block needed to fulfill request, with overhead */ - if((min_dblock_size - request) < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) + if(min_dblock_size < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) + request) min_dblock_size *= 2; /* Check if this is the first block in the heap */ @@ -460,7 +460,7 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, HDassert(dblock_size > 0); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (~H5AC__READ_ONLY_FLAG)) == 0); + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up parent info */ udata.par_info.hdr = hdr; @@ -543,7 +543,7 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, HDassert(ret_did_protect); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (~H5AC__READ_ONLY_FLAG)) == 0); + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Look up row & column for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 6560756..19ea14a 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -224,7 +224,7 @@ H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info") /* Set the size of heap IDs */ - hdr->heap_len_size = MIN(hdr->man_dtable.max_dir_blk_off_size, + hdr->heap_len_size = (uint8_t)MIN(hdr->man_dtable.max_dir_blk_off_size, H5VM_limit_enc_size((uint64_t)hdr->max_man_size)); done: @@ -382,7 +382,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "can't allocate space for shared heap info") #ifndef NDEBUG - if(cparam->managed.max_index > (8 * hdr->sizeof_size)) + if(cparam->managed.max_index > (unsigned)(8 * hdr->sizeof_size)) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. heap size too large for file") #endif /* NDEBUG */ @@ -433,7 +433,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set latest version of I/O filter pipeline") /* Compute the I/O filters' encoded size */ - if(0 == (hdr->filter_len = H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline)))) + if(0 == (hdr->filter_len = (unsigned)H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline)))) HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, HADDR_UNDEF, "can't get I/O filter pipeline size") /* Compute size of header on disk */ @@ -462,13 +462,13 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) case 1: /* Set the length of heap IDs to just enough to hold the information needed to directly access 'huge' objects in the heap */ if(hdr->filter_len > 0) - hdr->id_len = 1 /* ID flags */ + hdr->id_len = (unsigned)1 /* ID flags */ + hdr->sizeof_addr /* Address of filtered object */ + hdr->sizeof_size /* Length of filtered object */ + 4 /* Filter mask for filtered object */ + hdr->sizeof_size; /* Size of de-filtered object in memory */ else - hdr->id_len = 1 /* ID flags */ + hdr->id_len = (unsigned)1 /* ID flags */ + hdr->sizeof_addr /* Address of object */ + hdr->sizeof_size; /* Length of object */ break; @@ -764,7 +764,7 @@ H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) /* Update heap header */ HDassert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt); - hdr->total_man_free += amt; + hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + amt); /* Mark heap header as modified */ if(H5HF_hdr_dirty(hdr) < 0) @@ -804,7 +804,8 @@ H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) hdr->man_size = new_size; /* Adjust the free space in direct blocks */ - hdr->total_man_free += extra_free; + HDassert(extra_free > 0 || hdr->total_man_free >= (hsize_t)-extra_free); + hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + extra_free); /* Mark heap header as modified */ if(H5HF_hdr_dirty(hdr) < 0) @@ -1246,7 +1247,7 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr) /* Walk backwards through entries, until we find one that has a child */ /* (Skip direct block that will be deleted, if we find it) */ - tmp_entry = curr_entry; + tmp_entry = (int)curr_entry; while(tmp_entry >= 0 && (H5F_addr_eq(iblock->ents[tmp_entry].addr, dblock_addr) || !H5F_addr_defined(iblock->ents[tmp_entry].addr))) @@ -1281,7 +1282,7 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr) else { unsigned row; /* Row for entry */ - curr_entry = tmp_entry; + curr_entry = (unsigned)tmp_entry; /* Check if entry is for a direct block */ row = curr_entry / hdr->man_dtable.cparam.width; diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 888af48..ccee89e 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -124,31 +124,31 @@ H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id) */ if(hdr->huge_ids_direct) { if(hdr->filter_len > 0) { - bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */ - + hdr->sizeof_size /* Length of object */ - + 4 /* Filter mask for filtered object */ - + hdr->sizeof_size); /* Size of de-filtered object in memory */ + bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */ + + (unsigned)hdr->sizeof_size /* Length of object */ + + (unsigned)4 /* Filter mask for filtered object */ + + (unsigned)hdr->sizeof_size); /* Size of de-filtered object in memory */ bt2_cparam.cls = H5HF_HUGE_BT2_FILT_DIR; } /* end if */ else { - bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */ - + hdr->sizeof_size); /* Length of object */ + bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */ + + (unsigned)hdr->sizeof_size); /* Length of object */ bt2_cparam.cls = H5HF_HUGE_BT2_DIR; } /* end else */ } /* end if */ else { if(hdr->filter_len > 0) { - bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of filtered object */ - + hdr->sizeof_size /* Length of filtered object */ - + 4 /* Filter mask for filtered object */ - + hdr->sizeof_size /* Size of de-filtered object in memory */ - + hdr->sizeof_size); /* Unique ID for object */ + bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of filtered object */ + + (unsigned)hdr->sizeof_size /* Length of filtered object */ + + (unsigned)4 /* Filter mask for filtered object */ + + (unsigned)hdr->sizeof_size /* Size of de-filtered object in memory */ + + (unsigned)hdr->sizeof_size); /* Unique ID for object */ bt2_cparam.cls = H5HF_HUGE_BT2_FILT_INDIR; } /* end if */ else { - bt2_cparam.rrec_size = (size_t)(hdr->sizeof_addr /* Address of object */ - + hdr->sizeof_size /* Length of object */ - + hdr->sizeof_size); /* Unique ID for object */ + bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */ + + (unsigned)hdr->sizeof_size /* Length of object */ + + (unsigned)hdr->sizeof_size); /* Unique ID for object */ bt2_cparam.cls = H5HF_HUGE_BT2_INDIR; } /* end else */ } /* end else */ @@ -557,7 +557,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's length */ @@ -571,7 +571,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's length */ @@ -641,7 +641,7 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -655,7 +655,7 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -735,7 +735,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -751,7 +751,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -879,7 +879,7 @@ H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) /* Look up object in v2 B-tree */ - if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE) + if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_found, &found_rec) != TRUE) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") /* Retrieve the object's address & length */ @@ -1024,7 +1024,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_dir_remove, &udata) < 0) + if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_dir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end if */ else { @@ -1037,7 +1037,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_dir_remove, &udata) < 0) + if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_dir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end else */ } /* end if */ @@ -1050,7 +1050,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_remove, &udata) < 0) + if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_filt_indir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end if */ else { @@ -1061,7 +1061,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ - if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_remove, &udata) < 0) + if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF__huge_bt2_indir_remove, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") } /* end else */ } /* end else */ @@ -1180,15 +1180,15 @@ H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) /* Set the v2 B-tree callback operator */ if(hdr->huge_ids_direct) { if(hdr->filter_len > 0) - op = H5HF_huge_bt2_filt_dir_remove; + op = H5HF__huge_bt2_filt_dir_remove; else - op = H5HF_huge_bt2_dir_remove; + op = H5HF__huge_bt2_dir_remove; } /* end if */ else { if(hdr->filter_len > 0) - op = H5HF_huge_bt2_filt_indir_remove; + op = H5HF__huge_bt2_filt_indir_remove; else - op = H5HF_huge_bt2_indir_remove; + op = H5HF__huge_bt2_indir_remove; } /* end else */ /* Delete the v2 B-tree */ diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 29f4662..f3ec78f 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -214,7 +214,7 @@ H5HF_iblock_unpin(H5HF_indirect_t *iblock) } /* end if */ /* Indicate that the root indirect block is unpinned */ - iblock->hdr->root_iblock_flags &= ~(H5HF_ROOT_IBLOCK_PINNED); + iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); } /* end if */ } /* end else */ @@ -649,7 +649,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si /* Initialize new direct block entries in rows added */ acc_dblock_free = 0; for(u = (old_nrows * hdr->man_dtable.cparam.width); u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) { - unsigned row = u / hdr->man_dtable.cparam.width; /* Row for current entry */ + unsigned row = (unsigned)(u / hdr->man_dtable.cparam.width); /* Row for current entry */ iblock->ents[u].addr = HADDR_UNDEF; acc_dblock_free += hdr->man_dtable.row_tot_dblock_free[row]; @@ -751,7 +751,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; /* Compute new # of rows in root indirect block */ - new_nrows = 1 << (1 + H5VM_log2_gen((uint64_t)max_child_row)); + new_nrows = (unsigned)1 << (1 + H5VM_log2_gen((uint64_t)max_child_row)); /* Check if the indirect block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ @@ -1323,7 +1323,7 @@ H5HF_man_iblock_unprotect(H5HF_indirect_t *iblock, hid_t dxpl_id, } /* end if */ /* Indicate that the root indirect block is unprotected */ - iblock->hdr->root_iblock_flags &= ~(H5HF_ROOT_IBLOCK_PROTECTED); + iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PROTECTED)); } /* end if */ /* Unprotect the indirect block */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 7a6794e..6253160 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -48,19 +48,19 @@ /* "Standard" size of prefix information for fractal heap metadata */ #define H5HF_METADATA_PREFIX_SIZE(c) ( \ H5_SIZEOF_MAGIC /* Signature */ \ - + 1 /* Version */ \ - + ((c) ? H5HF_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \ + + (unsigned)1 /* Version */ \ + + ((c) ? (unsigned)H5HF_SIZEOF_CHKSUM : (unsigned)0) /* Metadata checksum */ \ ) /* Size of doubling-table information */ #define H5HF_DTABLE_INFO_SIZE(h) ( \ - 2 /* Width of table (i.e. # of columns) */ \ - + (h)->sizeof_size /* Starting block size */ \ - + (h)->sizeof_size /* Maximum direct block size */ \ - + 2 /* Max. size of heap (log2 of actual value - i.e. the # of bits) */ \ - + 2 /* Starting # of rows in root indirect block */ \ - + (h)->sizeof_addr /* File address of table managed */ \ - + 2 /* Current # of rows in root indirect block */ \ + (unsigned)2 /* Width of table (i.e. # of columns) */ \ + + (unsigned)(h)->sizeof_size /* Starting block size */ \ + + (unsigned)(h)->sizeof_size /* Maximum direct block size */ \ + + (unsigned)2 /* Max. size of heap (log2 of actual value - i.e. the # of bits) */ \ + + (unsigned)2 /* Starting # of rows in root indirect block */ \ + + (unsigned)(h)->sizeof_addr /* File address of table managed */ \ + + (unsigned)2 /* Current # of rows in root indirect block */ \ ) /* Flags for status byte */ @@ -78,28 +78,28 @@ /* Fractal Heap Header specific fields */ \ \ /* General heap information */ \ - + 2 /* Heap ID len */ \ - + 2 /* I/O filters' encoded len */ \ - + 1 /* Status flags */ \ + + (unsigned)2 /* Heap ID len */ \ + + (unsigned)2 /* I/O filters' encoded len */ \ + + (unsigned)1 /* Status flags */ \ \ /* "Huge" object fields */ \ - + 4 /* Max. size of "managed" object */ \ - + (h)->sizeof_size /* Next ID for "huge" object */ \ - + (h)->sizeof_addr /* File address of "huge" object tracker B-tree */ \ + + (unsigned)4 /* Max. size of "managed" object */ \ + + (unsigned)(h)->sizeof_size /* Next ID for "huge" object */ \ + + (unsigned)(h)->sizeof_addr /* File address of "huge" object tracker B-tree */ \ \ /* "Managed" object free space fields */ \ - + (h)->sizeof_size /* Total man. free space */ \ - + (h)->sizeof_addr /* File address of free section header */ \ + + (unsigned)(h)->sizeof_size /* Total man. free space */ \ + + (unsigned)(h)->sizeof_addr /* File address of free section header */ \ \ /* Statistics fields */ \ - + (h)->sizeof_size /* Size of man. space in heap */ \ - + (h)->sizeof_size /* Size of man. space iterator offset in heap */ \ - + (h)->sizeof_size /* Size of alloacted man. space in heap */ \ - + (h)->sizeof_size /* Number of man. objects in heap */ \ - + (h)->sizeof_size /* Size of huge space in heap */ \ - + (h)->sizeof_size /* Number of huge objects in heap */ \ - + (h)->sizeof_size /* Size of tiny space in heap */ \ - + (h)->sizeof_size /* Number of tiny objects in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of man. space in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of man. space iterator offset in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of alloacted man. space in heap */ \ + + (unsigned)(h)->sizeof_size /* Number of man. objects in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of huge space in heap */ \ + + (unsigned)(h)->sizeof_size /* Number of huge objects in heap */ \ + + (unsigned)(h)->sizeof_size /* Size of tiny space in heap */ \ + + (unsigned)(h)->sizeof_size /* Number of tiny objects in heap */ \ \ /* "Managed" object doubling table info */ \ + H5HF_DTABLE_INFO_SIZE(h) /* Size of managed obj. doubling-table info */ \ @@ -111,15 +111,15 @@ H5HF_METADATA_PREFIX_SIZE(h->checksum_dblocks) \ \ /* Fractal heap managed, absolutely mapped direct block specific fields */ \ - + (h)->sizeof_addr /* File address of heap owning the block */ \ - + (h)->heap_off_size /* Offset of the block in the heap */ \ + + (unsigned)(h)->sizeof_addr /* File address of heap owning the block */ \ + + (unsigned)(h)->heap_off_size /* Offset of the block in the heap */ \ ) /* Size of managed indirect block entry for a child direct block */ #define H5HF_MAN_INDIRECT_CHILD_DIR_ENTRY_SIZE(h) ( \ ((h)->filter_len > 0 ? \ - ((h)->sizeof_addr + (h)->sizeof_size + 4) : /* Size of entries for filtered direct blocks */ \ - (h)->sizeof_addr) /* Size of entries for un-filtered direct blocks */ \ + ((unsigned)(h)->sizeof_addr + (unsigned)(h)->sizeof_size + (unsigned)4) : /* Size of entries for filtered direct blocks */ \ + (unsigned)(h)->sizeof_addr) /* Size of entries for un-filtered direct blocks */ \ ) /* Size of managed indirect block */ @@ -128,8 +128,8 @@ H5HF_METADATA_PREFIX_SIZE(TRUE) \ \ /* Fractal heap managed, absolutely mapped indirect block specific fields */ \ - + (h)->sizeof_addr /* File address of heap owning the block */ \ - + (h)->heap_off_size /* Offset of the block in the heap */ \ + + (unsigned)(h)->sizeof_addr /* File address of heap owning the block */ \ + + (unsigned)(h)->heap_off_size /* Offset of the block in the heap */ \ + (MIN(r, (h)->man_dtable.max_direct_rows) * (h)->man_dtable.cparam.width * H5HF_MAN_INDIRECT_CHILD_DIR_ENTRY_SIZE(h)) /* Size of entries for direct blocks */ \ + (((r > (h)->man_dtable.max_direct_rows) ? (r - (h)->man_dtable.max_direct_rows) : 0) * (h)->man_dtable.cparam.width * (h)->sizeof_addr) /* Size of entries for indirect blocks */ \ ) @@ -731,13 +731,13 @@ H5_DLL herr_t H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id); H5_DLL herr_t H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id); /* 'Huge' object v2 B-tree function callbacks */ -H5_DLL herr_t H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_indir_remove(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_dir_remove(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_indir_found(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_indir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_filt_indir_found(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_filt_indir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_dir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_filt_dir_found(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *op_data); /* 'Tiny' object routines */ H5_DLL herr_t H5HF_tiny_init(H5HF_hdr_t *hdr); diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 070bc3e..8699827 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -14,10 +14,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 1, 2006 * - * Purpose: Free space section routines for fractal heaps. + * Purpose: Free space section routines for fractal heaps * */ @@ -43,10 +43,10 @@ /* Size of serialized indirect section information */ #define H5HF_SECT_INDIRECT_SERIAL_SIZE(h) ( \ - (h)->heap_off_size /* Indirect block's offset in "heap space" */ \ - + 2 /* Row */ \ - + 2 /* Column */ \ - + 2 /* # of entries */ \ + (unsigned)(h)->heap_off_size /* Indirect block's offset in "heap space" */ \ + + (unsigned)2 /* Row */ \ + + (unsigned)2 /* Column */ \ + + (unsigned)2 /* # of entries */ \ ) @@ -587,15 +587,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_revive + * Function: H5HF_sect_single_revive * - * Purpose: Update the memory information for a 'single' free section + * Purpose: Update the memory information for a 'single' free section * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 8 2006 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * May 8 2006 * *------------------------------------------------------------------------- */ @@ -636,15 +636,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_dblock_info + * Function: H5HF_sect_single_dblock_info * - * Purpose: Retrieve the direct block information for a single section + * Purpose: Retrieve the direct block information for a single section * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * October 24 2006 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * October 24 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 4ec7149..4b97194 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -97,10 +97,10 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam) /* Get fractal heap creation parameters */ if(fh->hdr->id_len == (unsigned)(1 + fh->hdr->heap_off_size + fh->hdr->heap_len_size)) cparam->id_len = 0; - else if(fh->hdr->id_len == (1 + fh->hdr->sizeof_size + fh->hdr->sizeof_addr)) + else if(fh->hdr->id_len == (unsigned)(1 + fh->hdr->sizeof_size + fh->hdr->sizeof_addr)) cparam->id_len = 1; else - cparam->id_len = fh->hdr->id_len; + H5_CHECKED_ASSIGN(cparam->id_len, uint16_t, fh->hdr->id_len, unsigned); cparam->max_man_size = fh->hdr->max_man_size; HDmemcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t)); H5O_msg_copy(H5O_PLINE_ID, &(fh->hdr->pline), &(cparam->pline)); diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index 8c321bc..bdfe30d 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -169,17 +169,17 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); /* Encode object into ID */ if(!hdr->tiny_len_extended) { - *id++ = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_TINY | - (enc_obj_size & H5HF_TINY_MASK_SHORT); + *id++ = (uint8_t)(H5HF_ID_VERS_CURR | H5HF_ID_TYPE_TINY | + (enc_obj_size & H5HF_TINY_MASK_SHORT)); } /* end if */ else { - *id++ = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_TINY | - ((enc_obj_size & H5HF_TINY_MASK_EXT_1) >> 8); + *id++ = (uint8_t)(H5HF_ID_VERS_CURR | H5HF_ID_TYPE_TINY | + ((enc_obj_size & H5HF_TINY_MASK_EXT_1) >> 8)); *id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2; } /* end else */ HDmemcpy(id, obj, obj_size); #ifdef H5_CLEAR_MEMORY -HDmemset(id + obj_size, 0, (hdr->id_len - (1 + hdr->tiny_len_extended + obj_size))); +HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); #endif /* H5_CLEAR_MEMORY */ /* Update statistics about heap */ @@ -229,7 +229,7 @@ H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) /* (performed in this odd way to avoid compiler bug on tg-login3 with * gcc 3.2.2 - QAK) */ - enc_obj_size = *(id + 1) | ((*id & H5HF_TINY_MASK_EXT_1) << 8); + enc_obj_size = (size_t)*(id + 1) | ((size_t)(*id & H5HF_TINY_MASK_EXT_1) << 8); /* Set the object's length */ *obj_len_p = enc_obj_size + 1; diff --git a/src/H5SM.c b/src/H5SM.c index e25d780..4a562dd 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -1639,7 +1639,7 @@ H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *e */ for(x = 0; x < list->header->list_max; x++) { if((list->messages[x].location != H5SM_NO_LOC) && - (0 == H5SM_message_compare(key, &(list->messages[x])))) + (0 == H5SM__message_compare(key, &(list->messages[x])))) HGOTO_DONE(x) else if(empty_pos && list->messages[x].location == H5SM_NO_LOC) { /* Note position */ @@ -2672,8 +2672,6 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr, FILE *stream, "Location:", "in heap"); HDfprintf(stream, "%*s%-*s 0x%Zx\n", indent + 3, "", fwidth, "Heap ID:", list->messages[x].u.heap_loc.fheap_id); -H5HF_id_print(fh, dxpl_id, - &(list->messages[x].u.heap_loc.fheap_id), stream, indent + 6, (fwidth - 3)); HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, "Reference count:", list->messages[x].u.heap_loc.ref_count); } /* end if */ diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index e24dbb7..e533ae8 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -45,11 +45,12 @@ /********************/ /* v2 B-tree callbacks */ -static void *H5SM_bt2_crt_context(void *udata); -static herr_t H5SM_bt2_dst_context(void *ctx); -static herr_t H5SM_bt2_store(void *native, const void *udata); -static herr_t H5SM_bt2_debug(FILE *stream, int indent, int fwidth, - const void *record); +static void *H5SM__bt2_crt_context(void *udata); +static herr_t H5SM__bt2_dst_context(void *ctx); +static herr_t H5SM__bt2_store(void *native, const void *udata); +static herr_t H5SM__bt2_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); +static void *H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /*****************************/ @@ -60,13 +61,15 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */ H5B2_SOHM_INDEX_ID, /* Type of B-tree */ "H5B2_SOHM_INDEX_ID", /* Name of B-tree class */ sizeof(H5SM_sohm_t), /* Size of native record */ - H5SM_bt2_crt_context, /* Create client callback context */ - H5SM_bt2_dst_context, /* Destroy client callback context */ - H5SM_bt2_store, /* Record storage callback */ - H5SM_message_compare, /* Record comparison callback */ - H5SM_message_encode, /* Record encoding callback */ - H5SM_message_decode, /* Record decoding callback */ - H5SM_bt2_debug /* Record debugging callback */ + H5SM__bt2_crt_context, /* Create client callback context */ + H5SM__bt2_dst_context, /* Destroy client callback context */ + H5SM__bt2_store, /* Record storage callback */ + H5SM__message_compare, /* Record comparison callback */ + H5SM__message_encode, /* Record encoding callback */ + H5SM__message_decode, /* Record decoding callback */ + H5SM__bt2_debug, /* Record debugging callback */ + H5SM__bt2_crt_dbg_context, /* Create debugging context */ + H5SM__bt2_dst_context /* Destroy debugging context */ }}; @@ -80,7 +83,7 @@ H5FL_DEFINE_STATIC(H5SM_bt2_ctx_t); /*------------------------------------------------------------------------- - * Function: H5SM_bt2_crt_context + * Function: H5SM__bt2_crt_context * * Purpose: Create client callback context * @@ -93,13 +96,13 @@ H5FL_DEFINE_STATIC(H5SM_bt2_ctx_t); *------------------------------------------------------------------------- */ static void * -H5SM_bt2_crt_context(void *_f) +H5SM__bt2_crt_context(void *_f) { H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ H5SM_bt2_ctx_t *ctx; /* Callback context structure */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -116,11 +119,11 @@ H5SM_bt2_crt_context(void *_f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5SM_bt2_crt_context() */ +} /* H5SM__bt2_crt_context() */ /*------------------------------------------------------------------------- - * Function: H5SM_bt2_dst_context + * Function: H5SM__bt2_dst_context * * Purpose: Destroy client callback context * @@ -133,11 +136,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5SM_bt2_dst_context(void *_ctx) +H5SM__bt2_dst_context(void *_ctx) { H5SM_bt2_ctx_t *ctx = (H5SM_bt2_ctx_t *)_ctx; /* Callback context structure */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(ctx); @@ -146,11 +149,11 @@ H5SM_bt2_dst_context(void *_ctx) ctx = H5FL_FREE(H5SM_bt2_ctx_t, ctx); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5SM_bt2_dst_context() */ +} /* H5SM__bt2_dst_context() */ /*------------------------------------------------------------------------- - * Function: H5SM_bt2_store + * Function: H5SM__bt2_store * * Purpose: Store a H5SM_sohm_t SOHM message in the B-tree. The message * comes in UDATA as a H5SM_mesg_key_t* and is copied to @@ -165,21 +168,21 @@ H5SM_bt2_dst_context(void *_ctx) *------------------------------------------------------------------------- */ static herr_t -H5SM_bt2_store(void *native, const void *udata) +H5SM__bt2_store(void *native, const void *udata) { const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *)udata; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy the source message to the B-tree */ *(H5SM_sohm_t *)native = key->message; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_bt2_store */ +} /* end H5SM__bt2_store */ /*------------------------------------------------------------------------- - * Function: H5SM_bt2_debug + * Function: H5SM__bt2_debug * * Purpose: Print debugging information for a H5SM_sohm_t. * @@ -192,11 +195,12 @@ H5SM_bt2_store(void *native, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5SM_bt2_debug(FILE *stream, int indent, int fwidth, const void *record) +H5SM__bt2_debug(FILE *stream, int indent, int fwidth, + const void *record, const void H5_ATTR_UNUSED *_udata) { const H5SM_sohm_t *sohm = (const H5SM_sohm_t *)record; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(sohm->location == H5SM_IN_HEAP) HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx}\n", indent, "", fwidth, @@ -210,7 +214,46 @@ H5SM_bt2_debug(FILE *stream, int indent, int fwidth, const void *record) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_bt2_debug */ +} /* end H5SM__bt2_debug */ + + +/*------------------------------------------------------------------------- + * Function: H5SM__bt2_crt_dbg_context + * + * Purpose: Create context for debugging callback + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Tuesday, December 1, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) +{ + H5SM_bt2_ctx_t *ctx; /* Callback context structure */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5SM_bt2_ctx_t))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") + + /* Determine the size of addresses & lengths in the file */ + ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5SM__bt2_crt_dbg_context() */ /*------------------------------------------------------------------------- diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 1bdd95a..c66fd0a 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -540,7 +540,7 @@ H5SM__cache_list_deserialize(const void *_image, size_t len, void *_udata, /* Read messages into the list array */ ctx.sizeof_addr = H5F_SIZEOF_ADDR(udata->f); for(u = 0; u < udata->header->num_messages; u++) { - if(H5SM_message_decode(image, &(list->messages[u]), &ctx) < 0) + if(H5SM__message_decode(image, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "can't decode shared message") image += H5SM_SOHM_ENTRY_SIZE(udata->f); @@ -661,7 +661,7 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len, ctx.sizeof_addr = H5F_SIZEOF_ADDR(f); for(u = 0; ((u < list->header->list_max) && (mesgs_serialized < list->header->num_messages)); u++) { if(list->messages[u].location != H5SM_NO_LOC) { - if(H5SM_message_encode(image, &(list->messages[u]), &ctx) < 0) + if(H5SM__message_encode(image, &(list->messages[u]), &ctx) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to serialize shared message") image += H5SM_SOHM_ENTRY_SIZE(f); diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index 5dbe5cf..426ea20 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -74,7 +74,7 @@ static herr_t H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequenc /*------------------------------------------------------------------------- * Function: H5SM_compare_cb * - * Purpose: Callback for H5HF_op, used in H5SM_message_compare below. + * Purpose: Callback for H5HF_op, used in H5SM__message_compare below. * Determines whether the search key passed in in _UDATA is * equal to OBJ or not. * @@ -170,7 +170,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5SM_message_compare + * Function: H5SM__message_compare * * Purpose: Determine whether the search key rec1 represents a shared * message that is equal to rec2 or not, and if not, whether @@ -186,13 +186,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5SM_message_compare(const void *rec1, const void *rec2) +H5SM__message_compare(const void *rec1, const void *rec2) { const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *) rec1; const H5SM_sohm_t *mesg = (const H5SM_sohm_t *) rec2; herr_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* If the key has an fheap ID, we're looking for a message that's * already in the index; if the fheap ID matches, we've found the message @@ -269,11 +269,11 @@ H5SM_message_compare(const void *rec1, const void *rec2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SM_message_compare */ +} /* end H5SM__message_compare */ /*------------------------------------------------------------------------- - * Function: H5SM_message_encode + * Function: H5SM__message_encode * * Purpose: Serialize a H5SM_sohm_t struct into a buffer RAW. * @@ -286,12 +286,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5SM_message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) +H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) { H5SM_bt2_ctx_t *ctx = (H5SM_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5SM_sohm_t *message = (const H5SM_sohm_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(ctx); @@ -313,11 +313,11 @@ H5SM_message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_message_encode */ +} /* end H5SM__message_encode */ /*------------------------------------------------------------------------- - * Function: H5SM_message_decode + * Function: H5SM__message_decode * * Purpose: Read an encoded SOHM message from RAW into an H5SM_sohm_t struct. * @@ -330,12 +330,12 @@ H5SM_message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) *------------------------------------------------------------------------- */ herr_t -H5SM_message_decode(const uint8_t *raw, void *_nrecord, void *_ctx) +H5SM__message_decode(const uint8_t *raw, void *_nrecord, void *_ctx) { H5SM_bt2_ctx_t *ctx = (H5SM_bt2_ctx_t *)_ctx; /* Callback context structure */ H5SM_sohm_t *message = (H5SM_sohm_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR message->location = (H5SM_storage_loc_t)*raw++; UINT32DECODE(raw, message->hash); @@ -354,5 +354,5 @@ H5SM_message_decode(const uint8_t *raw, void *_nrecord, void *_ctx) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SM_message_decode */ +} /* end H5SM__message_decode */ diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index ac2ba1b..f072741 100644 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -268,9 +268,9 @@ H5_DLLVAR const H5B2_class_t H5SM_INDEX[1]; H5_DLL ssize_t H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id); /* Encode and decode routines, used for B-tree and cache encoding/decoding */ -H5_DLL herr_t H5SM_message_compare(const void *rec1, const void *rec2); -H5_DLL herr_t H5SM_message_encode(uint8_t *raw, const void *native, void *ctx); -H5_DLL herr_t H5SM_message_decode(const uint8_t *raw, void *native, void *ctx); +H5_DLL herr_t H5SM__message_compare(const void *rec1, const void *rec2); +H5_DLL herr_t H5SM__message_encode(uint8_t *raw, const void *native, void *ctx); +H5_DLL herr_t H5SM__message_decode(const uint8_t *raw, void *native, void *ctx); /* H5B2_remove_t callback to add messages to a list index */ H5_DLL herr_t H5SM_bt2_convert_to_list_op(const void * record, void *op_data); diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 7de0060..0dc12a3 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -49,7 +49,7 @@ static herr_t H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t spac static size_t H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); static void H5Z_scaleoffset_convert(void *buf, unsigned d_nelmts, size_t dtype_size); -static unsigned H5Z_scaleoffset_log2(unsigned long long num); +static H5_ATTR_CONST unsigned H5Z_scaleoffset_log2(unsigned long long num); static void H5Z_scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffset_t type, unsigned filavail, const unsigned cd_values[], uint32_t *minbits, unsigned long long *minval); diff --git a/src/H5private.h b/src/H5private.h index 837ca75..daf6998 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -294,17 +294,23 @@ */ #ifdef __cplusplus # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_CONST /*void*/ +# define H5_ATTR_PURE /*void*/ #else /* __cplusplus */ #if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) # define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) -# define H5_ATTR_UNUSED __attribute__((unused)) -# define H5_ATTR_NORETURN __attribute__((noreturn)) +# define H5_ATTR_UNUSED __attribute__((unused)) +# define H5_ATTR_NORETURN __attribute__((noreturn)) +# define H5_ATTR_CONST __attribute__((const)) +# define H5_ATTR_PURE __attribute__((pure)) #else # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_CONST /*void*/ +# define H5_ATTR_PURE /*void*/ #endif #endif /* __cplusplus */ @@ -2340,18 +2346,21 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through #define FUNC_ENT_PUB(pkg, pkg_init) H5_PUBLIC_ENTER(pkg, pkg_init) /* Macros for substituting a function prefix */ -#define FUNC_PREFIX_STATIC static +#define FUNC_PREFIX_STATIC static #define FUNC_PREFIX_PKGINIT #define FUNC_PREFIX_PKG #define FUNC_PREFIX_PRIV #define FUNC_PREFIX_PUB /* Macros for declaring error variables */ +/* Function can detect errors and has a specific error return value */ #define FUNC_ERR_VAR_ERR(ret_typ, err) \ hbool_t past_catch = FALSE; \ ret_typ fail_value = err; +/* Function can detect errors but cannot return an error value (Cleanup only) */ #define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ hbool_t past_catch = FALSE; +/* Function has no need to detect or clean up from errors */ #define FUNC_ERR_VAR_NOERR(ret_typ, err) /* Use this macro when entering all functions */ diff --git a/src/H5system.c b/src/H5system.c index 05f1a70..f91fb27 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -32,11 +32,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Fprivate.h" /* File access */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Eprivate.h" - +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -667,6 +666,12 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5_make_time() */ +#ifdef H5_HAVE_VISUAL_STUDIO + +/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */ +#define _W32_FT_OFFSET (116444736000000000ULL) + + /*------------------------------------------------------------------------- * Function: Wgettimeofday * @@ -688,11 +693,6 @@ done: * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_VISUAL_STUDIO - -/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */ -#define _W32_FT_OFFSET (116444736000000000ULL) - int Wgettimeofday(struct timeval *tv, struct timezone *tz) { -- cgit v0.12