diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2018-07-03 14:57:13 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2018-07-03 14:57:13 (GMT) |
commit | 6190641722e194f8827a5a68dce72dadac4b8157 (patch) | |
tree | 3e5751102492f2380c1e44bf3e91b3ac9c1af6eb /src/H5S.c | |
parent | 8da8a1dcb5d1f51654018527fbc3fc9baeff130e (diff) | |
parent | b6fcbf4bb0f693fd6a0517f0ff3f74d52b329d1e (diff) | |
download | hdf5-6190641722e194f8827a5a68dce72dadac4b8157.zip hdf5-6190641722e194f8827a5a68dce72dadac4b8157.tar.gz hdf5-6190641722e194f8827a5a68dce72dadac4b8157.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit 'b6fcbf4bb0f693fd6a0517f0ff3f74d52b329d1e': (400 commits)
Fix ptr arith
Correct function call
Remove writeVL option
Region reference in compounds need class check
Correct cast formatting
Correct var name
Need to cast from void ptr
Update Java util lib, Refactor H5D write VL to match read
Fix attribute Read
Correct "," handling
Revert "Merge pull request #1116 in HDFFV/hdf5 from ~HDFTEST/hdf5_hft:hdf5_1_10 to develop"
Snapshot version 1.10 release 3 (snap3)
Remove debug statements
Split/fix utility for vl types
fix whitespace
HDFVIEW compound vlen needed vlen_t size
Update documents
Update document
Update document
HDFFV-10433 Update file with fix for issues
...
Diffstat (limited to 'src/H5S.c')
-rw-r--r-- | src/H5S.c | 53 |
1 files changed, 52 insertions, 1 deletions
@@ -26,7 +26,6 @@ #include "H5Fprivate.h" /* Files */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ #include "H5Spkg.h" /* Dataspaces */ @@ -208,6 +207,58 @@ H5S_term_package(void) FUNC_LEAVE_NOAPI(n) } /* end H5S_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_get_validiated_dataspace + PURPOSE + Get a pointer to a validated H5S_t pointer + USAGE + H5S_t *H5S_get_validated_space(dataspace_id, space) + hid_t space_id; IN: The ID of the dataspace + const H5S_t * space; OUT: A pointer to the dataspace + RETURNS + SUCCEED/FAIL + DESCRIPTION + Gets a pointer to a dataspace struct after validating it. The pointer + can be NULL (if the ID is H5S_ALL, for example). + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(space); + + if (space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)") + + if (H5S_ALL == space_id) { + /* No special dataspace struct for H5S_ALL */ + *space = NULL; + } + else { + /* Get the dataspace pointer */ + if (NULL == (*space = (const H5S_t *)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 */ + if (H5S_SELECT_VALID(*space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5S_get_validated_dataspace() */ + /*-------------------------------------------------------------------------- NAME |