summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1998-04-28 22:32:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1998-04-28 22:32:41 (GMT)
commit07ca2821d2cb4ea87b2cab27ae55efb2fabc2ac4 (patch)
tree82fc5851cbfb6180238aa363b8f1716daa64d92e /src/H5D.c
parentdce73e919fc77959ed7653b0ab330a6952494547 (diff)
downloadhdf5-07ca2821d2cb4ea87b2cab27ae55efb2fabc2ac4.zip
hdf5-07ca2821d2cb4ea87b2cab27ae55efb2fabc2ac4.tar.gz
hdf5-07ca2821d2cb4ea87b2cab27ae55efb2fabc2ac4.tar.bz2
[svn-r379] Fleshed out code for scalar dataspace support.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 5027844..90ed3d0 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -780,32 +780,36 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to initialize contiguous storage");
}
- for (i=1; i<ndims; i++) {
- if (max_dim[i]>new_dset->layout.dim[i]) {
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
- "only the first dimension can be extendible");
- }
- }
- if (efl->nused>0) {
- hsize_t max_points = H5S_get_npoints_max (space);
- hsize_t max_storage = H5O_efl_total_size (efl);
-
- if (H5S_UNLIMITED==max_points) {
- if (H5O_EFL_UNLIMITED!=max_storage) {
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
- "unlimited data space but finite storage");
- }
- } else if (max_points * H5T_get_size (type) < max_points) {
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
- "data space * type size overflowed");
- } else if (max_points * H5T_get_size (type) > max_storage) {
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
- "data space size exceeds external storage size");
- }
- } else if (max_dim[0]>new_dset->layout.dim[0]) {
- HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL,
- "extendible contiguous non-external dataset");
- }
+
+ /* Don't go through all these checks for scalar dataspaces */
+ if(ndims>0) {
+ for (i=1; i<ndims; i++) {
+ if (max_dim[i]>new_dset->layout.dim[i]) {
+ HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
+ "only the first dimension can be extendible");
+ }
+ }
+ if (efl->nused>0) {
+ hsize_t max_points = H5S_get_npoints_max (space);
+ hsize_t max_storage = H5O_efl_total_size (efl);
+
+ if (H5S_UNLIMITED==max_points) {
+ if (H5O_EFL_UNLIMITED!=max_storage) {
+ HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
+ "unlimited data space but finite storage");
+ }
+ } else if (max_points * H5T_get_size (type) < max_points) {
+ HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
+ "data space * type size overflowed");
+ } else if (max_points * H5T_get_size (type) > max_storage) {
+ HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
+ "data space size exceeds external storage size");
+ }
+ } else if (max_dim[0]>new_dset->layout.dim[0]) {
+ HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL,
+ "extendible contiguous non-external dataset");
+ }
+ }
break;
case H5D_CHUNKED: