summaryrefslogtreecommitdiffstats
path: root/src/H5Shyper.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-06-02 16:02:24 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-06-02 16:02:24 (GMT)
commit3e7aafb4aa6741226d457464e0bf960b6d89f692 (patch)
treef5497790fc1233b94403336c9b8f51bea2973a66 /src/H5Shyper.c
parent67c80b8e8d8224adfeb67d5c116f35834d56d62c (diff)
downloadhdf5-3e7aafb4aa6741226d457464e0bf960b6d89f692.zip
hdf5-3e7aafb4aa6741226d457464e0bf960b6d89f692.tar.gz
hdf5-3e7aafb4aa6741226d457464e0bf960b6d89f692.tar.bz2
[svn-r10845] Purpose:
Code cleanup Description: Simplify the "zero-sized hyperslab" handling. Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest Misc. update:
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r--src/H5Shyper.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 0235b7d..9360432 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -5724,7 +5724,6 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
const hsize_t *opt_stride; /* Optimized stride information */
const hsize_t *opt_count; /* Optimized count information */
const hsize_t *opt_block; /* Optimized block information */
- hbool_t zero_hyperslab = FALSE; /* Indicate if the new hyperslab contains zero elements */
unsigned u; /* Counters */
herr_t ret_value=SUCCEED; /* Return value */
@@ -5753,8 +5752,25 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap");
/* Detect zero-sized hyperslabs in new selection */
- if(count[u] == 0 || block[u] == 0)
- zero_hyperslab = TRUE;
+ if(count[u] == 0 || block[u] == 0) {
+ switch(op) {
+ case H5S_SELECT_SET: /* Select "set" operation */
+ case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
+ case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
+ /* Convert to "none" selection */
+ if(H5S_select_none(space)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
+ HGOTO_DONE(SUCCEED);
+
+ case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
+ case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
+ case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
+ HGOTO_DONE(SUCCEED); /* Selection stays same */
+
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ } /* end switch */
+ } /* end if */
} /* end for */
/* Optimize hyperslab parameters to merge contiguous blocks, etc. */
@@ -5792,27 +5808,6 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
} /* end for */
} /* end else */
- /* Fixup zero-sized hyperslab selections */
- if(zero_hyperslab) {
- switch(op) {
- case H5S_SELECT_SET: /* Select "set" operation */
- case H5S_SELECT_AND: /* Binary "and" operation for hyperslabs */
- case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
- /* Convert to "none" selection */
- if(H5S_select_none(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
- HGOTO_DONE(SUCCEED);
-
- case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
- case H5S_SELECT_XOR: /* Binary "xor" operation for hyperslabs */
- case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */
- HGOTO_DONE(SUCCEED); /* Selection stays same */
-
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
- } /* end switch */
- } /* end if */
-
/* Fixup operation for non-hyperslab selections */
switch(H5S_GET_SELECT_TYPE(space)) {
case H5S_SEL_NONE: /* No elements selected in dataspace */