summaryrefslogtreecommitdiffstats
path: root/src/H5Shyper.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2019-11-18 17:53:50 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2019-11-18 17:53:50 (GMT)
commit4064332a2dc45e591666ce1bff02001239009bb8 (patch)
tree746f10086a14edbcbc76990e64cef77113d53c70 /src/H5Shyper.c
parent3593b3d201dd6eac4a71e67db02a54959d9a169e (diff)
downloadhdf5-4064332a2dc45e591666ce1bff02001239009bb8.zip
hdf5-4064332a2dc45e591666ce1bff02001239009bb8.tar.gz
hdf5-4064332a2dc45e591666ce1bff02001239009bb8.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.c57
1 files changed, 9 insertions, 48 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 2c7502a..a76812d 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,
@@ -6980,11 +6982,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
@@ -6996,8 +6998,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 */
@@ -7048,48 +7050,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() */
/*--------------------------------------------------------------------------
@@ -7135,7 +7096,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 */
@@ -7183,7 +7144,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 */