diff options
-rw-r--r-- | src/H5Dbtree.c | 17 | ||||
-rw-r--r-- | src/H5Dbtree2.c | 52 | ||||
-rw-r--r-- | src/H5Dearray.c | 20 | ||||
-rw-r--r-- | src/H5Dfarray.c | 11 | ||||
-rw-r--r-- | src/H5Dnone.c | 106 | ||||
-rw-r--r-- | src/H5Dsingle.c | 158 |
6 files changed, 170 insertions, 194 deletions
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index b80f9a6..e11c94a 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -971,17 +971,12 @@ done: static hbool_t H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { - hbool_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); - /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(storage->idx_addr); - - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) } /* end H5D__btree_idx_is_space_alloc() */ @@ -1089,7 +1084,7 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */ int ret_value = -1; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Sanity check for memcpy() */ HDcompile_assert(offsetof(H5D_chunk_rec_t, nbytes) == offsetof(H5D_btree_key_t, nbytes)); @@ -1105,9 +1100,8 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, /* Make "generic chunk" callback */ if((ret_value = (udata->cb)(&chunk_rec, udata->udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, (-1), "failure in generic chunk iterator callback"); + HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); -done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D__btree_idx_iterate_cb() */ @@ -1132,7 +1126,7 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_btree_it_ud_t udata; /* User data for B-tree iterator callback */ int ret_value = -1; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR HDassert(idx_info); HDassert(idx_info->f); @@ -1152,9 +1146,8 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, /* Iterate over existing chunks */ if((ret_value = H5B_iterate(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->storage->idx_addr, H5D__btree_idx_iterate_cb, &udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, (-1), "unable to iterate over chunk B-tree"); + HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk B-tree"); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_idx_iterate() */ diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index a1842d5..ecb0082 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -1,5 +1,4 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -498,7 +497,6 @@ H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx) { H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */ const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ - hsize_t tmp_offset; /* Temporary coordinate offset, from file */ unsigned u; /* Local index varible */ FUNC_ENTER_STATIC_NOERR @@ -509,11 +507,8 @@ H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx) /* Encode the record's fields */ H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr); /* (Don't encode the chunk size & filter mask for non-filtered B-tree records) */ - for(u = 0; u < ctx->ndims; u++) { - /* Compute coordinate offset from scaled offset */ - tmp_offset = record->scaled[u] * ctx->dim[u]; - UINT64ENCODE(raw, tmp_offset); - } /* end for */ + for(u = 0; u < ctx->ndims; u++) + UINT64ENCODE(raw, record->scaled[u]); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5D__bt2_unfilt_encode() */ @@ -537,7 +532,6 @@ H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx) { H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */ H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */ - hsize_t tmp_offset; /* Temporary coordinate offset, from file */ unsigned u; /* Local index variable */ FUNC_ENTER_STATIC_NOERR @@ -549,14 +543,8 @@ H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx) H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr); record->nbytes = ctx->chunk_size; record->filter_mask = 0; - for(u = 0; u < ctx->ndims; u++) { - /* Retrieve coordinate offset */ - UINT64DECODE(raw, tmp_offset); - HDassert(0 == (tmp_offset % ctx->dim[u])); - - /* Convert to a scaled offset */ - record->scaled[u] = tmp_offset / ctx->dim[u]; - } /* end for */ + for(u = 0; u < ctx->ndims; u++) + UINT64DECODE(raw, record->scaled[u]); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5D__bt2_unfilt_decode() */ @@ -915,17 +903,12 @@ done: static hbool_t H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { - hbool_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); - /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(storage->idx_addr); - - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) } /* end H5D__bt2_idx_is_space_alloc() */ @@ -997,11 +980,10 @@ H5D__bt2_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda HDassert(H5F_addr_defined(udata->chunk_block.offset)); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) { + if(NULL == idx_info->storage->u.btree2.bt2) /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") - } /* end if */ /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1023,7 +1005,7 @@ H5D__bt2_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda if(udata->need_modify) { HDassert(idx_info->pline->nused > 0); - /* Modify record for filtered object in v2 B-tree */ + /* Modify record for v2 B-tree */ if(H5B2_modify(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata.rec) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree") } /* end if */ @@ -1098,11 +1080,10 @@ H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(udata); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) { + if(NULL == idx_info->storage->u.btree2.bt2) /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") - } /* end if */ /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1175,13 +1156,12 @@ H5D__bt2_idx_iterate_cb(const void *_record, void *_udata) const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* Native record */ int ret_value = -1; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Make "generic chunk" callback */ if((ret_value = (udata->cb)(record, udata->udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, (-1), "failure in generic chunk iterator callback"); + HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); -done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D__bt2_idx_iterate_cb() */ @@ -1219,11 +1199,10 @@ H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(chunk_udata); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) { + if(NULL == idx_info->storage->u.btree2.bt2) /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") - } /* end if */ /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1234,7 +1213,7 @@ H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, /* Iterate over the records in the v2 B-tree */ if((ret_value = H5B2_iterate(bt2, idx_info->dxpl_id, H5D__bt2_idx_iterate_cb, &udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over v2 B-tree for dataset chunks"); + HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk v2 B-tree"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1311,11 +1290,10 @@ H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *u HDassert(udata); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) { + if(NULL == idx_info->storage->u.btree2.bt2) /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") - } /* end if */ /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1461,10 +1439,9 @@ H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); /* Check if the source v2 B-tree is open yet */ - if(NULL == idx_info_src->storage->u.btree2.bt2) { + if(NULL == idx_info_src->storage->u.btree2.bt2) if(H5D__bt2_idx_open(idx_info_src) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") - } /* end if */ /* Set copied metadata tag */ H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL); @@ -1561,6 +1538,7 @@ H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) /* Get v2 B-tree size for indexing chunked dataset */ if(H5B2_size(bt2_cdset, idx_info->dxpl_id, index_size) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve v2 B-tree storage info for chunked dataset") + done: /* Close v2 B-tree index */ if(bt2_cdset && H5B2_close(bt2_cdset, idx_info->dxpl_id) < 0) diff --git a/src/H5Dearray.c b/src/H5Dearray.c index a3659f6..27c6b26 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -735,7 +735,7 @@ H5D__earray_dst_dbg_context(void *_dbg_ctx) static herr_t H5D__earray_idx_depend(const H5D_chk_idx_info_t *idx_info) { - H5O_loc_t oloc; /* Temporary object header location for dataset */ + H5O_loc_t oloc; /* Temporary object header location for dataset */ H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ @@ -792,7 +792,7 @@ done: static herr_t H5D__earray_idx_undepend(const H5D_chk_idx_info_t *idx_info) { - H5O_loc_t oloc; /* Temporary object header location for dataset */ + H5O_loc_t oloc; /* Temporary object header location for dataset */ H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1057,17 +1057,12 @@ done: static hbool_t H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { - hbool_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); - /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(storage->idx_addr); - - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) } /* end H5D__earray_idx_is_space_alloc() */ @@ -1114,6 +1109,7 @@ H5D__earray_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t * if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32") + /* Check for filters on chunks */ if(idx_info->pline->nused > 0) { H5D_earray_filt_elmt_t elmt; /* Extensible array element */ @@ -1124,11 +1120,12 @@ H5D__earray_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t * /* Set the info for the chunk */ if(H5EA_set(ea, idx_info->dxpl_id, udata->chunk_idx, &elmt) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") - } else { + } /* end if */ + else { /* Set the address for the chunk */ if(H5EA_set(ea, idx_info->dxpl_id, udata->chunk_idx, &udata->chunk_block.offset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1245,14 +1242,13 @@ done: static herr_t H5D__earray_idx_resize(H5O_layout_chunk_t *layout) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check args */ HDassert(layout); - /* "Swizzle" constant dimensions for this dataset */ if(layout->u.earray.unlim_dim > 0) { hsize_t swizzled_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of # of chunks in each dimension */ diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index aba077d..8ae4af5 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -736,7 +736,7 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, static herr_t H5D__farray_idx_depend(const H5D_chk_idx_info_t *idx_info) { - H5O_loc_t oloc; /* Temporary object header location for dataset */ + H5O_loc_t oloc; /* Temporary object header location for dataset */ H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ @@ -792,7 +792,7 @@ done: static herr_t H5D__farray_idx_undepend(const H5D_chk_idx_info_t *idx_info) { - H5O_loc_t oloc; /* Temporary object header location for dataset */ + H5O_loc_t oloc; /* Temporary object header location for dataset */ H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1006,17 +1006,12 @@ done: static hbool_t H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { - hbool_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); - /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(storage->idx_addr); - - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) } /* end H5D__farray_idx_is_space_alloc() */ diff --git a/src/H5Dnone.c b/src/H5Dnone.c index f30b5c0..0cadac2 100644 --- a/src/H5Dnone.c +++ b/src/H5Dnone.c @@ -48,10 +48,12 @@ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ + /********************/ /* Local Prototypes */ /********************/ @@ -59,19 +61,20 @@ /* Non Index chunking I/O ops */ static herr_t H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info); static hbool_t H5D__none_idx_is_space_alloc(const H5O_storage_chunk_t *storage); -static herr_t H5D_none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); -static int H5D_none_idx_iterate(const H5D_chk_idx_info_t *idx_info, +static int H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata); -static herr_t H5D_none_idx_remove(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D__none_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata); -static herr_t H5D_none_idx_delete(const H5D_chk_idx_info_t *idx_info); -static herr_t H5D_none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, +static herr_t H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info); +static herr_t H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst); -static herr_t H5D_none_idx_size(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D__none_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); -static herr_t H5D_none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); -static herr_t H5D_none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); +static herr_t H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); +static herr_t H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); + /*********************/ /* Package Variables */ @@ -84,19 +87,20 @@ const H5D_chunk_ops_t H5D_COPS_NONE[1] = {{ H5D__none_idx_create, /* create */ H5D__none_idx_is_space_alloc, /* is_space_alloc */ NULL, /* insert */ - H5D_none_idx_get_addr, /* get_addr */ + H5D__none_idx_get_addr, /* get_addr */ NULL, /* resize */ - H5D_none_idx_iterate, /* iterate */ - H5D_none_idx_remove, /* remove */ - H5D_none_idx_delete, /* delete */ - H5D_none_idx_copy_setup, /* copy_setup */ + H5D__none_idx_iterate, /* iterate */ + H5D__none_idx_remove, /* remove */ + H5D__none_idx_delete, /* delete */ + H5D__none_idx_copy_setup, /* copy_setup */ NULL, /* copy_shutdown */ - H5D_none_idx_size, /* size */ - H5D_none_idx_reset, /* reset */ - H5D_none_idx_dump, /* dump */ + H5D__none_idx_size, /* size */ + H5D__none_idx_reset, /* reset */ + H5D__none_idx_dump, /* dump */ NULL /* dest */ }}; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -106,6 +110,7 @@ const H5D_chunk_ops_t H5D_COPS_NONE[1] = {{ /* Local Variables */ /*******************/ + /*------------------------------------------------------------------------- * Function: H5D__none_idx_create @@ -178,7 +183,7 @@ H5D__none_idx_is_space_alloc(const H5O_storage_chunk_t *storage) /*------------------------------------------------------------------------- - * Function: H5D_none_idx_get_addr + * Function: H5D__none_idx_get_addr * * Purpose: Get the file address of a chunk. * Save the retrieved information in the udata supplied. @@ -190,10 +195,11 @@ H5D__none_idx_is_space_alloc(const H5O_storage_chunk_t *storage) *------------------------------------------------------------------------- */ static herr_t -H5D_none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) +H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->pline); @@ -214,11 +220,11 @@ H5D_none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) udata->filter_mask = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5D_none_idx_get_addr() */ +} /* H5D__none_idx_get_addr() */ /*------------------------------------------------------------------------- - * Function: H5D_none_idx_iterate + * Function: H5D__none_idx_iterate * * Purpose: Iterate over the chunks in an index, making a callback * for each one. @@ -230,7 +236,7 @@ H5D_none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) *------------------------------------------------------------------------- */ static int -H5D_none_idx_iterate(const H5D_chk_idx_info_t *idx_info, +H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata) { H5D_chunk_rec_t chunk_rec; /* generic chunk record */ @@ -238,10 +244,11 @@ H5D_none_idx_iterate(const H5D_chk_idx_info_t *idx_info, unsigned u; /* Local index variable */ int curr_dim; /* Current rank */ hsize_t idx; /* Array index of chunk */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->pline); @@ -290,11 +297,11 @@ H5D_none_idx_iterate(const H5D_chk_idx_info_t *idx_info, } /* end for */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_none_idx_iterate() */ +} /* end H5D__none_idx_iterate() */ /*------------------------------------------------------------------------- - * Function: H5D_none_idx_remove + * Function: H5D__none_idx_remove * * Purpose: Remove chunk from index. * @@ -309,18 +316,18 @@ H5D_none_idx_iterate(const H5D_chk_idx_info_t *idx_info, *------------------------------------------------------------------------- */ static herr_t -H5D_none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata) +H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* NO OP */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5D_none_idx_remove() */ +} /* H5D__none_idx_remove() */ /*------------------------------------------------------------------------- - * Function: H5D_none_idx_delete + * Function: H5D__none_idx_delete * * Purpose: Delete raw data storage for entire dataset (i.e. all chunks) * @@ -332,13 +339,14 @@ H5D_none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, H5D_chunk *------------------------------------------------------------------------- */ static herr_t -H5D_none_idx_delete(const H5D_chk_idx_info_t *idx_info) +H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info) { hsize_t nbytes; /* Size of all chunks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->pline); @@ -356,11 +364,11 @@ H5D_none_idx_delete(const H5D_chk_idx_info_t *idx_info) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_none_idx_delete() */ +} /* end H5D__none_idx_delete() */ /*------------------------------------------------------------------------- - * Function: H5D_none_idx_copy_setup + * Function: H5D__none_idx_copy_setup * * Purpose: Set up any necessary information for copying chunks * @@ -371,12 +379,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, +H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(idx_info_src); @@ -406,11 +414,11 @@ H5D_none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_none_idx_copy_setup() */ +} /* end H5D__none_idx_copy_setup() */ /*------------------------------------------------------------------------- - * Function: H5D_none_idx_size + * Function: H5D__none_idx_size * * Purpose: Retrieve the amount of index storage for chunked dataset * @@ -422,9 +430,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_none_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *index_size) +H5D__none_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *index_size) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(index_size); @@ -432,11 +440,11 @@ H5D_none_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *in *index_size = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5D_none_idx_size() */ +} /* end H5D__none_idx_size() */ /*------------------------------------------------------------------------- - * Function: H5D_none_idx_reset + * Function: H5D__none_idx_reset * * Purpose: Reset indexing information. * @@ -447,9 +455,9 @@ H5D_none_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *in *------------------------------------------------------------------------- */ static herr_t -H5D_none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) +H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); @@ -459,11 +467,11 @@ H5D_none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) storage->idx_addr = HADDR_UNDEF; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5D_none_idx_reset() */ +} /* end H5D__none_idx_reset() */ /*------------------------------------------------------------------------- - * Function: H5D_none_idx_dump + * Function: H5D__none_idx_dump * * Purpose: Dump * @@ -474,9 +482,9 @@ H5D_none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) *------------------------------------------------------------------------- */ static herr_t -H5D_none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) +H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); @@ -485,5 +493,5 @@ H5D_none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDfprintf(stream, " Address: %a\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5D_none_idx_dump() */ +} /* end H5D__none_idx_dump() */ diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c index 10db2a0..b49a578 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -46,10 +46,12 @@ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ + /********************/ /* Local Prototypes */ /********************/ @@ -58,22 +60,23 @@ static herr_t H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, haddr_t dset_ohdr_addr); static herr_t H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info); -static hbool_t H5D_single_idx_is_space_alloc(const H5O_storage_chunk_t *storage); -static herr_t H5D_single_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, +static hbool_t H5D__single_idx_is_space_alloc(const H5O_storage_chunk_t *storage); +static herr_t H5D__single_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, const H5D_t *dset); -static herr_t H5D_single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata); -static int H5D_single_idx_iterate(const H5D_chk_idx_info_t *idx_info, +static int H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata); -static herr_t H5D_single_idx_remove(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata); -static herr_t H5D_single_idx_delete(const H5D_chk_idx_info_t *idx_info); -static herr_t H5D_single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, +static herr_t H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info); +static herr_t H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst); -static herr_t H5D_single_idx_size(const H5D_chk_idx_info_t *idx_info, +static herr_t H5D__single_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); -static herr_t H5D_single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); -static herr_t H5D_single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); +static herr_t H5D__single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); +static herr_t H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); + /*********************/ /* Package Variables */ @@ -84,21 +87,22 @@ const H5D_chunk_ops_t H5D_COPS_SINGLE[1] = {{ FALSE, /* Single Chunk indexing doesn't current support SWMR access */ H5D__single_idx_init, /* init */ H5D__single_idx_create, /* create */ - H5D_single_idx_is_space_alloc, /* is_space_alloc */ - H5D_single_idx_insert_addr, /* insert */ - H5D_single_idx_get_addr, /* get_addr */ + H5D__single_idx_is_space_alloc, /* is_space_alloc */ + H5D__single_idx_insert_addr, /* insert */ + H5D__single_idx_get_addr, /* get_addr */ NULL, /* resize */ - H5D_single_idx_iterate, /* iterate */ - H5D_single_idx_remove, /* remove */ - H5D_single_idx_delete, /* delete */ - H5D_single_idx_copy_setup, /* copy_setup */ + H5D__single_idx_iterate, /* iterate */ + H5D__single_idx_remove, /* remove */ + H5D__single_idx_delete, /* delete */ + H5D__single_idx_copy_setup, /* copy_setup */ NULL, /* copy_shutdown */ - H5D_single_idx_size, /* size */ - H5D_single_idx_reset, /* reset */ - H5D_single_idx_dump, /* dump */ + H5D__single_idx_size, /* size */ + H5D__single_idx_reset, /* reset */ + H5D__single_idx_dump, /* dump */ NULL /* destroy */ }}; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -181,7 +185,7 @@ H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info) /*------------------------------------------------------------------------- - * Function: H5D_single_idx_is_space_alloc + * Function: H5D__single_idx_is_space_alloc * * Purpose: Query if space is allocated for the single chunk * @@ -192,24 +196,19 @@ H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info) *------------------------------------------------------------------------- */ static hbool_t -H5D_single_idx_is_space_alloc(const H5O_storage_chunk_t *storage) +H5D__single_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { - hbool_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); - /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(storage->idx_addr); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_single_idx_is_space_alloc() */ + FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) +} /* end H5D__single_idx_is_space_alloc() */ /*------------------------------------------------------------------------- - * Function: H5D_single_idx_insert_addr + * Function: H5D__single_idx_insert_addr * * Purpose: Allocate space for the single chunk * @@ -220,13 +219,14 @@ H5D_single_idx_is_space_alloc(const H5O_storage_chunk_t *storage) *------------------------------------------------------------------------- */ static herr_t -H5D_single_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, +H5D__single_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, const H5D_t *dset) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->pline); @@ -241,7 +241,7 @@ H5D_single_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *u idx_info->storage->idx_addr = udata->chunk_block.offset; if(idx_info->pline->nused > 0) { - idx_info->storage->u.single.nbytes = udata->chunk_block.length; + H5_CHECKED_ASSIGN(idx_info->storage->u.single.nbytes, uint32_t, udata->chunk_block.length, hsize_t); idx_info->storage->u.single.filter_mask = udata->filter_mask; } /* end if */ @@ -255,11 +255,11 @@ H5D_single_idx_insert_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *u done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_single_idx_insert_addr() */ +} /* H5D__single_idx_insert_addr() */ /*------------------------------------------------------------------------- - * Function: H5D_single_idx_get_addr + * Function: H5D__single_idx_get_addr * * Purpose: Get the file address of a chunk. * Save the retrieved information in the udata supplied. @@ -271,10 +271,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) +H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->pline); @@ -288,19 +289,20 @@ H5D_single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat if(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { udata->chunk_block.length = idx_info->storage->u.single.nbytes; udata->filter_mask = idx_info->storage->u.single.filter_mask; - } else { + } /* end if */ + else { udata->chunk_block.length = idx_info->layout->size; udata->filter_mask = 0; - } + } /* end else */ if(!H5F_addr_defined(udata->chunk_block.offset)) udata->chunk_block.length = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5D_single_idx_get_addr() */ +} /* H5D__single_idx_get_addr() */ /*------------------------------------------------------------------------- - * Function: H5D_single_idx_iterate + * Function: H5D__single_idx_iterate * * Purpose: Make callback for the single chunk * @@ -311,14 +313,15 @@ H5D_single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat *------------------------------------------------------------------------- */ static int -H5D_single_idx_iterate(const H5D_chk_idx_info_t *idx_info, +H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata) { - H5D_chunk_rec_t chunk_rec; /* generic chunk record */ - int ret_value; /* Return value */ + H5D_chunk_rec_t chunk_rec; /* generic chunk record */ + int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->pline); @@ -335,21 +338,22 @@ H5D_single_idx_iterate(const H5D_chk_idx_info_t *idx_info, if(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { chunk_rec.nbytes = idx_info->storage->u.single.nbytes; chunk_rec.filter_mask = idx_info->storage->u.single.filter_mask; - } else { + } /* end if */ + else { chunk_rec.nbytes = idx_info->layout->size; chunk_rec.filter_mask = 0; - } + } /* end else */ /* Make "generic chunk" callback */ if((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0) HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_single_idx_iterate() */ +} /* end H5D__single_idx_iterate() */ /*------------------------------------------------------------------------- - * Function: H5D_single_idx_remove + * Function: H5D__single_idx_remove * * Purpose: Remove the single chunk * @@ -360,13 +364,14 @@ H5D_single_idx_iterate(const H5D_chk_idx_info_t *idx_info, *------------------------------------------------------------------------- */ static herr_t -H5D_single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata) +H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata) { hsize_t nbytes; /* Size of all chunks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->pline); @@ -386,11 +391,11 @@ H5D_single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_single_idx_remove() */ +} /* H5D__single_idx_remove() */ /*------------------------------------------------------------------------- - * Function: H5D_single_idx_delete + * Function: H5D__single_idx_delete * * Purpose: Delete raw data storage for entire dataset (i.e. the only chunk) * @@ -402,29 +407,30 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_single_idx_delete(const H5D_chk_idx_info_t *idx_info) +H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(idx_info); HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); HDassert(idx_info->storage); - if(H5F_addr_defined(idx_info->storage->idx_addr)) { - ret_value = H5D_single_idx_remove(idx_info, NULL); - } else + if(H5F_addr_defined(idx_info->storage->idx_addr)) + ret_value = H5D__single_idx_remove(idx_info, NULL); + else HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_single_idx_delete() */ +} /* end H5D__single_idx_delete() */ /*------------------------------------------------------------------------- - * Function: H5D_single_idx_copy_setup + * Function: H5D__single_idx_copy_setup * * Purpose: Set up any necessary information for copying the single chunk * @@ -435,12 +441,12 @@ H5D_single_idx_delete(const H5D_chk_idx_info_t *idx_info) *------------------------------------------------------------------------- */ static herr_t -H5D_single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, +H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(idx_info_src); @@ -468,11 +474,11 @@ H5D_single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_single_idx_copy_setup() */ +} /* end H5D__single_idx_copy_setup() */ /*------------------------------------------------------------------------- - * Function: H5D_single_idx_size + * Function: H5D__single_idx_size * * Purpose: Retrieve the amount of index storage for the chunked dataset * @@ -484,9 +490,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_single_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *index_size) +H5D__single_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *index_size) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(index_size); @@ -494,11 +500,11 @@ H5D_single_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t * *index_size = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5D_single_idx_size() */ +} /* end H5D__single_idx_size() */ /*------------------------------------------------------------------------- - * Function: H5D_single_idx_reset + * Function: H5D__single_idx_reset * * Purpose: Reset indexing information. * @@ -509,9 +515,9 @@ H5D_single_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t * *------------------------------------------------------------------------- */ static herr_t -H5D_single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) +H5D__single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); @@ -521,11 +527,11 @@ H5D_single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) storage->idx_addr = HADDR_UNDEF; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5D_single_idx_reset() */ +} /* end H5D__single_idx_reset() */ /*------------------------------------------------------------------------- - * Function: H5D_single_idx_dump + * Function: H5D__single_idx_dump * * Purpose: Dump the address of the single chunk * @@ -536,9 +542,9 @@ H5D_single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) *------------------------------------------------------------------------- */ static herr_t -H5D_single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) +H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(storage); @@ -547,5 +553,5 @@ H5D_single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDfprintf(stream, " Address: %a\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5D_single_idx_dump() */ +} /* end H5D__single_idx_dump() */ |