summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5HG.c2
-rw-r--r--src/H5HP.c3
-rw-r--r--src/H5MFaggr.c2
-rw-r--r--src/H5SL.c16
-rw-r--r--src/H5Tbit.c67
-rw-r--r--src/H5Tconv.c8
-rw-r--r--src/H5Tpkg.h4
-rw-r--r--src/H5private.h16
8 files changed, 59 insertions, 59 deletions
diff --git a/src/H5HG.c b/src/H5HG.c
index f95b607..c33b85f 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -183,7 +183,7 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size)
* which was always at least H5HG_ALIGNMENT aligned then we could just
* align the pointer, but this might not be the case.
*/
- n = H5HG_ALIGN(p - heap->chunk) - (size_t)(p - heap->chunk);
+ n = (size_t)H5HG_ALIGN(p - heap->chunk) - (size_t)(p - heap->chunk);
#ifdef OLD_WAY
/* Don't bother zeroing out the rest of the info in the heap -QAK */
HDmemset(p, 0, n);
diff --git a/src/H5HP.c b/src/H5HP.c
index f6fb20c..78e9e5b 100644
--- a/src/H5HP.c
+++ b/src/H5HP.c
@@ -848,7 +848,8 @@ H5HP_decr(H5HP_t *heap, unsigned amt, void *_obj)
HDassert(obj_loc>0 && obj_loc<=heap->nobjs);
/* Change the heap object's priority */
- heap->heap[obj_loc].val-=amt;
+ H5_CHECK_OVERFLOW(amt, unsigned, int);
+ heap->heap[obj_loc].val-=(int)amt;
/* Restore heap condition */
if(heap->type==H5HP_MAX_HEAP) {
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 40f3ac0..f2c5936 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -414,7 +414,7 @@ H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type,
/* If the aggregator is at the end of file: */
if(H5F_addr_eq(eoa, aggr->addr + aggr->size)) {
/* If extra_requested is below percentage threshold, extend block into the aggregator. */
- if(extra_requested <= (EXTEND_THRESHOLD * aggr->size)) {
+ if(extra_requested <= (hsize_t)(EXTEND_THRESHOLD * (float)aggr->size)) {
aggr->size -= extra_requested;
aggr->addr += extra_requested;
diff --git a/src/H5SL.c b/src/H5SL.c
index 1cd64ec..f9d7654 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -1286,12 +1286,12 @@ done:
void *
H5SL_remove_first(H5SL_t *slist)
{
- void *ret_value = NULL; /* Return value */
- H5SL_node_t *head = slist->header; /* Skip list header */
- H5SL_node_t *tmp = slist->header->forward[0]; /* Temporary node pointer */
- H5SL_node_t *next; /* Next node to search for */
- size_t level = slist->curr_level; /* Skip list level */
- size_t i; /* Index */
+ void *ret_value = NULL; /* Return value */
+ H5SL_node_t *head = slist->header; /* Skip list header */
+ H5SL_node_t *tmp = slist->header->forward[0]; /* Temporary node pointer */
+ H5SL_node_t *next; /* Next node to search for */
+ size_t level; /* Skip list level */
+ size_t i; /* Index */
FUNC_ENTER_NOAPI_NOINIT
@@ -1301,6 +1301,10 @@ H5SL_remove_first(H5SL_t *slist)
/* Not currently supported */
HDassert(!slist->safe_iterating);
+ /* Assign level */
+ H5_CHECK_OVERFLOW(slist->curr_level, int, size_t);
+ level = (size_t)slist->curr_level;
+
/* Check internal consistency */
/* (Pre-condition) */
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index 8c53066..a6b917f 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -514,22 +514,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T__bit_inc
+ * Function: H5T__bit_inc
*
- * Purpose: Increment part of a bit field by adding 1. The bit field
+ * Purpose: Increment part of a bit field by adding 1. The bit field
* starts with bit position START and is SIZE bits long.
*
- * Return: Success: The carry-out value. One if overflows,
- * zero otherwise.
- *
- * Failure: Negative
+ * Return: The carry-out value. TRUE if overflows, FALSE otherwise.
*
* Programmer: Robb Matzke
* Friday, June 26, 1998
*
*-------------------------------------------------------------------------
*/
-htri_t
+hbool_t
H5T__bit_inc(uint8_t *buf, size_t start, size_t size)
{
size_t idx = start / 8;
@@ -545,38 +542,38 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size)
/* The first partial byte */
if(start) {
- if(size + start < 8)
+ if(size + start < 8)
mask = ((unsigned)1 << size) - 1;
- else
+ else
mask = ((unsigned)1 << (8 - start)) - 1;
- acc = ((unsigned)buf[idx] >> start) & mask;
- acc++;
- carry = acc & ((unsigned)1 << MIN(size, 8 - start));
- buf[idx] &= (uint8_t)(~(mask << start));
- buf[idx] = (uint8_t)(buf[idx] | ((acc & mask) << start));
- size -= MIN(size, 8 - start);
- start = 0;
- idx++;
+ acc = ((unsigned)buf[idx] >> start) & mask;
+ acc++;
+ carry = acc & ((unsigned)1 << MIN(size, 8 - start));
+ buf[idx] &= (uint8_t)(~(mask << start));
+ buf[idx] = (uint8_t)(buf[idx] | ((acc & mask) << start));
+ size -= MIN(size, 8 - start);
+ start = 0;
+ idx++;
} /* end if */
/* The middle */
while(carry && size >= 8) {
- acc = buf[idx];
- acc++;
- carry = acc & 0x100;
- buf[idx] = acc & 0xff;
- idx++;
- size -= 8;
+ acc = buf[idx];
+ acc++;
+ carry = acc & 0x100;
+ buf[idx] = acc & 0xff;
+ idx++;
+ size -= 8;
} /* end while */
/* The last bits */
if(carry && size > 0) {
- mask = ((unsigned)1 << size) - 1;
- acc = buf[idx] & mask;
- acc++;
- carry = acc & ((unsigned)1 << size);
- buf[idx] &= (uint8_t)(~mask);
- buf[idx] |= (uint8_t)(acc & mask);
+ mask = ((unsigned)1 << size) - 1;
+ acc = buf[idx] & mask;
+ acc++;
+ carry = acc & ((unsigned)1 << size);
+ buf[idx] &= (uint8_t)(~mask);
+ buf[idx] |= (uint8_t)(acc & mask);
} /* end if */
FUNC_LEAVE_NOAPI(carry ? TRUE : FALSE)
@@ -586,20 +583,18 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size)
/*-------------------------------------------------------------------------
* Function: H5T__bit_dec
*
- * Purpose: decrement part of a bit field by substracting 1. The bit
+ * Purpose: Decrement part of a bit field by substracting 1. The bit
* field starts with bit position START and is SIZE bits long.
*
- * Return: Success: The "borrow-in" value. It's one if underflows,
- * zero otherwise.
+ * Return: The "borrow-in" value. It's TRUE if underflows, FALSE
+ * otherwise.
*
- * Failure: Negative
- *
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* March 17, 2004
*
*-------------------------------------------------------------------------
*/
-htri_t
+hbool_t
H5T__bit_dec(uint8_t *buf, size_t start, size_t size)
{
size_t idx = start / 8;
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 8b96d22..23ccd98 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -4032,7 +4032,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
size_t mpos; /*offset to useful mant is src */
uint64_t sign; /*source sign bit value */
size_t mrsh; /*amount to right shift mantissa*/
- hbool_t carry = 0; /*carry after rounding mantissa */
+ hbool_t carry = FALSE; /*carry after rounding mantissa */
size_t i; /*miscellaneous counters */
size_t implied; /*destination implied bits */
hbool_t denormalized = FALSE; /*is either source or destination denormalized?*/
@@ -4408,7 +4408,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Don't do rounding if exponent is 111...110 and mantissa is 111...11.
* To do rounding and increment exponent in this case will create an infinity value.*/
if((H5T__bit_find(s, mpos + (size_t)bitno, msize - (size_t)bitno, H5T_BIT_LSB, FALSE) >= 0 || expo < expo_max - 1)) {
- carry = (hbool_t)H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno);
+ carry = H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno);
if(carry)
implied = 2;
}
@@ -4417,7 +4417,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno);
}
else
- carry=0;
+ carry = FALSE;
/*
* Write the mantissa to the destination
@@ -4480,7 +4480,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
}
/*reset CARRY*/
- carry = 0;
+ carry = FALSE;
H5_CHECK_OVERFLOW(expo,hssize_t,hsize_t);
H5T__bit_set_d(d, dst.u.f.epos, dst.u.f.esize, (hsize_t)expo);
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 0bd1e06..49b0ea0 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -1288,8 +1288,8 @@ H5_DLL void H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size,
uint64_t val);
H5_DLL ssize_t H5T__bit_find(uint8_t *buf, size_t offset, size_t size,
H5T_sdir_t direction, hbool_t value);
-H5_DLL htri_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size);
-H5_DLL htri_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size);
+H5_DLL hbool_t H5T__bit_inc(uint8_t *buf, size_t start, size_t size);
+H5_DLL hbool_t H5T__bit_dec(uint8_t *buf, size_t start, size_t size);
H5_DLL void H5T__bit_neg(uint8_t *buf, size_t start, size_t size);
/* VL functions */
diff --git a/src/H5private.h b/src/H5private.h
index e0ed6ef..d400469 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1515,7 +1515,7 @@ extern char *strdup(const char *s);
#define H5_CHECK_OVERFLOW(var, vartype, casttype) \
{ \
casttype _tmp_overflow = (casttype)(var); \
- assert((var) == (vartype)_tmp_overflow); \
+ HDassert((var) == (vartype)_tmp_overflow); \
}
#else /* NDEBUG */
#define H5_CHECK_OVERFLOW(var, vartype, casttype)
@@ -1529,7 +1529,7 @@ extern char *strdup(const char *s);
{ \
srctype _tmp_src = (srctype)(src); \
dsttype _tmp_dst = (dsttype)(_tmp_src); \
- assert(_tmp_src == (srctype)_tmp_dst); \
+ HDassert(_tmp_src == (srctype)_tmp_dst); \
(dst) = _tmp_dst; \
}
@@ -1540,8 +1540,8 @@ extern char *strdup(const char *s);
{ \
srctype _tmp_src = (srctype)(src); \
dsttype _tmp_dst = (dsttype)(_tmp_src); \
- assert(_tmp_src >= 0); \
- assert(_tmp_src == _tmp_dst); \
+ HDassert(_tmp_src >= 0); \
+ HDassert(_tmp_src == _tmp_dst); \
(dst) = _tmp_dst; \
}
@@ -1552,8 +1552,8 @@ extern char *strdup(const char *s);
{ \
srctype _tmp_src = (srctype)(src); \
dsttype _tmp_dst = (dsttype)(_tmp_src); \
- assert(_tmp_dst >= 0); \
- assert(_tmp_src == (srctype)_tmp_dst); \
+ HDassert(_tmp_dst >= 0); \
+ HDassert(_tmp_src == (srctype)_tmp_dst); \
(dst) = _tmp_dst; \
}
@@ -1561,8 +1561,8 @@ extern char *strdup(const char *s);
{ \
srctype _tmp_src = (srctype)(src); \
dsttype _tmp_dst = (dsttype)(_tmp_src); \
- assert(_tmp_src >= 0); \
- assert(_tmp_src == (srctype)_tmp_dst); \
+ HDassert(_tmp_src >= 0); \
+ HDassert(_tmp_src == (srctype)_tmp_dst); \
(dst) = _tmp_dst; \
}