summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1998-08-04 00:30:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1998-08-04 00:30:35 (GMT)
commit48f8e55c0a7aae63b741725b3c40c377959b9d35 (patch)
treeeb984bfd0b1d04efb51a3c89592fa74d8b65e0ce /src/H5D.c
parentb91c28331572a835e259b0fa7c49f67b5e20bd28 (diff)
downloadhdf5-48f8e55c0a7aae63b741725b3c40c377959b9d35.zip
hdf5-48f8e55c0a7aae63b741725b3c40c377959b9d35.tar.gz
hdf5-48f8e55c0a7aae63b741725b3c40c377959b9d35.tar.bz2
[svn-r566] Fixed offset code [finally :-/ ] for selections.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 1a88560..68a7a81 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -575,12 +575,20 @@ H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
NULL == (mem_space = H5I_object(mem_space_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
}
+ /* Check for valid selection */
+ if(H5S_select_valid(mem_space)!=TRUE) {
+ HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent");
+ } /* end if */
}
if (H5S_ALL != file_space_id) {
if (H5_DATASPACE != H5I_group(file_space_id) ||
NULL == (file_space = H5I_object(file_space_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
}
+ /* Check for valid selection */
+ if(H5S_select_valid(file_space)!=TRUE) {
+ HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent");
+ } /* end if */
}
if (H5P_DEFAULT == plist_id) {
xfer_parms = &H5D_xfer_dflt;
@@ -666,12 +674,20 @@ H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
NULL == (mem_space = H5I_object(mem_space_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
}
+ /* Check for valid selection */
+ if(H5S_select_valid(mem_space)!=TRUE) {
+ HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent");
+ } /* end if */
}
if (H5S_ALL != file_space_id) {
if (H5_DATASPACE != H5I_group(file_space_id) ||
NULL == (file_space = H5I_object(file_space_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
}
+ /* Check for valid selection */
+ if(H5S_select_valid(file_space)!=TRUE) {
+ HRETURN_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent");
+ } /* end if */
}
if (H5P_DEFAULT == plist_id) {
xfer_parms = &H5D_xfer_dflt;