From 9062c8583fa0ecb1609f9f3847fb6ac2bd16497c Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Thu, 14 Apr 2011 14:16:53 -0500 Subject: [svn-r20498] 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. I brought the changes from the trunk. Tested on jam - a simple change. --- src/H5S.c | 17 ++--------------- test/th5s.c | 8 ++++++++ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/H5S.c b/src/H5S.c index f002500..21029ef 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1161,13 +1161,8 @@ H5Sis_simple(hid_t space_id) Verifies that each element of DIMS is not equal to H5S_UNLIMITED. Raymond Lu 03/30/2011 - We allow 0-dimension for non-unlimited dimension starting from 1.8.7 + We allow 0 dimension size for non-unlimited dimension starting from 1.8.7 release. - - Raymond Lu 04/11/2011 - I added a condition check to make sure the new size won't exceed the - current maximal size when this function is called to change the - dimension size of an existent dataspace. --------------------------------------------------------------------------*/ herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], @@ -1202,14 +1197,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 7c7a95a..a5ef605 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -788,6 +788,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"); -- cgit v0.12