diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2011-04-13 16:14:16 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2011-04-13 16:14:16 (GMT) |
commit | 2815eefb6b0ea608712e0abbc1d3db0910b4cd80 (patch) | |
tree | 94051a5190c521b35601a023cec1509867a72742 /src/H5Dint.c | |
parent | 49a607c438d7e0135be61d4cb98d5de013f73fa3 (diff) | |
download | hdf5-2815eefb6b0ea608712e0abbc1d3db0910b4cd80.zip hdf5-2815eefb6b0ea608712e0abbc1d3db0910b4cd80.tar.gz hdf5-2815eefb6b0ea608712e0abbc1d3db0910b4cd80.tar.bz2 |
[svn-r20489] Bug 1386 - allow dimension size to be zero even though it isn't unlimited. I brought the changes from the trunk as below:
1. I added test cases for contiguous, compact, and chunked, and external storage datasets, and also attribute.
The test includes dataspace selections.
2. I added a test case of extending dataset of zero dimension size and shrinking back to zero dimension size.
3. I updated the Makefile to include the new data file to be cleaned up.
4. The dataspace code has another bug - when the maximal dimension isn't passed in for H5Sset_extent_simple, it
is supposed to be same as the dimension. The current library sets NULL to it. I corrected it and added a
test case to it.
5. I corrected the tests of Fortran and C++ for the problem in point 3.
Tested on jam, heiwa, and amani.
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r-- | src/H5Dint.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c index 3821b78..0b4392e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1628,16 +1628,23 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al case H5D_COMPACT: /* Check if space is already allocated */ if(NULL == layout->storage.u.compact.buf) { - /* Reserve space in layout header message for the entire array. */ - HDassert(layout->storage.u.compact.size > 0); - if(NULL == (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset") - if(!full_overwrite) - HDmemset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size); - layout->storage.u.compact.dirty = TRUE; - - /* Indicate that we should initialize storage space */ - must_init_space = TRUE; + /* Reserve space in layout header message for the entire array. + * Starting from the 1.8.7 release, we allow dataspace to have + * zero dimension size. So the storage size can be zero. + * SLU 2011/4/4 */ + if(layout->storage.u.compact.size > 0) { + if(NULL == (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset") + if(!full_overwrite) + HDmemset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size); + layout->storage.u.compact.dirty = TRUE; + + /* Indicate that we should initialize storage space */ + must_init_space = TRUE; + } else { + layout->storage.u.compact.dirty = FALSE; + must_init_space = FALSE; + } } /* end if */ break; |