summaryrefslogtreecommitdiffstats
path: root/src/H5Dchunk.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-04-07 21:56:38 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-04-07 21:56:38 (GMT)
commit4b7f286a45b24de8cb5d08780df21fc7b79542ed (patch)
tree7d02277da5b03000fcc25ef6b6d4f2356e77e634 /src/H5Dchunk.c
parentbaba8a3d59da7ab265900a4e94a7ee47d8856a4e (diff)
downloadhdf5-4b7f286a45b24de8cb5d08780df21fc7b79542ed.zip
hdf5-4b7f286a45b24de8cb5d08780df21fc7b79542ed.tar.gz
hdf5-4b7f286a45b24de8cb5d08780df21fc7b79542ed.tar.bz2
[svn-r20440] Bug 1386 - allow dimension size to be zero even though it isn't unlimited. I added test cases for contiguous, compact, and chunked, and external storage datasets, and also attribute. The test includes dataspace selections. I'll handle the tools in the next step.
Tested on jam, amani, and heiwa.
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r--src/H5Dchunk.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index e7a5bf1..64efc8a 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 */