diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2019-11-18 17:53:50 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2019-12-06 22:12:47 (GMT) |
commit | 975eea7940ef2628102222b411c3a8682d692d8c (patch) | |
tree | e1e93a7044e5c88678aa3647fe76f2a6d29f6baa /src/H5Shyper.c | |
parent | 9f9336a5bd541752f472bab4c93da8de89f862cd (diff) | |
download | hdf5-975eea7940ef2628102222b411c3a8682d692d8c.zip hdf5-975eea7940ef2628102222b411c3a8682d692d8c.tar.gz hdf5-975eea7940ef2628102222b411c3a8682d692d8c.tar.bz2 |
Replace H5Sselect_adjust_u() and H5Shyper_adjust_s() with
H5Sselect_adjust. Implement "adjust_s" callback for all selection
types. Add range checking to H5Sselect_adjust().
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r-- | src/H5Shyper.c | 57 |
1 files changed, 9 insertions, 48 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c index c6314de..44ca266 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -194,6 +194,7 @@ 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 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); @@ -240,6 +241,7 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{ H5S__hyper_shape_same, H5S__hyper_intersect_block, H5S__hyper_adjust_u, + H5S__hyper_adjust_s, H5S__hyper_project_scalar, H5S__hyper_project_simple, H5S__hyper_iter_init, @@ -6983,11 +6985,11 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank, /*-------------------------------------------------------------------------- NAME - H5S_hyper_adjust_s + H5S__hyper_adjust_s PURPOSE Adjust a hyperslab selection by subtracting an offset USAGE - herr_t H5S_hyper_adjust_s(space,offset) + herr_t H5S__hyper_adjust_s(space,offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hssize_t *offset; IN: Offset to subtract RETURNS @@ -6999,8 +7001,8 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank, EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t -H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset) +static herr_t +H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset) { hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */ unsigned u; /* Local index variable */ @@ -7051,48 +7053,7 @@ H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_hyper_adjust_s() */ - -/*-------------------------------------------------------------------------- - NAME - H5Shyper_adjust_s - PURPOSE - Adjust a hyperslab selection by subtracting an offset - USAGE - herr_t H5Shyper_adjust_s(space_id,offset) - hid_t space_id; IN: ID of the dataspace to adjust - const hssize_t *offset; IN: Offset to subtract - RETURNS - Non-negative on success, negative on failure - DESCRIPTION - Moves a hyperslab selection by subtracting an offset from it. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -herr_t -H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset) -{ - H5S_t *space; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Hs", space_id, offset); - - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") - if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection") - if(NULL == offset) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer") - - if(H5S_hyper_adjust_s(space, offset) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Shyper_adjust_s() */ +} /* end H5S__hyper_adjust_s() */ /*-------------------------------------------------------------------------- @@ -7138,7 +7099,7 @@ H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset) } /* end for */ /* Call the 'adjust' routine */ - if(H5S_hyper_adjust_s(space, space->select.offset) < 0) + if(H5S__hyper_adjust_s(space, space->select.offset) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection") /* Zero out the selection offset */ @@ -7186,7 +7147,7 @@ H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset) HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS); /* Call the 'adjust' routine */ - if(H5S_hyper_adjust_s(space, old_offset) < 0) + if(H5S__hyper_adjust_s(space, old_offset) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection") /* Copy the selection offset over */ |