summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Bdbg.c10
-rw-r--r--src/H5C.c32
-rw-r--r--src/H5Cimage.c5
-rw-r--r--src/H5Dchunk.c84
-rw-r--r--src/H5Dcompact.c7
-rw-r--r--src/H5Dcontig.c38
-rw-r--r--src/H5Defl.c28
-rw-r--r--src/H5Dfill.c2
-rw-r--r--src/H5Dint.c10
-rw-r--r--src/H5Dio.c32
-rw-r--r--src/H5Dmpio.c36
-rw-r--r--src/H5Dpkg.h55
-rw-r--r--src/H5Dprivate.h2
-rw-r--r--src/H5Dscatgath.c4
-rw-r--r--src/H5Dselect.c16
-rw-r--r--src/H5Dvirtual.c49
-rw-r--r--src/H5FD.c6
-rw-r--r--src/H5Gent.c5
-rw-r--r--src/H5Gint.c2
-rw-r--r--src/H5Gloc.c22
-rw-r--r--src/H5Gpkg.h4
-rw-r--r--src/H5Gprivate.h2
-rw-r--r--src/H5Idbg.c8
-rw-r--r--src/H5S.c4
-rw-r--r--src/H5Sall.c34
-rw-r--r--src/H5Shyper.c69
-rw-r--r--src/H5Smpio.c93
-rw-r--r--src/H5Snone.c34
-rw-r--r--src/H5Spkg.h18
-rw-r--r--src/H5Spoint.c34
-rw-r--r--src/H5Sprivate.h66
-rw-r--r--src/H5Sselect.c78
-rw-r--r--src/H5T.c2
-rw-r--r--src/H5Tconv.c4
-rw-r--r--src/H5Tpkg.h2
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--src/H5Tref.c4
-rw-r--r--src/H5Tvlen.c16
-rw-r--r--src/H5VLnative_dataset.c16
39 files changed, 481 insertions, 454 deletions
diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c
index 23d0a8f..de07442 100644
--- a/src/H5Bdbg.c
+++ b/src/H5Bdbg.c
@@ -110,20 +110,20 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5
*/
for (u = 0; u < bt->nchildren; u++) {
HDfprintf(stream, "%*sChild %d...\n", indent, "", u);
- HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3),
+ HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(3, fwidth) - 3,
"Address:", bt->child[u]);
/* If there is a key debugging routine, use it to display the left & right keys */
if (type->debug_key) {
/* Decode the 'left' key & print it */
- HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Left Key:");
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(3, fwidth) - 3, "Left Key:");
HDassert(H5B_NKEY(bt, shared, u));
- (void)(type->debug_key)(stream, indent + 6, MAX(0, fwidth - 6), H5B_NKEY(bt, shared, u), udata);
+ (void)(type->debug_key)(stream, indent + 6, MAX(6, fwidth) - 6, H5B_NKEY(bt, shared, u), udata);
/* Decode the 'right' key & print it */
- HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Right Key:");
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(3, fwidth) - 3, "Right Key:");
HDassert(H5B_NKEY(bt, shared, u + 1));
- (void)(type->debug_key)(stream, indent + 6, MAX(0, fwidth - 6), H5B_NKEY(bt, shared, u + 1),
+ (void)(type->debug_key)(stream, indent + 6, MAX(6, fwidth) - 6, H5B_NKEY(bt, shared, u + 1),
udata);
} /* end if */
} /* end for */
diff --git a/src/H5C.c b/src/H5C.c
index 490db81..b0ebf70 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -4669,10 +4669,11 @@ H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t *cache_ptr)
cache_ptr->epoch_marker_ringbuf_first =
(cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
+ if (cache_ptr->epoch_marker_ringbuf_size <= 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+
cache_ptr->epoch_marker_ringbuf_size -= 1;
- if (cache_ptr->epoch_marker_ringbuf_size < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
if ((cache_ptr->epoch_marker_active)[i] != TRUE)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
@@ -4692,11 +4693,11 @@ H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t *cache_ptr)
(cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
- cache_ptr->epoch_marker_ringbuf_size += 1;
-
- if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS)
+ if (cache_ptr->epoch_marker_ringbuf_size >= H5C__MAX_EPOCH_MARKERS)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
+ cache_ptr->epoch_marker_ringbuf_size += 1;
+
H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr,
(cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL))
done:
@@ -4967,13 +4968,13 @@ H5C__autoadjust__ageout__insert_new_marker(H5C_t *cache_ptr)
(cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i;
- cache_ptr->epoch_marker_ringbuf_size += 1;
-
- if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS) {
+ if (cache_ptr->epoch_marker_ringbuf_size >= H5C__MAX_EPOCH_MARKERS) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow")
}
+ cache_ptr->epoch_marker_ringbuf_size += 1;
+
H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr,
(cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL))
@@ -5021,11 +5022,11 @@ H5C__autoadjust__ageout__remove_all_markers(H5C_t *cache_ptr)
cache_ptr->epoch_marker_ringbuf_first =
(cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
- cache_ptr->epoch_marker_ringbuf_size -= 1;
-
- if (cache_ptr->epoch_marker_ringbuf_size < 0)
+ if (cache_ptr->epoch_marker_ringbuf_size <= 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+ cache_ptr->epoch_marker_ringbuf_size -= 1;
+
if ((cache_ptr->epoch_marker_active)[i] != TRUE)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
@@ -5094,10 +5095,11 @@ H5C__autoadjust__ageout__remove_excess_markers(H5C_t *cache_ptr)
cache_ptr->epoch_marker_ringbuf_first =
(cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1);
+ if (cache_ptr->epoch_marker_ringbuf_size <= 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
+
cache_ptr->epoch_marker_ringbuf_size -= 1;
- if (cache_ptr->epoch_marker_ringbuf_size < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow")
if ((cache_ptr->epoch_marker_active)[i] != TRUE)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?")
@@ -5525,8 +5527,8 @@ H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags)
hbool_t restart_slist_scan;
uint32_t protected_entries = 0;
int32_t i;
- int32_t cur_ring_pel_len;
- int32_t old_ring_pel_len;
+ uint32_t cur_ring_pel_len;
+ uint32_t old_ring_pel_len;
unsigned cooked_flags;
unsigned evict_flags;
H5SL_node_t * node_ptr = NULL;
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index 98c1291..691cbe3 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -2690,10 +2690,11 @@ H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr)
*/
if (entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID) {
image_entries[u].type_id = entry_ptr->prefetch_type_id;
- image_entries[u].age = entry_ptr->age + 1;
- if (image_entries[u].age > H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX)
+ if (entry_ptr->age >= H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX)
image_entries[u].age = H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX;
+ else
+ image_entries[u].age = entry_ptr->age + 1;
} /* end if */
else {
image_entries[u].type_id = entry_ptr->type->id;
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index ef1a447..69cdd78 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -257,14 +257,13 @@ typedef struct H5D_chunk_coll_fill_info_t {
static herr_t H5D__chunk_construct(H5F_t *f, H5D_t *dset);
static herr_t H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
static herr_t H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *fm);
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
static herr_t H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5D_chunk_map_t *fm);
static herr_t H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+ H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
static herr_t H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+ H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
static herr_t H5D__chunk_flush(H5D_t *dset);
static herr_t H5D__chunk_io_term(const H5D_chunk_map_t *fm);
static herr_t H5D__chunk_dest(H5D_t *dset);
@@ -1061,7 +1060,7 @@ H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset)
*/
static herr_t
H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm)
+ H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm)
{
const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */
@@ -1092,7 +1091,7 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
* speed up hyperslab calculations by removing the extra checks and/or
* additions involving the offset and the hyperslab selection -QAK)
*/
- if ((file_space_normalized = H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)) < 0)
+ if ((file_space_normalized = H5S_hyper_normalize_offset(file_space, old_offset)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to normalize selection")
/* Decide the number of chunks in each dimension */
@@ -1129,8 +1128,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)
@@ -1357,15 +1355,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_STATIC_NOERR
HDassert(size);
- if (pline && pline->nused)
+ if (_pline && _pline->nused)
ret_value = H5MM_malloc(size);
else
ret_value = H5FL_BLK_MALLOC(chunk, size);
@@ -1388,14 +1387,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_STATIC_NOERR
if (chk) {
- if (pline && pline->nused)
+ if (_pline && _pline->nused)
H5MM_xfree(chk);
else
chk = H5FL_BLK_FREE(chunk, chk);
@@ -1412,9 +1411,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);
}
/*-------------------------------------------------------------------------
@@ -1566,8 +1565,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;
@@ -1842,7 +1840,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 */
@@ -2001,8 +1998,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;
@@ -2124,8 +2120,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;
@@ -2467,8 +2462,7 @@ done:
*/
static herr_t
H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t H5_ATTR_UNUSED nelmts,
- const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
- H5D_chunk_map_t *fm)
+ H5S_t H5_ATTR_UNUSED *file_space, H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
{
H5SL_node_t * chunk_node; /* Current node in chunk skip list */
H5D_io_info_t nonexistent_io_info; /* "nonexistent" I/O info object */
@@ -2618,8 +2612,7 @@ done:
*/
static herr_t
H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t H5_ATTR_UNUSED nelmts,
- const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
- H5D_chunk_map_t *fm)
+ H5S_t H5_ATTR_UNUSED *file_space, H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
{
H5SL_node_t * chunk_node; /* Current node in chunk skip list */
H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
@@ -3716,11 +3709,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 */
@@ -4300,18 +4293,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 */
- const 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 =
@@ -4416,10 +4409,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;
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index b786936..4a2d545 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -55,8 +55,7 @@
static herr_t H5D__compact_construct(H5F_t *f, H5D_t *dset);
static hbool_t H5D__compact_is_space_alloc(const H5O_storage_t *storage);
static herr_t H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *cm);
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm);
static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]);
@@ -239,8 +238,8 @@ H5D__compact_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
*/
static herr_t
H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
- const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
+ hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space,
+ H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
{
FUNC_ENTER_STATIC_NOERR
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 9f41d6f..0cbe469 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -91,8 +91,7 @@ typedef struct H5D_contig_writevv_ud_t {
static herr_t H5D__contig_construct(H5F_t *f, H5D_t *dset);
static herr_t H5D__contig_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
static herr_t H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
- H5D_chunk_map_t *cm);
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm);
static ssize_t H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
@@ -109,13 +108,24 @@ static herr_t H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, size
/*********************/
/* Contiguous storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {
- {H5D__contig_construct, H5D__contig_init, H5D__contig_is_space_alloc, H5D__contig_is_data_cached,
- H5D__contig_io_init, H5D__contig_read, H5D__contig_write,
+const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{
+ H5D__contig_construct, /* construct */
+ H5D__contig_init, /* init */
+ H5D__contig_is_space_alloc, /* is_space_alloc */
+ H5D__contig_is_data_cached, /* is_data_cached */
+ H5D__contig_io_init, /* io_init */
+ H5D__contig_read, /* ser_read */
+ H5D__contig_write, /* ser_write */
#ifdef H5_HAVE_PARALLEL
- H5D__contig_collective_read, H5D__contig_collective_write,
-#endif /* H5_HAVE_PARALLEL */
- H5D__contig_readvv, H5D__contig_writevv, H5D__contig_flush, NULL, NULL}};
+ H5D__contig_collective_read, /* par_read */
+ H5D__contig_collective_write, /* par_write */
+#endif
+ H5D__contig_readvv, /* readvv */
+ H5D__contig_writevv, /* writevv */
+ H5D__contig_flush, /* flush */
+ NULL, /* io_term */
+ NULL /* dest */
+}};
/*******************/
/* Local Variables */
@@ -557,8 +567,8 @@ H5D__contig_is_data_cached(const H5D_shared_t *shared_dset)
*/
static herr_t
H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
- const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
+ hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space,
+ H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
{
FUNC_ENTER_STATIC_NOERR
@@ -581,8 +591,8 @@ H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_
*-------------------------------------------------------------------------
*/
herr_t
-H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space,
+ H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
herr_t ret_value = SUCCEED; /*return value */
@@ -616,8 +626,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space,
+ H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
herr_t ret_value = SUCCEED; /*return value */
diff --git a/src/H5Defl.c b/src/H5Defl.c
index 85c9dba..a30955b 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -62,7 +62,7 @@ typedef struct H5D_efl_writevv_ud_t {
/* Layout operation callbacks */
static herr_t H5D__efl_construct(H5F_t *f, H5D_t *dset);
static herr_t H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm);
+ H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm);
static ssize_t H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
@@ -80,12 +80,24 @@ static herr_t H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t ad
/*********************/
/* External File List (EFL) storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{H5D__efl_construct, NULL, H5D__efl_is_space_alloc, NULL,
- H5D__efl_io_init, H5D__contig_read, H5D__contig_write,
+const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{
+ H5D__efl_construct, /* construct */
+ NULL, /* init */
+ H5D__efl_is_space_alloc, /* is_space_alloc */
+ NULL, /* is_data_cached */
+ H5D__efl_io_init, /* io_init */
+ H5D__contig_read, /* ser_read */
+ H5D__contig_write, /* ser_write */
#ifdef H5_HAVE_PARALLEL
- NULL, NULL,
-#endif /* H5_HAVE_PARALLEL */
- H5D__efl_readvv, H5D__efl_writevv, NULL, NULL, NULL}};
+ NULL, /* par_read */
+ NULL, /* par_write */
+#endif
+ H5D__efl_readvv, /* readvv */
+ H5D__efl_writevv, /* writevv */
+ NULL, /* flush */
+ NULL, /* io_term */
+ NULL /* dest */
+}};
/*******************/
/* Local Variables */
@@ -198,8 +210,8 @@ H5D__efl_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
*/
static herr_t
H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
- const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
+ hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space,
+ H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
{
FUNC_ENTER_STATIC_NOERR
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index b7ecdc9..d6d88f0 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -164,7 +164,7 @@ done:
on each element so that each of them has a copy of the VL data.
--------------------------------------------------------------------------*/
herr_t
-H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_type, const H5S_t *space)
+H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_type, H5S_t *space)
{
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 53b691e..3e416d9 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -75,7 +75,7 @@ typedef struct {
/* General stuff */
static H5D_shared_t *H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type);
-static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
+static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type);
static herr_t H5D__cache_dataspace_info(const H5D_t *dset);
static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id);
@@ -534,7 +534,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
+H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type)
{
htri_t relocatable; /* Flag whether the type is relocatable */
htri_t immutable; /* Flag whether the type is immutable */
@@ -590,8 +590,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
/* Use existing datatype */
dset->shared->type_id = type_id;
- dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */
- } /* end else */
+ dset->shared->type = type;
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2238,7 +2238,7 @@ H5D_oloc(H5D_t *dataset)
*-------------------------------------------------------------------------
*/
H5G_name_t *
-H5D_nameof(const H5D_t *dataset)
+H5D_nameof(H5D_t *dataset)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 9f220c6..8ae0528 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -361,8 +361,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
- void *buf /*out*/)
+H5D__read(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space, void *buf /*out*/)
{
H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
H5D_io_info_t io_info; /* Dataset I/O info */
@@ -457,21 +456,21 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t
*/
if (TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
- const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
- /* to the beginning of the projected mem space. */
+ ptrdiff_t buf_adj = 0;
/* Attempt to construct projected dataspace for memory dataspace */
if (H5S_select_construct_projection(mem_space, &projected_mem_space,
- (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, &adj_buf,
- type_info.dst_type_size) < 0)
+ (unsigned)H5S_GET_EXTENT_NDIMS(file_space),
+ type_info.dst_type_size, &buf_adj) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to construct projected memory dataspace")
HDassert(projected_mem_space);
- HDassert(adj_buf);
+
+ /* Adjust the buffer by the given amount */
+ buf = (void *)(((uint8_t *)buf) + buf_adj);
/* Switch to using projected memory dataspace & adjusted buffer */
mem_space = projected_mem_space;
- buf = (void *)adj_buf; /* Casting away 'const' OK -QAK */
- } /* end if */
+ } /* end if */
/* Retrieve dataset properties */
/* <none needed in the general case> */
@@ -577,8 +576,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
- const void *buf)
+H5D__write(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space, const void *buf)
{
H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
H5D_io_info_t io_info; /* Dataset I/O info */
@@ -696,20 +694,20 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_
*/
if (TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
- const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
- /* to the beginning of the projected mem space. */
+ ptrdiff_t buf_adj = 0;
/* Attempt to construct projected dataspace for memory dataspace */
if (H5S_select_construct_projection(mem_space, &projected_mem_space,
- (unsigned)H5S_GET_EXTENT_NDIMS(file_space), buf, &adj_buf,
- type_info.src_type_size) < 0)
+ (unsigned)H5S_GET_EXTENT_NDIMS(file_space),
+ type_info.src_type_size, &buf_adj) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to construct projected memory dataspace")
HDassert(projected_mem_space);
- HDassert(adj_buf);
+
+ /* Adjust the buffer by the given amount */
+ buf = (const void *)(((const uint8_t *)buf) + buf_adj);
/* Switch to using projected memory dataspace & adjusted buffer */
mem_space = projected_mem_space;
- buf = adj_buf;
} /* end if */
/* Retrieve dataset properties */
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 7f018c4..1877f3d 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -302,7 +302,7 @@ static herr_t H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_ty
static herr_t H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5D_chunk_map_t *fm, int mpi_rank, int mpi_size);
static herr_t H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- const H5S_t *file_space, const H5S_t *mem_space);
+ H5S_t *file_space, H5S_t *mem_space);
static herr_t H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, MPI_Datatype mpi_file_type, MPI_Datatype mpi_buf_type);
static herr_t H5D__sort_chunk(H5D_io_info_t *io_info, const H5D_chunk_map_t *fm,
@@ -892,8 +892,8 @@ done:
*/
herr_t
H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t mpi_buf_count, const H5S_t H5_ATTR_UNUSED *file_space,
- const H5S_t H5_ATTR_UNUSED *mem_space)
+ hsize_t mpi_buf_count, H5S_t H5_ATTR_UNUSED *file_space,
+ H5S_t H5_ATTR_UNUSED *mem_space)
{
const H5D_contig_storage_t *store_contig =
&(io_info->store->contig); /* Contiguous storage info for this I/O operation */
@@ -923,8 +923,8 @@ done:
*/
herr_t
H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
- hsize_t mpi_buf_count, const H5S_t H5_ATTR_UNUSED *file_space,
- const H5S_t H5_ATTR_UNUSED *mem_space)
+ hsize_t mpi_buf_count, H5S_t H5_ATTR_UNUSED *file_space,
+ H5S_t H5_ATTR_UNUSED *mem_space)
{
const H5D_contig_storage_t *store_contig =
&(io_info->store->contig); /* Contiguous storage info for this I/O operation */
@@ -994,7 +994,7 @@ done:
*/
herr_t
H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ hsize_t H5_ATTR_UNUSED nelmts, H5S_t *file_space, H5S_t *mem_space,
H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_CONTIGUOUS_COLLECTIVE;
@@ -1033,7 +1033,7 @@ done:
*/
herr_t
H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ hsize_t H5_ATTR_UNUSED nelmts, H5S_t *file_space, H5S_t *mem_space,
H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_CONTIGUOUS_COLLECTIVE;
@@ -1262,8 +1262,8 @@ done:
*/
herr_t
H5D__chunk_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
- const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
+ hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space,
+ H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1292,8 +1292,8 @@ done:
*/
herr_t
H5D__chunk_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
- const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
+ hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space,
+ H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2372,8 +2372,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, const H5S_t *file_space,
- const H5S_t *mem_space)
+H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5S_t *file_space,
+ H5S_t *mem_space)
{
int mpi_buf_count; /* # of MPI types */
hbool_t mbt_is_derived = FALSE;
@@ -3467,8 +3467,9 @@ done:
static herr_t
H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chunk_list,
size_t *num_chunks_assigned_map, hbool_t all_ranks_involved,
- const H5D_io_info_t *io_info, const H5D_chunk_map_t *fm,
- int mpi_rank, int mpi_size)
+ const H5D_io_info_t * io_info,
+ const H5D_chunk_map_t H5_ATTR_NDEBUG_UNUSED *fm, int mpi_rank,
+ int mpi_size)
{
MPI_Datatype struct_type;
MPI_Datatype packed_type;
@@ -3797,7 +3798,8 @@ done:
static herr_t
H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk_list,
size_t *chunk_list_num_entries, H5D_io_info_t *io_info,
- const H5D_type_info_t *type_info, int mpi_rank, int mpi_size,
+ const H5D_type_info_t *type_info, int mpi_rank,
+ int H5_ATTR_NDEBUG_UNUSED mpi_size,
H5D_filtered_collective_io_info_t **chunk_hash_table,
unsigned char ***chunk_msg_bufs, int *chunk_msg_bufs_len)
{
@@ -4547,7 +4549,7 @@ H5D__mpio_collective_filtered_chunk_update(H5D_filtered_collective_io_info_t *ch
H5D_filtered_collective_io_info_t *chunk_hash_table,
unsigned char **chunk_msg_bufs, int chunk_msg_bufs_len,
const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- int mpi_rank, int mpi_size)
+ int H5_ATTR_NDEBUG_UNUSED mpi_rank, int mpi_size)
{
H5D_fill_buf_info_t fb_info;
H5D_chunk_info_t * chunk_info = NULL;
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 64692c5..8d99316 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -123,13 +123,12 @@ typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_storage_t *storage
typedef hbool_t (*H5D_layout_is_data_cached_func_t)(const H5D_shared_t *shared_dset);
typedef herr_t (*H5D_layout_io_init_func_t)(const struct H5D_io_info_t *io_info,
const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space,
- struct H5D_chunk_map_t *cm);
+ H5S_t *file_space, H5S_t *mem_space, struct H5D_chunk_map_t *cm);
typedef herr_t (*H5D_layout_read_func_t)(struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space,
struct H5D_chunk_map_t *fm);
typedef herr_t (*H5D_layout_write_func_t)(struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space,
struct H5D_chunk_map_t *fm);
typedef ssize_t (*H5D_layout_readvv_func_t)(const struct H5D_io_info_t *io_info, size_t dset_max_nseq,
size_t *dset_curr_seq, size_t dset_len_arr[],
@@ -170,10 +169,10 @@ typedef struct H5D_layout_ops_t {
/* Function pointers for either multiple or single block I/O access */
typedef herr_t (*H5D_io_single_read_func_t)(const struct H5D_io_info_t *io_info,
const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space);
+ H5S_t *file_space, H5S_t *mem_space);
typedef herr_t (*H5D_io_single_write_func_t)(const struct H5D_io_info_t *io_info,
const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space);
+ H5S_t *file_space, H5S_t *mem_space);
/* Typedef for raw data I/O framework info */
typedef struct H5D_io_ops_t {
@@ -346,10 +345,10 @@ typedef struct H5D_chunk_map_t {
H5O_layout_t *layout; /* Dataset layout information*/
hsize_t nelmts; /* Number of elements selected in file & memory dataspaces */
- const H5S_t *file_space; /* Pointer to the file dataspace */
- unsigned f_ndims; /* Number of dimensions for file dataspace */
+ H5S_t * file_space; /* Pointer to the file dataspace */
+ unsigned f_ndims; /* Number of dimensions for file dataspace */
- const H5S_t * mem_space; /* Pointer to the memory dataspace */
+ H5S_t * mem_space; /* Pointer to the memory dataspace */
H5S_t * mchunk_tmpl; /* Dataspace template for new memory chunks */
H5S_sel_iter_t mem_iter; /* Iterator for elements in memory selection */
unsigned m_ndims; /* Number of dimensions for memory dataspace */
@@ -581,29 +580,29 @@ H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset);
H5_DLL herr_t H5D__format_convert(H5D_t *dataset);
/* Internal I/O routines */
-H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
+H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space,
void *buf /*out*/);
-H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
+H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space,
const void *buf);
/* Functions that perform direct serial I/O operations */
H5_DLL herr_t H5D__select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space);
+ H5S_t *file_space, H5S_t *mem_space);
H5_DLL herr_t H5D__select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space);
/* Functions that perform direct copying between memory buffers */
-H5_DLL herr_t H5D_select_io_mem(void *dst_buf, const H5S_t *dst_space, const void *src_buf,
- const H5S_t *src_space, size_t elmt_size, size_t nelmts);
+H5_DLL herr_t H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *src_space,
+ size_t elmt_size, size_t nelmts);
/* Functions that perform scatter-gather serial I/O operations */
H5_DLL herr_t H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_buf);
H5_DLL size_t H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts,
void *_tgath_buf /*out*/);
H5_DLL herr_t H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space);
H5_DLL herr_t H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space);
/* Functions that operate on dataset's layout information */
H5_DLL herr_t H5D__layout_set_io_ops(const H5D_t *dataset);
@@ -621,9 +620,9 @@ H5_DLL hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage);
H5_DLL hbool_t H5D__contig_is_data_cached(const H5D_shared_t *shared_dset);
H5_DLL herr_t H5D__contig_fill(const H5D_io_info_t *io_info);
H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+ H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
H5_DLL herr_t H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+ H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
H5_DLL herr_t H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f_dst,
H5O_storage_contig_t *storage_dst, H5T_t *src_dtype, H5O_copy_t *cpy_info);
H5_DLL herr_t H5D__contig_delete(H5F_t *f, const H5O_storage_t *store);
@@ -640,8 +639,8 @@ H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_ov
const hsize_t old_dim[]);
H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk,
H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled);
-H5_DLL void * H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline);
-H5_DLL void H5D__chunk_mem_free(void *chk, const void *_pline);
+H5_DLL void * H5D__chunk_mem_alloc(size_t size, void *pline);
+H5_DLL void H5D__chunk_mem_free(void *chk, void *pline);
H5_DLL void * H5D__chunk_mem_xfree(void *chk, const void *pline);
H5_DLL void * H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline);
H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]);
@@ -696,7 +695,7 @@ H5_DLL herr_t H5D__efl_bh_info(H5F_t *f, H5O_efl_t *efl, hsize_t *heap_size);
/* Functions that perform fill value operations on datasets */
H5_DLL herr_t H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_type,
- const H5S_t *space);
+ H5S_t *space);
H5_DLL herr_t H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocate_t alloc_func,
void *alloc_info, H5MM_free_t free_func, void *free_info, const H5O_fill_t *fill,
const H5T_t *dset_type, hid_t dset_type_id, size_t nelmts, size_t min_buf_size);
@@ -712,26 +711,26 @@ H5_DLL herr_t H5D__fill_term(H5D_fill_buf_info_t *fb_info);
#endif /*H5D_DEBUG*/
/* MPI-IO function to read, it will select either regular or irregular read */
H5_DLL herr_t H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space);
/* MPI-IO function to write, it will select either regular or irregular read */
H5_DLL herr_t H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space);
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space);
/* MPI-IO functions to handle contiguous collective IO */
H5_DLL herr_t H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space,
H5D_chunk_map_t *fm);
H5_DLL herr_t H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space,
H5D_chunk_map_t *fm);
/* MPI-IO functions to handle chunked collective IO */
H5_DLL herr_t H5D__chunk_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space,
H5D_chunk_map_t *fm);
H5_DLL herr_t H5D__chunk_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
+ hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space,
H5D_chunk_map_t *fm);
/* MPI-IO function to check if a direct I/O transfer is possible between
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index f9ef772..0193ccb 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -163,7 +163,7 @@ H5_DLL herr_t H5D_close(H5D_t *dataset);
H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id);
H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset);
H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset);
-H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset);
+H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset);
H5_DLL herr_t H5D_flush_all(H5F_t *f);
H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset);
H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset);
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 1888adb..1ac5ada 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -437,7 +437,7 @@ done:
*/
herr_t
H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space)
+ H5S_t *file_space, H5S_t *mem_space)
{
void * buf = io_info->u.rbuf; /* Local pointer to application buffer */
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
@@ -577,7 +577,7 @@ done:
*/
herr_t
H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space)
+ H5S_t *file_space, H5S_t *mem_space)
{
const void * buf = io_info->u.wbuf; /* Local pointer to application buffer */
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index 4ca16ae..a5e73c2 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -44,8 +44,8 @@
/* Local Prototypes */
/********************/
-static herr_t H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space);
+static herr_t H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5S_t *file_space,
+ H5S_t *mem_space);
/*********************/
/* Package Variables */
@@ -77,8 +77,8 @@ H5FL_EXTERN(H5S_sel_iter_t);
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, const H5S_t *file_space,
- const H5S_t *mem_space)
+H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5S_t *file_space,
+ H5S_t *mem_space)
{
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
@@ -274,8 +274,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_select_io_mem(void *dst_buf, const H5S_t *dst_space, const void *src_buf, const H5S_t *src_space,
- size_t elmt_size, size_t nelmts)
+H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *src_space, size_t elmt_size,
+ size_t nelmts)
{
H5S_sel_iter_t *dst_sel_iter = NULL; /* Destination dataspace iteration info */
H5S_sel_iter_t *src_sel_iter = NULL; /* Source dataspace iteration info */
@@ -453,7 +453,7 @@ done:
*/
herr_t
H5D__select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space)
+ H5S_t *file_space, H5S_t *mem_space)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -482,7 +482,7 @@ done:
*/
herr_t
H5D__select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space)
+ H5S_t *file_space, H5S_t *mem_space)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 9ff3b06..2f60c16 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -84,9 +84,9 @@
/* Layout operation callbacks */
static hbool_t H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset);
static herr_t H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+ H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
static herr_t H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
+ H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
static herr_t H5D__virtual_flush(H5D_t *dset);
/* Other functions */
@@ -103,26 +103,37 @@ static herr_t H5D__virtual_build_source_name(char *
size_t static_strlen, size_t nsubs, hsize_t blockno,
char **built_name);
static herr_t H5D__virtual_init_all(const H5D_t *dset);
-static herr_t H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage,
- const H5S_t *file_space, const H5S_t *mem_space, hsize_t *tot_nelmts);
+static herr_t H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_t *file_space,
+ H5S_t *mem_space, hsize_t *tot_nelmts);
static herr_t H5D__virtual_post_io(H5O_storage_virtual_t *storage);
static herr_t H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- const H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset);
+ H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset);
static herr_t H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
- const H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset);
+ H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset);
/*********************/
/* Package Variables */
/*********************/
/* Contiguous storage layout I/O ops */
-const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{NULL, H5D__virtual_init, H5D__virtual_is_space_alloc,
- H5D__virtual_is_data_cached, NULL, H5D__virtual_read,
- H5D__virtual_write,
+const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{
+ NULL, /* construct */
+ H5D__virtual_init, /* init */
+ H5D__virtual_is_space_alloc, /* is_space_alloc */
+ H5D__virtual_is_data_cached, /* is_data_cached */
+ NULL, /* io_init */
+ H5D__virtual_read, /* ser_read */
+ H5D__virtual_write, /* ser_write */
#ifdef H5_HAVE_PARALLEL
- NULL, NULL,
-#endif /* H5_HAVE_PARALLEL */
- NULL, NULL, H5D__virtual_flush, NULL, NULL}};
+ NULL, /* par_read */
+ NULL, /* par_write */
+#endif
+ NULL, /* readvv */
+ NULL, /* writevv */
+ H5D__virtual_flush, /* flush */
+ NULL, /* io_term */
+ NULL /* dest */
+}};
/*******************/
/* Local Variables */
@@ -2377,8 +2388,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, const H5S_t *file_space,
- const H5S_t *mem_space, hsize_t *tot_nelmts)
+H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_t *file_space,
+ H5S_t *mem_space, hsize_t *tot_nelmts)
{
hssize_t select_nelmts; /* Number of elements in selection */
hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */
@@ -2688,7 +2699,7 @@ H5D__virtual_post_io(H5O_storage_virtual_t *storage)
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, const H5S_t *file_space,
+H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5S_t *file_space,
H5O_storage_virtual_srcdset_t *source_dset)
{
H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */
@@ -2748,8 +2759,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space,
+ H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
hsize_t tot_nelmts; /* Total number of elements mapped to mem_space */
@@ -2878,7 +2889,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, const H5S_t *file_space,
+H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5S_t *file_space,
H5O_storage_virtual_srcdset_t *source_dset)
{
H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */
@@ -2941,7 +2952,7 @@ done:
*/
static herr_t
H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
- const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
+ H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */
hsize_t tot_nelmts; /* Total number of elements mapped to mem_space */
diff --git a/src/H5FD.c b/src/H5FD.c
index 427057e..93438ad 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -1746,8 +1746,10 @@ H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver")
done:
- if (FAIL == ret_value)
- *file_handle = NULL;
+ if (FAIL == ret_value) {
+ if (file_handle)
+ *file_handle = NULL;
+ }
FUNC_LEAVE_API(ret_value)
} /* end H5FDget_vfd_handle() */
diff --git a/src/H5Gent.c b/src/H5Gent.c
index 2f1a2b4..2e06092 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -300,7 +300,7 @@ done:
*-------------------------------------------------------------------------
*/
void
-H5G__ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth)
+H5G__ent_copy(H5G_entry_t *dst, H5G_entry_t *src, H5_copy_depth_t depth)
{
FUNC_ENTER_PACKAGE_NOERR
@@ -318,8 +318,7 @@ H5G__ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth)
;
}
else if (depth == H5_COPY_SHALLOW) {
- /* Discarding 'const' qualifier OK - QAK */
- H5G__ent_reset((H5G_entry_t *)src);
+ H5G__ent_reset(src);
} /* end if */
FUNC_LEAVE_NOAPI_VOID
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 7488357..ce47aa4 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -562,7 +562,7 @@ H5G_oloc(H5G_t *grp)
*-------------------------------------------------------------------------
*/
H5G_name_t *
-H5G_nameof(const H5G_t *grp)
+H5G_nameof(H5G_t *grp)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 54c2cee..4f36328 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -562,8 +562,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type,
- const void *crt_info)
+H5G__loc_insert(H5G_loc_t *grp_loc, char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info)
{
H5O_link_t lnk; /* Link for object to insert */
herr_t ret_value = SUCCEED; /* Return value */
@@ -580,9 +579,8 @@ H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_ty
lnk.cset = H5F_DEFAULT_CSET;
lnk.corder = 0; /* Will be reset if the group is tracking creation order */
lnk.corder_valid = FALSE; /* Indicate that the creation order isn't valid (yet) */
- /* Casting away const OK -QAK */
- lnk.name = (char *)name;
- lnk.u.hard.addr = obj_loc->oloc->addr;
+ lnk.name = name;
+ lnk.u.hard.addr = obj_loc->oloc->addr;
/* Insert new group into current group's symbol table */
if (H5G_obj_insert(grp_loc->oloc, name, &lnk, TRUE, obj_type, crt_info) < 0)
@@ -911,10 +909,10 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_
const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/,
H5G_own_loc_t *own_loc /*out*/)
{
- H5G_loc_sc_t *udata = (H5G_loc_sc_t *)_udata; /* User data passed in */
- H5O_name_t comment; /* Object header "comment" message */
- htri_t exists; /* Whether a "comment" message already exists */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_sc_t *udata = (H5G_loc_sc_t *)_udata; /* User data passed in */
+ H5O_name_t comment = {0}; /* Object header "comment" message */
+ htri_t exists; /* Whether a "comment" message already exists */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -934,13 +932,15 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_
/* Add the new message */
if (udata->comment && *udata->comment) {
- /* Casting away const OK -QAK */
- comment.s = (char *)udata->comment;
+ if (NULL == (comment.s = HDstrdup(udata->comment)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy group comment")
if (H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message")
} /* end if */
done:
+ HDfree(comment.s);
+
/* Indicate that this callback didn't take ownership of the group *
* location for the object */
*own_loc = H5G_OWN_NONE;
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index b0adf30..795d3e1 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -374,7 +374,7 @@ H5_DLL herr_t H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab);
/*
* Functions that understand symbol table entries.
*/
-H5_DLL void H5G__ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth);
+H5_DLL void H5G__ent_copy(H5G_entry_t *dst, H5G_entry_t *src, H5_copy_depth_t depth);
H5_DLL void H5G__ent_reset(H5G_entry_t *ent);
H5_DLL herr_t H5G__ent_decode_vec(const H5F_t *f, const uint8_t **pp, const uint8_t *p_end, H5G_entry_t *ent,
unsigned n);
@@ -463,7 +463,7 @@ H5_DLL herr_t H5G__name_init(H5G_name_t *name, const char *path);
/*
* These functions operate on group "locations"
*/
-H5_DLL herr_t H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type,
+H5_DLL herr_t H5G__loc_insert(H5G_loc_t *grp_loc, char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type,
const void *crt_info);
H5_DLL herr_t H5G__loc_addr(const H5G_loc_t *loc, const char *name, haddr_t *addr /*out*/);
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 409d790..96b506c 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -191,7 +191,7 @@ typedef struct H5G_entry_t H5G_entry_t;
*/
H5_DLL herr_t H5G_init(void);
H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp);
-H5_DLL H5G_name_t *H5G_nameof(const H5G_t *grp);
+H5_DLL H5G_name_t *H5G_nameof(H5G_t *grp);
H5_DLL H5F_t *H5G_fileof(H5G_t *grp);
H5_DLL H5G_t * H5G_open(const H5G_loc_t *loc);
H5_DLL herr_t H5G_close(H5G_t *grp);
diff --git a/src/H5Idbg.c b/src/H5Idbg.c
index cf114d4..791b759 100644
--- a/src/H5Idbg.c
+++ b/src/H5Idbg.c
@@ -78,7 +78,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
H5I_id_info_t * info = (H5I_id_info_t *)_item; /* Pointer to the ID node */
H5I_type_t type = *(H5I_type_t *)_udata; /* User data */
const H5G_name_t *path = NULL; /* Path to file object */
- const void * object = NULL; /* Pointer to VOL connector object */
+ void * object = NULL; /* Pointer to VOL connector object */
FUNC_ENTER_STATIC_NOERR
@@ -94,7 +94,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
object = H5VL_object_data(vol_obj);
if (H5_VOL_NATIVE == vol_obj->connector->cls->value)
- path = H5G_nameof((const H5G_t *)object);
+ path = H5G_nameof(object);
break;
}
@@ -103,7 +103,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
object = H5VL_object_data(vol_obj);
if (H5_VOL_NATIVE == vol_obj->connector->cls->value)
- path = H5D_nameof((const H5D_t *)object);
+ path = H5D_nameof(object);
break;
}
@@ -114,7 +114,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
object = (void *)H5T_get_actual_type((H5T_t *)dt);
H5_GCC_DIAG_ON("cast-qual")
- path = H5T_nameof((const H5T_t *)object);
+ path = H5T_nameof(object);
break;
}
diff --git a/src/H5S.c b/src/H5S.c
index d74aaac..a201547 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -241,7 +241,7 @@ H5S_term_package(void)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space)
+H5S_get_validated_dataspace(hid_t space_id, H5S_t **space)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -258,7 +258,7 @@ H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space)
*space = NULL;
else {
/* Get the dataspace pointer */
- if (NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (*space = H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "space_id is not a dataspace ID")
/* Check for valid selection */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 35ddf3d..4dcc83a 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -49,22 +49,22 @@
static herr_t H5S__all_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
static herr_t H5S__all_release(H5S_t *space);
static htri_t H5S__all_is_valid(const H5S_t *space);
-static hssize_t H5S__all_serial_size(const H5S_t *space);
-static herr_t H5S__all_serialize(const H5S_t *space, uint8_t **p);
+static hssize_t H5S__all_serial_size(H5S_t *space);
+static herr_t H5S__all_serialize(H5S_t *space, uint8_t **p);
static herr_t H5S__all_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__all_offset(const H5S_t *space, hsize_t *off);
static int H5S__all_unlim_dim(const H5S_t *space);
static htri_t H5S__all_is_contiguous(const H5S_t *space);
static htri_t H5S__all_is_single(const H5S_t *space);
-static htri_t H5S__all_is_regular(const H5S_t *space);
-static htri_t H5S__all_shape_same(const H5S_t *space1, const H5S_t *space2);
-static htri_t H5S__all_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end);
+static htri_t H5S__all_is_regular(H5S_t *space);
+static htri_t H5S__all_shape_same(H5S_t *space1, H5S_t *space2);
+static htri_t H5S__all_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__all_adjust_s(H5S_t *space, const hssize_t *offset);
static herr_t H5S__all_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S__all_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
+static herr_t H5S__all_iter_init(H5S_t *space, H5S_sel_iter_t *iter);
/* Selection iteration callbacks */
static herr_t H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
@@ -144,7 +144,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__all_iter_init(const H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter)
+H5S__all_iter_init(H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter)
{
FUNC_ENTER_STATIC_NOERR
@@ -557,7 +557,7 @@ H5S__all_is_valid(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S__all_serial_size(const H5S_t H5_ATTR_UNUSED *space)
+H5S__all_serial_size(H5S_t H5_ATTR_UNUSED *space)
{
FUNC_ENTER_STATIC_NOERR
@@ -577,7 +577,7 @@ H5S__all_serial_size(const H5S_t H5_ATTR_UNUSED *space)
Serialize the current selection into a user-provided buffer.
USAGE
herr_t H5S__all_serialize(space, p)
- const H5S_t *space; IN: Dataspace with selection to serialize
+ H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
serialized selection.
@@ -592,7 +592,7 @@ H5S__all_serial_size(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__all_serialize(const H5S_t *space, uint8_t **p)
+H5S__all_serialize(H5S_t *space, uint8_t **p)
{
uint8_t *pp = (*p); /* Local pointer for decoding */
@@ -864,7 +864,7 @@ H5S__all_is_single(const H5S_t H5_ATTR_UNUSED *space)
Check if a "all" selection is "regular"
USAGE
htri_t H5S__all_is_regular(space)
- const H5S_t *space; IN: Dataspace pointer to check
+ H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
DESCRIPTION
@@ -877,7 +877,7 @@ H5S__all_is_single(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space)
+H5S__all_is_regular(H5S_t H5_ATTR_UNUSED *space)
{
FUNC_ENTER_STATIC_NOERR
@@ -894,8 +894,8 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space)
Check if a two "all" selections are the same shape
USAGE
htri_t H5S__all_shape_same(space1, space2)
- const H5S_t *space1; IN: First dataspace to check
- const H5S_t *space2; IN: Second dataspace to check
+ H5S_t *space1; IN: First dataspace to check
+ H5S_t *space2; IN: Second dataspace to check
RETURNS
TRUE / FALSE / FAIL
DESCRIPTION
@@ -907,7 +907,7 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S__all_shape_same(const H5S_t *space1, const H5S_t *space2)
+H5S__all_shape_same(H5S_t *space1, H5S_t *space2)
{
int space1_dim; /* Current dimension in first dataspace */
int space2_dim; /* Current dimension in second dataspace */
@@ -957,7 +957,7 @@ done:
Detect intersections of selection with block
USAGE
htri_t H5S__all_intersect_block(space, start, end)
- const H5S_t *space; IN: Dataspace with selection to use
+ H5S_t *space; IN: Dataspace with selection to use
const hsize_t *start; IN: Starting coordinate for block
const hsize_t *end; IN: Ending coordinate for block
RETURNS
@@ -970,7 +970,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S__all_intersect_block(const H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *start,
+H5S__all_intersect_block(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *start,
const hsize_t H5_ATTR_UNUSED *end)
{
FUNC_ENTER_STATIC_NOERR
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 70e9d54..cb64e08 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -160,7 +160,7 @@ static herr_t H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t max
static herr_t H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem,
size_t *nseq, size_t *nelem, hsize_t *off, size_t *len);
static herr_t H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata);
-static herr_t H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
+static herr_t H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t * ss_span_info,
const H5S_hyper_span_info_t *sis_span_info, hsize_t count,
unsigned depth, H5S_hyper_project_intersect_ud_t *udata);
static void H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count, hsize_t *block,
@@ -173,8 +173,8 @@ static herr_t H5S__hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_sele
static herr_t H5S__hyper_release(H5S_t *space);
static htri_t H5S__hyper_is_valid(const H5S_t *space);
static hsize_t H5S__hyper_span_nblocks(H5S_hyper_span_info_t *spans);
-static hssize_t H5S__hyper_serial_size(const H5S_t *space);
-static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p);
+static hssize_t H5S__hyper_serial_size(H5S_t *space);
+static herr_t H5S__hyper_serialize(H5S_t *space, uint8_t **p);
static herr_t H5S__hyper_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__hyper_offset(const H5S_t *space, hsize_t *offset);
@@ -182,14 +182,14 @@ static int H5S__hyper_unlim_dim(const H5S_t *space);
static herr_t H5S__hyper_num_elem_non_unlim(const H5S_t *space, hsize_t *num_elem_non_unlim);
static htri_t H5S__hyper_is_contiguous(const H5S_t *space);
static htri_t H5S__hyper_is_single(const H5S_t *space);
-static htri_t H5S__hyper_is_regular(const H5S_t *space);
-static htri_t H5S__hyper_shape_same(const H5S_t *space1, const H5S_t *space2);
-static htri_t H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end);
+static htri_t H5S__hyper_is_regular(H5S_t *space);
+static htri_t H5S__hyper_shape_same(H5S_t *space1, H5S_t *space2);
+static htri_t H5S__hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset);
static herr_t H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__hyper_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
+static herr_t H5S__hyper_iter_init(H5S_t *space, H5S_sel_iter_t *iter);
/* Selection iteration callbacks */
static herr_t H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
@@ -559,7 +559,7 @@ H5S__hyper_get_op_gen(void)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter)
+H5S__hyper_iter_init(H5S_t *space, H5S_sel_iter_t *iter)
{
hsize_t *slab_size; /* Pointer to the dataspace dimensions to use for calc. slab */
hsize_t acc; /* Accumulator for computing cumulative sizes */
@@ -586,7 +586,7 @@ H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter)
* to be impossible.
*/
if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
- H5S__hyper_rebuild((H5S_t *)space); /* Casting away const OK -NAF */
+ H5S__hyper_rebuild(space);
/* Check for the special case of just one H5Sselect_hyperslab call made */
if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
@@ -3575,7 +3575,7 @@ H5S__hyper_get_enc_size_real(hsize_t max_size)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_t *version, uint8_t *enc_size)
+H5S__hyper_get_version_enc_size(H5S_t *space, hsize_t block_count, uint32_t *version, uint8_t *enc_size)
{
hsize_t bounds_start[H5S_MAX_RANK]; /* Starting coordinate of bounding box */
hsize_t bounds_end[H5S_MAX_RANK]; /* Opposite coordinate of bounding box */
@@ -3728,7 +3728,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S__hyper_serial_size(const H5S_t *space)
+H5S__hyper_serial_size(H5S_t *space)
{
hsize_t block_count = 0; /* block counter for regular hyperslabs */
uint32_t version; /* Version number */
@@ -3928,7 +3928,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, hsize_t *start,
Serialize the current selection into a user-provided buffer.
USAGE
herr_t H5S__hyper_serialize(space, p)
- const H5S_t *space; IN: Dataspace with selection to serialize
+ H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
serialized selection.
@@ -3943,7 +3943,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, hsize_t *start,
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_serialize(const H5S_t *space, uint8_t **p)
+H5S__hyper_serialize(H5S_t *space, uint8_t **p)
{
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */
@@ -5326,7 +5326,7 @@ done:
Check if a hyperslab selection is "regular"
USAGE
htri_t H5S__hyper_is_regular(space)
- const H5S_t *space; IN: Dataspace pointer to check
+ H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
DESCRIPTION
@@ -5339,7 +5339,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S__hyper_is_regular(const H5S_t *space)
+H5S__hyper_is_regular(H5S_t *space)
{
htri_t ret_value = FAIL; /* return value */
@@ -5352,7 +5352,7 @@ H5S__hyper_is_regular(const H5S_t *space)
* to be impossible.
*/
if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
- H5S__hyper_rebuild((H5S_t *)space); /* Casting away const OK -NAF */
+ H5S__hyper_rebuild(space);
/* Only simple check for regular hyperslabs for now... */
if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES)
@@ -5576,8 +5576,8 @@ H5S__hyper_spans_shape_same(const H5S_hyper_span_info_t *span_info1, const H5S_h
Check if a two hyperslab selections are the same shape
USAGE
htri_t H5S__hyper_shape_same(space1, space2)
- const H5S_t *space1; IN: First dataspace to check
- const H5S_t *space2; IN: Second dataspace to check
+ H5S_t *space1; IN: First dataspace to check
+ H5S_t *space2; IN: Second dataspace to check
RETURNS
TRUE / FALSE / FAIL
DESCRIPTION
@@ -5594,7 +5594,7 @@ H5S__hyper_spans_shape_same(const H5S_hyper_span_info_t *span_info1, const H5S_h
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S__hyper_shape_same(const H5S_t *space1, const H5S_t *space2)
+H5S__hyper_shape_same(H5S_t *space1, H5S_t *space2)
{
unsigned space1_rank; /* Number of dimensions of first dataspace */
unsigned space2_rank; /* Number of dimensions of second dataspace */
@@ -5617,9 +5617,9 @@ H5S__hyper_shape_same(const H5S_t *space1, const H5S_t *space2)
/* Rebuild diminfo if it is invalid and has not been confirmed to be
* impossible */
if (space1->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
- H5S__hyper_rebuild((H5S_t *)space1); /* Casting away const OK -QAK */
+ H5S__hyper_rebuild(space1);
if (space2->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
- H5S__hyper_rebuild((H5S_t *)space2); /* Casting away const OK -QAK */
+ H5S__hyper_rebuild(space2);
/* If both are regular hyperslabs, compare their diminfo values */
if (space1->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES &&
@@ -5664,11 +5664,11 @@ H5S__hyper_shape_same(const H5S_t *space1, const H5S_t *space2)
/* Make certain that both selections have span trees */
if (NULL == space1->select.sel_info.hslab->span_lst)
- if (H5S__hyper_generate_spans((H5S_t *)space1) < 0) /* Casting away const OK -QAK */
+ if (H5S__hyper_generate_spans(space1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL,
"can't construct span tree for hyperslab selection")
if (NULL == space2->select.sel_info.hslab->span_lst)
- if (H5S__hyper_generate_spans((H5S_t *)space2) < 0) /* Casting away const OK -QAK */
+ if (H5S__hyper_generate_spans(space2) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL,
"can't construct span tree for hyperslab selection")
@@ -6255,7 +6255,7 @@ done:
Detect intersections of selection with block
USAGE
htri_t H5S__hyper_intersect_block(space, start, end)
- const H5S_t *space; IN: Dataspace with selection to use
+ H5S_t *space; IN: Dataspace with selection to use
const hsize_t *start; IN: Starting coordinate for block
const hsize_t *end; IN: Ending coordinate for block
RETURNS
@@ -6270,7 +6270,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end)
+H5S__hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end)
{
htri_t ret_value = FAIL; /* Return value */
@@ -6286,7 +6286,7 @@ H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, const hsize
* to be impossible.
*/
if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO)
- H5S__hyper_rebuild((H5S_t *)space); /* Casting away const OK -QAK */
+ H5S__hyper_rebuild(space);
/* Check for regular hyperslab intersection */
if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) {
@@ -11331,9 +11331,8 @@ sis_span_info unsigned depth; IN: Depth of iteration (in terms of rank)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__hyper_proj_int_iterate(const H5S_hyper_span_info_t *ss_span_info,
- const H5S_hyper_span_info_t *sis_span_info, hsize_t count, unsigned depth,
- H5S_hyper_project_intersect_ud_t *udata)
+H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper_span_info_t *sis_span_info,
+ hsize_t count, unsigned depth, H5S_hyper_project_intersect_ud_t *udata)
{
const H5S_hyper_span_t *ss_span; /* Current span in source space */
const H5S_hyper_span_t *sis_span; /* Current span in source intersect space */
@@ -11592,11 +11591,11 @@ also that proj_space can share some span trees with dst_space, so proj_space mus
if dst_space must be preserved. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
- const H5S_t *src_intersect_space, H5S_t *proj_space, hbool_t share_selection)
+H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_intersect_space,
+ H5S_t *proj_space, hbool_t share_selection)
{
H5S_hyper_project_intersect_ud_t udata; /* User data for subroutines */
- const H5S_hyper_span_info_t * ss_span_info;
+ H5S_hyper_span_info_t * ss_span_info;
const H5S_hyper_span_info_t * ds_span_info;
H5S_hyper_span_info_t * ss_span_info_buf = NULL;
H5S_hyper_span_info_t * ds_span_info_buf = NULL;
@@ -11622,7 +11621,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
if (H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_HYPERSLABS) {
/* Make certain the selection has a span tree */
if (NULL == src_space->select.sel_info.hslab->span_lst)
- if (H5S__hyper_generate_spans((H5S_t *)src_space) < 0) /* Casting away const OK -NAF */
+ if (H5S__hyper_generate_spans(src_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL,
"can't construct span tree for source hyperslab selection")
@@ -11644,7 +11643,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
if (H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_HYPERSLABS) {
/* Make certain the selection has a span tree */
if (NULL == dst_space->select.sel_info.hslab->span_lst)
- if (H5S__hyper_generate_spans((H5S_t *)dst_space) < 0) /* Casting away const OK -NAF */
+ if (H5S__hyper_generate_spans(dst_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL,
"can't construct span tree for dsetination hyperslab selection")
@@ -11664,7 +11663,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Make certain the source intersect selection has a span tree */
if (NULL == src_intersect_space->select.sel_info.hslab->span_lst)
- if (H5S__hyper_generate_spans((H5S_t *)src_intersect_space) < 0) /* Casting away const OK -NAF */
+ if (H5S__hyper_generate_spans(src_intersect_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL,
"can't construct span tree for source intersect hyperslab selection")
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index df4c3c7..b83cd1a 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -73,10 +73,10 @@ static herr_t H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_poin
static herr_t H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count,
hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute_map,
hbool_t *is_permuted);
-static herr_t H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute_map,
+static herr_t H5S__mpio_permute_type(H5S_t *space, size_t elmt_size, hsize_t **permute_map,
MPI_Datatype *new_type, int *count, hbool_t *is_derived_type);
-static herr_t H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
- int *count, hbool_t *is_derived_type);
+static herr_t H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count,
+ hbool_t *is_derived_type);
static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type,
int *count, hbool_t *is_derived_type);
static herr_t H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list);
@@ -95,6 +95,9 @@ static herr_t H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *
/* Declare a free list to manage the H5S_mpio_mpitype_node_t struct */
H5FL_DEFINE_STATIC(H5S_mpio_mpitype_node_t);
+/* Declare a free list to manage dataspace selection iterators */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/*-------------------------------------------------------------------------
* Function: H5S__mpio_all_type
*
@@ -501,17 +504,19 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Datatype *new_type,
- int *count, hbool_t *is_derived_type)
+H5S__mpio_permute_type(H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Datatype *new_type, int *count,
+ hbool_t *is_derived_type)
{
- MPI_Aint * disp = NULL; /* Datatype displacement for each point*/
- H5S_sel_iter_t sel_iter; /* Selection iteration info */
- hbool_t sel_iter_init = FALSE; /* Selection iteration info has been initialized */
- hssize_t snum_points; /* Signed number of elements in selection */
- hsize_t num_points; /* Number of points in the selection */
- size_t max_elem; /* Maximum number of elements allowed in sequences */
- hsize_t u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ MPI_Aint * disp = NULL; /* Datatype displacement for each point*/
+ H5S_sel_iter_t *sel_iter = NULL; /* Selection iteration info */
+ hbool_t sel_iter_init = FALSE; /* Selection iteration info has been initialized */
+ hssize_t snum_points; /* Signed number of elements in selection */
+ hsize_t num_points; /* Number of points in the selection */
+ hsize_t * off = NULL;
+ size_t * len = NULL;
+ size_t max_elem; /* Maximum number of elements allowed in sequences */
+ hsize_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -527,8 +532,18 @@ H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
if (NULL == (disp = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * num_points)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements")
+ /* Allocate arrays to hold sequence offsets and lengths */
+ if (NULL == (off = H5MM_malloc(H5D_IO_VECTOR_SIZE * sizeof(*off))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate sequence offsets array")
+ if (NULL == (len = H5MM_malloc(H5D_IO_VECTOR_SIZE * sizeof(*len))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate sequence lengths array")
+
+ /* Allocate a selection iterator for iterating over the dataspace */
+ if (NULL == (sel_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "couldn't allocate dataspace selection iterator")
+
/* Initialize selection iterator */
- if (H5S_select_iter_init(&sel_iter, space, elmt_size, 0) < 0)
+ if (H5S_select_iter_init(sel_iter, space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
sel_iter_init = TRUE; /* Selection iteration info has been initialized */
@@ -538,14 +553,12 @@ H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
/* Loop, while elements left in selection */
u = 0;
while (max_elem > 0) {
- hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
- size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
- size_t nelem; /* Number of elements used in sequences */
- size_t nseq; /* Number of sequences generated */
- size_t curr_seq; /* Current sequence being worked on */
+ size_t nelem; /* Number of elements used in sequences */
+ size_t nseq; /* Number of sequences generated */
+ size_t curr_seq; /* Current sequence being worked on */
/* Get the sequences of bytes */
- if (H5S_SELECT_ITER_GET_SEQ_LIST(&sel_iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off,
+ if (H5S_SELECT_ITER_GET_SEQ_LIST(sel_iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off,
len) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
@@ -602,9 +615,14 @@ H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute,
done:
/* Release selection iterator */
- if (sel_iter_init)
- if (H5S_SELECT_ITER_RELEASE(&sel_iter) < 0)
+ if (sel_iter) {
+ if (sel_iter_init && H5S_SELECT_ITER_RELEASE(sel_iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ sel_iter = H5FL_FREE(H5S_sel_iter_t, sel_iter);
+ }
+
+ H5MM_free(len);
+ H5MM_free(off);
/* Free memory */
if (disp)
@@ -634,11 +652,11 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count,
+H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count,
hbool_t *is_derived_type)
{
- H5S_sel_iter_t sel_iter; /* Selection iteration info */
- hbool_t sel_iter_init = FALSE; /* Selection iteration info has been initialized */
+ H5S_sel_iter_t *sel_iter = NULL; /* Selection iteration info */
+ hbool_t sel_iter_init = FALSE; /* Selection iteration info has been initialized */
struct dim { /* less hassle than malloc/free & ilk */
hssize_t start;
@@ -668,32 +686,37 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
HDassert(sizeof(MPI_Aint) >= sizeof(elmt_size));
bigio_count = H5_mpi_get_bigio_count();
+
+ /* Allocate a selection iterator for iterating over the dataspace */
+ if (NULL == (sel_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "couldn't allocate dataspace selection iterator")
+
/* Initialize selection iterator */
- if (H5S_select_iter_init(&sel_iter, space, elmt_size, 0) < 0)
+ if (H5S_select_iter_init(sel_iter, space, elmt_size, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
sel_iter_init = TRUE; /* Selection iteration info has been initialized */
/* Abbreviate args */
- diminfo = sel_iter.u.hyp.diminfo;
+ diminfo = sel_iter->u.hyp.diminfo;
HDassert(diminfo);
/* Make a local copy of the dimension info so we can operate with them */
/* Check if this is a "flattened" regular hyperslab selection */
- if (sel_iter.u.hyp.iter_rank != 0 && sel_iter.u.hyp.iter_rank < space->extent.rank) {
+ if (sel_iter->u.hyp.iter_rank != 0 && sel_iter->u.hyp.iter_rank < space->extent.rank) {
/* Flattened selection */
- rank = sel_iter.u.hyp.iter_rank;
+ rank = sel_iter->u.hyp.iter_rank;
#ifdef H5S_DEBUG
if (H5DEBUG(S))
HDfprintf(H5DEBUG(S), "%s: Flattened selection\n", FUNC);
#endif
for (u = 0; u < rank; ++u) {
H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t)
- d[u].start = (hssize_t)diminfo[u].start + sel_iter.u.hyp.sel_off[u];
+ d[u].start = (hssize_t)diminfo[u].start + sel_iter->u.hyp.sel_off[u];
d[u].strid = diminfo[u].stride;
d[u].block = diminfo[u].block;
d[u].count = diminfo[u].count;
- d[u].xtent = sel_iter.u.hyp.size[u];
+ d[u].xtent = sel_iter->u.hyp.size[u];
#ifdef H5S_DEBUG
if (H5DEBUG(S)) {
@@ -951,9 +974,11 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new
done:
/* Release selection iterator */
- if (sel_iter_init)
- if (H5S_SELECT_ITER_RELEASE(&sel_iter) < 0)
+ if (sel_iter) {
+ if (sel_iter_init && H5S_SELECT_ITER_RELEASE(sel_iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ sel_iter = H5FL_FREE(H5S_sel_iter_t, sel_iter);
+ }
#ifdef H5S_DEBUG
if (H5DEBUG(S))
@@ -1364,7 +1389,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count,
+H5S_mpio_space_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count,
hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute_map, hbool_t *is_permuted)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index 82e513e..9292cd4 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -49,22 +49,22 @@
static herr_t H5S__none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
static herr_t H5S__none_release(H5S_t *space);
static htri_t H5S__none_is_valid(const H5S_t *space);
-static hssize_t H5S__none_serial_size(const H5S_t *space);
-static herr_t H5S__none_serialize(const H5S_t *space, uint8_t **p);
+static hssize_t H5S__none_serial_size(H5S_t *space);
+static herr_t H5S__none_serialize(H5S_t *space, uint8_t **p);
static herr_t H5S__none_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__none_offset(const H5S_t *space, hsize_t *off);
static int H5S__none_unlim_dim(const H5S_t *space);
static htri_t H5S__none_is_contiguous(const H5S_t *space);
static htri_t H5S__none_is_single(const H5S_t *space);
-static htri_t H5S__none_is_regular(const H5S_t *space);
-static htri_t H5S__none_shape_same(const H5S_t *space1, const H5S_t *space2);
-static htri_t H5S__none_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end);
+static htri_t H5S__none_is_regular(H5S_t *space);
+static htri_t H5S__none_shape_same(H5S_t *space1, H5S_t *space2);
+static htri_t H5S__none_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
static herr_t H5S__none_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__none_adjust_s(H5S_t *space, const hssize_t *offset);
static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S__none_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
+static herr_t H5S__none_iter_init(H5S_t *space, H5S_sel_iter_t *iter);
/* Selection iteration callbacks */
static herr_t H5S__none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
@@ -144,7 +144,7 @@ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__none_iter_init(const H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter)
+H5S__none_iter_init(H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter)
{
FUNC_ENTER_STATIC_NOERR
@@ -513,7 +513,7 @@ H5S__none_is_valid(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S__none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_serial_size(H5S_t H5_ATTR_UNUSED *space)
{
FUNC_ENTER_STATIC_NOERR
@@ -533,7 +533,7 @@ H5S__none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
Serialize the current selection into a user-provided buffer.
USAGE
herr_t H5S__none_serialize(space, p)
- const H5S_t *space; IN: Dataspace with selection to serialize
+ H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
serialized selection.
@@ -548,7 +548,7 @@ H5S__none_serial_size(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__none_serialize(const H5S_t *space, uint8_t **p)
+H5S__none_serialize(H5S_t *space, uint8_t **p)
{
uint8_t *pp = (*p); /* Local pointer for decoding */
@@ -803,7 +803,7 @@ H5S__none_is_single(const H5S_t H5_ATTR_UNUSED *space)
Check if a "none" selection is "regular"
USAGE
htri_t H5S__none_is_regular(space)
- const H5S_t *space; IN: Dataspace pointer to check
+ H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
DESCRIPTION
@@ -816,7 +816,7 @@ H5S__none_is_single(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S__none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
+H5S__none_is_regular(H5S_t H5_ATTR_UNUSED *space)
{
FUNC_ENTER_STATIC_NOERR
@@ -833,8 +833,8 @@ H5S__none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
Check if a two "none" selections are the same shape
USAGE
htri_t H5S__none_shape_same(space1, space2)
- const H5S_t *space1; IN: First dataspace to check
- const H5S_t *space2; IN: Second dataspace to check
+ H5S_t *space1; IN: First dataspace to check
+ H5S_t *space2; IN: Second dataspace to check
RETURNS
TRUE / FALSE / FAIL
DESCRIPTION
@@ -846,7 +846,7 @@ H5S__none_is_regular(const H5S_t H5_ATTR_UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S__none_shape_same(const H5S_t H5_ATTR_UNUSED *space1, const H5S_t H5_ATTR_UNUSED *space2)
+H5S__none_shape_same(H5S_t H5_ATTR_UNUSED *space1, H5S_t H5_ATTR_UNUSED *space2)
{
FUNC_ENTER_STATIC_NOERR
@@ -864,7 +864,7 @@ H5S__none_shape_same(const H5S_t H5_ATTR_UNUSED *space1, const H5S_t H5_ATTR_UNU
Detect intersections of selection with block
USAGE
htri_t H5S__none_intersect_block(space, start, end)
- const H5S_t *space; IN: Dataspace with selection to use
+ H5S_t *space; IN: Dataspace with selection to use
const hsize_t *start; IN: Starting coordinate for block
const hsize_t *end; IN: Ending coordinate for block
RETURNS
@@ -877,7 +877,7 @@ H5S__none_shape_same(const H5S_t H5_ATTR_UNUSED *space1, const H5S_t H5_ATTR_UNU
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S__none_intersect_block(const H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *start,
+H5S__none_intersect_block(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *start,
const hsize_t H5_ATTR_UNUSED *end)
{
FUNC_ENTER_STATIC_NOERR
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index b34b628..d069393 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -242,9 +242,9 @@ typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space);
/* Method to determine if current selection is valid for dataspace */
typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space);
/* Method to determine number of bytes required to store current selection */
-typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space);
+typedef hssize_t (*H5S_sel_serial_size_func_t)(H5S_t *space);
/* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */
-typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p);
+typedef herr_t (*H5S_sel_serialize_func_t)(H5S_t *space, uint8_t **p);
/* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */
typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t **space, const uint8_t **p);
/* Method to determine smallest n-D bounding box containing the current selection */
@@ -260,12 +260,11 @@ typedef htri_t (*H5S_sel_is_contiguous_func_t)(const H5S_t *space);
/* Method to determine if current selection is a single block */
typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space);
/* Method to determine if current selection is "regular" */
-typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space);
+typedef htri_t (*H5S_sel_is_regular_func_t)(H5S_t *space);
/* Method to determine if two dataspaces' selections are the same shape */
-typedef htri_t (*H5S_sel_shape_same_func_t)(const H5S_t *space1, const H5S_t *space2);
+typedef htri_t (*H5S_sel_shape_same_func_t)(H5S_t *space1, H5S_t *space2);
/* Method to determine if selection intersects a block */
-typedef htri_t (*H5S_sel_intersect_block_func_t)(const H5S_t *space, const hsize_t *start,
- const hsize_t *end);
+typedef htri_t (*H5S_sel_intersect_block_func_t)(H5S_t *space, const hsize_t *start, const hsize_t *end);
/* Method to adjust a selection by an offset */
typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset);
/* Method to adjust a selection by an offset (signed) */
@@ -275,7 +274,7 @@ typedef herr_t (*H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset);
/* Method to construct selection projection onto/into simple dataspace */
typedef herr_t (*H5S_sel_project_simple)(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
/* Method to initialize iterator for current selection */
-typedef herr_t (*H5S_sel_iter_init_func_t)(const H5S_t *space, H5S_sel_iter_t *sel_iter);
+typedef herr_t (*H5S_sel_iter_init_func_t)(H5S_t *space, H5S_sel_iter_t *sel_iter);
/* Selection class information */
typedef struct {
@@ -405,9 +404,8 @@ H5_DLL herr_t H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
H5_DLL uint64_t H5S__hyper_get_op_gen(void);
H5_DLL void H5S__hyper_rebuild(H5S_t *space);
H5_DLL herr_t H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2);
-H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
- const H5S_t *src_intersect_space, H5S_t *proj_space,
- hbool_t share_space);
+H5_DLL herr_t H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_intersect_space,
+ H5S_t *proj_space, hbool_t share_space);
/* Testing functions */
#ifdef H5S_TESTING
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 65aefe2..56daad1 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -59,22 +59,22 @@ static void H5S__free_pnt_list(H5S_pnt_list_t *pnt_lst);
static herr_t H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
static herr_t H5S__point_release(H5S_t *space);
static htri_t H5S__point_is_valid(const H5S_t *space);
-static hssize_t H5S__point_serial_size(const H5S_t *space);
-static herr_t H5S__point_serialize(const H5S_t *space, uint8_t **p);
+static hssize_t H5S__point_serial_size(H5S_t *space);
+static herr_t H5S__point_serialize(H5S_t *space, uint8_t **p);
static herr_t H5S__point_deserialize(H5S_t **space, const uint8_t **p);
static herr_t H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static herr_t H5S__point_offset(const H5S_t *space, hsize_t *off);
static int H5S__point_unlim_dim(const H5S_t *space);
static htri_t H5S__point_is_contiguous(const H5S_t *space);
static htri_t H5S__point_is_single(const H5S_t *space);
-static htri_t H5S__point_is_regular(const H5S_t *space);
-static htri_t H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2);
-static htri_t H5S__point_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end);
+static htri_t H5S__point_is_regular(H5S_t *space);
+static htri_t H5S__point_shape_same(H5S_t *space1, H5S_t *space2);
+static htri_t H5S__point_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset);
static herr_t H5S__point_adjust_s(H5S_t *space, const hssize_t *offset);
static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset);
static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-static herr_t H5S__point_iter_init(const H5S_t *space, H5S_sel_iter_t *iter);
+static herr_t H5S__point_iter_init(H5S_t *space, H5S_sel_iter_t *iter);
static herr_t H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size);
/* Selection iteration callbacks */
@@ -169,7 +169,7 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t);
*-------------------------------------------------------------------------
*/
static herr_t
-H5S__point_iter_init(const H5S_t *space, H5S_sel_iter_t *iter)
+H5S__point_iter_init(H5S_t *space, H5S_sel_iter_t *iter)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1158,7 +1158,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static hssize_t
-H5S__point_serial_size(const H5S_t *space)
+H5S__point_serial_size(H5S_t *space)
{
uint32_t version; /* Version number */
uint8_t enc_size; /* Encoded size of point selection info */
@@ -1203,7 +1203,7 @@ done:
Serialize the current selection into a user-provided buffer.
USAGE
herr_t H5S__point_serialize(space, p)
- const H5S_t *space; IN: Dataspace with selection to serialize
+ H5S_t *space; IN: Dataspace with selection to serialize
uint8_t **p; OUT: Pointer to buffer to put serialized
selection. Will be advanced to end of
serialized selection.
@@ -1218,7 +1218,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S__point_serialize(const H5S_t *space, uint8_t **p)
+H5S__point_serialize(H5S_t *space, uint8_t **p)
{
H5S_pnt_node_t *curr; /* Point information nodes */
uint8_t * pp; /* Local pointer for encoding */
@@ -1842,7 +1842,7 @@ H5S__point_is_single(const H5S_t *space)
Check if a point selection is "regular"
USAGE
htri_t H5S__point_is_regular(space)
- const H5S_t *space; IN: Dataspace pointer to check
+ H5S_t *space; IN: Dataspace pointer to check
RETURNS
TRUE/FALSE/FAIL
DESCRIPTION
@@ -1857,7 +1857,7 @@ H5S__point_is_single(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S__point_is_regular(const H5S_t *space)
+H5S__point_is_regular(H5S_t *space)
{
htri_t ret_value = FAIL; /* Return value */
@@ -1882,8 +1882,8 @@ H5S__point_is_regular(const H5S_t *space)
Check if a two "point" selections are the same shape
USAGE
htri_t H5S__point_shape_same(space1, space2)
- const H5S_t *space1; IN: First dataspace to check
- const H5S_t *space2; IN: Second dataspace to check
+ H5S_t *space1; IN: First dataspace to check
+ H5S_t *space2; IN: Second dataspace to check
RETURNS
TRUE / FALSE / FAIL
DESCRIPTION
@@ -1895,7 +1895,7 @@ H5S__point_is_regular(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2)
+H5S__point_shape_same(H5S_t *space1, H5S_t *space2)
{
H5S_pnt_node_t *pnt1, *pnt2; /* Point information nodes */
hssize_t offset[H5S_MAX_RANK]; /* Offset between the selections */
@@ -1988,7 +1988,7 @@ done:
Detect intersections of selection with block
USAGE
htri_t H5S__point_intersect_block(space, start, end)
- const H5S_t *space; IN: Dataspace with selection to use
+ H5S_t *space; IN: Dataspace with selection to use
const hsize_t *start; IN: Starting coordinate for block
const hsize_t *end; IN: Ending coordinate for block
RETURNS
@@ -2001,7 +2001,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S__point_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end)
+H5S__point_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end)
{
H5S_pnt_node_t *pnt; /* Point information node */
htri_t ret_value = FALSE; /* Return value */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 76ed237..7cad13d 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -216,7 +216,7 @@ H5_DLL htri_t H5S_set_extent(H5S_t *space, const hsize_t *size);
H5_DLL herr_t H5S_set_extent_real(H5S_t *space, const hsize_t *size);
H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max);
H5_DLL H5S_t *H5S_create(H5S_class_t type);
-H5_DLL herr_t H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space /*out*/);
+H5_DLL herr_t H5S_get_validated_dataspace(hid_t space_id, H5S_t **space /*out*/);
H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]);
H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds);
H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc);
@@ -232,36 +232,35 @@ H5_DLL herr_t H5S_extent_copy(H5S_t *dst, const H5S_t *src);
/* Operations on selections */
H5_DLL herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p);
H5_DLL H5S_sel_type H5S_get_select_type(const H5S_t *space);
-H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
- const H5S_sel_iter_op_t *op, void *op_data);
-H5_DLL herr_t H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *buf);
-H5_DLL htri_t H5S_select_valid(const H5S_t *space);
-H5_DLL hsize_t H5S_get_select_npoints(const H5S_t *space);
-H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
-H5_DLL herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset);
-H5_DLL int H5S_get_select_unlim_dim(const H5S_t *space);
-H5_DLL herr_t H5S_get_select_num_elem_non_unlim(const H5S_t *space, hsize_t *num_elem_non_unlim);
-H5_DLL herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset);
-H5_DLL herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
-H5_DLL htri_t H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2);
-H5_DLL htri_t H5S_select_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end);
-H5_DLL herr_t H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
- unsigned new_space_rank, const void *buf,
- void const **adj_buf_ptr, hsize_t element_size);
-H5_DLL herr_t H5S_select_release(H5S_t *ds);
-H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space);
-H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p);
-H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
-H5_DLL htri_t H5S_select_is_single(const H5S_t *space);
-H5_DLL htri_t H5S_select_is_regular(const H5S_t *space);
-H5_DLL herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset);
-H5_DLL herr_t H5S_select_adjust_s(H5S_t *space, const hssize_t *offset);
-H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset);
-H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
-H5_DLL herr_t H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
- const H5S_t *src_intersect_space, H5S_t **new_space_ptr,
- hbool_t share_space);
-H5_DLL herr_t H5S_select_subtract(H5S_t *space, H5S_t *subtract_space);
+H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_iter_op_t *op,
+ void *op_data);
+H5_DLL herr_t H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *buf);
+H5_DLL htri_t H5S_select_valid(const H5S_t *space);
+H5_DLL hsize_t H5S_get_select_npoints(const H5S_t *space);
+H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
+H5_DLL herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset);
+H5_DLL int H5S_get_select_unlim_dim(const H5S_t *space);
+H5_DLL herr_t H5S_get_select_num_elem_non_unlim(const H5S_t *space, hsize_t *num_elem_non_unlim);
+H5_DLL herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset);
+H5_DLL herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
+H5_DLL htri_t H5S_select_shape_same(H5S_t *space1, H5S_t *space2);
+H5_DLL htri_t H5S_select_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end);
+H5_DLL herr_t H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr,
+ unsigned new_space_rank, hsize_t element_size,
+ ptrdiff_t *buf_adj);
+H5_DLL herr_t H5S_select_release(H5S_t *ds);
+H5_DLL hssize_t H5S_select_serial_size(H5S_t *space);
+H5_DLL herr_t H5S_select_serialize(H5S_t *space, uint8_t **p);
+H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
+H5_DLL htri_t H5S_select_is_single(const H5S_t *space);
+H5_DLL htri_t H5S_select_is_regular(H5S_t *space);
+H5_DLL herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset);
+H5_DLL herr_t H5S_select_adjust_s(H5S_t *space, const hssize_t *offset);
+H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset);
+H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
+H5_DLL herr_t H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_intersect_space,
+ H5S_t **new_space_ptr, hbool_t share_space);
+H5_DLL herr_t H5S_select_subtract(H5S_t *space, H5S_t *subtract_space);
/* Operations on all selections */
H5_DLL herr_t H5S_select_all(H5S_t *space, hbool_t rel_prev);
@@ -290,8 +289,7 @@ H5_DLL H5S_t * H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index
H5_DLL hsize_t H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size, hbool_t *partial);
/* Operations on selection iterators */
-H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size,
- unsigned flags);
+H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, H5S_t *space, size_t elmt_size, unsigned flags);
H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords);
H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter);
H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
@@ -301,7 +299,7 @@ H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter);
H5_DLL herr_t H5S_sel_iter_close(H5S_sel_iter_t *sel_iter);
#ifdef H5_HAVE_PARALLEL
-H5_DLL herr_t H5S_mpio_space_type(const H5S_t *space, size_t elmt_size,
+H5_DLL herr_t H5S_mpio_space_type(H5S_t *space, size_t elmt_size,
/* out: */ MPI_Datatype *new_type, int *count, hbool_t *is_derived_type,
hbool_t do_permute, hsize_t **permute_map, hbool_t *is_permuted);
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 241708a..8209b9a 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -304,7 +304,7 @@ done:
*-------------------------------------------------------------------------
*/
hssize_t
-H5S_select_serial_size(const H5S_t *space)
+H5S_select_serial_size(H5S_t *space)
{
hssize_t ret_value = -1; /* Return value */
@@ -343,7 +343,7 @@ H5S_select_serial_size(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_serialize(const H5S_t *space, uint8_t **p)
+H5S_select_serialize(H5S_t *space, uint8_t **p)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -880,7 +880,7 @@ H5S_select_is_single(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_select_is_regular(const H5S_t *space)
+H5S_select_is_regular(H5S_t *space)
{
herr_t ret_value = FAIL; /* Return value */
@@ -1116,7 +1116,7 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset)
in the dataspace's selection.
--------------------------------------------------------------------------*/
herr_t
-H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_size, unsigned flags)
+H5S_select_iter_init(H5S_sel_iter_t *sel_iter, H5S_t *space, size_t elmt_size, unsigned flags)
{
herr_t ret_value = FAIL; /* Return value */
@@ -1497,8 +1497,7 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter)
the selection is not modified.
--------------------------------------------------------------------------*/
herr_t
-H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space, const H5S_sel_iter_op_t *op,
- void *op_data)
+H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_iter_op_t *op, void *op_data)
{
H5S_sel_iter_t *iter = NULL; /* Selection iteration info */
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
@@ -1739,7 +1738,7 @@ H5S_get_select_type(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
+H5S_select_shape_same(H5S_t *space1, H5S_t *space2)
{
H5S_sel_iter_t *iter_a = NULL; /* Selection a iteration info */
H5S_sel_iter_t *iter_b = NULL; /* Selection b iteration info */
@@ -1760,8 +1759,8 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
/* Check special cases if both dataspaces aren't scalar */
/* (If only one is, the number of selected points check is sufficient) */
if (space1->extent.rank > 0 && space2->extent.rank > 0) {
- const H5S_t *space_a; /* Dataspace with larger rank */
- const H5S_t *space_b; /* Dataspace with smaller rank */
+ H5S_t * space_a; /* Dataspace with larger rank */
+ H5S_t * space_b; /* Dataspace with smaller rank */
unsigned space_a_rank; /* Number of dimensions of dataspace A */
unsigned space_b_rank; /* Number of dimensions of dataspace B */
int space_a_dim; /* Current dimension in dataspace A */
@@ -2063,7 +2062,7 @@ done:
don't call it directly, use the appropriate macro defined in H5Sprivate.h.
--------------------------------------------------------------------------*/
htri_t
-H5S_select_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end)
+H5S_select_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end)
{
htri_t ret_value = TRUE; /* Return value */
@@ -2171,27 +2170,24 @@ done:
Note that if m > n, it is possible that the starting point in the
buffer associated with the memory dataspace will have to be
- adjusted to match the projected dataspace. If the buf parameter
- is not NULL, the function must return an adjusted buffer base
- address in *adj_buf_ptr.
+ adjusted to match the projected dataspace. In this case, the amount
+ of adjustment to be applied to the buffer will be returned via the
+ buf_adj parameter, if supplied.
USAGE
htri_t H5S_select_construct_projection(base_space,
new_space_ptr,
new_space_rank,
- buf,
- adj_buf_ptr)
+ element_size,
+ buf_adj)
const H5S_t *base_space; IN: Ptr to Dataspace to project
H5S_t ** new_space_ptr; OUT: Ptr to location in which to return
the address of the projected space
int new_space_rank; IN: Rank of the projected space.
- const void * buf; IN: Base address of the buffer
- associated with the base space.
- May be NULL.
- void ** adj_buf_ptr; OUT: If buf != NULL, store the base
- address of the section of buf
- that is described by *new_space_ptr
- in *adj_buf_ptr.
+ hsize_t element_size; IN: size of each element in the selection
+ ptrdiff_t buf_adj; OUT: amount of adjustment to be applied
+ to buffer associated with memory
+ dataspace
RETURNS
Non-negative on success/Negative on failure.
@@ -2201,9 +2197,6 @@ done:
projection of the supplied dataspace and associated selection into
the specified rank. Return it in *new_space_ptr.
- If buf is supplied, computes the base address of the projected
- selection in buf, and stores the base address in *adj_buf_ptr.
-
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
The selection in the supplied base_space has thickness 1 in all
@@ -2214,8 +2207,8 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, unsigned new_space_rank,
- const void *buf, void const **adj_buf_ptr, hsize_t element_size)
+H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr, unsigned new_space_rank,
+ hsize_t element_size, ptrdiff_t *buf_adj)
{
H5S_t * new_space = NULL; /* New dataspace constructed */
hsize_t base_space_dims[H5S_MAX_RANK]; /* Current dimensions of base dataspace */
@@ -2234,7 +2227,6 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
HDassert(new_space_ptr != NULL);
HDassert((new_space_rank != 0) || (H5S_GET_SELECT_NPOINTS(base_space) <= 1));
HDassert(new_space_rank <= H5S_MAX_RANK);
- HDassert((buf == NULL) || (adj_buf_ptr != NULL));
HDassert(element_size > 0);
/* Get the extent info for the base dataspace */
@@ -2397,26 +2389,15 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr,
/* load the address of the new space into *new_space_ptr */
*new_space_ptr = new_space;
- /* now adjust the buffer if required */
- if (buf != NULL) {
+ /* return the buffer adjustment amount if required */
+ if (buf_adj != NULL) {
if (new_space_rank < base_space_rank) {
- /* a bit of pointer magic here:
- *
- * Since we can't do pointer arithmetic on void pointers, we first
- * cast buf to a pointer to byte -- i.e. uint8_t.
- *
- * We then multiply the projected space element offset we
- * calculated earlier by the supplied element size, add this
- * value to the type cast buf pointer, cast the result back
- * to a pointer to void, and assign the result to *adj_buf_ptr.
- */
- *adj_buf_ptr = (const void *)(((const uint8_t *)buf) +
- ((size_t)(projected_space_element_offset * element_size)));
- } /* end if */
+ *buf_adj = (ptrdiff_t)(projected_space_element_offset * element_size);
+ }
else
/* No adjustment necessary */
- *adj_buf_ptr = buf;
- } /* end if */
+ *buf_adj = 0;
+ }
done:
/* Cleanup on error */
@@ -2452,7 +2433,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_buf)
+H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *_buf)
{
H5S_sel_iter_t *iter = NULL; /* Selection iteration info */
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
@@ -2568,9 +2549,8 @@ to share structures inside dst_space with proj_space
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
- const H5S_t *src_intersect_space, H5S_t **new_space_ptr,
- hbool_t share_selection)
+H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_intersect_space,
+ H5S_t **new_space_ptr, hbool_t share_selection)
{
H5S_t * new_space = NULL; /* New dataspace constructed */
H5S_t * tmp_src_intersect_space = NULL; /* Temporary SIS converted from points->hyperslabs */
diff --git a/src/H5T.c b/src/H5T.c
index 3bb220a..c982ae7 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -5514,7 +5514,7 @@ done:
*-------------------------------------------------------------------------
*/
H5G_name_t *
-H5T_nameof(const H5T_t *dt)
+H5T_nameof(H5T_t *dt)
{
H5G_name_t *ret_value = NULL;
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index c349757..039abc4 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -3406,8 +3406,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si
/* For nested VL case, free leftover heap objects from the deeper level if the
* length of new data elements is shorter than the old data elements.*/
if (nested && seq_len < bg_seq_len) {
- const uint8_t *tmp;
- size_t u;
+ uint8_t *tmp;
+ size_t u;
/* Sanity check */
HDassert(write_to_file);
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 4062cbe..ce5bace 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -287,7 +287,7 @@ typedef herr_t (*H5T_vlen_setnull_func_t)(H5VL_object_t *file, void *_vl, void *
typedef herr_t (*H5T_vlen_read_func_t)(H5VL_object_t *file, void *_vl, void *buf, size_t len);
typedef herr_t (*H5T_vlen_write_func_t)(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info,
void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size);
-typedef herr_t (*H5T_vlen_delete_func_t)(H5VL_object_t *file, const void *_vl);
+typedef herr_t (*H5T_vlen_delete_func_t)(H5VL_object_t *file, void *_vl);
/* VL datatype callbacks */
typedef struct H5T_vlen_class_t {
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 6dd309a..b1e3d1b 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -122,7 +122,7 @@ H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
H5_DLL H5T_t * H5T_decode(size_t buf_size, const unsigned char *buf);
H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE *stream);
H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt);
-H5_DLL H5G_name_t *H5T_nameof(const H5T_t *dt);
+H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt);
H5_DLL htri_t H5T_is_immutable(const H5T_t *dt);
H5_DLL htri_t H5T_is_named(const H5T_t *dt);
H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f);
diff --git a/src/H5Tref.c b/src/H5Tref.c
index 7e12ac6..087c73e 100644
--- a/src/H5Tref.c
+++ b/src/H5Tref.c
@@ -594,8 +594,8 @@ done:
*/
static herr_t
H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type,
- H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size,
- void H5_ATTR_UNUSED *bg_buf)
+ H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf,
+ size_t H5_ATTR_NDEBUG_UNUSED dst_size, void H5_ATTR_UNUSED *bg_buf)
{
H5F_t * src_f = NULL;
hid_t file_id = H5I_INVALID_HID;
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 0d412ba..74770f6 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -76,7 +76,7 @@ static herr_t H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *_bg);
static herr_t H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len);
static herr_t H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl,
void *_buf, void *_bg, size_t seq_len, size_t base_size);
-static herr_t H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl);
+static herr_t H5T__vlen_disk_delete(H5VL_object_t *file, void *_vl);
/*********************/
/* Public Variables */
@@ -955,9 +955,9 @@ static herr_t
H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info,
void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size)
{
- uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- const uint8_t *bg = (const uint8_t *)_bg; /* Pointer to the old data hvl_t */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ uint8_t *bg = (uint8_t *)_bg; /* Pointer to the old data hvl_t */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -995,10 +995,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl)
+H5T__vlen_disk_delete(H5VL_object_t *file, void *_vl)
{
- const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1014,7 +1014,7 @@ H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl)
/* Delete object, if length > 0 */
if (seq_len > 0)
- if (H5VL_blob_specific(file, (void *)vl, H5VL_BLOB_DELETE) < 0) /* Casting away 'const' OK -QAK */
+ if (H5VL_blob_specific(file, vl, H5VL_BLOB_DELETE) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
} /* end if */
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index f23267e..c3ded4f 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -141,10 +141,10 @@ herr_t
H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
hid_t dxpl_id, void *buf, void H5_ATTR_UNUSED **req)
{
- H5D_t * dset = (H5D_t *)obj;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = (H5D_t *)obj;
+ H5S_t *mem_space = NULL;
+ H5S_t *file_space = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -182,10 +182,10 @@ herr_t
H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
hid_t dxpl_id, const void *buf, void H5_ATTR_UNUSED **req)
{
- H5D_t * dset = (H5D_t *)obj;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = (H5D_t *)obj;
+ H5S_t *mem_space = NULL;
+ H5S_t *file_space = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE