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/H5Dchunk.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/H5Dchunk.c')
-rw-r--r-- | src/H5Dchunk.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index ab1a975..39613f5 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -378,8 +378,9 @@ done: static herr_t H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset) { - const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ - hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ + const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ + hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ + hsize_t dims[H5O_LAYOUT_NDIMS]; /* Dimension size of data in elements */ uint64_t chunk_size; /* Size of chunk in bytes */ int ndims; /* Rank of dataspace */ unsigned u; /* Local index variable */ @@ -413,7 +414,7 @@ H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset) dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(type); /* Get local copy of dataset dimensions (for sanity checking) */ - if(H5S_get_simple_extent_dims(dset->shared->space, NULL, max_dim) < 0) + if(H5S_get_simple_extent_dims(dset->shared->space, dims, max_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to query maximum dimensions") /* Sanity check dimensions */ @@ -424,9 +425,10 @@ H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset) /* * The chunk size of a dimension with a fixed size cannot exceed - * the maximum dimension size + * the maximum dimension size. If any dimension size is zero, there + * will be no such restriction. */ - if(max_dim[u] != H5S_UNLIMITED && max_dim[u] < dset->shared->layout.u.chunk.dim[u]) + if(dims[u] && max_dims[u] != H5S_UNLIMITED && max_dims[u] < dset->shared->layout.u.chunk.dim[u]) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be <= maximum dimension size for fixed-sized dimensions") } /* end for */ |