summaryrefslogtreecommitdiffstats
path: root/src/H5Shyper.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2000-10-10 02:45:05 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2000-10-10 02:45:05 (GMT)
commita1e44979edfe671a6c7f8278a8798d9a834476c3 (patch)
tree417203a95024b4ffdb8435c566c87dd004406109 /src/H5Shyper.c
parent884b83d6069d3a90482203dd665dc49965fdc5a4 (diff)
downloadhdf5-a1e44979edfe671a6c7f8278a8798d9a834476c3.zip
hdf5-a1e44979edfe671a6c7f8278a8798d9a834476c3.tar.gz
hdf5-a1e44979edfe671a6c7f8278a8798d9a834476c3.tar.bz2
[svn-r2647] Purpose:
Bug fiX Description: H5S_hyper_select_valid would report hyperslab invalid if the one of the count values is zero. The verifying algorithm did not take into consideration that block or count can contain zeros to indicate no element is wanted. Solution: Added code to test if block or count is zero. If so, skip the rest of the validity check. Platforms tested: IRIX64 -64.
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r--src/H5Shyper.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 9733152..65cc9fd 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -4127,21 +4127,25 @@ H5S_hyper_select_valid (const H5S_t *space)
/* Check each dimension */
for(i=0; i<space->extent.u.simple.rank; i++) {
- /* Bounds check the start point in this dimension */
- if((diminfo[i].start+space->select.offset[i])<0 ||
- (diminfo[i].start+space->select.offset[i])>=(hssize_t)space->extent.u.simple.size[i]) {
- ret_value=FALSE;
- break;
- } /* end if */
-
- /* Compute the largest location in this dimension */
- end=diminfo[i].start+diminfo[i].stride*(diminfo[i].count-1)+(diminfo[i].block-1)+space->select.offset[i];
-
- /* Bounds check the end point in this dimension */
- if(end<0 || end>=(hssize_t)space->extent.u.simple.size[i]) {
- ret_value=FALSE;
- break;
- } /* end if */
+ /* if block or count is zero, then can skip the test since */
+ /* no data point is chosen */
+ if (diminfo[i].count*diminfo[i].block != 0){
+ /* Bounds check the start point in this dimension */
+ if((diminfo[i].start+space->select.offset[i])<0 ||
+ (diminfo[i].start+space->select.offset[i])>=(hssize_t)space->extent.u.simple.size[i]) {
+ ret_value=FALSE;
+ break;
+ } /* end if */
+
+ /* Compute the largest location in this dimension */
+ end=diminfo[i].start+diminfo[i].stride*(diminfo[i].count-1)+(diminfo[i].block-1)+space->select.offset[i];
+
+ /* Bounds check the end point in this dimension */
+ if(end<0 || end>=(hssize_t)space->extent.u.simple.size[i]) {
+ ret_value=FALSE;
+ break;
+ } /* end if */
+ }
} /* end for */
} /* end if */
else {