summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2000-04-12 22:02:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2000-04-12 22:02:16 (GMT)
commite47b34e54f2886a39cbbcf99d20dd8fbaf77b834 (patch)
treeb2eec65303e6440115a0583fc2bb7b47f9666985
parentefbeda8d65b92a2232d6fccb127f373403ab28ed (diff)
downloadhdf5-e47b34e54f2886a39cbbcf99d20dd8fbaf77b834.zip
hdf5-e47b34e54f2886a39cbbcf99d20dd8fbaf77b834.tar.gz
hdf5-e47b34e54f2886a39cbbcf99d20dd8fbaf77b834.tar.bz2
[svn-r2131] Changed H5Screate_simple & H5Sset_extent_simple to disallow
size 0 dimensions without corresponding unlimited dimension.
-rw-r--r--src/H5S.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/H5S.c b/src/H5S.c
index 65a45ff..94949e5 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1350,23 +1350,21 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/],
if (rank<0 || rank>H5S_MAX_RANK) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank");
}
-#ifdef OLD_WAY
if (dims) {
for (u=0; u<rank; u++) {
- if (((max!=NULL && max[u]!=H5S_UNLIMITED) || max==NULL) &&
- dims[u]==0) {
+ if (((max!=NULL && max[u]!=H5S_UNLIMITED) || max==NULL)
+ && dims[u]==0) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"invalid dimension size");
}
}
}
-#endif /* OLD_WAY */
if (max!=NULL) {
if(dims==NULL) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"maximum dimension specified, but no current "
"dimensions specified");
- }
+ }
for (u=0; u<rank; u++) {
if (max[u]!=H5S_UNLIMITED && max[u]<dims[u]) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
@@ -1684,12 +1682,23 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/],
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"no dimensions specified");
}
- if (maxdims) {
- for (i=0; i<rank; i++) {
+ /* Check whether the current dimensions are valid */
+ for (i=0; i<rank; i++) {
+ if (maxdims) {
if (H5S_UNLIMITED!=maxdims[i] && maxdims[i]<dims[i]) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"maxdims is smaller than dims");
}
+ if (H5S_UNLIMITED!=maxdims[i] && dims[i]==0) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
+ "zero sized dimension for non-unlimited dimension");
+ }
+ }
+ else {
+ if (dims[i]==0) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
+ "zero sized dimension for non-unlimited dimension");
+ }
}
}