diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2015-08-07 16:15:39 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2015-08-07 16:15:39 (GMT) |
commit | 98f947ceaedbae472efbebad505680d2ca62b403 (patch) | |
tree | 21146ddcd7fd224d9f68bccc9824aa082eb9c205 /src/H5Shyper.c | |
parent | bfd13897f6dcfddce253c6a5463cb9f53b927800 (diff) | |
download | hdf5-98f947ceaedbae472efbebad505680d2ca62b403.zip hdf5-98f947ceaedbae472efbebad505680d2ca62b403.tar.gz hdf5-98f947ceaedbae472efbebad505680d2ca62b403.tar.bz2 |
[svn-r27479] Add checking for invalid inputs to H5Dset_virtual: point selections, incorrect
numbers of elements selected, incorrect "slice" through limited dimensions,
incorrect number of printf substitutions.
Patch source selection space extent with bounds of selection if extent is
unknown before returning via H5Pget_virtual_srcspace.
Write updated VDS dataspace to file when it changes due to unlimited selections.
Other minor fixes/cleanup.
Tested: ummon
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r-- | src/H5Shyper.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 8736b69..898c3df 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -65,6 +65,8 @@ static herr_t H5S_hyper_deserialize(const H5F_t *f, H5S_t *space, 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); 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); @@ -102,6 +104,7 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{ H5S_hyper_bounds, H5S_hyper_offset, H5S_hyper_unlim_dim, + H5S_hyper_num_elem_non_unlim, H5S_hyper_is_contiguous, H5S_hyper_is_single, H5S_hyper_is_regular, @@ -3007,6 +3010,48 @@ H5S_hyper_unlim_dim(const H5S_t *space) /*-------------------------------------------------------------------------- NAME + H5S_hyper_num_elem_non_unlim + PURPOSE + Return number of elements in the non-unlimited dimensions + USAGE + herr_t H5S_hyper_num_elem_non_unlim(space,num_elem_non_unlim) + H5S_t *space; IN: Dataspace pointer to check + hsize_t *num_elem_non_unlim; OUT: Number of elements in the non-unlimited dimensions + RETURNS + Non-negative on success/Negative on failure + DESCRIPTION + Returns the number of elements in a slice through the non-unlimited + dimensions of the selection. Fails if the selection has no unlimited + dimension. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_hyper_num_elem_non_unlim(const H5S_t *space, hsize_t *num_elem_non_unlim) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(space); + HDassert(num_elem_non_unlim); + + /* Get number of elements in the non-unlimited dimensions */ + if(space->select.sel_info.hslab->unlim_dim >= 0) + *num_elem_non_unlim = space->select.sel_info.hslab->num_elem_non_unlim; + else + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "selection has no unlimited dimension") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S_hyper_num_elem_non_unlim() */ + + +/*-------------------------------------------------------------------------- + NAME H5S_hyper_is_contiguous PURPOSE Check if a hyperslab selection is contiguous within the dataspace extent. |