summaryrefslogtreecommitdiffstats
path: root/src/H5Oattr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-07-07 18:54:11 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-07-07 18:54:11 (GMT)
commitec2fbe0883f9e76df60bcfbebbd4b6f62d5a09e6 (patch)
treebd27f9b92053818b5d83de373dfcadbbbc892ee2 /src/H5Oattr.c
parent3e5a61c9ff7a22589dbb2fc71f95f32f919c8b54 (diff)
downloadhdf5-ec2fbe0883f9e76df60bcfbebbd4b6f62d5a09e6.zip
hdf5-ec2fbe0883f9e76df60bcfbebbd4b6f62d5a09e6.tar.gz
hdf5-ec2fbe0883f9e76df60bcfbebbd4b6f62d5a09e6.tar.bz2
[svn-r30158] Description:
More warning cleanups. This brings us down to ~1300 warnings in 167 files Tested on: MacOSX/64 10.11.5 (amazon) w/serial & parallel (h5committest forthcoming)
Diffstat (limited to 'src/H5Oattr.c')
-rw-r--r--src/H5Oattr.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 9cbcdc4..064c4cb 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -128,6 +128,9 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
H5A_t *attr = NULL;
H5S_extent_t *extent; /*extent dimensionality information */
size_t name_len; /*attribute name length */
+ size_t dt_size; /* Datatype size */
+ hssize_t sds_size; /* Signed Dataspace size */
+ hsize_t ds_size; /* Dataspace size */
unsigned flags = 0; /* Attribute flags */
H5A_t *ret_value = NULL; /* Return value */
@@ -199,7 +202,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
/* Decode attribute's dataspace extent */
if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, open_oh,
- ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
+ ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information to the dataspace */
@@ -217,8 +220,19 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
else
p += attr->shared->ds_size;
+ /* Get the datatype's size */
+ if(0 == (dt_size = H5T_get_size(attr->shared->dt)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get datatype size")
+
+ /* Get the datatype & dataspace sizes */
+ if(0 == (dt_size = H5T_get_size(attr->shared->dt)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get datatype size")
+ if((sds_size = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get dataspace size")
+ ds_size = (hsize_t)sds_size;
+
/* Compute the size of the data */
- H5_CHECKED_ASSIGN(attr->shared->data_size, size_t, H5S_GET_EXTENT_NPOINTS(attr->shared->ds) * H5T_get_size(attr->shared->dt), hsize_t);
+ H5_CHECKED_ASSIGN(attr->shared->data_size, size_t, ds_size * (hsize_t)dt_size, hsize_t);
/* Go get the data */
if(attr->shared->data_size) {