summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5FSstat.c2
-rw-r--r--src/H5Oattr.c18
2 files changed, 17 insertions, 3 deletions
diff --git a/src/H5FSstat.c b/src/H5FSstat.c
index d2c0177..3200849 100644
--- a/src/H5FSstat.c
+++ b/src/H5FSstat.c
@@ -96,7 +96,7 @@ H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats)
stats->serial_sect_count = frsp->serial_sect_count;
stats->ghost_sect_count = frsp->ghost_sect_count;
stats->addr = frsp->addr;
- stats->hdr_size = (size_t)H5FS_HEADER_SIZE(f);
+ stats->hdr_size = (hsize_t)H5FS_HEADER_SIZE(f);
stats->sect_addr = frsp->sect_addr;
stats->alloc_sect_size = frsp->alloc_sect_size;
stats->sect_size = frsp->sect_size;
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) {