summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-04-23 20:20:57 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-04-23 20:20:57 (GMT)
commit46809b86cf01d9648fc452086f5bcb6783f07dfb (patch)
treefd93ed6d24f10c807e3b83573823a040a5950d56 /src
parent55f2a52191fcbf38d67b698f90e2c876f1b39d02 (diff)
downloadhdf5-46809b86cf01d9648fc452086f5bcb6783f07dfb.zip
hdf5-46809b86cf01d9648fc452086f5bcb6783f07dfb.tar.gz
hdf5-46809b86cf01d9648fc452086f5bcb6783f07dfb.tar.bz2
[svn-r18626] Description:
Bring r18625 from trunk to 1.8 branch: Checkpoint progress on Bz#1398 - strict aliasing issues. (Lots of compiler warnings & code cleanups also) Tested on: Mac OS X/32 10.6.3 (amazon) in debug mode (h5committested on trunk)
Diffstat (limited to 'src')
-rw-r--r--src/H5Tbit.c512
-rw-r--r--src/H5Tconv.c698
-rw-r--r--src/H5Tpkg.h2
3 files changed, 610 insertions, 602 deletions
diff --git a/src/H5Tbit.c b/src/H5Tbit.c
index a5340a6..2c289b0 100644
--- a/src/H5Tbit.c
+++ b/src/H5Tbit.c
@@ -24,9 +24,10 @@
#include "H5private.h" /*generic functions */
#include "H5Eprivate.h" /*error handling */
-#include "H5Iprivate.h" /*ID functions */
#include "H5MMprivate.h" /* Memory management */
#include "H5Tpkg.h" /*data-type functions */
+#include "H5WBprivate.h" /* Wrapped Buffers */
+
/*-------------------------------------------------------------------------
@@ -39,24 +40,22 @@
* Programmer: Robb Matzke
* Wednesday, June 10, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
-H5T_bit_copy (uint8_t *dst, size_t dst_offset, const uint8_t *src,
- size_t src_offset, size_t size)
+H5T_bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src,
+ size_t src_offset, size_t size)
{
- int shift;
- unsigned mask_lo, mask_hi;
- int s_idx, d_idx;
+ unsigned shift;
+ unsigned mask_lo, mask_hi;
+ unsigned s_idx, d_idx;
/*
* Normalize the offset to be a byte number and a bit offset within that
* byte.
*/
- s_idx = (int)src_offset / 8;
- d_idx = (int)dst_offset / 8;
+ s_idx = src_offset / 8;
+ d_idx = dst_offset / 8;
src_offset %= 8;
dst_offset %= 8;
@@ -76,25 +75,27 @@ H5T_bit_copy (uint8_t *dst, size_t dst_offset, const uint8_t *src,
* ...+---------------+---------------+
* dst[d_idx+1] dst[d_idx]
*/
- while (src_offset && size>0) {
- unsigned nbits = (unsigned)MIN3 (size, 8-dst_offset, 8-src_offset);
- unsigned mask = (1<<nbits) - 1;
+ while(src_offset && size > 0) {
+ unsigned nbits = MIN3(size, 8 - dst_offset, 8 - src_offset);
+ unsigned mask = ((unsigned)1 << nbits) - 1;
- dst[d_idx] &= ~(mask<<dst_offset);
- dst[d_idx] |= ((src[s_idx]>>src_offset)&mask) << dst_offset;
+ dst[d_idx] &= (uint8_t)~(mask << dst_offset);
+ dst[d_idx] |= (uint8_t)(((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset);
src_offset += nbits;
- if (src_offset>=8) {
+ if(src_offset >= 8) {
s_idx++;
src_offset %= 8;
- }
+ } /* end if */
+
dst_offset += nbits;
- if (dst_offset>=8) {
+ if(dst_offset >= 8) {
d_idx++;
dst_offset %= 8;
- }
+ } /* end if */
+
size -= nbits;
- }
+ } /* end while */
/*
* The middle bits. We are aligned on a source byte which needs to be
@@ -117,42 +118,44 @@ H5T_bit_copy (uint8_t *dst, size_t dst_offset, const uint8_t *src,
* bits). SHIFT is three since the source must be shifted right three bits
* to line up with the destination.
*/
- shift = (int)dst_offset;
- mask_lo = (1<<(8-shift))-1;
+ shift = dst_offset;
+ mask_lo = ((unsigned)1 << (8 - shift)) - 1;
mask_hi = (~mask_lo) & 0xff;
- for (/*void*/; size>8; size-=8, d_idx++, s_idx++) {
- if (shift) {
- dst[d_idx+0] &= ~(mask_lo<<shift);
- dst[d_idx+0] |= (src[s_idx] & mask_lo) << shift;
- dst[d_idx+1] &= ~(mask_hi>>(8-shift));
- dst[d_idx+1] |= (src[s_idx] & mask_hi) >> (8-shift);
- } else {
+ for(/*void*/; size > 8; size -= 8, d_idx++, s_idx++) {
+ if(shift) {
+ dst[d_idx + 0] &= (uint8_t)(~(mask_lo << shift));
+ dst[d_idx + 0] |= (uint8_t)((src[s_idx] & mask_lo) << shift);
+ dst[d_idx + 1] &= (uint8_t)(~(mask_hi >> (8 - shift)));
+ dst[d_idx + 1] |= (uint8_t)((src[s_idx] & mask_hi) >> (8 - shift));
+ } /* end if */
+ else
dst[d_idx] = src[s_idx];
- }
- }
+ } /* end for */
/* Finish up */
- while (size>0) {
- unsigned nbits = (unsigned)MIN3 (size, 8-dst_offset, 8-src_offset);
- unsigned mask = (1<<nbits) - 1;
+ while(size > 0) {
+ unsigned nbits = (unsigned)MIN3 (size, 8 - dst_offset, 8 - src_offset);
+ unsigned mask = ((unsigned)1 << nbits) - 1;
- dst[d_idx] &= ~(mask<<dst_offset);
- dst[d_idx] |= ((src[s_idx]>>src_offset)&mask) << dst_offset;
+ dst[d_idx] &= (uint8_t)(~(mask << dst_offset));
+ dst[d_idx] |= (uint8_t)(((src[s_idx] >> src_offset) & (uint8_t)mask) << dst_offset);
src_offset += nbits;
- if (src_offset>=8) {
+ if(src_offset >= 8) {
s_idx++;
src_offset %= 8;
- }
+ } /* end if */
+
dst_offset += nbits;
- if (dst_offset>=8) {
+ if(dst_offset >= 8) {
d_idx++;
dst_offset %= 8;
- }
+ } /* end if */
+
size -= nbits;
- }
-}
+ } /* end while */
+} /* end H5T_bit_copy() */
/*-------------------------------------------------------------------------
@@ -173,54 +176,64 @@ H5T_bit_copy (uint8_t *dst, size_t dst_offset, const uint8_t *src,
* Programmer: Raymond Lu
* Monday, April 12, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-void
-H5T_bit_shift (uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size)
+herr_t
+H5T_bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size)
{
- uint8_t *tmp_buf;
+ uint8_t tmp_buf[512]; /* Temporary buffer */
+ H5WB_t *wb = NULL; /* Wrapped buffer for temporary buffer */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_shift);
+ FUNC_ENTER_NOAPI(H5T_bit_shift, FAIL)
/* Sanity check */
- assert(buf);
- assert(size);
-
- if(!shift_dist)
- goto done;
- if((size_t)ABS(shift_dist) >= size) {
- H5T_bit_set(buf, offset, size, 0);
- goto done;
- }
-
- tmp_buf = (uint8_t*)H5MM_calloc(size/8+1);
- assert(tmp_buf);
-
- /* Shift vector by making copies */
- if(shift_dist > 0) { /* left shift */
- /* Copy part to be shifted to a temporary buffer */
- H5T_bit_copy(tmp_buf, (size_t)0, buf, offset, (size_t)(size - shift_dist));
-
- /* Copy it back to the original buffer */
- H5T_bit_copy(buf, offset + shift_dist, tmp_buf, (size_t)0, (size_t)(size - shift_dist));
-
- /* Zero-set the left part*/
- H5T_bit_set(buf, offset, (size_t)shift_dist, 0);
- } else { /* right shift */
- shift_dist = - shift_dist;
- H5T_bit_copy(tmp_buf, (size_t)0, buf, offset + shift_dist, (size_t)(size - shift_dist));
- H5T_bit_copy (buf, offset, tmp_buf, (size_t)0, (size_t)(size - shift_dist));
- H5T_bit_set(buf, offset + size - shift_dist, (size_t)shift_dist, 0);
- }
-
- /* Free temporary buffer */
- H5MM_xfree(tmp_buf);
+ HDassert(buf);
+ HDassert(size);
+
+ if(shift_dist) {
+ size_t abs_shift_dist = (size_t)ABS(shift_dist);
+
+ if(abs_shift_dist >= size)
+ H5T_bit_set(buf, offset, size, 0);
+ else {
+ size_t buf_size = (size / 8) + 1; /* Size of shift buffer needed */
+ uint8_t *shift_buf; /* Pointer to shift buffer */
+
+ /* Wrap the local buffer for serialized header info */
+ if(NULL == (wb = H5WB_wrap(tmp_buf, sizeof(tmp_buf))))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't wrap buffer")
+
+ /* Get a pointer to a buffer that's large enough */
+ if(NULL == (shift_buf = (uint8_t *)H5WB_actual(wb, buf_size)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "can't get actual buffer")
+
+ /* Shift vector by making copies */
+ if(shift_dist > 0) { /* left shift */
+ /* Copy part to be shifted to a temporary buffer */
+ H5T_bit_copy(shift_buf, (size_t)0, buf, offset, size - abs_shift_dist);
+
+ /* Copy it back to the original buffer */
+ H5T_bit_copy(buf, offset + abs_shift_dist, shift_buf, (size_t)0, size - abs_shift_dist);
+
+ /* Zero-set the left part*/
+ H5T_bit_set(buf, offset, abs_shift_dist, 0);
+ } /* end if */
+ else { /* right shift */
+ H5T_bit_copy(shift_buf, (size_t)0, buf, offset + abs_shift_dist, size - abs_shift_dist);
+ H5T_bit_copy(buf, offset, shift_buf, (size_t)0, size - abs_shift_dist);
+ H5T_bit_set(buf, offset + size - abs_shift_dist, abs_shift_dist, 0);
+ } /* end else */
+ } /* end else */
+ } /* end if */
done:
- FUNC_LEAVE_NOAPI_VOID
-}
+ /* Release resources */
+ if(wb && H5WB_unwrap(wb) < 0)
+ HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_bit_shift() */
/*-------------------------------------------------------------------------
@@ -237,20 +250,18 @@ done:
* Programmer: Robb Matzke
* Tuesday, June 23, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
uint64_t
-H5T_bit_get_d (uint8_t *buf, size_t offset, size_t size)
+H5T_bit_get_d(uint8_t *buf, size_t offset, size_t size)
{
- uint64_t val=0;
+ uint64_t val = 0;
size_t i, hs;
uint64_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOFUNC(H5T_bit_get_d)
- assert (8*sizeof(val)>=size);
+ HDassert(8 * sizeof(val) >= size);
H5T_bit_copy((uint8_t*)&val, (size_t)0, buf, offset, size);
switch(H5T_native_order_g) {
@@ -262,20 +273,23 @@ H5T_bit_get_d (uint8_t *buf, size_t offset, size_t size)
uint8_t tmp = ((uint8_t*)&val)[i];
((uint8_t*)&val)[i] = ((uint8_t*)&val)[sizeof(val) - (i + 1)];
((uint8_t*)&val)[sizeof(val) - (i + 1)] = tmp;
- }
+ } /* end for */
break;
+ case H5T_ORDER_ERROR:
+ case H5T_ORDER_VAX:
+ case H5T_ORDER_NONE:
default:
/* Unknown endianness. Bail out. */
HGOTO_DONE(UFAIL)
- }
+ } /* end switch */
/* Set return value */
ret_value = val;
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5T_bit_get_d() */
/*-------------------------------------------------------------------------
@@ -288,35 +302,36 @@ done:
* Programmer: Robb Matzke
* Wednesday, June 24, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
-H5T_bit_set_d (uint8_t *buf, size_t offset, size_t size, uint64_t val)
+H5T_bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val)
{
size_t i, hs;
- assert (8*sizeof(val)>=size);
+ HDassert(8 * sizeof(val) >= size);
- switch (H5T_native_order_g) {
+ switch(H5T_native_order_g) {
case H5T_ORDER_LE:
break;
case H5T_ORDER_BE:
- for (i=0, hs=sizeof(val)/2; i<hs; i++) {
- uint8_t tmp = ((uint8_t*)&val)[i];
- ((uint8_t*)&val)[i] = ((uint8_t*)&val)[sizeof(val)-(i+1)];
- ((uint8_t*)&val)[sizeof(val)-(i+1)] = tmp;
- }
+ for(i = 0, hs = sizeof(val) / 2; i < hs; i++) {
+ uint8_t tmp = ((uint8_t *)&val)[i];
+ ((uint8_t *)&val)[i] = ((uint8_t *)&val)[sizeof(val) - (i + 1)];
+ ((uint8_t *)&val)[sizeof(val) - (i + 1)] = tmp;
+ } /* end for */
break;
+ case H5T_ORDER_ERROR:
+ case H5T_ORDER_VAX:
+ case H5T_ORDER_NONE:
default:
- HDabort ();
- }
+ HDabort();
+ } /* end switch */
H5T_bit_copy(buf, offset, (uint8_t*)&val, (size_t)0, size);
-}
+} /* end H5T_bit_set_d() */
/*-------------------------------------------------------------------------
@@ -335,7 +350,7 @@ H5T_bit_set_d (uint8_t *buf, size_t offset, size_t size, uint64_t val)
*-------------------------------------------------------------------------
*/
void
-H5T_bit_set (uint8_t *buf, size_t offset, size_t size, hbool_t value)
+H5T_bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value)
{
int idx;
@@ -344,32 +359,31 @@ H5T_bit_set (uint8_t *buf, size_t offset, size_t size, hbool_t value)
offset %= 8;
/* The first partial byte */
- if (size && offset%8) {
- size_t nbits = MIN (size, 8-offset);
- unsigned mask = (1<<nbits)-1;
- if (value) {
- buf[idx++] |= mask << offset;
- } else {
- buf[idx++] &= ~(mask << offset);
- }
+ if(size && offset % 8) {
+ size_t nbits = MIN(size, 8 - offset);
+ unsigned mask = ((unsigned)1 << nbits) - 1;
+
+ if(value)
+ buf[idx++] |= (uint8_t)(mask << offset);
+ else
+ buf[idx++] &= (uint8_t)(~(mask << offset));
size -= nbits;
- }
+ } /* end if */
/* The middle bytes */
- while (size>=8) {
+ while(size >= 8) {
buf[idx++] = value ? 0xff : 0x00;
size -= 8;
- }
+ } /* end while */
/* The last partial byte */
- if (size) {
- if (value) {
- buf[idx] |= (1<<size)-1;
- } else {
- buf[idx] &= ~((1<<size)-1);
- }
- }
-}
+ if(size) {
+ if(value)
+ buf[idx] |= (uint8_t)(((unsigned)1 << size) - 1);
+ else
+ buf[idx] &= (uint8_t)(~(((unsigned)1 << size) - 1));
+ } /* end if */
+} /* end H5T_bit_set() */
/*-------------------------------------------------------------------------
@@ -390,8 +404,6 @@ H5T_bit_set (uint8_t *buf, size_t offset, size_t size, hbool_t value)
* Programmer: Robb Matzke
* Wednesday, June 10, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
ssize_t
@@ -401,10 +413,10 @@ H5T_bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction,
ssize_t base = (ssize_t)offset;
ssize_t idx, i;
size_t iu;
- ssize_t ret_value=(-1); /* Return value */
+ ssize_t ret_value = (-1); /* Return value */
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_find);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_find)
/* Some functions call this with value=TRUE */
HDassert(TRUE == 1);
@@ -416,63 +428,64 @@ H5T_bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction,
offset %= 8;
/* Beginning */
- if (offset) {
- for (iu=offset; iu<8 && size>0; iu++, size--) {
- if (value==(hbool_t)((buf[idx]>>iu) & 0x01))
- HGOTO_DONE(8*idx+(ssize_t)iu - base);
- }
+ if(offset) {
+ for(iu = offset; iu < 8 && size > 0; iu++, size--)
+ if(value == (hbool_t)((buf[idx] >> iu) & 0x01))
+ HGOTO_DONE(8 * idx + (ssize_t)iu - base);
+
offset = 0;
idx++;
- }
+ } /* end if */
+
/* Middle */
- while (size>=8) {
- if ((value?0x00:0xff)!=buf[idx]) {
- for (i=0; i<8; i++) {
- if (value==(hbool_t)((buf[idx]>>i) & 0x01))
- HGOTO_DONE(8*idx+i - base);
- }
- }
+ while(size >= 8) {
+ if((value ? 0x00 : 0xff) != buf[idx])
+ for(i = 0; i < 8; i++)
+ if(value == (hbool_t)((buf[idx] >> i) & 0x01))
+ HGOTO_DONE(8 * idx + i - base);
+
size -= 8;
idx++;
- }
+ } /* end while */
+
/* End */
- for (i=0; i<(ssize_t)size; i++) {
- if (value==(hbool_t)((buf[idx]>>i) & 0x01))
- HGOTO_DONE(8*idx+i - base);
- }
+ for(i = 0; i < (ssize_t)size; i++)
+ if(value == (hbool_t)((buf[idx] >> i) & 0x01))
+ HGOTO_DONE(8 * idx + i - base);
break;
case H5T_BIT_MSB:
/* Calculate index */
- idx = (ssize_t)((offset+size-1) / 8);
+ idx = (ssize_t)((offset + size - 1) / 8);
offset %= 8;
/* Beginning */
- if (size>8-offset && (offset+size)%8) {
- for (iu=(offset+size)%8; iu>0; --iu, --size) {
- if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01))
- HGOTO_DONE(8*idx+(ssize_t)(iu-1) - base);
- }
+ if(size > 8 - offset && (offset + size) % 8) {
+ for(iu = (offset + size) % 8; iu > 0; --iu, --size)
+ if(value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01))
+ HGOTO_DONE(8 * idx + (ssize_t)(iu - 1) - base);
+
--idx;
- }
+ } /* end if */
+
/* Middle */
- while (size>=8) {
- if ((value?0x00:0xff)!=buf[idx]) {
- for (i=7; i>=0; --i) {
- if (value==(hbool_t)((buf[idx]>>i) & 0x01))
- HGOTO_DONE(8*idx+i - base);
- }
- }
+ while(size >= 8) {
+ if((value ? 0x00 : 0xff) != buf[idx]) {
+ for(i = 7; i >= 0; --i)
+ if(value == (hbool_t)((buf[idx] >> i) & 0x01))
+ HGOTO_DONE(8 * idx + i - base);
+ } /* end if */
+
size -= 8;
--idx;
- }
+ } /* end while */
+
/* End */
- if (size>0) {
- for (iu=offset+size; iu>offset; --iu) {
- if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01))
- HGOTO_DONE(8*idx+(ssize_t)(iu-1) - base);
- }
- }
+ if(size > 0) {
+ for(iu = offset + size; iu > offset; --iu)
+ if(value == (hbool_t)((buf[idx] >> (iu - 1)) & 0x01))
+ HGOTO_DONE(8 * idx + (ssize_t)(iu - 1) - base);
+ } /* end if */
break;
default:
@@ -480,7 +493,7 @@ H5T_bit_find(uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction,
} /* end switch */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_bit_find() */
@@ -498,8 +511,6 @@ done:
* Programmer: Robb Matzke
* Friday, June 26, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
htri_t
@@ -510,47 +521,50 @@ H5T_bit_inc(uint8_t *buf, size_t start, size_t size)
unsigned acc, mask;
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_inc);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_inc)
+
+ HDassert(buf);
- assert(buf);
start %= 8;
/* The first partial byte */
- if (start) {
- if (size+start<8) mask = (1<<size)-1;
- else mask = (1<<(8-start))-1;
- acc = (buf[idx]>>start) & mask;
+ if(start) {
+ if(size + start < 8)
+ mask = ((unsigned)1 << size) - 1;
+ else
+ mask = ((unsigned)1 << (8 - start)) - 1;
+ acc = ((unsigned)buf[idx] >> start) & mask;
acc += 1;
- carry = acc & (1<<MIN(size, 8-start));
- buf[idx] &= ~(mask<<start);
- buf[idx] |= (acc & mask) << start;
- size -= MIN(size, 8-start);
- start=0;
+ carry = acc & ((unsigned)1 << MIN(size, 8 - start));
+ buf[idx] &= (uint8_t)(~(mask << start));
+ buf[idx] |= (uint8_t)((acc & mask) << start);
+ size -= MIN(size, 8 - start);
+ start = 0;
idx++;
- }
+ } /* end if */
/* The middle */
- while (carry && size>=8) {
+ while(carry && size >= 8) {
acc = buf[idx];
acc += 1;
carry = acc & 0x100;
buf[idx] = acc & 0xff;
idx++;
size -= 8;
- }
+ } /* end while */
/* The last bits */
- if (carry && size>0) {
- mask = (1<<size)-1;
+ if(carry && size > 0) {
+ mask = ((unsigned)1 << size) - 1;
acc = buf[idx] & mask;
acc += 1;
- carry = acc & (1<<size);
- buf[idx] &= ~mask;
- buf[idx] |= acc & mask;
- }
+ carry = acc & ((unsigned)1 << size);
+ buf[idx] &= (uint8_t)(~mask);
+ buf[idx] |= (uint8_t)(acc & mask);
+ } /* end if */
- FUNC_LEAVE_NOAPI(carry ? TRUE : FALSE);
-}
+ FUNC_LEAVE_NOAPI(carry ? TRUE : FALSE)
+} /* end H5T_bit_inc() */
/*-------------------------------------------------------------------------
@@ -567,8 +581,6 @@ H5T_bit_inc(uint8_t *buf, size_t start, size_t size)
* Programmer: Raymond Lu
* March 17, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
htri_t
@@ -580,13 +592,13 @@ H5T_bit_dec(uint8_t *buf, size_t start, size_t size)
unsigned borrow = 0;
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_dec);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_dec)
- assert(buf);
- assert(size);
+ HDassert(buf);
+ HDassert(size);
/* The first partial byte */
- if ((size+start-1)/8 > idx) { /*bit sequence doesn't end in the same byte as starts*/
+ if((size + start - 1) / 8 > idx) { /*bit sequence doesn't end in the same byte as starts*/
/* Example: a sequence like 11000100 and start = 3. We substract 00001000 from
* it and get 10111100. If a sequence is 00000111, we do right shift for START
* bits and get 00000000. So we need to borrow from higher byte when we substract
@@ -597,42 +609,41 @@ H5T_bit_dec(uint8_t *buf, size_t start, size_t size)
buf[idx] -= 1 << pos;
idx++;
size -= (8 - pos);
- } else { /* bit sequence ends in the same byte as starts */
+
+ /* The middle bytes */
+ while(borrow && size >= 8) {
+ if(buf[idx])
+ borrow = 0;
+ buf[idx] -= 1;
+
+ idx++;
+ size -= 8;
+ } /* end while */
+
+ /* The last partial byte */
+ if(borrow && size > 0) {
+ /* Similar to the first byte case, where sequence ends in the same byte as starts */
+ tmp = buf[idx];
+ buf[idx] -= 1;
+ if((buf[idx] >> size) != tmp >> size)
+ buf[idx] += 1 << size;
+ } /* end if */
+ } /* end if */
+ else { /* bit sequence ends in the same byte as starts */
/* Example: a sequence like 11000100 and pos=3, size=3. We substract 00001000
* and get 10111100. A bit is borrowed from 6th bit(buf[idx]>>6=00000010, tmp>>6=00000011,
* not equal). We need to put this bit back by increment 1000000.
*/
tmp = buf[idx];
buf[idx] -= 1 << pos;
- if((buf[idx] >> (pos+size)) != tmp >> (pos+size)) {
- buf[idx] += 1 << (pos+size);
+ if((buf[idx] >> (pos + size)) != tmp >> (pos + size)) {
+ buf[idx] += 1 << (pos + size);
borrow = 1;
- }
- goto done;
- }
+ } /* end if */
+ } /* end else */
- /* The middle bytes */
- while (borrow && size>=8) {
- if(buf[idx])
- borrow = 0;
- buf[idx] -= 1;
-
- idx++;
- size -= 8;
- }
-
- /* The last partial byte */
- if (borrow && size>0) {
- /* Similar to the first byte case, where sequence ends in the same byte as starts */
- tmp = buf[idx];
- buf[idx] -= 1;
- if((buf[idx] >> size) != tmp >> size)
- buf[idx] += 1 << size;
- }
-
-done:
- FUNC_LEAVE_NOAPI(borrow ? TRUE : FALSE);
-}
+ FUNC_LEAVE_NOAPI(borrow ? TRUE : FALSE)
+} /* end H5T_bit_dec() */
/*-------------------------------------------------------------------------
@@ -646,8 +657,6 @@ done:
* Programmer: Raymond Lu
* March 19, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -660,38 +669,37 @@ H5T_bit_neg(uint8_t *buf, size_t start, size_t size)
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_bit_neg);
- assert(buf);
- assert(size);
+ HDassert(buf);
+ HDassert(size);
/* The first partial byte */
tmp = buf[idx];
- tmp = ~tmp;
+ tmp = (uint8_t)~tmp;
/* Simply copy the negated bit field back to the original byte */
- if((size+start-1)/8 > idx) { /*bit sequence doesn't end in the same byte as starts*/
- H5T_bit_copy (&(buf[idx]), pos, &tmp, pos, (8-pos));
+ if((size + start - 1) / 8 > idx) { /*bit sequence doesn't end in the same byte as starts*/
+ H5T_bit_copy(&(buf[idx]), pos, &tmp, pos, (8-pos));
idx++;
size -= (8 - pos);
- } else { /* bit sequence ends in the same byte as starts */
- H5T_bit_copy (&(buf[idx]), pos, &tmp, pos, size);
- goto done;
- }
-
- /* The middle bytes */
- while (size>=8) {
- buf[idx] = ~(buf[idx]);
- idx++;
- size -= 8;
- }
- /* The last partial byte */
- if(size > 0) {
- /* Similar to the first byte case, where sequence ends in the same byte as starts */
- tmp = buf[idx];
- tmp = ~tmp;
- H5T_bit_copy(&(buf[idx]), (size_t)0, &tmp, (size_t)0, size);
- }
+ /* The middle bytes */
+ while(size >= 8) {
+ buf[idx] = (uint8_t)~(buf[idx]);
+ idx++;
+ size -= 8;
+ } /* end while */
+
+ /* The last partial byte */
+ if(size > 0) {
+ /* Similar to the first byte case, where sequence ends in the same byte as starts */
+ tmp = buf[idx];
+ tmp = (uint8_t)~tmp;
+ H5T_bit_copy(&(buf[idx]), (size_t)0, &tmp, (size_t)0, size);
+ } /* end if */
+ } /* end if */
+ else /* bit sequence ends in the same byte as starts */
+ H5T_bit_copy(&(buf[idx]), pos, &tmp, pos, size);
-done:
FUNC_LEAVE_NOAPI_VOID
-}
+} /* end H5T_bit_neg() */
+
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index cda9011..be09488 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -175,237 +175,237 @@
*
*/
#define H5T_CONV_xX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_xX_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
-/* Added a condition branch(else if (*((ST*)S) == (DT)(D_MAX))) which seems redundant.
+/* Added a condition branch(else if (*(S) == (DT)(D_MAX))) which seems redundant.
* It handles a special situation when the source is "float" and assigned the value
* of "INT_MAX". A compiler may do roundup making this value "INT_MAX+1". However,
- * when do comparison "if (*((ST*)S) > (DT)(D_MAX))", the compiler may consider them
+ * when do comparison "if (*(S) > (DT)(D_MAX))", the compiler may consider them
* equal. In this case, do not return exception but make sure the maximum is assigned
* to the destination. SLU - 2005/06/29
*/
#define H5T_CONV_Xx_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX)) { \
+ if (*(S) > (DT)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(D_MAX); \
+ *(D) = (DT)(D_MAX); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
- } else if (*((ST*)S) < (DT)(D_MIN)) { \
+ } else if (*(S) < (DT)(D_MIN)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(D_MIN); \
+ *(D) = (DT)(D_MIN); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_Xx_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX)) { \
- *((DT*)D) = (DT)(D_MAX); \
- } else if (*((ST*)S) < (DT)(D_MIN)) { \
- *((DT*)D) = (DT)(D_MIN); \
+ if (*(S) > (DT)(D_MAX)) { \
+ *(D) = (DT)(D_MAX); \
+ } else if (*(S) < (DT)(D_MIN)) { \
+ *(D) = (DT)(D_MIN); \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_Ux_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX)) { \
+ if (*(S) > (DT)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(D_MAX); \
+ *(D) = (DT)(D_MAX); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_Ux_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX)) { \
- *((DT*)D) = (DT)(D_MAX); \
+ if (*(S) > (DT)(D_MAX)) { \
+ *(D) = (DT)(D_MAX); \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_sS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)<=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
H5T_CONV(H5T_CONV_xX, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_sU_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) < 0) { \
+ if (*(S) < 0) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = 0; \
+ *(D) = 0; \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_sU_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) < 0) { \
- *((DT*)D) = 0; \
- } else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ if(*(S) < 0) \
+ *(D) = 0; \
+ else \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_sU(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)<=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
H5T_CONV(H5T_CONV_sU, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_uS_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (sizeof(ST)==sizeof(DT) && *((ST*)S) > (DT)(D_MAX)) { \
+ if(sizeof(ST) == sizeof(DT) && *(S) > (DT)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(D_MAX); \
+ *(D) = (DT)(D_MAX); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_uS_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (sizeof(ST)==sizeof(DT) && *((ST*)S) > (D_MAX)) { \
- *((DT*)D) = (D_MAX); \
+ if (sizeof(ST)==sizeof(DT) && *(S) > (D_MAX)) { \
+ *(D) = (D_MAX); \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_uS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)<=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
H5T_CONV(H5T_CONV_uS, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_uU(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)<=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
H5T_CONV(H5T_CONV_xX, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_Ss(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)>=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
H5T_CONV(H5T_CONV_Xx, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_Su_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) < 0) { \
+ if(*(S) < 0) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = 0; \
+ *(D) = 0; \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
- } else if (sizeof(ST)>sizeof(DT) && *((ST*)S) > (DT)(D_MAX)) { \
+ } else if (sizeof(ST)>sizeof(DT) && *(S) > (DT)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(D_MAX); \
+ *(D) = (DT)(D_MAX); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_Su_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) < 0) { \
- *((DT*)D) = 0; \
- } else if (sizeof(ST)>sizeof(DT) && *((ST*)S) > (DT)(D_MAX)) { \
- *((DT*)D) = (DT)(D_MAX); \
- } else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ if(*(S) < 0) \
+ *(D) = 0; \
+ else if (sizeof(ST)>sizeof(DT) && *(S) > (DT)(D_MAX)) \
+ *(D) = (DT)(D_MAX); \
+ else \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_Su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)>=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
H5T_CONV(H5T_CONV_Su, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_Us(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)>=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
H5T_CONV(H5T_CONV_Ux, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_Uu(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)>=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
H5T_CONV(H5T_CONV_Ux, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_su_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
- if (*((ST*)S) < 0) { \
+ if(*(S) < 0) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = 0; \
+ *(D) = 0; \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_su_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
- if (*((ST*)S) < 0) { \
- *((DT*)D) = 0; \
- } else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ if(*(S) < 0) \
+ *(D) = 0; \
+ else \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)==sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)==sizeof(DT)); \
H5T_CONV(H5T_CONV_su, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_us_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
- if (*((ST*)S) > (DT)(D_MAX)) { \
+ if (*(S) > (DT)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(D_MAX); \
+ *(D) = (DT)(D_MAX); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_us_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
- if (*((ST*)S) > (DT)(D_MAX)) { \
- *((DT*)D) = (DT)(D_MAX); \
- } else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ if(*(S) > (DT)(D_MAX)) \
+ *(D) = (DT)(D_MAX); \
+ else \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_us(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)==sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)==sizeof(DT)); \
H5T_CONV(H5T_CONV_us, long long, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
#define H5T_CONV_fF(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)<=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
H5T_CONV(H5T_CONV_xX, long double, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
@@ -413,38 +413,38 @@
* when an overflow occurs, use the 'float' infinity values.
*/
#define H5T_CONV_Ff_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX)) { \
+ if(*(S) > (DT)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (H5T_NATIVE_FLOAT_POS_INF_g); \
+ *(D) = (H5T_NATIVE_FLOAT_POS_INF_g); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
- } else if (*((ST*)S) < (DT)(D_MIN)) { \
+ } else if (*(S) < (DT)(D_MIN)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (H5T_NATIVE_FLOAT_NEG_INF_g); \
+ *(D) = (H5T_NATIVE_FLOAT_NEG_INF_g); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_Ff_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX)) { \
- *((DT*)D) = (H5T_NATIVE_FLOAT_POS_INF_g); \
- } else if (*((ST*)S) < (DT)(D_MIN)) { \
- *((DT*)D) = (H5T_NATIVE_FLOAT_NEG_INF_g); \
- } else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ if(*(S) > (DT)(D_MAX)) \
+ *(D) = (H5T_NATIVE_FLOAT_POS_INF_g); \
+ else if (*(S) < (DT)(D_MIN)) \
+ *(D) = (H5T_NATIVE_FLOAT_NEG_INF_g); \
+ else \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_Ff(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- assert(sizeof(ST)>=sizeof(DT)); \
+ HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
H5T_CONV(H5T_CONV_Ff, long double, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
@@ -512,7 +512,7 @@
unsigned low_bit_pos, high_bit_pos; \
\
/* Detect high & low bits set in source */ \
- H5T_HI_LO_BIT_SET(ST, *((ST*)S), low_bit_pos, high_bit_pos) \
+ H5T_HI_LO_BIT_SET(ST, *(S), low_bit_pos, high_bit_pos) \
\
/* Check for more bits of precision in src than available in dst */ \
if((high_bit_pos - low_bit_pos) >= dprec) { \
@@ -520,73 +520,72 @@
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
} \
else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_xF_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_xF(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
H5T_CONV(H5T_CONV_xF, long double, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
}
-/* Quincey added the condition branch (else if (*((ST*)S) != (ST)((DT)(*((ST*)S))))).
+/* Quincey added the condition branch (else if (*(S) != (ST)((DT)(*(S))))).
* It handles a special situation when the source is "float" and assigned the value
* of "INT_MAX". Compilers do roundup making this value "INT_MAX+1". This branch
* is to check that situation and return exception for some compilers, mainly GCC.
- * The branch if (*((ST*)S) > (DT)(D_MAX) || (sprec < dprec && *((ST*)S) ==
+ * The branch if (*(S) > (DT)(D_MAX) || (sprec < dprec && *(S) ==
* (DT)(D_MAX))) is for some compilers like Sun, HP, IBM, and SGI where under
* the same situation the "int" doesn't overflow. SLU - 2005/9/12
*/
#define H5T_CONV_Fx_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX) || (sprec < dprec && *((ST*)S) == (DT)(D_MAX))) { \
+ if(*(S) > (DT)(D_MAX) || (sprec < dprec && *(S) == (DT)(D_MAX))) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(D_MAX); \
+ *(D) = (DT)(D_MAX); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
- } else if (*((ST*)S) < (DT)(D_MIN)) { \
+ } else if (*(S) < (DT)(D_MIN)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(D_MIN); \
+ *(D) = (DT)(D_MIN); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
- } else if (*((ST*)S) != (ST)((DT)(*((ST*)S)))) { \
+ } else if (*(S) != (ST)((DT)(*(S)))) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_TRUNCATE, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
/* Let compiler convert if case is ignored by user handler*/ \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
} \
else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_Fx_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*((ST*)S) > (DT)(D_MAX)) { \
- *((DT*)D) = (DT)(D_MAX); \
- } else if (*((ST*)S) < (DT)(D_MIN)) { \
- *((DT*)D) = (DT)(D_MIN); \
- } \
+ if(*(S) > (DT)(D_MAX)) \
+ *(D) = (DT)(D_MAX); \
+ else if(*(S) < (DT)(D_MIN)) \
+ *(D) = (DT)(D_MIN); \
else \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
#define H5T_CONV_Fx(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
@@ -598,7 +597,7 @@
* to do them all.
*/
#define H5T_CONV_NO_EXCEPT_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- *((DT*)D) = (DT)(*((ST*)S)); \
+ *(D) = (DT)(*(S)); \
}
/* The main part of every integer hardware conversion macro */
@@ -606,11 +605,14 @@
size_t elmtno; /*element number */ \
size_t sprec; /*source precision */ \
size_t dprec; /*destination precision */ \
- uint8_t *src, *s; /*source buffer */ \
- uint8_t *dst, *d; /*destination buffer */ \
+ uint8_t *src_buf; /*'raw' source buffer */ \
+ uint8_t *dst_buf; /*'raw' destination buffer */ \
+ ST *src, *s; /*source buffer */ \
+ DT *dst, *d; /*destination buffer */ \
H5T_class_t tclass; /*datatype's class */ \
H5T_t *st, *dt; /*datatype descriptors */ \
- ATYPE aligned; /*aligned type */ \
+ ST src_aligned; /*source aligned type */ \
+ DT dst_aligned; /*destination aligned type */ \
hbool_t s_mv, d_mv; /*move data to align it? */ \
ssize_t s_stride, d_stride; /*src and dst strides */ \
size_t safe; /*how many elements are safe to process in each pass */ \
@@ -641,7 +643,6 @@
if (buf_stride) { \
assert(buf_stride>=sizeof(ST)); \
assert(buf_stride>=sizeof(DT)); \
- H5_CHECK_OVERFLOW(buf_stride,size_t,ssize_t); \
s_stride = d_stride = (ssize_t)buf_stride; \
} else { \
s_stride = sizeof(ST); \
@@ -700,32 +701,33 @@
/* If we're down to the last few elements, just wrap up */ \
/* with a "real" reverse copy */ \
if(safe<2) { \
- src = (uint8_t*)buf+(nelmts-1)*s_stride; \
- dst = (uint8_t*)buf+(nelmts-1)*d_stride; \
+ src = (ST *)(src_buf = (uint8_t*)buf+(nelmts-1)*s_stride); \
+ dst = (DT *)(dst_buf = (uint8_t*)buf+(nelmts-1)*d_stride); \
s_stride = -s_stride; \
d_stride = -d_stride; \
\
safe=nelmts; \
} /* end if */ \
else { \
- src = (uint8_t*)buf+(nelmts-safe)*s_stride; \
- dst = (uint8_t*)buf+(nelmts-safe)*d_stride; \
+ src = (ST *)(src_buf = (uint8_t*)buf+(nelmts-safe)*s_stride); \
+ dst = (DT *)(dst_buf = (uint8_t*)buf+(nelmts-safe)*d_stride); \
} /* end else */ \
} /* end if */ \
else { \
/* Single forward pass over all data */ \
- src = dst = (uint8_t*)buf; \
+ src = (ST *)(src_buf = (uint8_t*)buf); \
+ dst = (DT *)(dst_buf = (uint8_t*)buf); \
safe=nelmts; \
} /* end else */ \
\
/* Perform loop over elements to convert */ \
if (s_mv && d_mv) { \
/* Alignment is required for both source and dest */ \
- s = (uint8_t*)&aligned; \
+ s = &src_aligned; \
H5T_CONV_LOOP_OUTER(PRE_SALIGN,PRE_DALIGN,POST_SALIGN,POST_DALIGN,GUTS,s,d,ST,DT,D_MIN,D_MAX) \
} else if(s_mv) { \
/* Alignment is required only for source */ \
- s = (uint8_t*)&aligned; \
+ s = &src_aligned; \
H5T_CONV_LOOP_OUTER(PRE_SALIGN,PRE_DNOALIGN,POST_SALIGN,POST_DNOALIGN,GUTS,s,dst,ST,DT,D_MIN,D_MAX) \
} else if(d_mv) { \
/* Alignment is required only for destination */ \
@@ -748,7 +750,7 @@
/* Macro defining action on source data which needs to be aligned (before main action) */
#define H5T_CONV_LOOP_PRE_SALIGN(ST) { \
- HDmemcpy(&aligned, src, sizeof(ST)); \
+ HDmemcpy(&src_aligned, src, sizeof(ST)); \
}
/* Macro defining action on source data which doesn't need to be aligned (before main action) */
@@ -757,7 +759,7 @@
/* Macro defining action on destination data which needs to be aligned (before main action) */
#define H5T_CONV_LOOP_PRE_DALIGN(DT) { \
- d = (uint8_t*)&aligned; \
+ d = &dst_aligned; \
}
/* Macro defining action on destination data which doesn't need to be aligned (before main action) */
@@ -774,7 +776,7 @@
/* Macro defining action on destination data which needs to be aligned (after main action) */
#define H5T_CONV_LOOP_POST_DALIGN(DT) { \
- HDmemcpy(dst, &aligned, sizeof(DT)); \
+ HDmemcpy(dst, &dst_aligned, sizeof(DT)); \
}
/* Macro defining action on destination data which doesn't need to be aligned (after main action) */
@@ -809,8 +811,10 @@
H5_GLUE(H5T_CONV_LOOP_,POST_DALIGN_GUTS)(DT) \
\
/* Advance pointers */ \
- src += s_stride; \
- dst += d_stride; \
+ src_buf += s_stride; \
+ src = (ST *)src_buf; \
+ dst_buf += d_stride; \
+ dst = (DT *)dst_buf; \
}
/* Macro to call the actual "guts" of the type conversion, or call the "no exception" guts */
@@ -1037,8 +1041,8 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
switch(cdata->command) {
case H5T_CONV_INIT:
/* Capability query */
- if(NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
if(src->shared->size != dst->shared->size ||
0 != src->shared->u.atomic.offset ||
@@ -1081,8 +1085,8 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
case H5T_CONV_CONV:
/* The conversion */
- if(NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
/* Check for "no op" reference conversion */
@@ -1446,8 +1450,8 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
switch(cdata->command) {
case H5T_CONV_INIT:
/* Capability query */
- if(NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
if(src->shared->size != dst->shared->size || 0 != src->shared->u.atomic.offset ||
0 != dst->shared->u.atomic.offset ||
@@ -1483,8 +1487,8 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_CONV_CONV:
/* The conversion */
- if(NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
buf_stride = buf_stride ? buf_stride : src->shared->size;
@@ -1552,8 +1556,8 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
switch(cdata->command) {
case H5T_CONV_INIT:
/* Capability query */
- if(NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
if(H5T_ORDER_LE != src->shared->u.atomic.order &&
H5T_ORDER_BE != src->shared->u.atomic.order)
@@ -1569,8 +1573,8 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_CONV_CONV:
/* Get the data types */
- if(NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
/*
@@ -1789,7 +1793,7 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv)
H5MM_xfree(src_memb_id);
H5MM_xfree(dst_memb_id);
H5MM_xfree(priv->memb_path);
- FUNC_LEAVE_NOAPI(H5MM_xfree(priv));
+ FUNC_LEAVE_NOAPI((H5T_conv_struct_t *)H5MM_xfree(priv));
}
@@ -1861,10 +1865,10 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
/*
* Allocate private data structure and arrays.
*/
- if(NULL == (priv = cdata->priv=H5MM_calloc(sizeof(H5T_conv_struct_t))) ||
- NULL == (priv->src2dst = H5MM_malloc(src_nmembs * sizeof(int))) ||
- NULL == (priv->src_memb_id = H5MM_malloc(src_nmembs * sizeof(hid_t))) ||
- NULL == (priv->dst_memb_id = H5MM_malloc(dst_nmembs * sizeof(hid_t))))
+ if(NULL == (priv = (H5T_conv_struct_t *)(cdata->priv=H5MM_calloc(sizeof(H5T_conv_struct_t)))) ||
+ NULL == (priv->src2dst = (int *)H5MM_malloc(src_nmembs * sizeof(int))) ||
+ NULL == (priv->src_memb_id = (hid_t *)H5MM_malloc(src_nmembs * sizeof(hid_t))) ||
+ NULL == (priv->dst_memb_id = (hid_t *)H5MM_malloc(dst_nmembs * sizeof(hid_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
src2dst = priv->src2dst;
priv->src_nmembs = src_nmembs;
@@ -1891,7 +1895,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
src2dst[i] = -1;
for(j = 0; j < dst_nmembs; j++) {
if(!HDstrcmp(src->shared->u.compnd.memb[i].name, dst->shared->u.compnd.memb[j].name)) {
- src2dst[i] = j;
+ H5_ASSIGN_OVERFLOW(src2dst[i],j,unsigned,int);
break;
} /* end if */
} /* end for */
@@ -1921,7 +1925,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
*/
src2dst = priv->src2dst;
H5MM_xfree(priv->memb_path);
- if(NULL == (priv->memb_path = H5MM_malloc(src->shared->u.compnd.nmembs * sizeof(H5T_path_t*))))
+ if(NULL == (priv->memb_path = (H5T_path_t **)H5MM_malloc(src->shared->u.compnd.nmembs * sizeof(H5T_path_t*))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
for(i = 0; i < src_nmembs; i++) {
@@ -1945,7 +1949,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
* order or there's conversion between members, don't do the
* optimization.
*/
- if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
+ if(src2dst[i] != (int)i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
priv->subset_info.subset = H5T_SUBSET_FALSE;
break;
} /* end if */
@@ -1962,7 +1966,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
for(i = 0; i < dst_nmembs; i++) {
/* If any of source members doesn't have counterpart in the same order or
* there's conversion between members, don't do the optimization. */
- if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
+ if(src2dst[i] != (int)i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
priv->subset_info.subset = H5T_SUBSET_FALSE;
break;
}
@@ -1976,7 +1980,7 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
+ dst->shared->u.compnd.memb[dst_nmembs-1].size;
} else /* If the numbers of source and dest members are equal and no conversion is needed,
* the case should have been handled as noop earlier in H5Dio.c. */
- ;
+ {;}
cdata->recalc = FALSE;
@@ -2067,8 +2071,7 @@ H5T_conv_struct_subset(const H5T_cdata_t *cdata)
*/
herr_t
H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
- size_t buf_stride, size_t bkg_stride, void *_buf, void *_bkg,
- hid_t dxpl_id)
+ size_t buf_stride, size_t bkg_stride, void *_buf, void *_bkg, hid_t dxpl_id)
{
uint8_t *buf = (uint8_t *)_buf; /*cast for pointer arithmetic */
uint8_t *bkg = (uint8_t *)_bkg; /*background pointer arithmetic */
@@ -2096,8 +2099,8 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* otherwise initialize the `priv' field of `cdata' with information
* that remains (almost) constant for this conversion path.
*/
- if (NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if (NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
assert (H5T_COMPOUND==src->shared->type);
assert (H5T_COMPOUND==dst->shared->type);
@@ -2117,8 +2120,8 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/*
* Conversion.
*/
- if (NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if (NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
assert (priv);
assert (bkg && cdata->need_bkg);
@@ -2138,17 +2141,19 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
*/
if (buf_stride) {
src_delta = buf_stride;
- if (!bkg_stride)
- bkg_stride = dst->shared->size;
- } else if (dst->shared->size <= src->shared->size) {
+ if(!bkg_stride)
+ bkg_stride = dst->shared->size;
+ } /* end if */
+ else if(dst->shared->size <= src->shared->size) {
src_delta = src->shared->size;
- bkg_stride = dst->shared->size;
- } else {
+ bkg_stride = dst->shared->size;
+ } /* end else-if */
+ else {
src_delta = -(int)src->shared->size; /*overflow shouldn't be possible*/
bkg_stride = -(int)dst->shared->size; /*overflow shouldn't be possible*/
- xbuf += (nelmts-1) * src->shared->size;
- xbkg += (nelmts-1) * dst->shared->size;
- }
+ xbuf += (nelmts - 1) * src->shared->size;
+ xbkg += (nelmts - 1) * dst->shared->size;
+ } /* end else */
/* Conversion loop... */
for (elmtno=0; elmtno<nelmts; elmtno++) {
@@ -2318,17 +2323,17 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
uint8_t *xbkg = NULL; /*temporary pointer into `bkg' */
H5T_t *src = NULL; /*source datatype */
H5T_t *dst = NULL; /*destination datatype */
- int *src2dst = NULL; /*maps src member to dst member */
+ int *src2dst = NULL; /*maps src member to dst member */
H5T_cmemb_t *src_memb = NULL; /*source struct member descript.*/
H5T_cmemb_t *dst_memb = NULL; /*destination struct memb desc. */
size_t offset; /*byte offset wrt struct */
size_t elmtno; /*element counter */
size_t copy_size; /*size of element for copying */
- unsigned u; /*counters */
- int i; /*counters */
H5T_conv_struct_t *priv = NULL; /*private data */
hbool_t no_stride = FALSE; /*flag to indicate no stride */
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned u; /*counters */
+ int i; /*counters */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_struct_opt, FAIL)
@@ -2340,15 +2345,14 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* otherwise initialize the `priv' field of `cdata' with information
* that remains (almost) constant for this conversion path.
*/
- if (NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
- assert (H5T_COMPOUND==src->shared->type);
- assert (H5T_COMPOUND==dst->shared->type);
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ HDassert(H5T_COMPOUND == src->shared->type);
+ HDassert(H5T_COMPOUND == dst->shared->type);
/* Initialize data which is relatively constant */
- if (H5T_conv_struct_init (src, dst, cdata, dxpl_id)<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data");
+ if(H5T_conv_struct_init(src, dst, cdata, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data")
priv = (H5T_conv_struct_t *)(cdata->priv);
src2dst = priv->src2dst;
@@ -2362,29 +2366,29 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* of loops as in the actual conversion except it checks that there
* is room for each conversion instead of actually doing anything.
*/
- if (dst->shared->size > src->shared->size) {
- for (u=0, offset=0; u<src->shared->u.compnd.nmembs; u++) {
- if (src2dst[u]<0)
+ if(dst->shared->size > src->shared->size) {
+ for(u = 0, offset = 0; u < src->shared->u.compnd.nmembs; u++) {
+ if(src2dst[u] < 0)
continue;
src_memb = src->shared->u.compnd.memb + u;
dst_memb = dst->shared->u.compnd.memb + src2dst[u];
- if (dst_memb->size > src_memb->size)
+ if(dst_memb->size > src_memb->size)
offset += src_memb->size;
- }
- for (i=src->shared->u.compnd.nmembs-1; i>=0; --i) {
- if (src2dst[i]<0)
+ } /* end for */
+ for(i = src->shared->u.compnd.nmembs - 1; i >= 0; --i) {
+ if(src2dst[i] < 0)
continue;
src_memb = src->shared->u.compnd.memb + i;
dst_memb = dst->shared->u.compnd.memb + src2dst[i];
- if (dst_memb->size > src_memb->size) {
+ if(dst_memb->size > src_memb->size) {
offset -= src_memb->size;
- if (dst_memb->size > src->shared->size-offset) {
+ if(dst_memb->size > src->shared->size-offset) {
cdata->priv = priv = H5T_conv_struct_free(priv);
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "convertion is unsupported by this function");
- }
- }
- }
- }
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "convertion is unsupported by this function")
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ } /* end if */
break;
case H5T_CONV_FREE:
@@ -2399,17 +2403,16 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
/*
* Conversion.
*/
- if (NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Update cached data if necessary */
- if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata, dxpl_id)<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data");
+ if(cdata->recalc && H5T_conv_struct_init(src, dst, cdata, dxpl_id)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data")
priv = (H5T_conv_struct_t *)(cdata->priv);
src2dst = priv->src2dst;
- assert(priv);
- assert(bkg && cdata->need_bkg);
+ HDassert(priv);
+ HDassert(bkg && cdata->need_bkg);
/*
* Insure that members are sorted.
@@ -2427,27 +2430,30 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* background data into the BKG buffer at multiples of BKG_STRIDE;
* otherwise assume BKG buffer is the packed destination datatype.
*/
- if (!buf_stride || !bkg_stride) bkg_stride = dst->shared->size;
- if (!buf_stride) {
+ if(!buf_stride || !bkg_stride)
+ bkg_stride = dst->shared->size;
+ if(!buf_stride) {
no_stride = TRUE;
buf_stride = src->shared->size;
- }
+ } /* end if */
if(priv->subset_info.subset == H5T_SUBSET_SRC || priv->subset_info.subset == H5T_SUBSET_DST) {
/* If the optimization flag is set to indicate source members are a subset and
- * in the top of the destination, simply copy the source members to background buffer. */
+ * in the top of the destination, simply copy the source members to background buffer.
+ */
xbuf = buf;
xbkg = bkg;
copy_size = priv->subset_info.copy_size;
- for (elmtno=0; elmtno<nelmts; elmtno++) {
+ for(elmtno = 0; elmtno < nelmts; elmtno++) {
HDmemmove(xbkg, xbuf, copy_size);
/* Update pointers */
xbuf += buf_stride;
xbkg += bkg_stride;
- }
- } else {
+ } /* end for */
+ } /* end if */
+ else {
/*
* For each member where the destination is not larger than the
* source, stride through all the elements converting only that member
@@ -2455,33 +2461,33 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* destination in the bkg buffer. Otherwise move the element as far
* left as possible in the buffer.
*/
- for (u=0, offset=0; u<src->shared->u.compnd.nmembs; u++) {
- if (src2dst[u]<0) continue; /*subsetting*/
+ for(u = 0, offset = 0; u < src->shared->u.compnd.nmembs; u++) {
+ if(src2dst[u] < 0)
+ continue; /*subsetting*/
src_memb = src->shared->u.compnd.memb + u;
dst_memb = dst->shared->u.compnd.memb + src2dst[u];
- if (dst_memb->size <= src_memb->size) {
+ if(dst_memb->size <= src_memb->size) {
xbuf = buf + src_memb->offset;
xbkg = bkg + dst_memb->offset;
- if (H5T_convert(priv->memb_path[u],
- priv->src_memb_id[u],
+ if(H5T_convert(priv->memb_path[u], priv->src_memb_id[u],
priv->dst_memb_id[src2dst[u]], nelmts,
- buf_stride, bkg_stride, xbuf, xbkg, dxpl_id)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member");
- for (elmtno=0; elmtno<nelmts; elmtno++) {
+ buf_stride, bkg_stride, xbuf, xbkg, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member")
+ for(elmtno = 0; elmtno < nelmts; elmtno++) {
HDmemmove(xbkg, xbuf, dst_memb->size);
xbuf += buf_stride;
xbkg += bkg_stride;
- }
- } else {
- for (xbuf=buf, elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbuf+offset, xbuf+src_memb->offset,
- src_memb->size);
+ } /* end for */
+ } /* end if */
+ else {
+ for(xbuf = buf, elmtno = 0; elmtno < nelmts; elmtno++) {
+ HDmemmove(xbuf + offset, xbuf + src_memb->offset, src_memb->size);
xbuf += buf_stride;
- }
+ } /* end for */
offset += src_memb->size;
- }
- }
+ } /* end else */
+ } /* end else */
/*
* Work from right to left, converting those members that weren't
@@ -2489,51 +2495,48 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* is larger than the source) and them to their final position in the
* bkg buffer.
*/
- for (i=src->shared->u.compnd.nmembs-1; i>=0; --i) {
- if (src2dst[i]<0)
+ for(i = src->shared->u.compnd.nmembs - 1; i >= 0; --i) {
+ if(src2dst[i] < 0)
continue;
src_memb = src->shared->u.compnd.memb + i;
dst_memb = dst->shared->u.compnd.memb + src2dst[i];
- if (dst_memb->size > src_memb->size) {
+ if(dst_memb->size > src_memb->size) {
offset -= src_memb->size;
xbuf = buf + offset;
xbkg = bkg + dst_memb->offset;
- if (H5T_convert(priv->memb_path[i],
- priv->src_memb_id[i],
- priv->dst_memb_id[src2dst[i]], nelmts,
- buf_stride,
- bkg_stride, xbuf, xbkg,
- dxpl_id)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member");
- for (elmtno=0; elmtno<nelmts; elmtno++) {
+ if(H5T_convert(priv->memb_path[i], priv->src_memb_id[i],
+ priv->dst_memb_id[src2dst[i]], nelmts,
+ buf_stride, bkg_stride, xbuf, xbkg, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound datatype member")
+ for(elmtno = 0; elmtno < nelmts; elmtno++) {
HDmemmove(xbkg, xbuf, dst_memb->size);
xbuf += buf_stride;
xbkg += bkg_stride;
- }
- }
- }
- }
+ } /* end for */
+ } /* end if */
+ } /* end for */
+ } /* end else */
if(no_stride)
buf_stride = dst->shared->size;
/* Move background buffer into result buffer */
- for (xbuf=buf, xbkg=bkg, elmtno=0; elmtno<nelmts; elmtno++) {
+ for(xbuf = buf, xbkg = bkg, elmtno = 0; elmtno < nelmts; elmtno++) {
HDmemmove(xbuf, xbkg, dst->shared->size);
xbuf += buf_stride;
xbkg += bkg_stride;
- }
+ } /* end for */
break;
default:
/* Some other command we don't know about yet.*/
- HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
- }
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command")
+ } /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5T_conv_struct_opt() */
/*-------------------------------------------------------------------------
@@ -2566,7 +2569,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
FUNC_ENTER_NOAPI_NOINIT(H5T_conv_enum_init)
cdata->need_bkg = H5T_BKG_NO;
- if (NULL==(priv=cdata->priv=H5MM_calloc(sizeof(*priv))))
+ if (NULL==(priv=(H5T_enum_struct_t *)(cdata->priv=H5MM_calloc(sizeof(*priv)))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
if (0==src->shared->u.enumer.nmembs)
HGOTO_DONE(SUCCEED);
@@ -2578,7 +2581,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
*/
H5T_sort_name(src, NULL);
H5T_sort_name(dst, NULL);
- if (NULL==(priv->src2dst=H5MM_malloc(src->shared->u.enumer.nmembs*sizeof(int))))
+ if (NULL==(priv->src2dst=(int *)H5MM_malloc(src->shared->u.enumer.nmembs*sizeof(int))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");;
for (i=0, j=0;
i<src->shared->u.enumer.nmembs && j<dst->shared->u.enumer.nmembs;
@@ -2630,7 +2633,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
(double)length/src->shared->u.enumer.nmembs<1.2) {
priv->base = domain[0];
priv->length = length;
- if (NULL==(map=H5MM_malloc(length*sizeof(int))))
+ if (NULL==(map=(int *)H5MM_malloc(length*sizeof(int))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
for (i=0; i<length; i++)
map[i] = -1; /*entry unused*/
@@ -2719,8 +2722,8 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* the `priv' field of `cdata' with information about the underlying
* integer conversion.
*/
- if (NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if (NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
assert (H5T_ENUM==src->shared->type);
assert (H5T_ENUM==dst->shared->type);
@@ -2744,8 +2747,8 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
break;
case H5T_CONV_CONV:
- if (NULL == (src = H5I_object(src_id)) ||
- NULL == (dst = H5I_object(dst_id)))
+ if (NULL == (src = (H5T_t *)H5I_object(src_id)) ||
+ NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
assert (H5T_ENUM==src->shared->type);
assert (H5T_ENUM==dst->shared->type);
@@ -2899,14 +2902,14 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dxpl_id)
{
H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */
- H5T_vlen_alloc_info_t *vl_alloc_info=&_vl_alloc_info; /* VL allocation info */
+ H5T_vlen_alloc_info_t *vl_alloc_info = &_vl_alloc_info; /* VL allocation info */
H5T_path_t *tpath; /* Type conversion path */
- hbool_t noop_conv=FALSE; /* Flag to indicate a noop conversion */
- hbool_t write_to_file=FALSE; /* Flag to indicate writing to file */
+ hbool_t noop_conv = FALSE; /* Flag to indicate a noop conversion */
+ hbool_t write_to_file = FALSE; /* Flag to indicate writing to file */
hbool_t parent_is_vlen; /* Flag to indicate parent is vlen datatyp */
hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */
- H5T_t *src = NULL; /*source datatype */
- H5T_t *dst = NULL; /*destination datatype */
+ H5T_t *src; /*source datatype */
+ H5T_t *dst; /*destination datatype */
H5HG_t bg_hobjid, parent_hobjid;
uint8_t *s; /*source buffer */
uint8_t *d; /*destination buffer */
@@ -2915,15 +2918,15 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
ssize_t b_stride; /*bkg stride */
size_t safe; /*how many elements are safe to process in each pass */
ssize_t seq_len; /*the number of elements in the current sequence*/
- size_t bg_seq_len=0;
+ size_t bg_seq_len = 0;
size_t src_base_size, dst_base_size;/*source & destination base size*/
- void *conv_buf=NULL; /*temporary conversion buffer */
- size_t conv_buf_size=0; /*size of conversion buffer in bytes */
- void *tmp_buf=NULL; /*temporary background buffer */
- size_t tmp_buf_size=0; /*size of temporary bkg buffer */
- hbool_t nested=FALSE; /*flag of nested VL case */
+ void *conv_buf = NULL; /*temporary conversion buffer */
+ size_t conv_buf_size = 0; /*size of conversion buffer in bytes */
+ void *tmp_buf = NULL; /*temporary background buffer */
+ size_t tmp_buf_size = 0; /*size of temporary bkg buffer */
+ hbool_t nested = FALSE; /*flag of nested VL case */
size_t elmtno; /*element number counter */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_vlen, FAIL)
@@ -2936,7 +2939,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* information that remains (almost) constant for this
* conversion path.
*/
- if(NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id)))
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
HDassert(H5T_VLEN == src->shared->type);
HDassert(H5T_VLEN == dst->shared->type);
@@ -2954,7 +2957,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/*
* Conversion.
*/
- if(NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id)))
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Initialize source & destination strides */
@@ -2971,10 +2974,8 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
d_stride = (ssize_t)dst->shared->size;
} /* end else */
if(bkg) {
- if(bkg_stride) {
- H5_CHECK_OVERFLOW(bkg_stride, size_t, ssize_t);
+ if(bkg_stride)
b_stride = (ssize_t)bkg_stride;
- } /* end if */
else
b_stride = d_stride;
} /* end if */
@@ -2992,20 +2993,21 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->shared->parent, H5T_COPY_ALL), FALSE)) < 0 ||
(tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->shared->parent, H5T_COPY_ALL), FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
- } else
+ } /* end else-if */
+ else
noop_conv = TRUE;
/* Check if we need a temporary buffer for this conversion */
parent_is_vlen = H5T_detect_class(dst->shared->parent, H5T_VLEN, FALSE);
if(tpath->cdata.need_bkg || parent_is_vlen) {
/* Set up initial background buffer */
- tmp_buf_size = MAX(src_base_size,dst_base_size);
+ tmp_buf_size = MAX(src_base_size, dst_base_size);
if(NULL == (tmp_buf = H5FL_BLK_MALLOC(vlen_seq,tmp_buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
/* Get the allocation info */
- if(H5T_vlen_get_alloc_info(dxpl_id,&vl_alloc_info) < 0)
+ if(H5T_vlen_get_alloc_info(dxpl_id, &vl_alloc_info) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
/* Set flags to indicate we are writing to or reading from the file */
@@ -3018,145 +3020,143 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* The outer loop of the type conversion macro, controlling which */
/* direction the buffer is walked */
- while (nelmts>0) {
+ while(nelmts > 0) {
/* Check if we need to go backwards through the buffer */
- if(d_stride>s_stride) {
+ if(d_stride > s_stride) {
/* Compute the number of "safe" destination elements at */
/* the end of the buffer (Those which don't overlap with */
/* any source elements at the beginning of the buffer) */
- safe=nelmts-(((nelmts*s_stride)+(d_stride-1))/d_stride);
+ safe = nelmts - (((nelmts * s_stride) + (d_stride - 1)) / d_stride);
/* If we're down to the last few elements, just wrap up */
/* with a "real" reverse copy */
- if(safe<2) {
- s = (uint8_t*)buf+(nelmts-1)*s_stride;
- d = (uint8_t*)buf+(nelmts-1)*d_stride;
- b = (uint8_t*)bkg+(nelmts-1)*b_stride;
+ if(safe < 2) {
+ s = (uint8_t *)buf + (nelmts - 1) * s_stride;
+ d = (uint8_t *)buf + (nelmts - 1) * d_stride;
+ b = (uint8_t *)bkg + (nelmts - 1) * b_stride;
s_stride = -s_stride;
d_stride = -d_stride;
b_stride = -b_stride;
- safe=nelmts;
+ safe = nelmts;
} /* end if */
else {
- s = (uint8_t*)buf+(nelmts-safe)*s_stride;
- d = (uint8_t*)buf+(nelmts-safe)*d_stride;
- b = (uint8_t*)bkg+(nelmts-safe)*b_stride;
+ s = (uint8_t *)buf + (nelmts - safe) * s_stride;
+ d = (uint8_t *)buf + (nelmts - safe) * d_stride;
+ b = (uint8_t *)bkg + (nelmts - safe) * b_stride;
} /* end else */
} /* end if */
else {
/* Single forward pass over all data */
- s = d = buf;
- b = bkg;
- safe=nelmts;
+ s = d = (uint8_t *)buf;
+ b = (uint8_t *)bkg;
+ safe = nelmts;
} /* end else */
- for (elmtno=0; elmtno<safe; elmtno++) {
+ for(elmtno = 0; elmtno < safe; elmtno++) {
/* Check for "nil" source sequence */
- if((*(src->shared->u.vlen.isnull))(src->shared->u.vlen.f,s)) {
+ if((*(src->shared->u.vlen.isnull))(src->shared->u.vlen.f, s)) {
/* Write "nil" sequence to destination location */
- if((*(dst->shared->u.vlen.setnull))(dst->shared->u.vlen.f,dxpl_id,d,b)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'");
+ if((*(dst->shared->u.vlen.setnull))(dst->shared->u.vlen.f, dxpl_id, d, b) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'")
} /* end if */
else {
/* Get length of element sequences */
- if((seq_len=(*(src->shared->u.vlen.getlen))(s))<0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect length");
+ if((seq_len = (*(src->shared->u.vlen.getlen))(s)) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect length")
/* If we are reading from memory and there is no conversion, just get the pointer to sequence */
if(write_to_file && noop_conv) {
/* Get direct pointer to sequence */
- if((conv_buf=(*(src->shared->u.vlen.getptr))(s))==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid source pointer");
+ if(NULL == (conv_buf = (*(src->shared->u.vlen.getptr))(s)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid source pointer")
} /* end if */
else {
size_t src_size, dst_size; /*source & destination total size in bytes*/
- src_size=seq_len*src_base_size;
- dst_size=seq_len*dst_base_size;
+ src_size = seq_len * src_base_size;
+ dst_size = seq_len * dst_base_size;
/* Check if conversion buffer is large enough, resize if
- * necessary. If the SEQ_LEN is 0, allocate a minimal size buffer. */
+ * necessary. If the SEQ_LEN is 0, allocate a minimal size buffer.
+ */
if(!seq_len && !conv_buf) {
- conv_buf_size=((1/H5T_VLEN_MIN_CONF_BUF_SIZE)+1)*H5T_VLEN_MIN_CONF_BUF_SIZE;
- if((conv_buf=H5FL_BLK_MALLOC(vlen_seq,conv_buf_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ conv_buf_size = ((1 / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE;
+ if(NULL == (conv_buf = H5FL_BLK_MALLOC(vlen_seq, conv_buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
}
- else if(conv_buf_size<MAX(src_size,dst_size)) {
+ else if(conv_buf_size < MAX(src_size, dst_size)) {
/* Only allocate conversion buffer in H5T_VLEN_MIN_CONF_BUF_SIZE increments */
- conv_buf_size=((MAX(src_size,dst_size)/H5T_VLEN_MIN_CONF_BUF_SIZE)+1)*H5T_VLEN_MIN_CONF_BUF_SIZE;
- if((conv_buf=H5FL_BLK_REALLOC(vlen_seq,conv_buf, conv_buf_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ conv_buf_size = ((MAX(src_size, dst_size) / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE;
+ if(NULL == (conv_buf = H5FL_BLK_REALLOC(vlen_seq, conv_buf, conv_buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
/* Read in VL sequence */
- if((*(src->shared->u.vlen.read))(src->shared->u.vlen.f,dxpl_id,s,conv_buf,src_size)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data");
+ if((*(src->shared->u.vlen.read))(src->shared->u.vlen.f, dxpl_id, s, conv_buf, src_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data")
} /* end else */
if(!noop_conv) {
/* Check if temporary buffer is large enough, resize if necessary */
/* (Chain off the conversion buffer size) */
- if(tmp_buf && tmp_buf_size<conv_buf_size) {
+ if(tmp_buf && tmp_buf_size < conv_buf_size) {
/* Set up initial background buffer */
- tmp_buf_size=conv_buf_size;
- if((tmp_buf=H5FL_BLK_REALLOC(vlen_seq,tmp_buf,tmp_buf_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ tmp_buf_size = conv_buf_size;
+ if(NULL == (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
} /* end if */
/* If we are writing and there is a nested VL type, read
* the sequence into the background buffer */
if(nested) {
- uint8_t *tmp=b;
- UINT32DECODE(tmp, bg_seq_len);
+ uint8_t *tmp = b;
- if(bg_seq_len>0) {
- if(tmp_buf_size<(bg_seq_len*MAX(src_base_size, dst_base_size))) {
- tmp_buf_size=(bg_seq_len*MAX(src_base_size, dst_base_size));
- if((tmp_buf=H5FL_BLK_REALLOC(vlen_seq,tmp_buf, tmp_buf_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
- }
+ UINT32DECODE(tmp, bg_seq_len);
+ if(bg_seq_len > 0) {
+ if(tmp_buf_size < (bg_seq_len * MAX(src_base_size, dst_base_size))) {
+ tmp_buf_size = (bg_seq_len * MAX(src_base_size, dst_base_size));
+ if(NULL == (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ } /* end if */
H5F_addr_decode(dst->shared->u.vlen.f, (const uint8_t **)&tmp, &(bg_hobjid.addr));
INT32DECODE(tmp, bg_hobjid.idx);
- if(H5HG_read(dst->shared->u.vlen.f,dxpl_id,&bg_hobjid,tmp_buf, NULL)==NULL)
- HGOTO_ERROR (H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL sequence into background buffer");
+ if(NULL == H5HG_read(dst->shared->u.vlen.f, dxpl_id, &bg_hobjid, tmp_buf, NULL))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL sequence into background buffer")
} /* end if */
/* If the sequence gets shorter, pad out the original sequence with zeros */
- H5_CHECK_OVERFLOW(bg_seq_len,size_t,ssize_t);
- if((ssize_t)bg_seq_len<seq_len) {
- HDmemset((uint8_t *)tmp_buf+dst_base_size*bg_seq_len,0,(seq_len-bg_seq_len)*dst_base_size);
- } /* end if */
+ if((ssize_t)bg_seq_len < seq_len)
+ HDmemset((uint8_t *)tmp_buf + dst_base_size * bg_seq_len, 0, (seq_len - bg_seq_len) * dst_base_size);
} /* end if */
/* Convert VL sequence */
- H5_CHECK_OVERFLOW(seq_len,ssize_t,size_t);
if(H5T_convert(tpath, tsrc_id, tdst_id, (size_t)seq_len, (size_t)0, (size_t)0, conv_buf, tmp_buf, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
} /* end if */
/* Write sequence to destination location */
- if((*(dst->shared->u.vlen.write))(dst->shared->u.vlen.f,dxpl_id,vl_alloc_info,d,conv_buf, b, (size_t)seq_len, dst_base_size)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data");
+ if((*(dst->shared->u.vlen.write))(dst->shared->u.vlen.f, dxpl_id, vl_alloc_info, d, conv_buf, b, (size_t)seq_len, dst_base_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data")
if(!noop_conv) {
/* For nested VL case, free leftover heap objects from the deeper level if the length of new data elements is shorter than the old data elements.*/
- H5_CHECK_OVERFLOW(bg_seq_len,size_t,ssize_t);
- if(nested && seq_len<(ssize_t)bg_seq_len) {
+ if(nested && seq_len < (ssize_t)bg_seq_len) {
size_t parent_seq_len;
- size_t u;
uint8_t *tmp_p;
+ size_t u;
+
/* TMP_P is reset each time in the loop because DST_BASE_SIZE may include some data in addition to VL info. - SLU */
- for(u=seq_len; u<bg_seq_len; u++) {
- tmp_p = (uint8_t*)tmp_buf + u*dst_base_size;
+ for(u = seq_len; u < bg_seq_len; u++) {
+ tmp_p = (uint8_t*)tmp_buf + u * dst_base_size;
UINT32DECODE(tmp_p, parent_seq_len);
- if(parent_seq_len>0) {
+ if(parent_seq_len > 0) {
H5F_addr_decode(dst->shared->u.vlen.f, (const uint8_t **)&tmp_p, &(parent_hobjid.addr));
INT32DECODE(tmp_p, parent_hobjid.idx);
- if(H5HG_remove(dst->shared->u.vlen.f, dxpl_id,&parent_hobjid)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object");
- }
- }
+ if(H5HG_remove(dst->shared->u.vlen.f, dxpl_id, &parent_hobjid) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
+ } /* end if */
+ } /* end for */
} /* end if */
} /* end if */
} /* end else */
@@ -3168,18 +3168,18 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end for */
/* Decrement number of elements left to convert */
- nelmts-=safe;
+ nelmts -= safe;
} /* end while */
/* Release the temporary datatype IDs used */
- if (tsrc_id >= 0)
+ if(tsrc_id >= 0)
H5I_dec_ref(tsrc_id, FALSE);
- if (tdst_id >= 0)
+ if(tdst_id >= 0)
H5I_dec_ref(tdst_id, FALSE);
break;
default: /* Some other command we don't know about yet.*/
- HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command")
} /* end switch */
done:
@@ -3194,7 +3194,7 @@ done:
tmp_buf = H5FL_BLK_FREE(vlen_seq, tmp_buf);
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5T_conv_vlen() */
/*-------------------------------------------------------------------------
@@ -3240,7 +3240,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* information that remains (almost) constant for this
* conversion path.
*/
- if(NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id)))
+ if(NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
HDassert(H5T_ARRAY==src->shared->type);
HDassert(H5T_ARRAY==dst->shared->type);
@@ -3265,7 +3265,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/*
* Conversion.
*/
- if (NULL == (src = H5I_object(src_id)) || NULL == (dst = H5I_object(dst_id)))
+ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/*
@@ -3398,8 +3398,8 @@ H5T_conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
switch (cdata->command) {
case H5T_CONV_INIT:
- if (NULL==(src=H5I_object(src_id)) ||
- NULL==(dst=H5I_object(dst_id)))
+ if (NULL==(src=(H5T_t *)H5I_object(src_id)) ||
+ NULL==(dst=(H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
if (H5T_ORDER_LE!=src->shared->u.atomic.order &&
H5T_ORDER_BE!=src->shared->u.atomic.order)
@@ -3417,8 +3417,8 @@ H5T_conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_CONV_CONV:
/* Get the datatypes */
- if (NULL==(src=H5I_object(src_id)) ||
- NULL==(dst=H5I_object(dst_id)))
+ if (NULL==(src=(H5T_t *)H5I_object(src_id)) ||
+ NULL==(dst=(H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
/*
@@ -3824,8 +3824,8 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
switch (cdata->command) {
case H5T_CONV_INIT:
- if (NULL==(src_p=H5I_object(src_id)) ||
- NULL==(dst_p=H5I_object(dst_id)))
+ if (NULL==(src_p=(H5T_t *)H5I_object(src_id)) ||
+ NULL==(dst_p=(H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
src = src_p->shared->u.atomic;
dst = dst_p->shared->u.atomic;
@@ -3845,8 +3845,8 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_CONV_CONV:
/* Get the datatypes */
- if (NULL==(src_p=H5I_object(src_id)) ||
- NULL==(dst_p=H5I_object(dst_id)))
+ if (NULL==(src_p=(H5T_t *)H5I_object(src_id)) ||
+ NULL==(dst_p=(H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
src = src_p->shared->u.atomic;
dst = dst_p->shared->u.atomic;
@@ -4367,8 +4367,8 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
switch (cdata->command) {
case H5T_CONV_INIT:
- if (NULL==(src=H5I_object(src_id)) ||
- NULL==(dst=H5I_object(dst_id)))
+ if (NULL==(src=(H5T_t *)H5I_object(src_id)) ||
+ NULL==(dst=(H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
if (8*src->shared->size != src->shared->u.atomic.prec || 8*dst->shared->size != dst->shared->u.atomic.prec)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad precision");
@@ -4389,8 +4389,8 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_CONV_CONV:
/* Get the datatypes */
- if (NULL==(src=H5I_object(src_id)) ||
- NULL==(dst=H5I_object(dst_id)))
+ if (NULL==(src=(H5T_t *)H5I_object(src_id)) ||
+ NULL==(dst=(H5T_t *)H5I_object(dst_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
/*
@@ -4422,7 +4422,7 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
/* Allocate the overlap buffer */
- if (NULL==(dbuf=H5MM_malloc(dst->shared->size)))
+ if (NULL==(dbuf=(uint8_t *)H5MM_malloc(dst->shared->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for string conversion");
/* The conversion loop. */
@@ -9808,18 +9808,18 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
int_buf = (uint8_t*)H5MM_calloc(buf_size);
/* Get the plist structure. Do I need to close it? */
- if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID");
/* Get conversion exception callback property */
- if (H5P_get(plist,H5D_XFER_CONV_CB_NAME,&cb_struct)<0)
+ if(H5P_get(plist, H5D_XFER_CONV_CB_NAME, &cb_struct) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get conversion exception callback");
/* Allocate space for order-reversed source buffer */
src_rev = (uint8_t*)H5MM_calloc(src_p->shared->size);
/* The conversion loop */
- for (elmtno=0; elmtno<nelmts; elmtno++) {
+ for(elmtno = 0; elmtno < nelmts; elmtno++) {
/* Set these variables to default */
except_ret = H5T_CONV_UNHANDLED;
truncated = FALSE;
@@ -9829,7 +9829,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* If the source and destination buffers overlap then use a
* temporary buffer for the destination.
*/
- if (direction>0) {
+ if(direction > 0) {
s = sp;
d = elmtno<olap ? dbuf : dp;
} else {
@@ -10038,8 +10038,8 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* Restore the implicit bit for mantissa if it's implied.
* Equivalent to mantissa |= (hsize_t)1<<src.u.f.msize.
*/
- if (H5T_NORM_IMPLIED==src.u.f.norm)
- H5T_bit_inc(int_buf, src.u.f.msize, 8*buf_size-src.u.f.msize);
+ if(H5T_NORM_IMPLIED == src.u.f.norm)
+ H5T_bit_inc(int_buf, src.u.f.msize, 8 * buf_size - src.u.f.msize);
/*
* Shift mantissa part by exponent minus mantissa size(right shift),
@@ -10047,7 +10047,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* 10...010111, expo=20, expo-msize=-3. Right-shift the sequence, we get
* 00010...10. The last three bits were dropped.
*/
- H5T_bit_shift(int_buf, (ssize_t)(expo-src.u.f.msize), (size_t)0, buf_size*8);
+ H5T_bit_shift(int_buf, (ssize_t)(expo-src.u.f.msize), (size_t)0, buf_size * 8);
/*
* If expo is less than mantissa size, the frantional value is dropped off
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 45b0e7f..0ec9632 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -1363,7 +1363,7 @@ H5_DLL herr_t H5T_conv_ldouble_ullong(hid_t src_id, hid_t dst_id,
/* Bit twiddling functions */
H5_DLL void H5T_bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src,
size_t src_offset, size_t size);
-H5_DLL void H5T_bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size);
+H5_DLL herr_t H5T_bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size);
H5_DLL void H5T_bit_set(uint8_t *buf, size_t offset, size_t size,
hbool_t value);
H5_DLL uint64_t H5T_bit_get_d(uint8_t *buf, size_t offset, size_t size);