diff options
author | David Young <dyoung@hdfgroup.org> | 2020-01-29 16:47:30 (GMT) |
---|---|---|
committer | Larry Knox <lrknox@hdfgroup.org> | 2020-05-05 17:05:24 (GMT) |
commit | c61a2a024875eba5adce53394ddc25c7fb6920b9 (patch) | |
tree | 584e97a4175eb45f32c29869d025093f596eab6f /src | |
parent | 52931310e24bcdd43927d4c2e249094cc11c4839 (diff) | |
download | hdf5-c61a2a024875eba5adce53394ddc25c7fb6920b9.zip hdf5-c61a2a024875eba5adce53394ddc25c7fb6920b9.tar.gz hdf5-c61a2a024875eba5adce53394ddc25c7fb6920b9.tar.bz2 |
Reduce casts of HDcalloc()/HDmalloc() that -Wc++-compat required.
Reduce gratuitous casts---e.g., (size_t)1.
Use the right format string for a pointer.
In the H5C sanity checks, change a "size increase" variable from ssize_t
(too narrow) to int64_t (wide enough).
Parenthesize every appearance of `storage` in the macro
`H5D_CHUNK_STORAGE_INDEX_CHK(storage)` so that you can pass in an
expression like &sc and it works properly.
Disallow re-assignment of the `dset` parameter to H5D__chunk_init()
because it helped assure me that it's safe to replace the repeating
expression `&dset->shared->layout.storage.u.chunk` with `sc` throughout.
Replace lengthy expressions such as
`&dset->shared->layout.storage.u.chunk` with `sc` throughout several
functions in H5Dchunk.c ISTR that the compiler warned that `sc` was
declared but unused in a couple of functions, and then I found that `sc`
could be used in many places. Maybe the disused `sc` appeared because a
bunch of code was copied and pasted, I don't know. Anyway, it's a lot
tighter code now that I use `sc`.
In H5D__chunk_update_old_edge_chunks() and H5D__chunk_delete()
I actually expand `sc` and another temporary variable, `pline`,
because they're used only in !defined(NDEBUG) code. This squashes
unused-variable warnings in the defined(NDEBUG) configuration.
Don't drop the `volatile` qualification with a cast in
tools/src/h5import/h5import.c.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5B.c | 6 | ||||
-rw-r--r-- | src/H5Cdbg.c | 5 | ||||
-rw-r--r-- | src/H5Cpkg.h | 2 | ||||
-rw-r--r-- | src/H5Dchunk.c | 104 | ||||
-rw-r--r-- | src/H5FDdirect.c | 16 | ||||
-rw-r--r-- | src/H5Fsuper_cache.c | 14 |
6 files changed, 70 insertions, 77 deletions
@@ -2019,7 +2019,6 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) { H5B_t *bt = NULL; /* The B-tree */ H5UC_t *rc_shared; /* Ref-counted shared info */ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ htri_t ret_value = SUCCEED; /* Return value */ @@ -2036,9 +2035,8 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, NULL))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") - shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HDassert(H5UC_GET_OBJ(rc_shared) != NULL); /* * Load the tree node. diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index 1f55e86..cb1d0e2 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -319,9 +319,8 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) (int)(entry_ptr->is_dirty), entry_ptr->type->name); - HDfprintf(stdout, " node_ptr = 0x%llx, item = %p\n", - (unsigned long long)node_ptr, - H5SL_item(node_ptr)); + HDfprintf(stdout, " node_ptr = %p, item = %p\n", + node_ptr, H5SL_item(node_ptr)); /* increment node_ptr before we delete its target */ node_ptr = H5SL_next(node_ptr); diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 9156c0d..b8648f0 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -4694,7 +4694,7 @@ struct H5C_t { uint32_t num_last_entries; #if H5C_DO_SANITY_CHECKS int32_t slist_len_increase; - ssize_t slist_size_increase; + int64_t slist_size_increase; #endif /* H5C_DO_SANITY_CHECKS */ /* Fields for maintaining list of tagged entries */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 2c3b9a2..2d48d10 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -74,12 +74,12 @@ /* Sanity check on chunk index types: commonly used by a lot of routines in this file */ #define H5D_CHUNK_STORAGE_INDEX_CHK(storage) \ - HDassert((H5D_CHUNK_IDX_EARRAY == storage->idx_type && H5D_COPS_EARRAY == storage->ops) || \ - (H5D_CHUNK_IDX_FARRAY == storage->idx_type && H5D_COPS_FARRAY == storage->ops) || \ - (H5D_CHUNK_IDX_BT2 == storage->idx_type && H5D_COPS_BT2 == storage->ops) || \ - (H5D_CHUNK_IDX_BTREE == storage->idx_type && H5D_COPS_BTREE == storage->ops) || \ - (H5D_CHUNK_IDX_SINGLE == storage->idx_type && H5D_COPS_SINGLE == storage->ops) || \ - (H5D_CHUNK_IDX_NONE == storage->idx_type && H5D_COPS_NONE == storage->ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == (storage)->idx_type && H5D_COPS_EARRAY == (storage)->ops) || \ + (H5D_CHUNK_IDX_FARRAY == (storage)->idx_type && H5D_COPS_FARRAY == (storage)->ops) || \ + (H5D_CHUNK_IDX_BT2 == (storage)->idx_type && H5D_COPS_BT2 == (storage)->ops) || \ + (H5D_CHUNK_IDX_BTREE == (storage)->idx_type && H5D_COPS_BTREE == (storage)->ops) || \ + (H5D_CHUNK_IDX_SINGLE == (storage)->idx_type && H5D_COPS_SINGLE == (storage)->ops) || \ + (H5D_CHUNK_IDX_NONE == (storage)->idx_type && H5D_COPS_NONE == (storage)->ops)); /* * Feature: If this constant is defined then every cache preemption and load @@ -925,7 +925,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) +H5D__chunk_init(H5F_t *f, const H5D_t * const dset, hid_t dapl_id) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Convenience pointer to dataset's chunk cache */ @@ -1001,11 +1001,11 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) idx_info.f = f; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; + idx_info.storage = sc; /* Allocate any indexing structures */ - if(dset->shared->layout.storage.u.chunk.ops->init && (dset->shared->layout.storage.u.chunk.ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") + if(sc->ops->init && (sc->ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") /* Set the number of chunks in dataset, etc. */ if(H5D__chunk_set_info(dset) < 0) @@ -1041,7 +1041,7 @@ H5D__chunk_is_space_alloc(const H5O_storage_t *storage) H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Query index layer */ - ret_value = (storage->u.chunk.ops->is_space_alloc)(&storage->u.chunk); + ret_value = (sc->ops->is_space_alloc)(sc); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_is_space_alloc() */ @@ -2632,12 +2632,11 @@ H5D__chunk_dest(H5D_t *dset) idx_info.f = dset->oloc.file; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; + idx_info.storage = sc; /* Free any index structures */ - if(dset->shared->layout.storage.u.chunk.ops->dest && - (dset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + if(sc->ops->dest && (sc->ops->dest)(&idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -2833,11 +2832,11 @@ H5D__chunk_create(const H5D_t *dset /*in,out*/) idx_info.f = dset->oloc.file; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; + idx_info.storage = sc; /* Create the index for the chunks */ - if((dset->shared->layout.storage.u.chunk.ops->create)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") + if((sc->ops->create)(&idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2920,7 +2919,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, /* Initialize the query information about the chunk we are looking for */ udata->common.layout = &(dset->shared->layout.u.chunk); - udata->common.storage = &(dset->shared->layout.storage.u.chunk); + udata->common.storage = sc; udata->common.scaled = scaled; /* Reset information about the chunk we are looking for */ @@ -2970,7 +2969,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, idx_info.f = dset->oloc.file; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; + idx_info.storage = sc; #ifdef H5_HAVE_PARALLEL /* Disable collective metadata read for chunk indexes as it is @@ -2982,7 +2981,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, #endif /* H5_HAVE_PARALLEL */ /* Go get the chunk information */ - if((dset->shared->layout.storage.u.chunk.ops->get_addr)(&idx_info, udata) < 0) + if((sc->ops->get_addr)(&idx_info, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") /* @@ -3068,7 +3067,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) /* Set up user data for index callbacks */ udata.common.layout = &dset->shared->layout.u.chunk; - udata.common.storage = &dset->shared->layout.storage.u.chunk; + udata.common.storage = sc; udata.common.scaled = ent->scaled; udata.chunk_block.offset = ent->chunk_block.offset; udata.chunk_block.length = dset->shared->layout.u.chunk.size; @@ -3153,7 +3152,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) idx_info.f = dset->oloc.file; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; + idx_info.storage = sc; /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. @@ -3173,8 +3172,8 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ - if(need_insert && dset->shared->layout.storage.u.chunk.ops->insert) - if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, dset) < 0) + if(need_insert && sc->ops->insert) + if((sc->ops->insert)(&idx_info, &udata, dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") /* Cache the chunk's info, in case it's accessed again shortly */ @@ -3984,10 +3983,10 @@ H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes) idx_info.f = dset->oloc.file; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; + idx_info.storage = sc; /* Iterate over the chunks */ - if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_allocated_cb, &chunk_bytes) < 0) + if((sc->ops->iterate)(&idx_info, H5D__chunk_allocated_cb, &chunk_bytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index") /* Set number of bytes for caller */ @@ -4186,7 +4185,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ idx_info.f = dset->oloc.file; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; + idx_info.storage = sc; /* Loop over all chunks */ /* The algorithm is: @@ -4257,8 +4256,9 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") #ifndef NDEBUG /* None of the chunks should be allocated */ - if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) - HDassert(!H5F_addr_defined(udata.chunk_block.offset)); + if(H5D_CHUNK_IDX_NONE != sc->idx_type) { + HDassert(!H5F_addr_defined(udata.chunk_block.offset)); + } /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -4330,7 +4330,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ /* Initialize the chunk information */ udata.common.layout = &layout->u.chunk; - udata.common.storage = &layout->storage.u.chunk; + udata.common.storage = sc; udata.common.scaled = scaled; udata.chunk_block.offset = HADDR_UNDEF; H5_CHECKED_ASSIGN(udata.chunk_block.length, uint32_t, chunk_size, size_t); @@ -4480,7 +4480,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) hsize_t max_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* largest offset of chunks that might need to be modified in each dimension */ hbool_t new_full_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of chunks in this dimension needs to be modified */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ - const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */ hsize_t chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */ const uint32_t *chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */ unsigned space_ndims; /* Dataset's space rank */ @@ -4491,7 +4490,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) H5D_storage_t chk_store; /* Chunk storage information */ void *chunk; /* The file chunk */ hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */ - const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -4499,8 +4497,8 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - H5D_CHUNK_STORAGE_INDEX_CHK(sc); - HDassert(pline->nused > 0); + H5D_CHUNK_STORAGE_INDEX_CHK(&layout->storage.u.chunk); + HDassert(dset->shared->dcpl_cache.pline.nused > 0); HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); @@ -5142,7 +5140,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) /* Initialize the user data for the iteration */ HDmemset(&udata, 0, sizeof udata); udata.common.layout = &layout->u.chunk; - udata.common.storage = &layout->storage.u.chunk; + udata.common.storage = sc; udata.common.scaled = scaled; udata.io_info = &chk_io_info; udata.idx_info = &idx_info; @@ -5155,7 +5153,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) /* Initialize user data for removal */ idx_udata.layout = &layout->u.chunk; - idx_udata.storage = &layout->storage.u.chunk; + idx_udata.storage = sc; /* Determine if partial edge chunk filters are disabled */ disable_edge_filters = (layout->u.chunk.flags @@ -5312,7 +5310,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) idx_udata.scaled = udata.common.scaled; /* Remove the chunk from disk */ - if((layout->storage.u.chunk.ops->remove)(&idx_info, &idx_udata) < 0) + if((sc->ops->remove)(&idx_info, &idx_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry from index") } /* end if */ } /* end else */ @@ -5443,17 +5441,17 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) /* Set up user data for B-tree callback */ HDmemset(&udata, 0, sizeof(udata)); udata.common.layout = &dset->shared->layout.u.chunk; - udata.common.storage = &dset->shared->layout.storage.u.chunk; + udata.common.storage = sc; udata.chunk_addr = chunk_addr; /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; + idx_info.storage = sc; /* Iterate over chunks to build mapping of chunk addresses */ - if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_addrmap_cb, &udata) < 0) + if((sc->ops->iterate)(&idx_info, H5D__chunk_addrmap_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to iterate over chunk index to build address map") done: @@ -5484,7 +5482,6 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage) H5O_pline_t pline; /* I/O pipeline message */ hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read from the file */ htri_t exists; /* Flag if header message of interest exists */ - H5O_storage_chunk_t *sc = &(storage->u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -5493,7 +5490,7 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage) HDassert(f); HDassert(oh); HDassert(storage); - H5D_CHUNK_STORAGE_INDEX_CHK(sc); + H5D_CHUNK_STORAGE_INDEX_CHK(&storage->u.chunk); /* Check for I/O pipeline message */ if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0) @@ -6229,26 +6226,25 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, idx_info.f = loc->file; idx_info.pline = &pline; idx_info.layout = &layout->u.chunk; - idx_info.storage = &layout->storage.u.chunk; + idx_info.storage = sc; /* Get the dataspace for the dataset */ if(NULL == (space = H5S_read(loc))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") /* Allocate any indexing structures */ - if(layout->storage.u.chunk.ops->init && (layout->storage.u.chunk.ops->init)(&idx_info, space, loc->addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") + if(sc->ops->init && (sc->ops->init)(&idx_info, space, loc->addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") idx_info_init = TRUE; /* Get size of index structure */ - if(layout->storage.u.chunk.ops->size && (layout->storage.u.chunk.ops->size)(&idx_info, index_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info") + if(sc->ops->size && (sc->ops->size)(&idx_info, index_size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info") done: /* Free resources, if they've been initialized */ - if(idx_info_init && layout->storage.u.chunk.ops->dest && - (layout->storage.u.chunk.ops->dest)(&idx_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + if(idx_info_init && sc->ops->dest && (sc->ops->dest)(&idx_info) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") if(pline_read && H5O_msg_reset(H5O_PLINE_ID, &pline) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message") if(space && H5S_close(space) < 0) @@ -6335,14 +6331,14 @@ H5D__chunk_dump_index(H5D_t *dset, FILE *stream) H5D_chunk_it_ud4_t udata; /* User data for callback */ /* Display info for index */ - if((dset->shared->layout.storage.u.chunk.ops->dump)(&dset->shared->layout.storage.u.chunk, stream) < 0) + if((sc->ops->dump)(sc, stream) < 0) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info") /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; + idx_info.storage = sc; /* Set up user data for callback */ udata.stream = stream; @@ -6351,7 +6347,7 @@ H5D__chunk_dump_index(H5D_t *dset, FILE *stream) udata.chunk_dim = dset->shared->layout.u.chunk.dim; /* Iterate over index and dump chunk info */ - if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_dump_index_cb, &udata) < 0) + if((sc->ops->iterate)(&idx_info, H5D__chunk_dump_index_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to dump chunk info") } /* end if */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 4a41403..564b44d 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -461,8 +461,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd #endif h5_stat_t sb; H5P_genplist_t *plist; /* Property list */ - int *buf1, *buf2; - H5FD_t *ret_value; + void *buf1, *buf2; + H5FD_t *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT @@ -527,13 +527,13 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd /* NOTE: Use HDmalloc and HDfree here to ensure compatibility with * HDposix_memalign. */ - buf1 = (int *)HDmalloc(sizeof(int)); + buf1 = HDmalloc(sizeof(int)); if(HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") if(o_flags & O_CREAT) { - if(HDwrite(file->fd, (void*)buf1, sizeof(int))<0) { - if(HDwrite(file->fd, (void*)buf2, file->fa.fbsize)<0) + if(HDwrite(file->fd, buf1, sizeof(int))<0) { + if(HDwrite(file->fd, buf2, file->fa.fbsize)<0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, NULL, "file system may not support Direct I/O") else file->fa.must_align = TRUE; @@ -542,8 +542,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd HDftruncate(file->fd, (HDoff_t)0); } } else { - if(HDread(file->fd, (void*)buf1, sizeof(int))<0) { - if(HDread(file->fd, (void*)buf2, file->fa.fbsize)<0) + if(HDread(file->fd, buf1, sizeof(int))<0) { + if(HDread(file->fd, buf2, file->fa.fbsize)<0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "file system may not support Direct I/O") else file->fa.must_align = TRUE; @@ -551,7 +551,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd if(o_flags & O_RDWR) { if(HDlseek(file->fd, (HDoff_t)0, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, NULL, "unable to seek to proper position") - if(HDwrite(file->fd, (void *)buf1, sizeof(int))<0) + if(HDwrite(file->fd, buf1, sizeof(int))<0) file->fa.must_align = TRUE; else file->fa.must_align = FALSE; diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 76866db..05438fa 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -348,7 +348,7 @@ static herr_t H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len, void *_udata, size_t *actual_len) { - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ H5F_super_t sblock; /* Temporary file superblock */ htri_t ret_value = SUCCEED; /* Return value */ @@ -394,7 +394,7 @@ done: static htri_t H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata) { - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ @@ -440,7 +440,7 @@ H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata, { H5F_super_t *sblock = NULL; /* File's superblock */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_super_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -665,7 +665,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU void *_thing) { H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the object */ - uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint8_t *image = _image; /* Pointer into raw data buffer */ haddr_t rel_eof; /* Relative EOF for file */ herr_t ret_value = SUCCEED; /* Return value */ @@ -871,7 +871,7 @@ static herr_t H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len, void *_udata, size_t *actual_len) { - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */ H5O_drvinfo_t drvrinfo; /* Driver info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -917,7 +917,7 @@ H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata, { H5O_drvinfo_t *drvinfo = NULL; /* Driver info */ H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */ - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ char drv_name[9]; /* Name of driver */ H5O_drvinfo_t *ret_value = NULL; /* Return value */ @@ -1011,7 +1011,7 @@ H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thing) { H5O_drvinfo_t *drvinfo = (H5O_drvinfo_t *)_thing; /* Pointer to the object */ - uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint8_t *image = _image; /* Pointer into raw data buffer */ uint8_t *dbuf; /* Pointer to beginning of driver info */ herr_t ret_value = SUCCEED; /* Return value */ |