From 824dc864bf953e2866a83c03d3bb209b0195fa0b Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Thu, 14 Apr 2011 12:24:03 -0500 Subject: [PATCH] [svn-r20496] Bug 1386 - allow dimension size to be zero even though it isn't unlimited. I made a change in H5Sset_extent_simple to forbid setting the dimension size bigger than existing maximal size. In this checkin, I restored it to the previous behavior that any change will wipe out previous record of dimensionality. Tested on jam - a simple change. --- src/H5S.c | 10 +--------- test/th5s.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/H5S.c b/src/H5S.c index f0025003f8..13e74de7c5 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1202,14 +1202,6 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], } } - /* Check through all the dimensions to see if the new dimension size exceeds the current - * size or if the new maximal size exceeds the current maximal size */ - for(u = 0; u < space->extent.rank; u++) { - if(space->extent.max && H5S_UNLIMITED!=space->extent.max[u] && - (space->extent.max[u]extent.max[u]extent.max && H5S_UNLIMITED != space->extent.max[u] && space->extent.max[u] < size[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "dimension cannot be modified") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "dimension cannot exceed the existing maximal size") /* Indicate that dimension size can be modified */ ret_value = TRUE; diff --git a/test/th5s.c b/test/th5s.c index 916feb69b4..d0d176a4f9 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -145,8 +145,6 @@ test_h5s_basic(void) "H5Sget_simple_extent_dims"); /* Change max dims to be equal to the dimensions */ - /*ret = H5Sset_extent_simple(sid1, SPACE1_RANK, dims1, max2); - CHECK(ret, FAIL, "H5Sset_extent_simple");*/ ret = H5Sset_extent_simple(sid1, SPACE1_RANK, dims1, NULL); CHECK(ret, FAIL, "H5Sset_extent_simple"); rank = H5Sget_simple_extent_dims(sid1, tdims, tmax); @@ -785,6 +783,14 @@ test_h5s_zero_dim(void) } } + /* Now extend the first dimension size of the dataset to SPACE1_DIM1*3 past the maximal size. + * It is supposed to fail. */ + extend_dims[0] = SPACE1_DIM1*3; + H5E_BEGIN_TRY { + ret = H5Dset_extent(dset1, extend_dims); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Dset_extent"); + ret = H5Pclose(plist_id); CHECK(ret, FAIL, "H5Pclose");