summaryrefslogtreecommitdiffstats
path: root/src/H5Oattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Oattr.c')
-rw-r--r--src/H5Oattr.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index c96a2ce..951ffbb 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -94,7 +94,7 @@ H5O_attr_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
H5A_t *attr = NULL;
H5S_simple_t *simple; /*simple dimensionality information */
size_t name_len; /*attribute name length */
- int version; /*message version number*/
+ int version; /*message version number*/
FUNC_ENTER(H5O_attr_decode, NULL);
@@ -102,17 +102,13 @@ H5O_attr_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
assert(f);
assert(p);
- if (NULL==(attr = H5MM_calloc(sizeof(H5A_t)))) {
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
- "memory allocation failed");
- }
+ if (NULL==(attr = H5MM_calloc(sizeof(H5A_t))))
+ HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
/* Version number */
version = *p++;
- if (version!=H5O_ATTR_VERSION) {
- HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
- "bad version number for attribute message");
- }
+ if (version!=H5O_ATTR_VERSION)
+ HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for attribute message");
/* Reserved */
p++;
@@ -126,25 +122,19 @@ H5O_attr_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
UINT16DECODE(p, attr->ds_size);
/* Decode and store the name */
- if (NULL==(attr->name=H5MM_malloc(name_len))) {
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
- "memory allocation failed");
- }
+ if (NULL==(attr->name=H5MM_malloc(name_len)))
+ HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
HDmemcpy(attr->name,p,name_len);
p += H5O_ALIGN(name_len); /* advance the memory pointer */
/* decode the attribute datatype */
- if((attr->dt=(H5O_DTYPE->decode)(f,p,NULL))==NULL) {
- HRETURN_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL,
- "can't decode attribute datatype");
- }
+ if((attr->dt=(H5O_DTYPE->decode)(f,p,NULL))==NULL)
+ HRETURN_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype");
p += H5O_ALIGN(attr->dt_size);
/* decode the attribute dataspace */
- if (NULL==(attr->ds = H5FL_ALLOC(H5S_t,1))) {
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
- "memory allocation failed");
- }
+ if (NULL==(attr->ds = H5FL_ALLOC(H5S_t,1)))
+ HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
if((simple=(H5O_SDSPACE->decode)(f,p,NULL))!=NULL) {
attr->ds->extent.type = H5S_SIMPLE;
HDmemcpy(&(attr->ds->extent.u.simple),simple, sizeof(H5S_simple_t));
@@ -155,13 +145,11 @@ H5O_attr_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
p += H5O_ALIGN(attr->ds_size);
/* Compute the size of the data */
- attr->data_size=H5S_get_simple_extent_npoints(attr->ds)*H5T_get_size(attr->dt);
+ H5_ASSIGN_OVERFLOW(attr->data_size,H5S_get_simple_extent_npoints(attr->ds)*H5T_get_size(attr->dt),hsize_t,size_t);
/* Go get the data */
- if (NULL==(attr->data = H5MM_malloc(attr->data_size))) {
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
- "memory allocation failed");
- }
+ if (NULL==(attr->data = H5MM_malloc(attr->data_size)))
+ HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
HDmemcpy(attr->data,p,attr->data_size);
/* Indicate that the fill values aren't to be written out */