summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/H5Aint.c22
-rw-r--r--src/H5Defl.c8
-rw-r--r--src/H5FDmulti.c24
-rw-r--r--src/H5FS.c2
-rw-r--r--src/H5FSpkg.h2
-rw-r--r--src/H5FSsection.c2
-rw-r--r--src/H5Fprivate.h2
-rw-r--r--src/H5Gnode.c2
-rw-r--r--src/H5Gpkg.h2
-rw-r--r--src/H5Oprivate.h2
-rw-r--r--src/H5Spoint.c10
-rw-r--r--src/H5Tvlen.c10
12 files changed, 50 insertions, 38 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) {
diff --git a/src/H5Defl.c b/src/H5Defl.c
index cf1b36c..387cbe3 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -286,13 +286,13 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size
HDassert(buf);
if(u >= efl->nused)
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file")
- if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip))
+ if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip))
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
if((fd = HDopen(full_name, O_RDONLY, 0)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
- if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
+ if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
tempto_read = MIN((size_t)(efl->slot[u].size-skip), (hsize_t)size);
@@ -378,7 +378,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
HDassert(buf);
if(u >= efl->nused)
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file")
- if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip))
+ if(H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip))
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
@@ -388,7 +388,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
else
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
} /* end if */
- if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0)
+ if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
#ifndef NDEBUG
tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size);
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 0e49813..d0dfab3 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -44,16 +44,22 @@
#endif
/* Loop through all mapped files */
-#define UNIQUE_MEMBERS(MAP,LOOPVAR) { \
- H5FD_mem_t _unmapped, LOOPVAR; \
- unsigned _seen[H5FD_MEM_NTYPES]; \
+#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) { \
+ H5FD_mem_t ITER, LOOPVAR; \
+ unsigned SEEN[H5FD_MEM_NTYPES]; \
\
- memset(_seen, 0, sizeof _seen); \
- for (_unmapped=H5FD_MEM_SUPER; _unmapped<H5FD_MEM_NTYPES; _unmapped=(H5FD_mem_t)(_unmapped+1)) { \
- LOOPVAR = MAP[_unmapped]; \
- if (H5FD_MEM_DEFAULT==LOOPVAR) LOOPVAR=_unmapped; \
+ memset(SEEN, 0, sizeof SEEN); \
+ for (ITER=H5FD_MEM_SUPER; ITER<H5FD_MEM_NTYPES; ITER=(H5FD_mem_t)(ITER+1)) { \
+ LOOPVAR = MAP[ITER]; \
+ if (H5FD_MEM_DEFAULT==LOOPVAR) LOOPVAR=ITER; \
assert(LOOPVAR>0 && LOOPVAR<H5FD_MEM_NTYPES); \
- if (_seen[LOOPVAR]++) continue; \
+ if (SEEN[LOOPVAR]++) continue; \
+
+/* Need two front-ends, since they are nested sometimes */
+#define UNIQUE_MEMBERS(MAP, LOOPVAR) \
+ UNIQUE_MEMBERS_CORE(MAP, _unmapped, _seen, LOOPVAR)
+#define UNIQUE_MEMBERS2(MAP, LOOPVAR) \
+ UNIQUE_MEMBERS_CORE(MAP, _unmapped2, _seen2, LOOPVAR)
#define ALL_MEMBERS(LOOPVAR) { \
H5FD_mem_t LOOPVAR; \
@@ -1904,7 +1910,7 @@ compute_next(H5FD_multi_t *file)
} END_MEMBERS;
UNIQUE_MEMBERS(file->fa.memb_map, mt1) {
- UNIQUE_MEMBERS(file->fa.memb_map, mt2) {
+ UNIQUE_MEMBERS2(file->fa.memb_map, mt2) {
if (file->fa.memb_addr[mt1]<file->fa.memb_addr[mt2] &&
(HADDR_UNDEF==file->memb_next[mt1] ||
file->memb_next[mt1]>file->fa.memb_addr[mt2])) {
diff --git a/src/H5FS.c b/src/H5FS.c
index 19ff8e4..c3b45d2 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -606,7 +606,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list")
/* Set immutable free list parameters */
- H5_CHECKED_ASSIGN(fspace->nclasses, unsigned, nclasses, size_t);
+ H5_CHECKED_ASSIGN(fspace->nclasses, uint16_t, nclasses, size_t);
if(nclasses > 0) {
if(NULL == (fspace->sect_cls = H5FL_SEQ_MALLOC(H5FS_section_class_t, nclasses)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section class array")
diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h
index eafe3c2..54029cc 100644
--- a/src/H5FSpkg.h
+++ b/src/H5FSpkg.h
@@ -85,7 +85,7 @@
H5FS_METADATA_PREFIX_SIZE \
\
/* Free space serialized sections specific fields */ \
- + H5F_SIZEOF_ADDR(f) /* Address of free space header for these sections */ \
+ + (unsigned)H5F_SIZEOF_ADDR(f) /* Address of free space header for these sections */ \
)
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 5638f4f..4697bd50 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -144,7 +144,7 @@ HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr);
/* Set non-zero values */
sinfo->nbins = H5VM_log2_gen(fspace->max_sect_size);
- sinfo->sect_prefix_size = (size_t)H5FS_SINFO_PREFIX_SIZE(f);
+ sinfo->sect_prefix_size = H5FS_SINFO_PREFIX_SIZE(f);
sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8;
sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size);
#ifdef H5FS_SINFO_DEBUG
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 34a5277..8c27edd 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -409,7 +409,7 @@
#endif
#if (H5_SIZEOF_HSIZE_T >= H5_SIZEOF_OFF_T)
# define H5F_OVERFLOW_HSIZET2OFFT(X) \
- ((hsize_t)(X)>=(hsize_t)((hsize_t)1<<(8*sizeof(HDoff_t)-1)))
+ ((hsize_t)(X) >= (hsize_t)((hsize_t)1 << (8 * sizeof(HDoff_t) - 1)))
#else
# define H5F_OVERFLOW_HSIZET2OFFT(X) 0
#endif
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 4d299dc..89d1df8 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -715,7 +715,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
md_key->offset = ent.name_off;
} /* end if */
else {
- idx -= H5F_SYM_LEAF_K(f);
+ idx -= (int)H5F_SYM_LEAF_K(f);
insert_into = snrt;
if(idx == (int)H5F_SYM_LEAF_K(f)) {
rt_key->offset = ent.name_off;
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 4cb6f9b..c994da3 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -55,7 +55,7 @@
+ 2 /* Number of symbols */ \
\
/* Entries */ \
- + ((2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY_FILE(f)) \
+ + ((2 * H5F_SYM_LEAF_K(f)) * (unsigned)H5G_SIZEOF_ENTRY_FILE(f)) \
)
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 44b4998..0acac8c 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -349,7 +349,7 @@ typedef struct H5O_link_t {
typedef struct H5O_efl_entry_t {
size_t name_offset; /*offset of name within heap */
char *name; /*malloc'd name */
- off_t offset; /*offset of data within file */
+ HDoff_t offset; /*offset of data within file */
hsize_t size; /*size allocated within file */
} H5O_efl_entry_t;
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 0f85110..1531bac 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -1125,10 +1125,10 @@ H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
if(((hssize_t)node->pnt[u] + space->select.offset[u]) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
- if(start[u] > (node->pnt[u] + space->select.offset[u]))
- start[u] = node->pnt[u] + space->select.offset[u];
- if(end[u] < (node->pnt[u] + space->select.offset[u]))
- end[u] = node->pnt[u] + space->select.offset[u];
+ if(start[u] > (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]))
+ start[u] = (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]);
+ if(end[u] < (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]))
+ end[u] = (hsize_t)((hssize_t)node->pnt[u] + space->select.offset[u]);
} /* end for */
node = node->next;
} /* end while */
@@ -1703,7 +1703,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
while(NULL != node) {
/* Compute the offset of each selected point in the buffer */
for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) {
- loc += (node->pnt[i] + space->select.offset[i]) * acc;
+ loc += (hsize_t)((hssize_t)node->pnt[i] + space->select.offset[i]) * acc;
acc *= dims[i];
} /* end for */
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 0ed8209..d198d50 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -243,7 +243,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc)
* of an address in this file, plus 4 bytes for the size of a heap
* ID. Memory size is different
*/
- dt->shared->size = 4 + H5F_SIZEOF_ADDR(f) + 4;
+ dt->shared->size = 4 + (size_t)H5F_SIZEOF_ADDR(f) + 4;
/* Set up the function pointers to access the VL information on disk */
/* VL sequences and VL strings are stored identically on disk, so use the same functions */
@@ -801,7 +801,7 @@ H5T_vlen_disk_getptr(void H5_ATTR_UNUSED *vl)
static htri_t
H5T_vlen_disk_isnull(const H5F_t *f, void *_vl)
{
- uint8_t *vl=(uint8_t *)_vl; /* Pointer to the disk VL information */
+ uint8_t *vl = (uint8_t *)_vl; /* Pointer to the disk VL information */
haddr_t addr; /* Sequence's heap address */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -810,12 +810,12 @@ H5T_vlen_disk_isnull(const H5F_t *f, void *_vl)
HDassert(vl);
/* Skip the sequence's length */
- vl+=4;
+ vl += 4;
/* Get the heap address */
- H5F_addr_decode(f,(const uint8_t **)&vl,&addr);
+ H5F_addr_decode(f, (const uint8_t **)&vl, &addr);
- FUNC_LEAVE_NOAPI(addr==0 ? TRUE : FALSE)
+ FUNC_LEAVE_NOAPI(addr == 0 ? TRUE : FALSE)
} /* end H5T_vlen_disk_isnull() */