summaryrefslogtreecommitdiffstats
path: root/src/H5Dchunk.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-04-26 18:18:18 (GMT)
committerGitHub <noreply@github.com>2022-04-26 18:18:18 (GMT)
commitd7565f316de2516f119e464e6450c4f8c73476b2 (patch)
treefcec98687ef88e0c8f5a1b377d48f5349fdae356 /src/H5Dchunk.c
parent417ee1393b425d5c7c998562e7fb492e28928643 (diff)
downloadhdf5-d7565f316de2516f119e464e6450c4f8c73476b2.zip
hdf5-d7565f316de2516f119e464e6450c4f8c73476b2.tar.gz
hdf5-d7565f316de2516f119e464e6450c4f8c73476b2.tar.bz2
Address some warnings from casting away of const (#1684)
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r--src/H5Dchunk.c67
1 files changed, 31 insertions, 36 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index eac48a9..1d4b215 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -1143,8 +1143,7 @@ done:
fm->mem_space = NULL;
if (file_space_normalized == TRUE)
- if (H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) <
- 0) /* (Casting away const OK -QAK) */
+ if (H5S_hyper_denormalize_offset(file_space, old_offset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1371,15 +1370,16 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
+H5D__chunk_mem_alloc(size_t size, void *pline)
{
- void *ret_value = NULL; /* Return value */
+ H5O_pline_t *_pline = (H5O_pline_t *)pline;
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
HDassert(size);
- if (pline && pline->nused)
+ if (_pline && _pline->nused)
ret_value = H5MM_malloc(size);
else
ret_value = H5FL_BLK_MALLOC(chunk, size);
@@ -1402,14 +1402,14 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
*-------------------------------------------------------------------------
*/
void *
-H5D__chunk_mem_xfree(void *chk, const void *_pline)
+H5D__chunk_mem_xfree(void *chk, const void *pline)
{
- const H5O_pline_t *pline = (const H5O_pline_t *)_pline;
+ const H5O_pline_t *_pline = (const H5O_pline_t *)pline;
FUNC_ENTER_PACKAGE_NOERR
if (chk) {
- if (pline && pline->nused)
+ if (_pline && _pline->nused)
H5MM_xfree(chk);
else
chk = H5FL_BLK_FREE(chunk, chk);
@@ -1426,9 +1426,9 @@ H5D__chunk_mem_xfree(void *chk, const void *_pline)
*-------------------------------------------------------------------------
*/
void
-H5D__chunk_mem_free(void *chk, const void *_pline)
+H5D__chunk_mem_free(void *chk, void *pline)
{
- (void)H5D__chunk_mem_xfree(chk, _pline);
+ (void)H5D__chunk_mem_xfree(chk, pline);
}
/*-------------------------------------------------------------------------
@@ -1580,8 +1580,7 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
chunk_info->fspace_shared = TRUE;
/* Just point at the memory dataspace & selection */
- /* (Casting away const OK -QAK) */
- chunk_info->mspace = (H5S_t *)fm->mem_space;
+ chunk_info->mspace = fm->mem_space;
/* Indicate that the chunk's memory dataspace is shared */
chunk_info->mspace_shared = TRUE;
@@ -1856,7 +1855,6 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Iterate through each chunk in the dataset */
while (sel_points) {
/* Check for intersection of current chunk and file selection */
- /* (Casting away const OK - QAK) */
if (TRUE == H5S_SELECT_INTERSECT_BLOCK(fm->file_space, coords, end)) {
H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */
hsize_t chunk_points; /* Number of elements in chunk selection */
@@ -2015,8 +2013,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
HDassert(chunk_info);
/* Just point at the memory dataspace & selection */
- /* (Casting away const OK -QAK) */
- chunk_info->mspace = (H5S_t *)fm->mem_space;
+ chunk_info->mspace = fm->mem_space;
/* Indicate that the chunk's memory space is shared */
chunk_info->mspace_shared = TRUE;
@@ -2138,8 +2135,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
HDassert(chunk_info);
/* Just point at the memory dataspace & selection */
- /* (Casting away const OK -QAK) */
- chunk_info->mspace = (H5S_t *)fm->mem_space;
+ chunk_info->mspace = fm->mem_space;
/* Indicate that the chunk's memory space is shared */
chunk_info->mspace_shared = TRUE;
@@ -4104,11 +4100,11 @@ done:
static void *
H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk)
{
- const H5D_t * dset = io_info->dset; /* Local pointer to the dataset info */
- const H5O_pline_t *pline =
+ const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */
+ H5O_pline_t *pline =
&(dset->shared->dcpl_cache
.pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_mem_alloc */
- const H5O_pline_t * old_pline = pline; /* Old pipeline, i.e. pipeline used to read the chunk */
+ H5O_pline_t * old_pline = pline; /* Old pipeline, i.e. pipeline used to read the chunk */
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */
const H5O_fill_t * fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
@@ -4688,18 +4684,18 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const
coordinates) */
hsize_t max_unalloc[H5O_LAYOUT_NDIMS]; /* Last chunk in each dimension that is unallocated (in scaled
coordinates) */
- hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Offset of current chunk (in scaled coordinates) */
- size_t orig_chunk_size; /* Original size of chunk in bytes */
- size_t chunk_size; /* Actual size of chunk in bytes, possibly filtered */
- unsigned filter_mask = 0; /* Filter mask for chunks that have them */
- H5O_layout_t * layout = &(dset->shared->layout); /* Dataset layout */
- const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
- const H5O_pline_t def_pline = H5O_CRT_PIPELINE_DEF; /* Default pipeline */
- const H5O_fill_t * fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
- H5D_fill_value_t fill_status; /* The fill value status */
- hbool_t should_fill = FALSE; /* Whether fill values should be written */
- void * unfilt_fill_buf = NULL; /* Unfiltered fill value buffer */
- void ** fill_buf = NULL; /* Pointer to the fill buffer to use for a chunk */
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Offset of current chunk (in scaled coordinates) */
+ size_t orig_chunk_size; /* Original size of chunk in bytes */
+ size_t chunk_size; /* Actual size of chunk in bytes, possibly filtered */
+ unsigned filter_mask = 0; /* Filter mask for chunks that have them */
+ H5O_layout_t * layout = &(dset->shared->layout); /* Dataset layout */
+ H5O_pline_t * pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */
+ H5O_pline_t def_pline = H5O_CRT_PIPELINE_DEF; /* Default pipeline */
+ const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */
+ H5D_fill_value_t fill_status; /* The fill value status */
+ hbool_t should_fill = FALSE; /* Whether fill values should be written */
+ void * unfilt_fill_buf = NULL; /* Unfiltered fill value buffer */
+ void ** fill_buf = NULL; /* Pointer to the fill buffer to use for a chunk */
#ifdef H5_HAVE_PARALLEL
hbool_t blocks_written = FALSE; /* Flag to indicate that chunk was actually written */
hbool_t using_mpi =
@@ -4804,10 +4800,9 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const
if (should_fill) {
/* Initialize the fill value buffer */
/* (delay allocating fill buffer for VL datatypes until refilling) */
- /* (casting away const OK - QAK) */
- if (H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, (void *)pline,
- (H5MM_free_t)H5D__chunk_mem_free, (void *)pline, &dset->shared->dcpl_cache.fill,
- dset->shared->type, dset->shared->type_id, (size_t)0, orig_chunk_size) < 0)
+ if (H5D__fill_init(&fb_info, NULL, H5D__chunk_mem_alloc, pline, H5D__chunk_mem_free, pline,
+ &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id,
+ (size_t)0, orig_chunk_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
fb_info_init = TRUE;