summaryrefslogtreecommitdiffstats
path: root/src/H5Aint.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-07-22 22:43:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-07-22 22:43:18 (GMT)
commit4af66b09e03af4e9b0b6a1293dfe746f48106aba (patch)
tree0cb162e0921a0a774a433f9d3cd9f08c44bbe57d /src/H5Aint.c
parent9b597a48552f5201b37793a4c6fece4fd9f1c346 (diff)
downloadhdf5-4af66b09e03af4e9b0b6a1293dfe746f48106aba.zip
hdf5-4af66b09e03af4e9b0b6a1293dfe746f48106aba.tar.gz
hdf5-4af66b09e03af4e9b0b6a1293dfe746f48106aba.tar.bz2
[svn-r30219] Description:
More warning cleaups: down to 770 warnings (from ~940) in 134 files (from 148), with 28 unique kinds of warnings (from 31). Tested on: MacOSX/64 10.11.5 (amazon) w/serial & parallel (h5committest forthcoming)
Diffstat (limited to 'src/H5Aint.c')
-rw-r--r--src/H5Aint.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 2730b0b..1b7b830 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -1920,15 +1920,16 @@ H5A_t *
H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_size,
H5O_copy_t *cpy_info, hid_t dxpl_id)
{
- H5A_t *attr_dst = NULL;
-
- /* for dataype conversion */
+ H5A_t *attr_dst = NULL; /* Destination attribute */
hid_t tid_src = -1; /* Datatype ID for source datatype */
hid_t tid_dst = -1; /* Datatype ID for destination datatype */
hid_t tid_mem = -1; /* Datatype ID for memory datatype */
void *buf = NULL; /* Buffer for copying data */
void *reclaim_buf = NULL; /* Buffer for reclaiming data */
hid_t buf_sid = -1; /* ID for buffer dataspace */
+ hssize_t sdst_nelmts; /* # of elements in destination attribute (signed) */
+ size_t dst_nelmts; /* # of elements in destination attribute */
+ size_t dst_dt_size; /* Size of destination attribute datatype */
H5A_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -2014,12 +2015,17 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si
if(attr_dst->shared->dt_size != attr_src->shared->dt_size || attr_dst->shared->ds_size != attr_src->shared->ds_size)
*recompute_size = TRUE;
+ /* Get # of elements for destination attribute's dataspace */
+ if((sdst_nelmts = H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid")
+ H5_CHECKED_ASSIGN(dst_nelmts, size_t, sdst_nelmts, hssize_t);
+
+ /* Get size of destination attribute's datatype */
+ if(0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size")
+
/* Compute the size of the data */
- /* NOTE: This raises warnings. If we are going to be serious about
- * expecting overflow here, we should implement testing similar to
- * that described in CERT bulletins INT30-C and INT32-C.
- */
- H5_CHECKED_ASSIGN(attr_dst->shared->data_size, size_t, H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds) * H5T_get_size(attr_dst->shared->dt), hssize_t);
+ attr_dst->shared->data_size = dst_nelmts * dst_dt_size;
/* Copy (& convert) the data, if necessary */
if(attr_src->shared->data) {