diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-01-12 19:56:59 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-01-12 19:56:59 (GMT) |
commit | 093c2fea18fa2266e4707ba7a21c7160516b5533 (patch) | |
tree | a621c0236afe2b3b4d13252e9d5e4abb0e581946 /src/H5D.c | |
parent | a1551e334d3cae6a4c0aa1e075a9f397648dddb3 (diff) | |
download | hdf5-093c2fea18fa2266e4707ba7a21c7160516b5533.zip hdf5-093c2fea18fa2266e4707ba7a21c7160516b5533.tar.gz hdf5-093c2fea18fa2266e4707ba7a21c7160516b5533.tar.bz2 |
[svn-r3280] Purpose:
Bug fix
Description:
Datasets were allowed to be created with chunks larger than the maximum
dimension for each dimension.
Solution:
Compare chunk sizes against maximum dimensions and reject dataset creations
which have chunks too large for the dimensions in the dataspace.
Platforms tested:
FreeBSD 4.2 (hawkwind)
Diffstat (limited to 'src/H5D.c')
-rw-r--r-- | src/H5D.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1055,6 +1055,23 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL, "external storage not supported with chunked layout"); } + + /* + * The chunk size of a dimension with a fixed size cannot exceed + * the maximum dimension size + */ + if (H5S_get_simple_extent_dims(space, NULL, max_dim)<0) { + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, + "unable to query maximum dimensions"); + } + for (u=0; u<new_dset->layout.ndims-1; u++) { + if (max_dim[u]!=H5S_UNLIMITED && max_dim[u]<new_dset->create_parms->chunk_size[u]) { + HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, + "chunk size must be <= maximum dimension size for fixed-sized dimensions"); + } + } + + /* Set the dataset's chunk sizes from the property list's chunk sizes */ for (u=0; u<new_dset->layout.ndims-1; u++) { new_dset->layout.dim[u] = new_dset->create_parms->chunk_size[u]; } |