diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-09-10 19:53:38 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-09-10 19:53:38 (GMT) |
commit | d517c77bc0fe9c9dbfd013d720e1533289decd9f (patch) | |
tree | 97f369888eccbb8455ebbc2fd6de9f6834f6b433 /src/H5Defl.c | |
parent | fc7993a9f068319ed35f13fd153feeb5da3d86a7 (diff) | |
download | hdf5-d517c77bc0fe9c9dbfd013d720e1533289decd9f.zip hdf5-d517c77bc0fe9c9dbfd013d720e1533289decd9f.tar.gz hdf5-d517c77bc0fe9c9dbfd013d720e1533289decd9f.tar.bz2 |
[svn-r15610] Description:
Bring r15609 back from trunk:
Omnibus compiler warning cleanup & some formatting happiness.
Tested on:
Mac OS X/32 10.5.4 (amazon)
Too minor to require h5committest
Diffstat (limited to 'src/H5Defl.c')
-rw-r--r-- | src/H5Defl.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/H5Defl.c b/src/H5Defl.c index 15bcd60..1fe0f37 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -110,7 +110,7 @@ static herr_t H5D_efl_new(H5F_t *f, hid_t UNUSED dxpl_id, H5D_t *dset, const H5P_genplist_t *dc_plist) { - const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ + size_t dt_size; /* Size of datatype */ hsize_t dim[H5O_LAYOUT_NDIMS]; /* Current size of data in elements */ hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ hssize_t tmp_size; /* Temporary holder for raw data size */ @@ -141,6 +141,10 @@ H5D_efl_new(H5F_t *f, hid_t UNUSED dxpl_id, H5D_t *dset, if(max_dim[i] > dim[i]) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "only the first dimension can be extendible") + /* Retrieve the size of the dataset's datatype */ + if(0 == (dt_size = H5T_get_size(dset->shared->type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") + /* Check for storage overflows */ max_points = H5S_get_npoints_max(dset->shared->space); max_storage = H5O_efl_total_size(&dset->shared->dcpl_cache.efl); @@ -148,13 +152,13 @@ H5D_efl_new(H5F_t *f, hid_t UNUSED dxpl_id, H5D_t *dset, if(H5O_EFL_UNLIMITED != max_storage) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unlimited data space but finite storage") } /* end if */ - else if(max_points * H5T_get_size(type) < max_points) + else if((max_points * dt_size) < max_points) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data space * type size overflowed") - else if(max_points * H5T_get_size(type) > max_storage) + else if((max_points * dt_size) > max_storage) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "data space size exceeds external storage size") /* Compute the total size of dataset */ - tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * H5T_get_size(type); + tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * dt_size; H5_ASSIGN_OVERFLOW(dset->shared->layout.u.contig.size, tmp_size, hssize_t, hsize_t); /* Get the sieve buffer size for this dataset */ |