summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2018-06-15 18:53:36 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2018-06-15 18:53:36 (GMT)
commit87829e06189cd9b29583b5ca8065b52b1f4cd523 (patch)
tree495ea989045018667409ee2e9a9d1ffded52091f /src/H5S.c
parent413bc90ec95524c72d0576bc9f1fc5356e541473 (diff)
parent57f64b92d19fed2879ee9bafe1d29bfac865d54c (diff)
downloadhdf5-87829e06189cd9b29583b5ca8065b52b1f4cd523.zip
hdf5-87829e06189cd9b29583b5ca8065b52b1f4cd523.tar.gz
hdf5-87829e06189cd9b29583b5ca8065b52b1f4cd523.tar.bz2
Merge pull request #1111 in HDFFV/hdf5 from hdf5_1_10.sync to hdf5_1_10
* commit '57f64b92d19fed2879ee9bafe1d29bfac865d54c': (30 commits) HDFFV-10405: Using h5fget_obj_count_f with a file id of H5F_OBJ_ALL_F does not work properly HDFFV-10405: Using h5fget_obj_count_f with a file id of H5F_OBJ_ALL_F does not work properly HDFFV-10405: Using h5fget_obj_count_f with a file id of H5F_OBJ_ALL_F does not work properly Cleaned up H5Fmount/unmount code. Normalization with vol_integration branch. Add fortran MPI to test and example Add mpi include folders for fortran C objects Normalization with the vol_integration branch. Fixed MANIFEST Fix usage of compression lib in shared tests Fix jni function call version Fix the error found after earlier checkin. H5O_info fixes for java and examples Added a RELASE.txt entry for HDFFV-10505. Changed 'deprecated' to indicate 'no longer supported' in the --enable-debug/production configure flags. (1) Made the change according to the pull request feedback. (2) Removed the performance test form test/th5o.c: will decide on what needs to be done to show speedup via HDFFV-10463. Normalize with vol_integration. Removed unused H5MF functions and updated FUNC_ENTER macros and naming in H5MFsection.c. Restored some unused #defines to the deprecated section of H5Dpublic.h. Changes made based on feedback from pull request #1039. ...
Diffstat (limited to 'src/H5S.c')
-rw-r--r--src/H5S.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/H5S.c b/src/H5S.c
index b490b36..bd21caf 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -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