summaryrefslogtreecommitdiffstats
path: root/src/H5Shyper.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-05-08 06:04:32 (GMT)
committerGitHub <noreply@github.com>2022-05-08 06:04:32 (GMT)
commitc0f314ad03f5ef0b4366ee625c83a7955a9ea87f (patch)
tree1aff05e5b992bc1f15b3a1a9b14c325c9ae64c98 /src/H5Shyper.c
parent555e79d05f3fb778c9345b3abd4e55a1f177df90 (diff)
downloadhdf5-c0f314ad03f5ef0b4366ee625c83a7955a9ea87f.zip
hdf5-c0f314ad03f5ef0b4366ee625c83a7955a9ea87f.tar.gz
hdf5-c0f314ad03f5ef0b4366ee625c83a7955a9ea87f.tar.bz2
[1.10 Merge] Hdf5 1 10 warnings merge (#1754)
* Warnings fixes (#1680) * Clean stack size warnings in sio_engine (#1687) * Fixes stack size warnings in tcoords.c (#1688) * Address some warnings from casting away of const (#1684) * Fixes stack size warnings in dtransform (#1696) * Fixes stack size warnings in set_extent test (#1698) * Be a bit safer with signed arithmetic, thus quieting some signed-overflow warnings from GCC (#1706) * Avoid a signed overflow: check the range of `entry_ptr->age` before increasing it instead of increasing it and then checking the range. This quiets a GCC warning. * Avoid the potential for signed overflow by rewriting expressions `MAX(0, fwidth - n)` as `MAX(n, fwidth) - n` for various `n`. This change quiets some GCC warnings. * Change some local variables that cannot take sensible negative values from signed to unsigned. This quiets GCC warnings about potential signed overflow. * In a handful of instances, check the range of a signed integer before increasing/decreasing it, just in case the increase/decrease overflows. This quiets a handful of GCC signed-overflow warnings. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix object size warnings in cache.c test (#1701) * Fix some const cast and stack/static object size warnings (#1700) * Fix various warnings * Move HDfree_const to H5private.h for wider use * Print output from all ranks in parallel tests on allocation failure * Move const pointer freeing macro to h5test.h for now * Fixes a bug where t_cache fails due to a string size being too small (#1720) * Fixes a bug where t_cache fails due to a string size being too small Recent warning reductions led to an incorrect string size being passed to h5_fileaccess, causing the test to silently fail. In addition to fixing the bug, the test will now fail noisily on setup failures. * Updates the t_cache test to fail noisily on setup errors * Fix a few Clang sanitizer warnings (#1727) * Stop lying about H5S_t const-ness (#1209) Hyperslabs can be reworked inside several H5S callbacks, making H5S_t non-const in some places where it is marked const. This change switches these incorrectly const H5S_t pointer parameters and variables to non-const where appropriate. * Fix a few warnings after recent H5S const-related changes (#1225) * Adjustments for HDF5 1.10 * Hdf5 1 12 Miscellaneous warnings fixes (#1718) * Fixes const issues in the version 2 B-trees (#1172) The operations that were changed are fundamentally not const since the shadow operation can modify the node structure when SWMR is in use. * Quiets const warning in H5RS code (#1181) * Avoid calling H5Ropen_object with a misaligned H5R_ref_t: copy the (#1171) * Avoid calling H5Ropen_object with a misaligned H5R_ref_t: copy the raw H5R_ref_t bytes to a heap buffer that's known to have the right alignment. * Committing clang-format changes * Use an automatic H5R_ref_t instead of malloc'ing one. Go ahead and initialize the H5R_ref_t to all-0s so that arbitrary stack content doesn't foul things up. Bail out with an error if `size` exceeds `sizeof(H5R_ref_t)`. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Miscellaneous warnings fixes Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: David Young <dyoung@hdfgroup.org> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix several warnings (#747) Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: David Young <dyoung@hdfgroup.org> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r--src/H5Shyper.c69
1 files changed, 34 insertions, 35 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 10708d2..438afef 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);
@@ -558,7 +558,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 */
@@ -585,7 +585,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) {
@@ -3556,7 +3556,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 */
@@ -3660,7 +3660,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 */
@@ -3820,7 +3820,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.
@@ -3835,7 +3835,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 */
@@ -5137,7 +5137,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
@@ -5150,7 +5150,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 */
@@ -5163,7 +5163,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)
@@ -5387,8 +5387,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
@@ -5405,7 +5405,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 */
@@ -5428,9 +5428,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 &&
@@ -5475,11 +5475,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")
@@ -6066,7 +6066,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
@@ -6081,7 +6081,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 */
@@ -6097,7 +6097,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) {
@@ -11144,9 +11144,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 */
@@ -11405,11 +11404,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;
@@ -11435,7 +11434,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")
@@ -11457,7 +11456,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")
@@ -11477,7 +11476,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")