summaryrefslogtreecommitdiffstats
path: root/src/H5Tconv.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-08-08 16:52:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-08-08 16:52:55 (GMT)
commitd8397a6f426227d09d20e647ce8b12b8c6295b2d (patch)
tree2943fbfd2bfb66cf167eb642835fdb4deb3afd3c /src/H5Tconv.c
parent573307786a1f5f7ce597e5191ea08c3bbd95b66c (diff)
downloadhdf5-d8397a6f426227d09d20e647ce8b12b8c6295b2d.zip
hdf5-d8397a6f426227d09d20e647ce8b12b8c6295b2d.tar.gz
hdf5-d8397a6f426227d09d20e647ce8b12b8c6295b2d.tar.bz2
[svn-r5842] Purpose:
Code cleanup Description: Change most (all?) HRETURN_ERROR macros to HGOTO_ERROR macros, along with HRETURN macros to HGOTO_DONE macros. This unifies the error return path from functions and reduces the size of the library by up to 10% on some platforms. Additionally, I improved a lot of the error cleanup code in many routines. Platforms tested: FreeBSD 4.6 (sleipnir) serial & parallel and IRIX64 6.5 (modi4) serial & parallel.
Diffstat (limited to 'src/H5Tconv.c')
-rw-r--r--src/H5Tconv.c3586
1 files changed, 1818 insertions, 1768 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index f15acf7..43d9dd2 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -285,11 +285,11 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
cdata->need_bkg = H5T_BKG_NO; \
if (NULL==(st=H5I_object_verify(src_id,H5I_DATATYPE)) || \
NULL==(dt=H5I_object_verify(dst_id,H5I_DATATYPE))) { \
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
"unable to dereference data type object ID"); \
} \
if (st->size!=sizeof(ST) || dt->size!=sizeof(DT)) { \
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \
"disagreement about data type size"); \
} \
CI_ALLOC_PRIV \
@@ -355,7 +355,7 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
break; \
\
default: \
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, \
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, \
"unknown conversion command"); \
} \
}
@@ -381,7 +381,7 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
/* Allocate private alignment structure for atomic types */
# define CI_ALLOC_PRIV \
if (NULL==(cdata->priv=H5MM_calloc(sizeof(H5T_conv_hw_t)))) { \
- HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \
"memory allocation failed"); \
}
@@ -395,17 +395,18 @@ H5FL_BLK_DEFINE_STATIC(array_seq);
/* Increment destination alignment counter */
# define CI_INC_DST(d) if (d) ((H5T_conv_hw_t *)cdata->priv)->d_aligned += nelmts;
-#else
+#else /* H5T_DEBUG */
# define CI_PRINT_STATS(STYPE,DTYPE) /*void*/
# define CI_ALLOC_PRIV cdata->priv=NULL;
# define CI_FREE_PRIV /* void */
# define CI_INC_SRC(s) /* void */
# define CI_INC_DST(d) /* void */
-#endif
+#endif /* H5T_DEBUG */
/* Swap two elements (I & J) of an array using a temporary variable */
#define H5_SWAP_BYTES(ARRAY,I,J) {uint8_t _tmp; _tmp=ARRAY[I]; ARRAY[I]=ARRAY[J]; ARRAY[J]=_tmp;}
+
/*-------------------------------------------------------------------------
* Function: H5T_conv_noop
*
@@ -427,6 +428,8 @@ H5T_conv_noop(hid_t UNUSED src_id, hid_t UNUSED dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void UNUSED *buf,
void UNUSED *background, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_noop, FAIL);
switch (cdata->command) {
@@ -442,13 +445,14 @@ H5T_conv_noop(hid_t UNUSED src_id, hid_t UNUSED dst_id, H5T_cdata_t *cdata,
break;
default:
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_conv_order_opt
*
@@ -477,6 +481,7 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5T_t *src = NULL;
H5T_t *dst = NULL;
hsize_t i;
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_order_opt, FAIL);
@@ -485,45 +490,38 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
/* Capability query */
if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
if (src->size != dst->size ||
- 0 != src->u.atomic.offset ||
- 0 != dst->u.atomic.offset ||
- !((H5T_ORDER_BE == src->u.atomic.order &&
- H5T_ORDER_LE == dst->u.atomic.order) ||
- (H5T_ORDER_LE == src->u.atomic.order &&
- H5T_ORDER_BE == dst->u.atomic.order))) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "conversion not supported");
- }
+ 0 != src->u.atomic.offset ||
+ 0 != dst->u.atomic.offset ||
+ !((H5T_ORDER_BE == src->u.atomic.order &&
+ H5T_ORDER_LE == dst->u.atomic.order) ||
+ (H5T_ORDER_LE == src->u.atomic.order &&
+ H5T_ORDER_BE == dst->u.atomic.order)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
if (src->size!=1 && src->size!=2 && src->size!=4 &&
- src->size!=8 && src->size!=16) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "conversion not supported");
- }
+ src->size!=8 && src->size!=16)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
switch (src->type) {
- case H5T_INTEGER:
- case H5T_BITFIELD:
- /* nothing to check */
- break;
-
- case H5T_FLOAT:
- if (src->u.atomic.u.f.sign != dst->u.atomic.u.f.sign ||
- src->u.atomic.u.f.epos != dst->u.atomic.u.f.epos ||
- src->u.atomic.u.f.esize != dst->u.atomic.u.f.esize ||
- src->u.atomic.u.f.ebias != dst->u.atomic.u.f.ebias ||
- src->u.atomic.u.f.mpos != dst->u.atomic.u.f.mpos ||
- src->u.atomic.u.f.msize != dst->u.atomic.u.f.msize ||
- src->u.atomic.u.f.norm != dst->u.atomic.u.f.norm ||
- src->u.atomic.u.f.pad != dst->u.atomic.u.f.pad) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "conversion not supported");
- }
- break;
-
- default:
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "conversion not supported");
+ case H5T_INTEGER:
+ case H5T_BITFIELD:
+ /* nothing to check */
+ break;
+
+ case H5T_FLOAT:
+ if (src->u.atomic.u.f.sign != dst->u.atomic.u.f.sign ||
+ src->u.atomic.u.f.epos != dst->u.atomic.u.f.epos ||
+ src->u.atomic.u.f.esize != dst->u.atomic.u.f.esize ||
+ src->u.atomic.u.f.ebias != dst->u.atomic.u.f.ebias ||
+ src->u.atomic.u.f.mpos != dst->u.atomic.u.f.mpos ||
+ src->u.atomic.u.f.msize != dst->u.atomic.u.f.msize ||
+ src->u.atomic.u.f.norm != dst->u.atomic.u.f.norm ||
+ src->u.atomic.u.f.pad != dst->u.atomic.u.f.pad)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
}
cdata->need_bkg = H5T_BKG_NO;
break;
@@ -532,7 +530,7 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
/* The conversion */
if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
buf_stride = buf_stride ? buf_stride : src->size;
switch (src->size) {
@@ -826,11 +824,11 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
break;
default:
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -867,6 +865,7 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
H5T_t *dst = NULL;
hsize_t i;
size_t j, md;
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_order, FAIL);
@@ -875,40 +874,35 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* Capability query */
if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- if (src->size != dst->size ||
- 0 != src->u.atomic.offset ||
- 0 != dst->u.atomic.offset ||
- !((H5T_ORDER_BE == src->u.atomic.order &&
- H5T_ORDER_LE == dst->u.atomic.order) ||
- (H5T_ORDER_LE == src->u.atomic.order &&
- H5T_ORDER_BE == dst->u.atomic.order))) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "conversion not supported");
- }
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ if (src->size != dst->size || 0 != src->u.atomic.offset ||
+ 0 != dst->u.atomic.offset ||
+ !((H5T_ORDER_BE == src->u.atomic.order &&
+ H5T_ORDER_LE == dst->u.atomic.order) ||
+ (H5T_ORDER_LE == src->u.atomic.order &&
+ H5T_ORDER_BE == dst->u.atomic.order)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
switch (src->type) {
- case H5T_INTEGER:
- case H5T_BITFIELD:
- /* nothing to check */
- break;
-
- case H5T_FLOAT:
- if (src->u.atomic.u.f.sign != dst->u.atomic.u.f.sign ||
- src->u.atomic.u.f.epos != dst->u.atomic.u.f.epos ||
- src->u.atomic.u.f.esize != dst->u.atomic.u.f.esize ||
- src->u.atomic.u.f.ebias != dst->u.atomic.u.f.ebias ||
- src->u.atomic.u.f.mpos != dst->u.atomic.u.f.mpos ||
- src->u.atomic.u.f.msize != dst->u.atomic.u.f.msize ||
- src->u.atomic.u.f.norm != dst->u.atomic.u.f.norm ||
- src->u.atomic.u.f.pad != dst->u.atomic.u.f.pad) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "conversion not supported");
- }
- break;
+ case H5T_INTEGER:
+ case H5T_BITFIELD:
+ /* nothing to check */
+ break;
+
+ case H5T_FLOAT:
+ if (src->u.atomic.u.f.sign != dst->u.atomic.u.f.sign ||
+ src->u.atomic.u.f.epos != dst->u.atomic.u.f.epos ||
+ src->u.atomic.u.f.esize != dst->u.atomic.u.f.esize ||
+ src->u.atomic.u.f.ebias != dst->u.atomic.u.f.ebias ||
+ src->u.atomic.u.f.mpos != dst->u.atomic.u.f.mpos ||
+ src->u.atomic.u.f.msize != dst->u.atomic.u.f.msize ||
+ src->u.atomic.u.f.norm != dst->u.atomic.u.f.norm ||
+ src->u.atomic.u.f.pad != dst->u.atomic.u.f.pad) {
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
+ }
+ break;
- default:
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "conversion not supported");
+ default:
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported");
}
cdata->need_bkg = H5T_BKG_NO;
break;
@@ -917,14 +911,13 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* The conversion */
if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
buf_stride = buf_stride ? buf_stride : src->size;
md = src->size / 2;
for (i=0; i<nelmts; i++, buf+=buf_stride) {
- for (j=0; j<md; j++) {
+ for (j=0; j<md; j++)
H5_SWAP_BYTES(buf, j, src->size-(j+1));
- }
}
break;
@@ -933,13 +926,14 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
break;
default:
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_conv_b_b
*
@@ -973,184 +967,179 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
uint8_t dbuf[256]; /*temp destination buffer */
size_t msb_pad_offset; /*offset for dest MSB padding */
size_t i;
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_b_b, FAIL);
switch(cdata->command) {
- case H5T_CONV_INIT:
- /* Capability query */
- if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- if (H5T_ORDER_LE!=src->u.atomic.order &&
- H5T_ORDER_BE!=src->u.atomic.order) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unsupported byte order");
- }
- if (H5T_ORDER_LE!=dst->u.atomic.order &&
- H5T_ORDER_BE!=dst->u.atomic.order) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unsupported byte order");
- }
- cdata->need_bkg = H5T_BKG_NO;
- break;
+ case H5T_CONV_INIT:
+ /* Capability query */
+ if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ if (H5T_ORDER_LE!=src->u.atomic.order &&
+ H5T_ORDER_BE!=src->u.atomic.order)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
+ if (H5T_ORDER_LE!=dst->u.atomic.order &&
+ H5T_ORDER_BE!=dst->u.atomic.order)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
+ cdata->need_bkg = H5T_BKG_NO;
+ break;
- case H5T_CONV_FREE:
- break;
+ case H5T_CONV_FREE:
+ break;
- case H5T_CONV_CONV:
- /* Get the data types */
- if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
-
- /*
- * Do we process the values from beginning to end or vice versa? Also,
- * how many of the elements have the source and destination areas
- * overlapping?
- */
- if (src->size==dst->size || buf_stride) {
- sp = dp = (uint8_t*)buf;
- direction = 1;
- olap = nelmts;
- } else if (src->size>=dst->size) {
- double olap_d = HDceil((double)(dst->size)/
- (double)(src->size-dst->size));
-
- olap = (size_t)olap_d;
- sp = dp = (uint8_t*)buf;
- direction = 1;
- } else {
- double olap_d = HDceil((double)(src->size)/
- (double)(dst->size-src->size));
- olap = (size_t)olap_d;
- sp = (uint8_t*)buf + (nelmts-1) * src->size;
- dp = (uint8_t*)buf + (nelmts-1) * dst->size;
- direction = -1;
- }
+ case H5T_CONV_CONV:
+ /* Get the data types */
+ if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+
+ /*
+ * Do we process the values from beginning to end or vice versa? Also,
+ * how many of the elements have the source and destination areas
+ * overlapping?
+ */
+ if (src->size==dst->size || buf_stride) {
+ sp = dp = (uint8_t*)buf;
+ direction = 1;
+ olap = nelmts;
+ } else if (src->size>=dst->size) {
+ double olap_d = HDceil((double)(dst->size)/
+ (double)(src->size-dst->size));
+
+ olap = (size_t)olap_d;
+ sp = dp = (uint8_t*)buf;
+ direction = 1;
+ } else {
+ double olap_d = HDceil((double)(src->size)/
+ (double)(dst->size-src->size));
+ olap = (size_t)olap_d;
+ sp = (uint8_t*)buf + (nelmts-1) * src->size;
+ dp = (uint8_t*)buf + (nelmts-1) * dst->size;
+ direction = -1;
+ }
- /* The conversion loop */
- for (elmtno=0; elmtno<nelmts; elmtno++) {
+ /* The conversion loop */
+ for (elmtno=0; elmtno<nelmts; elmtno++) {
- /*
- * If the source and destination buffers overlap then use a
- * temporary buffer for the destination.
- */
- if (direction>0) {
- s = sp;
- d = elmtno<olap ? dbuf : dp;
- } else {
- s = sp;
- d = elmtno+olap >= nelmts ? dbuf : dp;
- }
+ /*
+ * If the source and destination buffers overlap then use a
+ * temporary buffer for the destination.
+ */
+ if (direction>0) {
+ s = sp;
+ d = elmtno<olap ? dbuf : dp;
+ } else {
+ s = sp;
+ d = elmtno+olap >= nelmts ? dbuf : dp;
+ }
#ifndef NDEBUG
- /* I don't quite trust the overlap calculations yet --rpm */
- if (d==dbuf) {
- assert ((dp>=sp && dp<sp+src->size) ||
- (sp>=dp && sp<dp+dst->size));
- } else {
- assert ((dp<sp && dp+dst->size<=sp) ||
- (sp<dp && sp+src->size<=dp));
- }
+ /* I don't quite trust the overlap calculations yet --rpm */
+ if (d==dbuf) {
+ assert ((dp>=sp && dp<sp+src->size) ||
+ (sp>=dp && sp<dp+dst->size));
+ } else {
+ assert ((dp<sp && dp+dst->size<=sp) ||
+ (sp<dp && sp+src->size<=dp));
+ }
#endif
-
- /*
- * Put the data in little endian order so our loops aren't so
- * complicated. We'll do all the conversion stuff assuming
- * little endian and then we'll fix the order at the end.
- */
- if (H5T_ORDER_BE==src->u.atomic.order) {
- half_size = src->size/2;
- for (i=0; i<half_size; i++) {
- uint8_t tmp = s[src->size-(i+1)];
- s[src->size-(i+1)] = s[i];
- s[i] = tmp;
- }
- }
+
+ /*
+ * Put the data in little endian order so our loops aren't so
+ * complicated. We'll do all the conversion stuff assuming
+ * little endian and then we'll fix the order at the end.
+ */
+ if (H5T_ORDER_BE==src->u.atomic.order) {
+ half_size = src->size/2;
+ for (i=0; i<half_size; i++) {
+ uint8_t tmp = s[src->size-(i+1)];
+ s[src->size-(i+1)] = s[i];
+ s[i] = tmp;
+ }
+ }
- /*
- * Copy the significant part of the value. If the source is larger
- * than the destination then invoke the overflow function or copy
- * as many bits as possible. Zero extra bits in the destination.
- */
- if (src->u.atomic.prec>dst->u.atomic.prec) {
- if (!H5T_overflow_g ||
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- H5T_bit_copy(d, dst->u.atomic.offset,
- s, src->u.atomic.offset, dst->u.atomic.prec);
- }
- } else {
- H5T_bit_copy(d, dst->u.atomic.offset,
- s, src->u.atomic.offset,
- src->u.atomic.prec);
- H5T_bit_set(d, dst->u.atomic.offset+src->u.atomic.prec,
- dst->u.atomic.prec-src->u.atomic.prec, FALSE);
- }
+ /*
+ * Copy the significant part of the value. If the source is larger
+ * than the destination then invoke the overflow function or copy
+ * as many bits as possible. Zero extra bits in the destination.
+ */
+ if (src->u.atomic.prec>dst->u.atomic.prec) {
+ if (!H5T_overflow_g ||
+ (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
+ H5T_bit_copy(d, dst->u.atomic.offset,
+ s, src->u.atomic.offset, dst->u.atomic.prec);
+ }
+ } else {
+ H5T_bit_copy(d, dst->u.atomic.offset,
+ s, src->u.atomic.offset,
+ src->u.atomic.prec);
+ H5T_bit_set(d, dst->u.atomic.offset+src->u.atomic.prec,
+ dst->u.atomic.prec-src->u.atomic.prec, FALSE);
+ }
- /*
- * Fill the destination padding areas.
- */
- switch (dst->u.atomic.lsb_pad) {
- case H5T_PAD_ZERO:
- H5T_bit_set(d, 0, dst->u.atomic.offset, FALSE);
- break;
- case H5T_PAD_ONE:
- H5T_bit_set(d, 0, dst->u.atomic.offset, TRUE);
- break;
- default:
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unsupported LSB padding");
- }
- msb_pad_offset = dst->u.atomic.offset + dst->u.atomic.prec;
- switch (dst->u.atomic.msb_pad) {
- case H5T_PAD_ZERO:
- H5T_bit_set(d, msb_pad_offset, 8*dst->size-msb_pad_offset,
- FALSE);
- break;
- case H5T_PAD_ONE:
- H5T_bit_set(d, msb_pad_offset, 8*dst->size-msb_pad_offset,
- TRUE);
- break;
- default:
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unsupported MSB padding");
- }
+ /*
+ * Fill the destination padding areas.
+ */
+ switch (dst->u.atomic.lsb_pad) {
+ case H5T_PAD_ZERO:
+ H5T_bit_set(d, 0, dst->u.atomic.offset, FALSE);
+ break;
+ case H5T_PAD_ONE:
+ H5T_bit_set(d, 0, dst->u.atomic.offset, TRUE);
+ break;
+ default:
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported LSB padding");
+ }
+ msb_pad_offset = dst->u.atomic.offset + dst->u.atomic.prec;
+ switch (dst->u.atomic.msb_pad) {
+ case H5T_PAD_ZERO:
+ H5T_bit_set(d, msb_pad_offset, 8*dst->size-msb_pad_offset,
+ FALSE);
+ break;
+ case H5T_PAD_ONE:
+ H5T_bit_set(d, msb_pad_offset, 8*dst->size-msb_pad_offset,
+ TRUE);
+ break;
+ default:
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported MSB padding");
+ }
- /*
- * Put the destination in the correct byte order. See note at
- * beginning of loop.
- */
- if (H5T_ORDER_BE==dst->u.atomic.order) {
- half_size = dst->size/2;
- for (i=0; i<half_size; i++) {
- uint8_t tmp = d[dst->size-(i+1)];
- d[dst->size-(i+1)] = d[i];
- d[i] = tmp;
- }
- }
+ /*
+ * Put the destination in the correct byte order. See note at
+ * beginning of loop.
+ */
+ if (H5T_ORDER_BE==dst->u.atomic.order) {
+ half_size = dst->size/2;
+ for (i=0; i<half_size; i++) {
+ uint8_t tmp = d[dst->size-(i+1)];
+ d[dst->size-(i+1)] = d[i];
+ d[i] = tmp;
+ }
+ }
- /*
- * If we had used a temporary buffer for the destination then we
- * should copy the value to the true destination buffer.
- */
- if (d==dbuf) HDmemcpy (dp, d, dst->size);
- if (buf_stride) {
- sp += direction * buf_stride;
- dp += direction * buf_stride;
- } else {
- sp += direction * src->size;
- dp += direction * dst->size;
- }
- }
-
- break;
+ /*
+ * If we had used a temporary buffer for the destination then we
+ * should copy the value to the true destination buffer.
+ */
+ if (d==dbuf) HDmemcpy (dp, d, dst->size);
+ if (buf_stride) {
+ sp += direction * buf_stride;
+ dp += direction * buf_stride;
+ } else {
+ sp += direction * src->size;
+ dp += direction * dst->size;
+ }
+ }
+
+ break;
- default:
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ default:
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
}
@@ -1188,6 +1177,7 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
int i, j, *src2dst = NULL;
H5T_t *type = NULL;
hid_t tid;
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOINIT(H5T_conv_struct_init);
@@ -1196,15 +1186,13 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
* Allocate private data structure and arrays.
*/
if (NULL==(priv=cdata->priv=H5MM_calloc(sizeof(H5T_conv_struct_t))) ||
- NULL==(priv->src2dst=H5MM_malloc(src->u.compnd.nmembs *
- sizeof(int))) ||
- NULL==(priv->src_memb_id=H5MM_malloc(src->u.compnd.nmembs *
- sizeof(hid_t))) ||
- NULL==(priv->dst_memb_id=H5MM_malloc(dst->u.compnd.nmembs *
- sizeof(hid_t)))) {
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed");
- }
+ NULL==(priv->src2dst=H5MM_malloc(src->u.compnd.nmembs *
+ sizeof(int))) ||
+ NULL==(priv->src_memb_id=H5MM_malloc(src->u.compnd.nmembs *
+ sizeof(hid_t))) ||
+ NULL==(priv->dst_memb_id=H5MM_malloc(dst->u.compnd.nmembs *
+ sizeof(hid_t))))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
src2dst = priv->src2dst;
/*
@@ -1251,10 +1239,8 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
src2dst = priv->src2dst;
H5MM_xfree(priv->memb_path);
if (NULL==(priv->memb_path=H5MM_malloc(src->u.compnd.nmembs *
- sizeof(H5T_path_t*)))) {
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed");
- }
+ sizeof(H5T_path_t*))))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
for (i=0; i<src->u.compnd.nmembs; i++) {
if (src2dst[i]>=0) {
@@ -1267,8 +1253,7 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
H5MM_xfree(priv->dst_memb_id);
H5MM_xfree(priv->memb_path);
cdata->priv = priv = H5MM_xfree (priv);
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unable to convert member data type");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert member data type");
}
}
}
@@ -1278,9 +1263,12 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
cdata->need_bkg = H5T_BKG_YES;
cdata->recalc = FALSE;
- FUNC_LEAVE (SUCCEED);
+
+done:
+ FUNC_LEAVE (ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5T_conv_struct
*
@@ -1339,174 +1327,167 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
hsize_t elmtno;
int i; /*counters */
H5T_conv_struct_t *priv = (H5T_conv_struct_t *)(cdata->priv);
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_struct, FAIL);
switch (cdata->command) {
- case H5T_CONV_INIT:
- /*
- * First, determine if this conversion function applies to the
- * conversion path SRC_ID-->DST_ID. If not, return failure;
- * otherwise initialize the `priv' field of `cdata' with information
- * that remains (almost) constant for this conversion path.
- */
- if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- assert (H5T_COMPOUND==src->type);
- assert (H5T_COMPOUND==dst->type);
+ case H5T_CONV_INIT:
+ /*
+ * First, determine if this conversion function applies to the
+ * conversion path SRC_ID-->DST_ID. If not, return failure;
+ * otherwise initialize the `priv' field of `cdata' with information
+ * that remains (almost) constant for this conversion path.
+ */
+ if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ assert (H5T_COMPOUND==src->type);
+ assert (H5T_COMPOUND==dst->type);
- if (H5T_conv_struct_init (src, dst, cdata)<0) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to initialize conversion data");
- }
- break;
+ if (H5T_conv_struct_init (src, dst, cdata)<0)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data");
+ break;
- case H5T_CONV_FREE:
- /*
- * Free the private conversion data.
- */
- H5MM_xfree(priv->src2dst);
- H5MM_xfree(priv->src_memb_id);
- H5MM_xfree(priv->dst_memb_id);
- H5MM_xfree(priv->memb_path);
- cdata->priv = priv = H5MM_xfree (priv);
- break;
+ case H5T_CONV_FREE:
+ /*
+ * Free the private conversion data.
+ */
+ H5MM_xfree(priv->src2dst);
+ H5MM_xfree(priv->src_memb_id);
+ H5MM_xfree(priv->dst_memb_id);
+ H5MM_xfree(priv->memb_path);
+ cdata->priv = priv = H5MM_xfree (priv);
+ break;
- case H5T_CONV_CONV:
- /*
- * Conversion.
- */
- if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- assert (priv);
- assert (bkg && cdata->need_bkg);
+ case H5T_CONV_CONV:
+ /*
+ * Conversion.
+ */
+ if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ assert (priv);
+ assert (bkg && cdata->need_bkg);
- if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata)<0) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to initialize conversion data");
- }
+ if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata)<0)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data");
+
+ /*
+ * Insure that members are sorted.
+ */
+ H5T_sort_value(src, NULL);
+ H5T_sort_value(dst, NULL);
+ src2dst = priv->src2dst;
- /*
- * Insure that members are sorted.
- */
- H5T_sort_value(src, NULL);
- H5T_sort_value(dst, NULL);
- src2dst = priv->src2dst;
-
- /*
- * Direction of conversion and striding through background.
- */
- if (buf_stride) {
- src_delta = buf_stride;
- if (!bkg_stride)
+ /*
+ * Direction of conversion and striding through background.
+ */
+ if (buf_stride) {
+ src_delta = buf_stride;
+ if (!bkg_stride)
+ bkg_stride = dst->size;
+ } else if (dst->size <= src->size) {
+ src_delta = src->size;
bkg_stride = dst->size;
- } else if (dst->size <= src->size) {
- src_delta = src->size;
- bkg_stride = dst->size;
- } else {
- src_delta = -(int)src->size; /*overflow shouldn't be possible*/
- bkg_stride = -(int)dst->size; /*overflow shouldn't be possible*/
- xbuf += (nelmts-1) * src->size;
- xbkg += (nelmts-1) * dst->size;
- }
+ } else {
+ src_delta = -(int)src->size; /*overflow shouldn't be possible*/
+ bkg_stride = -(int)dst->size; /*overflow shouldn't be possible*/
+ xbuf += (nelmts-1) * src->size;
+ xbkg += (nelmts-1) * dst->size;
+ }
- /* Conversion loop... */
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- /*
- * For each source member which will be present in the
- * destination, convert the member to the destination type unless
- * it is larger than the source type. Then move the member to the
- * left-most unoccupied position in the buffer. This makes the
- * data point as small as possible with all the free space on the
- * right side.
- */
- for (i=0, offset=0; i<src->u.compnd.nmembs; i++) {
- if (src2dst[i]<0) continue; /*subsetting*/
- src_memb = src->u.compnd.memb + i;
- dst_memb = dst->u.compnd.memb + src2dst[i];
-
- if (dst_memb->size <= src_memb->size) {
- if (H5T_convert(priv->memb_path[i], priv->src_memb_id[i],
- priv->dst_memb_id[src2dst[i]],
- (hsize_t)1, 0, 0, /*no striding (packed array)*/
- xbuf+src_memb->offset, xbkg+dst_memb->offset,
- dset_xfer_plist)<0) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to convert compound data type member");
- }
- HDmemmove (xbuf+offset, xbuf+src_memb->offset,
- dst_memb->size);
- offset += dst_memb->size;
- } else {
- HDmemmove (xbuf+offset, xbuf+src_memb->offset,
- src_memb->size);
- offset += src_memb->size;
- }
- }
+ /* Conversion loop... */
+ for (elmtno=0; elmtno<nelmts; elmtno++) {
+ /*
+ * For each source member which will be present in the
+ * destination, convert the member to the destination type unless
+ * it is larger than the source type. Then move the member to the
+ * left-most unoccupied position in the buffer. This makes the
+ * data point as small as possible with all the free space on the
+ * right side.
+ */
+ for (i=0, offset=0; i<src->u.compnd.nmembs; i++) {
+ if (src2dst[i]<0) continue; /*subsetting*/
+ src_memb = src->u.compnd.memb + i;
+ dst_memb = dst->u.compnd.memb + src2dst[i];
+
+ if (dst_memb->size <= src_memb->size) {
+ if (H5T_convert(priv->memb_path[i], priv->src_memb_id[i],
+ priv->dst_memb_id[src2dst[i]],
+ (hsize_t)1, 0, 0, /*no striding (packed array)*/
+ xbuf+src_memb->offset, xbkg+dst_memb->offset,
+ dset_xfer_plist)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member");
+ HDmemmove (xbuf+offset, xbuf+src_memb->offset,
+ dst_memb->size);
+ offset += dst_memb->size;
+ } else {
+ HDmemmove (xbuf+offset, xbuf+src_memb->offset,
+ src_memb->size);
+ offset += src_memb->size;
+ }
+ }
- /*
- * For each source member which will be present in the
- * destination, convert the member to the destination type if it
- * is larger than the source type (that is, has not been converted
- * yet). Then copy the member to the destination offset in the
- * background buffer.
- */
- for (i=src->u.compnd.nmembs-1; i>=0; --i) {
- if (src2dst[i]<0) continue; /*subsetting*/
- src_memb = src->u.compnd.memb + i;
- dst_memb = dst->u.compnd.memb + src2dst[i];
-
- if (dst_memb->size > src_memb->size) {
- offset -= src_memb->size;
- if (H5T_convert(priv->memb_path[i],
- priv->src_memb_id[i], priv->dst_memb_id[src2dst[i]],
- (hsize_t)1, 0, 0, /*no striding (packed array)*/
- xbuf+offset, xbkg+dst_memb->offset,
- dset_xfer_plist)<0) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to convert compound data type member");
- }
- } else {
- offset -= dst_memb->size;
- }
- HDmemmove (xbkg+dst_memb->offset, xbuf+offset, dst_memb->size);
- }
- assert (0==offset);
+ /*
+ * For each source member which will be present in the
+ * destination, convert the member to the destination type if it
+ * is larger than the source type (that is, has not been converted
+ * yet). Then copy the member to the destination offset in the
+ * background buffer.
+ */
+ for (i=src->u.compnd.nmembs-1; i>=0; --i) {
+ if (src2dst[i]<0) continue; /*subsetting*/
+ src_memb = src->u.compnd.memb + i;
+ dst_memb = dst->u.compnd.memb + src2dst[i];
+
+ if (dst_memb->size > src_memb->size) {
+ offset -= src_memb->size;
+ if (H5T_convert(priv->memb_path[i],
+ priv->src_memb_id[i], priv->dst_memb_id[src2dst[i]],
+ (hsize_t)1, 0, 0, /*no striding (packed array)*/
+ xbuf+offset, xbkg+dst_memb->offset,
+ dset_xfer_plist)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member");
+ } else {
+ offset -= dst_memb->size;
+ }
+ HDmemmove (xbkg+dst_memb->offset, xbuf+offset, dst_memb->size);
+ }
+ assert (0==offset);
- /*
- * Update pointers
- */
- xbuf += src_delta;
- xbkg += bkg_stride;
- }
+ /*
+ * Update pointers
+ */
+ xbuf += src_delta;
+ xbkg += bkg_stride;
+ }
- /* If the bkg_stride was set to -(dst->size), make it positive now */
- if(buf_stride==0 && dst->size>src->size)
- bkg_stride=dst->size;
-
- /*
- * Copy the background buffer back into the in-place conversion
- * buffer.
- */
- for (xbuf=buf, xbkg=bkg, elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbuf, xbkg, dst->size);
- xbuf += buf_stride ? buf_stride : dst->size;
- xbkg += bkg_stride;
- }
- break;
+ /* If the bkg_stride was set to -(dst->size), make it positive now */
+ if(buf_stride==0 && dst->size>src->size)
+ bkg_stride=dst->size;
- default:
- /* Some other command we don't know about yet.*/
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ /*
+ * Copy the background buffer back into the in-place conversion
+ * buffer.
+ */
+ for (xbuf=buf, xbkg=bkg, elmtno=0; elmtno<nelmts; elmtno++) {
+ HDmemmove(xbuf, xbkg, dst->size);
+ xbuf += buf_stride ? buf_stride : dst->size;
+ xbkg += bkg_stride;
+ }
+ break;
+
+ default:
+ /* Some other command we don't know about yet.*/
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
}
-
+
/*-------------------------------------------------------------------------
* Function: H5T_conv_struct_opt
*
@@ -1578,209 +1559,198 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t elmtno; /*element counter */
int i; /*counters */
H5T_conv_struct_t *priv = NULL; /*private data */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_struct_opt, FAIL);
switch (cdata->command) {
- case H5T_CONV_INIT:
- /*
- * First, determine if this conversion function applies to the
- * conversion path SRC_ID-->DST_ID. If not, return failure;
- * otherwise initialize the `priv' field of `cdata' with information
- * that remains (almost) constant for this conversion path.
- */
- if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- assert (H5T_COMPOUND==src->type);
- assert (H5T_COMPOUND==dst->type);
-
- /* Initialize data which is relatively constant */
- if (H5T_conv_struct_init (src, dst, cdata)<0) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to initialize conversion data");
- }
- priv = (H5T_conv_struct_t *)(cdata->priv);
- src2dst = priv->src2dst;
-
- /*
- * If the destination type is not larger than the source type then
- * this conversion function is guaranteed to work (provided all
- * members can be converted also). Otherwise the determination is
- * quite a bit more complicated. Essentially we have to make sure
- * that there is always room in the source buffer to do the
- * conversion of a member in place. This is basically the same pair
- * of loops as in the actual conversion except it checks that there
- * is room for each conversion instead of actually doing anything.
- */
- if (dst->size > src->size) {
- for (i=0, offset=0; i<src->u.compnd.nmembs; i++) {
- if (src2dst[i]<0)
- continue;
- src_memb = src->u.compnd.memb + i;
- dst_memb = dst->u.compnd.memb + src2dst[i];
- if (dst_memb->size > src_memb->size)
- offset += src_memb->size;
- }
- for (i=src->u.compnd.nmembs-1; i>=0; --i) {
- if (src2dst[i]<0)
- continue;
- src_memb = src->u.compnd.memb + i;
- dst_memb = dst->u.compnd.memb + src2dst[i];
- if (dst_memb->size > src_memb->size) {
- offset -= src_memb->size;
- if (dst_memb->size > src->size-offset) {
- H5MM_xfree(priv->src2dst);
- H5MM_xfree(priv->src_memb_id);
- H5MM_xfree(priv->dst_memb_id);
- H5MM_xfree(priv->memb_path);
- cdata->priv = priv = H5MM_xfree (priv);
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "convertion is unsupported by this "
- "function");
+ case H5T_CONV_INIT:
+ /*
+ * First, determine if this conversion function applies to the
+ * conversion path SRC_ID-->DST_ID. If not, return failure;
+ * otherwise initialize the `priv' field of `cdata' with information
+ * that remains (almost) constant for this conversion path.
+ */
+ if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ assert (H5T_COMPOUND==src->type);
+ assert (H5T_COMPOUND==dst->type);
+
+ /* Initialize data which is relatively constant */
+ if (H5T_conv_struct_init (src, dst, cdata)<0)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data");
+ priv = (H5T_conv_struct_t *)(cdata->priv);
+ src2dst = priv->src2dst;
+
+ /*
+ * If the destination type is not larger than the source type then
+ * this conversion function is guaranteed to work (provided all
+ * members can be converted also). Otherwise the determination is
+ * quite a bit more complicated. Essentially we have to make sure
+ * that there is always room in the source buffer to do the
+ * conversion of a member in place. This is basically the same pair
+ * of loops as in the actual conversion except it checks that there
+ * is room for each conversion instead of actually doing anything.
+ */
+ if (dst->size > src->size) {
+ for (i=0, offset=0; i<src->u.compnd.nmembs; i++) {
+ if (src2dst[i]<0)
+ continue;
+ src_memb = src->u.compnd.memb + i;
+ dst_memb = dst->u.compnd.memb + src2dst[i];
+ if (dst_memb->size > src_memb->size)
+ offset += src_memb->size;
+ }
+ for (i=src->u.compnd.nmembs-1; i>=0; --i) {
+ if (src2dst[i]<0)
+ continue;
+ src_memb = src->u.compnd.memb + i;
+ dst_memb = dst->u.compnd.memb + src2dst[i];
+ if (dst_memb->size > src_memb->size) {
+ offset -= src_memb->size;
+ if (dst_memb->size > src->size-offset) {
+ H5MM_xfree(priv->src2dst);
+ H5MM_xfree(priv->src_memb_id);
+ H5MM_xfree(priv->dst_memb_id);
+ H5MM_xfree(priv->memb_path);
+ cdata->priv = priv = H5MM_xfree (priv);
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "convertion is unsupported by this function");
+ }
+ }
}
}
- }
- }
- break;
+ break;
- case H5T_CONV_FREE:
- /*
- * Free the private conversion data.
- */
- priv = (H5T_conv_struct_t *)(cdata->priv);
- H5MM_xfree(priv->src2dst);
- H5MM_xfree(priv->src_memb_id);
- H5MM_xfree(priv->dst_memb_id);
- H5MM_xfree(priv->memb_path);
- cdata->priv = priv = H5MM_xfree (priv);
- break;
+ case H5T_CONV_FREE:
+ /*
+ * Free the private conversion data.
+ */
+ priv = (H5T_conv_struct_t *)(cdata->priv);
+ H5MM_xfree(priv->src2dst);
+ H5MM_xfree(priv->src_memb_id);
+ H5MM_xfree(priv->dst_memb_id);
+ H5MM_xfree(priv->memb_path);
+ cdata->priv = priv = H5MM_xfree (priv);
+ break;
- case H5T_CONV_CONV:
- /*
- * Conversion.
- */
- if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ case H5T_CONV_CONV:
+ /*
+ * Conversion.
+ */
+ if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- /* Update cached data if necessary */
- if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata)<0) {
- HRETURN_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);
-
- /*
- * Insure that members are sorted.
- */
- H5T_sort_value(src, NULL);
- H5T_sort_value(dst, NULL);
-
- /*
- * Calculate strides. If BUF_STRIDE is non-zero then convert one
- * data element at every BUF_STRIDE bytes through the main buffer
- * (BUF), leaving the result of each conversion at the same
- * location; otherwise assume the source and destination data are
- * packed tightly based on src->size and dst->size. Also, if
- * BUF_STRIDE and BKG_STRIDE are both non-zero then place
- * 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->size;
-
- /*
- * For each member where the destination is not larger than the
- * source, stride through all the elements converting only that member
- * in each element and then copying the element to its final
- * destination in the bkg buffer. Otherwise move the element as far
- * left as possible in the buffer.
- */
- for (i=0, offset=0; i<src->u.compnd.nmembs; i++) {
- if (src2dst[i]<0) continue; /*subsetting*/
- src_memb = src->u.compnd.memb + i;
- dst_memb = dst->u.compnd.memb + src2dst[i];
-
- if (dst_memb->size <= src_memb->size) {
- xbuf = buf + src_memb->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 ? buf_stride : src->size,
- bkg_stride, xbuf, xbkg,
- dset_xfer_plist)<0) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to convert compound data "
- "type member");
- }
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbkg, xbuf, dst_memb->size);
- xbuf += buf_stride ? buf_stride : src->size;
- xbkg += bkg_stride;
- }
- } else {
- for (xbuf=buf, elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbuf+offset, xbuf+src_memb->offset,
- src_memb->size);
- xbuf += buf_stride ? buf_stride : src->size;
+ /* Update cached data if necessary */
+ if (cdata->recalc && H5T_conv_struct_init (src, dst, cdata)<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);
+
+ /*
+ * Insure that members are sorted.
+ */
+ H5T_sort_value(src, NULL);
+ H5T_sort_value(dst, NULL);
+
+ /*
+ * Calculate strides. If BUF_STRIDE is non-zero then convert one
+ * data element at every BUF_STRIDE bytes through the main buffer
+ * (BUF), leaving the result of each conversion at the same
+ * location; otherwise assume the source and destination data are
+ * packed tightly based on src->size and dst->size. Also, if
+ * BUF_STRIDE and BKG_STRIDE are both non-zero then place
+ * 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->size;
+
+ /*
+ * For each member where the destination is not larger than the
+ * source, stride through all the elements converting only that member
+ * in each element and then copying the element to its final
+ * destination in the bkg buffer. Otherwise move the element as far
+ * left as possible in the buffer.
+ */
+ for (i=0, offset=0; i<src->u.compnd.nmembs; i++) {
+ if (src2dst[i]<0) continue; /*subsetting*/
+ src_memb = src->u.compnd.memb + i;
+ dst_memb = dst->u.compnd.memb + src2dst[i];
+
+ if (dst_memb->size <= src_memb->size) {
+ xbuf = buf + src_memb->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 ? buf_stride : src->size,
+ bkg_stride, xbuf, xbkg,
+ dset_xfer_plist)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member");
+ for (elmtno=0; elmtno<nelmts; elmtno++) {
+ HDmemmove(xbkg, xbuf, dst_memb->size);
+ xbuf += buf_stride ? buf_stride : src->size;
+ xbkg += bkg_stride;
+ }
+ } else {
+ for (xbuf=buf, elmtno=0; elmtno<nelmts; elmtno++) {
+ HDmemmove(xbuf+offset, xbuf+src_memb->offset,
+ src_memb->size);
+ xbuf += buf_stride ? buf_stride : src->size;
+ }
+ offset += src_memb->size;
+ }
}
- offset += src_memb->size;
- }
- }
- /*
- * Work from right to left, converting those members that weren't
- * converted in the previous loop (those members where the destination
- * is larger than the source) and them to their final position in the
- * bkg buffer.
- */
- for (i=src->u.compnd.nmembs-1; i>=0; --i) {
- if (src2dst[i]<0)
- continue;
- src_memb = src->u.compnd.memb + i;
- dst_memb = dst->u.compnd.memb + src2dst[i];
-
- 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,
+ /*
+ * Work from right to left, converting those members that weren't
+ * converted in the previous loop (those members where the destination
+ * is larger than the source) and them to their final position in the
+ * bkg buffer.
+ */
+ for (i=src->u.compnd.nmembs-1; i>=0; --i) {
+ if (src2dst[i]<0)
+ continue;
+ src_memb = src->u.compnd.memb + i;
+ dst_memb = dst->u.compnd.memb + src2dst[i];
+
+ 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 ? buf_stride : src->size,
bkg_stride, xbuf, xbkg,
- dset_xfer_plist)<0) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to convert compound data type "
- "member");
- }
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbkg, xbuf, dst_memb->size);
- xbuf += buf_stride ? buf_stride : src->size;
- xbkg += bkg_stride;
- }
- }
- }
+ dset_xfer_plist)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert compound data type member");
+ for (elmtno=0; elmtno<nelmts; elmtno++) {
+ HDmemmove(xbkg, xbuf, dst_memb->size);
+ xbuf += buf_stride ? buf_stride : src->size;
+ xbkg += bkg_stride;
+ }
+ }
+ }
- /* Move background buffer into result buffer */
- for (xbuf=buf, xbkg=bkg, elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbuf, xbkg, dst->size);
- xbuf += buf_stride ? buf_stride : dst->size;
- xbkg += bkg_stride;
- }
- break;
+ /* Move background buffer into result buffer */
+ for (xbuf=buf, xbkg=bkg, elmtno=0; elmtno<nelmts; elmtno++) {
+ HDmemmove(xbuf, xbkg, dst->size);
+ xbuf += buf_stride ? buf_stride : dst->size;
+ xbkg += bkg_stride;
+ }
+ break;
- default:
- /* Some other command we don't know about yet.*/
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ default:
+ /* Some other command we don't know about yet.*/
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
}
@@ -1808,19 +1778,16 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
int domain[2]; /*min and max source values */
int *map=NULL; /*map from src value to dst idx */
int length; /*nelmts in map array */
- herr_t ret_value=FAIL; /*return value */
int i, j; /*counters */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOINIT(H5T_conv_enum_init);
cdata->need_bkg = H5T_BKG_NO;
- if (NULL==(priv=cdata->priv=H5MM_calloc(sizeof(*priv)))) {
- HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed");
- }
- if (0==src->u.enumer.nmembs) {
- HRETURN(SUCCEED);
- }
+ if (NULL==(priv=cdata->priv=H5MM_calloc(sizeof(*priv))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ if (0==src->u.enumer.nmembs)
+ HGOTO_DONE(SUCCEED);
/*
* Check that the source symbol names are a subset of the destination
@@ -1829,19 +1796,16 @@ 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->u.enumer.nmembs*sizeof(int)))) {
- HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed");;
- }
+ if (NULL==(priv->src2dst=H5MM_malloc(src->u.enumer.nmembs*sizeof(int))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");;
for (i=0, j=0;
- i<src->u.enumer.nmembs && j<dst->u.enumer.nmembs;
- i++, j++) {
+ i<src->u.enumer.nmembs && j<dst->u.enumer.nmembs;
+ i++, j++) {
while (j<dst->u.enumer.nmembs &&
- HDstrcmp(src->u.enumer.name[i], dst->u.enumer.name[j])) j++;
- if (j>=dst->u.enumer.nmembs) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "source type is not a subset of destination type");
- }
+ HDstrcmp(src->u.enumer.name[i], dst->u.enumer.name[j]))
+ j++;
+ if (j>=dst->u.enumer.nmembs)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "source type is not a subset of destination type");
priv->src2dst[i] = j;
}
@@ -1884,11 +1848,10 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
(double)length/src->u.enumer.nmembs<1.2) {
priv->base = domain[0];
priv->length = length;
- if (NULL==(map=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*/
+ if (NULL==(map=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*/
for (i=0; i<src->u.enumer.nmembs; i++) {
if (1==src->size) {
n = *((signed char*)(src->u.enumer.value+i));
@@ -1916,9 +1879,8 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
H5T_sort_value(src, priv->src2dst);
}
}
- ret_value = SUCCEED;
- done:
+done:
if (ret_value<0 && priv) {
H5MM_xfree(priv->src2dst);
H5MM_xfree(priv);
@@ -1960,135 +1922,135 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
int n; /*src value cast as native int */
hsize_t i; /*counters */
H5T_enum_struct_t *priv = (H5T_enum_struct_t*)(cdata->priv);
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_enum, FAIL);
switch (cdata->command) {
- case H5T_CONV_INIT:
- /*
- * Determine if this conversion function applies to the conversion
- * path SRC_ID->DST_ID. If not return failure; otherwise initialize
- * the `priv' field of `cdata' with information about the underlying
- * integer conversion.
- */
- if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- assert (H5T_ENUM==src->type);
- assert (H5T_ENUM==dst->type);
- if (H5T_conv_enum_init(src, dst, cdata)<0) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "unable to initialize private data");
- }
- break;
+ case H5T_CONV_INIT:
+ /*
+ * Determine if this conversion function applies to the conversion
+ * path SRC_ID->DST_ID. If not return failure; otherwise initialize
+ * the `priv' field of `cdata' with information about the underlying
+ * integer conversion.
+ */
+ if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ assert (H5T_ENUM==src->type);
+ assert (H5T_ENUM==dst->type);
+ if (H5T_conv_enum_init(src, dst, cdata)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize private data");
+ break;
- case H5T_CONV_FREE:
+ case H5T_CONV_FREE:
#ifdef H5T_DEBUG
- if (H5DEBUG(T)) {
- fprintf(H5DEBUG(T), " Using %s mapping function%s\n",
- priv->length?"O(1)":"O(log N)",
- priv->length?"":", where N is the number of enum members");
- }
+ if (H5DEBUG(T)) {
+ fprintf(H5DEBUG(T), " Using %s mapping function%s\n",
+ priv->length?"O(1)":"O(log N)",
+ priv->length?"":", where N is the number of enum members");
+ }
#endif
- if (priv) {
- H5MM_xfree(priv->src2dst);
- H5MM_xfree(priv);
- }
- cdata->priv = NULL;
- break;
+ if (priv) {
+ H5MM_xfree(priv->src2dst);
+ H5MM_xfree(priv);
+ }
+ cdata->priv = NULL;
+ break;
- case H5T_CONV_CONV:
- if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- assert (H5T_ENUM==src->type);
- assert (H5T_ENUM==dst->type);
-
- if (priv->length) {
- /* Use O(1) lookup */
- H5T_sort_name(src, NULL);
- H5T_sort_name(dst, NULL);
- } else {
- /* Use O(log N) lookup */
- H5T_sort_value(src, NULL); /*yes, by value*/
- H5T_sort_name(dst, NULL); /*yes, by name*/
- }
-
- /*
- * Direction of conversion.
- */
- if (buf_stride) {
- src_delta = dst_delta = (int)buf_stride;
- s = d = buf;
- } else if (dst->size <= src->size) {
- src_delta = (int)src->size; /*overflow shouldn't be possible*/
- dst_delta = (int)dst->size; /*overflow shouldn't be possible*/
- s = d = buf;
- } else {
- src_delta = -(int)src->size; /*overflow shouldn't be possible*/
- dst_delta = -(int)dst->size; /*overflow shouldn't be possible*/
- s = buf + (nelmts-1) * src->size;
- d = buf + (nelmts-1) * dst->size;
- }
+ case H5T_CONV_CONV:
+ if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ assert (H5T_ENUM==src->type);
+ assert (H5T_ENUM==dst->type);
- for (i=0; i<nelmts; i++, s+=src_delta, d+=dst_delta) {
- if (priv->length) {
- /* Use O(1) lookup */
- if (1==src->size) {
- n = *((signed char*)s);
- } else if (sizeof(short)==src->size) {
- n = *((short*)s);
- } else {
- n = *((int*)s);
- }
- n -= priv->base;
- if (n<0 || n>=priv->length || priv->src2dst[n]<0) {
- if (!H5T_overflow_g ||
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- HDmemset(d, 0xff, dst->size);
- }
- } else {
- HDmemcpy(d,
- dst->u.enumer.value+priv->src2dst[n]*dst->size,
- dst->size);
- }
- } else {
- /* Use O(log N) lookup */
- int lt = 0;
- int rt = src->u.enumer.nmembs;
- int md, cmp;
- while (lt<rt) {
- md = (lt+rt)/2;
- cmp = HDmemcmp(s, src->u.enumer.value+md*src->size,
- src->size);
- if (cmp<0) {
- rt = md;
- } else if (cmp>0) {
- lt = md+1;
- } else {
- break;
- }
- }
- if (lt>=rt) {
- if (!H5T_overflow_g ||
- (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- HDmemset(d, 0xff, dst->size);
- }
- } else {
- HDmemcpy(d,
- dst->u.enumer.value+priv->src2dst[md]*dst->size,
- dst->size);
- }
- }
- }
- break;
+ if (priv->length) {
+ /* Use O(1) lookup */
+ H5T_sort_name(src, NULL);
+ H5T_sort_name(dst, NULL);
+ } else {
+ /* Use O(log N) lookup */
+ H5T_sort_value(src, NULL); /*yes, by value*/
+ H5T_sort_name(dst, NULL); /*yes, by name*/
+ }
+
+ /*
+ * Direction of conversion.
+ */
+ if (buf_stride) {
+ src_delta = dst_delta = (int)buf_stride;
+ s = d = buf;
+ } else if (dst->size <= src->size) {
+ src_delta = (int)src->size; /*overflow shouldn't be possible*/
+ dst_delta = (int)dst->size; /*overflow shouldn't be possible*/
+ s = d = buf;
+ } else {
+ src_delta = -(int)src->size; /*overflow shouldn't be possible*/
+ dst_delta = -(int)dst->size; /*overflow shouldn't be possible*/
+ s = buf + (nelmts-1) * src->size;
+ d = buf + (nelmts-1) * dst->size;
+ }
- default:
- /* Some other command we don't know about yet.*/
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ for (i=0; i<nelmts; i++, s+=src_delta, d+=dst_delta) {
+ if (priv->length) {
+ /* Use O(1) lookup */
+ if (1==src->size) {
+ n = *((signed char*)s);
+ } else if (sizeof(short)==src->size) {
+ n = *((short*)s);
+ } else {
+ n = *((int*)s);
+ }
+ n -= priv->base;
+ if (n<0 || n>=priv->length || priv->src2dst[n]<0) {
+ if (!H5T_overflow_g ||
+ (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
+ HDmemset(d, 0xff, dst->size);
+ }
+ } else {
+ HDmemcpy(d,
+ dst->u.enumer.value+priv->src2dst[n]*dst->size,
+ dst->size);
+ }
+ } else {
+ /* Use O(log N) lookup */
+ int lt = 0;
+ int rt = src->u.enumer.nmembs;
+ int md, cmp;
+ while (lt<rt) {
+ md = (lt+rt)/2;
+ cmp = HDmemcmp(s, src->u.enumer.value+md*src->size,
+ src->size);
+ if (cmp<0) {
+ rt = md;
+ } else if (cmp>0) {
+ lt = md+1;
+ } else {
+ break;
+ }
+ }
+ if (lt>=rt) {
+ if (!H5T_overflow_g ||
+ (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
+ HDmemset(d, 0xff, dst->size);
+ }
+ } else {
+ HDmemcpy(d,
+ dst->u.enumer.value+priv->src2dst[md]*dst->size,
+ dst->size);
+ }
+ }
+ }
+ break;
+
+ default:
+ /* Some other command we don't know about yet.*/
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE(SUCCEED);
+
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -2157,6 +2119,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
int nested=0; /*flag of nested VL case */
hsize_t elmtno; /*element number counter */
hsize_t i;
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_vlen, FAIL);
@@ -2171,7 +2134,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
*/
if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
assert (H5T_VLEN==src->type);
assert (H5T_VLEN==dst->type);
@@ -2190,7 +2153,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
*/
if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
/*
* Do we process the values from beginning to end or vice
@@ -2247,16 +2210,15 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* Get initial conversion buffer */
conv_buf_size=MAX(src_base_size,dst_base_size);
if ((conv_buf=H5FL_BLK_ALLOC(vlen_seq,conv_buf_size,1))==NULL)
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
/* Set up conversion path for base elements */
if (NULL==(tpath=H5T_path_find(src->parent, dst->parent, NULL, NULL))) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes");
} else if (!H5T_IS_NOOP(tpath)) {
if ((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->parent, H5T_COPY_ALL)))<0 ||
- (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->parent, H5T_COPY_ALL)))<0) {
- HRETURN_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion");
- }
+ (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->parent, H5T_COPY_ALL)))<0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion");
}
/* Check if we need a temporary buffer for this conversion */
@@ -2264,7 +2226,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* Set up initial background buffer */
tmp_buf_size=MAX(src_base_size,dst_base_size);
if ((tmp_buf=H5FL_BLK_ALLOC(vlen_seq,tmp_buf_size,1))==NULL)
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
} /* end if */
/* Set the flag for nested VL case */
@@ -2287,14 +2249,12 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
if(conv_buf_size<MAX(src_size,dst_size)) {
conv_buf_size=MAX(src_size,dst_size);
if((conv_buf=H5FL_BLK_REALLOC(vlen_seq,conv_buf, conv_buf_size))==NULL)
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed for type conversion");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
} /* end if */
/* Read in VL sequence */
if((*(src->u.vlen.read))(src->u.vlen.f,s,conv_buf,src_size)<0)
- HRETURN_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL,
- "can't read VL data");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data");
/* Check if temporary buffer is large enough, resize if necessary */
/* (Chain off the conversion buffer size) */
@@ -2303,7 +2263,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* 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)
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ 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
@@ -2317,16 +2277,14 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
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)
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed for type conversion");
+ tmp_buf_size))==NULL)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
}
H5F_addr_decode(dst->u.vlen.f, (const uint8_t **)&tmp,
&(bg_hobjid.addr));
INT32DECODE(tmp, bg_hobjid.idx);
if(H5HG_read(dst->u.vlen.f,&bg_hobjid,tmp_buf)==NULL)
- HRETURN_ERROR (H5E_DATATYPE, H5E_READERROR, FAIL,
- "can't read VL sequence into background buffer");
+ 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 */
@@ -2340,13 +2298,11 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* Convert VL sequence */
H5_CHECK_OVERFLOW(seq_len,hssize_t,hsize_t);
if (H5T_convert(tpath, tsrc_id, tdst_id, (hsize_t)seq_len, 0, bkg_stride, conv_buf, tmp_buf, dset_xfer_plist)<0)
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "datatype conversion failed");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed");
/* Write sequence to destination location */
if((*(dst->u.vlen.write))(dset_xfer_plist,dst->u.vlen.f,d,conv_buf, bg_ptr, (hsize_t)seq_len,(hsize_t)dst_base_size)<0)
- HRETURN_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL,
- "can't write VL data");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data");
/* For nested VL case, free leftover heap objects from the deeper level if the length of new data elements is shorted than the old data elements.*/
H5_CHECK_OVERFLOW(bg_seq_len,hsize_t,hssize_t);
@@ -2359,7 +2315,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
H5F_addr_decode(dst->u.vlen.f, (const uint8_t **)&tmp_p, &(parent_hobjid.addr));
INT32DECODE(tmp_p, parent_hobjid.idx);
if(H5HG_remove(dst->u.vlen.f, &parent_hobjid)<0)
- HRETURN_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object");
}
}
}
@@ -2399,11 +2355,11 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
break;
default: /* Some other command we don't know about yet.*/
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
} /* end switch */
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
}
@@ -2438,6 +2394,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
int i; /* local index variable */
void *bkg_buf=NULL; /*temporary background buffer */
size_t bkg_buf_size=0; /*size of background buffer in bytes */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_array, FAIL);
@@ -2452,20 +2409,20 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
*/
if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
assert (H5T_ARRAY==src->type);
assert (H5T_ARRAY==dst->type);
/* Check the number and sizes of the dimensions */
if(src->u.array.ndims!=dst->u.array.ndims)
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same number of dimensions");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same number of dimensions");
for(i=0; i<src->u.array.ndims; i++)
if(src->u.array.dim[i]!=dst->u.array.dim[i])
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same sizes of dimensions");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same sizes of dimensions");
#ifdef LATER
for(i=0; i<src->u.array.ndims; i++)
if(src->u.array.perm[i]!=dst->u.array.perm[i])
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same dimension permutations");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "array datatypes do not have the same dimension permutations");
#endif /* LATER */
/* Array datatypes don't need a background buffer */
@@ -2483,7 +2440,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
*/
if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
/*
* Do we process the values from beginning to end or vice
@@ -2509,12 +2466,11 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* Set up conversion path for base elements */
if (NULL==(tpath=H5T_path_find(src->parent, dst->parent, NULL, NULL))) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes");
} else if (!H5T_IS_NOOP(tpath)) {
if ((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->parent, H5T_COPY_ALL)))<0 ||
- (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->parent, H5T_COPY_ALL)))<0) {
- HRETURN_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion");
- }
+ (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->parent, H5T_COPY_ALL)))<0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion");
}
/* Check if we need a background buffer for this conversion */
@@ -2522,7 +2478,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* Allocate background buffer */
bkg_buf_size=src->u.array.nelem*MAX(src->size,dst->size);
if ((bkg_buf=H5FL_BLK_ALLOC(array_seq,bkg_buf_size,0))==NULL)
- HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
} /* end if */
/* Perform the actual conversion */
@@ -2532,7 +2488,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
/* Convert array */
if (H5T_convert(tpath, tsrc_id, tdst_id, (hsize_t)src->u.array.nelem, 0, bkg_stride, dp, bkg_buf, dset_xfer_plist)<0)
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed");
/* Advance the source & destination pointers */
sp += src_delta;
@@ -2551,11 +2507,11 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
break;
default: /* Some other command we don't know about yet.*/
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
} /* end switch */
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
} /* end H5T_conv_array() */
@@ -2598,291 +2554,286 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
size_t first;
ssize_t sfirst; /*a signed version of `first' */
size_t i;
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_i_i, FAIL);
switch (cdata->command) {
- case H5T_CONV_INIT:
- if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- if (H5T_ORDER_LE!=src->u.atomic.order &&
- H5T_ORDER_BE!=src->u.atomic.order) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unsupported byte order");
- }
- if (H5T_ORDER_LE!=dst->u.atomic.order &&
- H5T_ORDER_BE!=dst->u.atomic.order) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unsupported byte order");
- }
- if (dst->size>sizeof dbuf) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "destination size is too large");
- }
- cdata->need_bkg = H5T_BKG_NO;
- break;
-
- case H5T_CONV_FREE:
- break;
-
- case H5T_CONV_CONV:
- /* Get the data types */
- if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
-
- /*
- * Do we process the values from beginning to end or vice versa? Also,
- * how many of the elements have the source and destination areas
- * overlapping?
- */
- if (src->size==dst->size || buf_stride) {
- sp = dp = (uint8_t*)buf;
- direction = 1;
- olap = nelmts;
- } else if (src->size>=dst->size) {
- double olap_d = HDceil((double)(dst->size)/
- (double)(src->size-dst->size));
-
- olap = (size_t)olap_d;
- sp = dp = (uint8_t*)buf;
- direction = 1;
- } else {
- double olap_d = HDceil((double)(src->size)/
- (double)(dst->size-src->size));
- olap = (size_t)olap_d;
- sp = (uint8_t*)buf + (nelmts-1) * src->size;
- dp = (uint8_t*)buf + (nelmts-1) * dst->size;
- direction = -1;
- }
-
- /* The conversion loop */
- for (elmtno=0; elmtno<nelmts; elmtno++) {
-
- /*
- * If the source and destination buffers overlap then use a
- * temporary buffer for the destination.
- */
- if (direction>0) {
- s = sp;
- d = elmtno<olap ? dbuf : dp;
- } else {
- s = sp;
- d = elmtno+olap >= nelmts ? dbuf : dp;
- }
-#ifndef NDEBUG
- /* I don't quite trust the overlap calculations yet --rpm */
- if (d==dbuf) {
- assert ((dp>=sp && dp<sp+src->size) || (sp>=dp && sp<dp+dst->size));
- } else {
- assert ((dp<sp && dp+dst->size<=sp) || (sp<dp && sp+src->size<=dp));
- }
-#endif
-
- /*
- * Put the data in little endian order so our loops aren't so
- * complicated. We'll do all the conversion stuff assuming
- * little endian and then we'll fix the order at the end.
- */
- if (H5T_ORDER_BE==src->u.atomic.order) {
- half_size = src->size/2;
- for (i=0; i<half_size; i++) {
- uint8_t tmp = s[src->size-(i+1)];
- s[src->size-(i+1)] = s[i];
- s[i] = tmp;
- }
- }
+ case H5T_CONV_INIT:
+ if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ if (H5T_ORDER_LE!=src->u.atomic.order &&
+ H5T_ORDER_BE!=src->u.atomic.order)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
+ if (H5T_ORDER_LE!=dst->u.atomic.order &&
+ H5T_ORDER_BE!=dst->u.atomic.order)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
+ if (dst->size>sizeof dbuf)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large");
+ cdata->need_bkg = H5T_BKG_NO;
+ break;
+
+ case H5T_CONV_FREE:
+ break;
- /*
- * What is the bit number for the msb bit of S which is set? The
- * bit number is relative to the significant part of the number.
- */
- sfirst = H5T_bit_find (s, src->u.atomic.offset, src->u.atomic.prec,
- H5T_BIT_MSB, TRUE);
- first = (size_t)sfirst;
+ case H5T_CONV_CONV:
+ /* Get the data types */
+ if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- if (sfirst<0) {
/*
- * The source has no bits set and must therefore be zero.
- * Set the destination to zero.
- */
- H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec, FALSE);
-
- } else if (H5T_SGN_NONE==src->u.atomic.u.i.sign &&
- H5T_SGN_NONE==dst->u.atomic.u.i.sign) {
- /*
- * Source and destination are both unsigned, but if the
- * source has more precision bits than the destination then
- * it's possible to overflow. When overflow occurs the
- * destination will be set to the maximum possible value.
+ * Do we process the values from beginning to end or vice versa? Also,
+ * how many of the elements have the source and destination areas
+ * overlapping?
*/
- if (src->u.atomic.prec <= dst->u.atomic.prec) {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
- src->u.atomic.prec);
- H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec,
- dst->u.atomic.prec-src->u.atomic.prec, FALSE);
- } else if (first>=dst->u.atomic.prec) {
- /*overflow*/
- if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec, TRUE);
- }
+ if (src->size==dst->size || buf_stride) {
+ sp = dp = (uint8_t*)buf;
+ direction = 1;
+ olap = nelmts;
+ } else if (src->size>=dst->size) {
+ double olap_d = HDceil((double)(dst->size)/
+ (double)(src->size-dst->size));
+
+ olap = (size_t)olap_d;
+ sp = dp = (uint8_t*)buf;
+ direction = 1;
} else {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
- dst->u.atomic.prec);
+ double olap_d = HDceil((double)(src->size)/
+ (double)(dst->size-src->size));
+ olap = (size_t)olap_d;
+ sp = (uint8_t*)buf + (nelmts-1) * src->size;
+ dp = (uint8_t*)buf + (nelmts-1) * dst->size;
+ direction = -1;
}
-
- } else if (H5T_SGN_2==src->u.atomic.u.i.sign &&
- H5T_SGN_NONE==dst->u.atomic.u.i.sign) {
- /*
- * If the source is signed and the destination isn't then we
- * can have overflow if the source contains more bits than
- * the destination (destination is set to the maximum
- * possible value) or overflow if the source is negative
- * (destination is set to zero).
- */
- if (first+1 == src->u.atomic.prec) {
- /*overflow*/
- if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec, FALSE);
+
+ /* The conversion loop */
+ for (elmtno=0; elmtno<nelmts; elmtno++) {
+
+ /*
+ * If the source and destination buffers overlap then use a
+ * temporary buffer for the destination.
+ */
+ if (direction>0) {
+ s = sp;
+ d = elmtno<olap ? dbuf : dp;
+ } else {
+ s = sp;
+ d = elmtno+olap >= nelmts ? dbuf : dp;
}
- } else if (src->u.atomic.prec < dst->u.atomic.prec) {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
- src->u.atomic.prec-1);
- H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec-1,
- (dst->u.atomic.prec-src->u.atomic.prec)+1, FALSE);
- } else if (first>=dst->u.atomic.prec) {
- /*overflow*/
- if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec, TRUE);
+#ifndef NDEBUG
+ /* I don't quite trust the overlap calculations yet --rpm */
+ if (d==dbuf) {
+ assert ((dp>=sp && dp<sp+src->size) || (sp>=dp && sp<dp+dst->size));
+ } else {
+ assert ((dp<sp && dp+dst->size<=sp) || (sp<dp && sp+src->size<=dp));
}
- } else {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
- dst->u.atomic.prec);
- }
-
- } else if (H5T_SGN_NONE==src->u.atomic.u.i.sign &&
- H5T_SGN_2==dst->u.atomic.u.i.sign) {
- /*
- * If the source is not signed but the destination is then
- * overflow can occur in which case the destination is set to
- * the largest possible value (all bits set except the msb).
- */
- if (first+1 >= dst->u.atomic.prec) {
- /*overflow*/
- if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec-1, TRUE);
- H5T_bit_set (d, (dst->u.atomic.offset + dst->u.atomic.prec-1), 1, FALSE);
+#endif
+
+ /*
+ * Put the data in little endian order so our loops aren't so
+ * complicated. We'll do all the conversion stuff assuming
+ * little endian and then we'll fix the order at the end.
+ */
+ if (H5T_ORDER_BE==src->u.atomic.order) {
+ half_size = src->size/2;
+ for (i=0; i<half_size; i++) {
+ uint8_t tmp = s[src->size-(i+1)];
+ s[src->size-(i+1)] = s[i];
+ s[i] = tmp;
+ }
}
- } else if (src->u.atomic.prec<dst->u.atomic.prec) {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
- src->u.atomic.prec);
- H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec,
- dst->u.atomic.prec-src->u.atomic.prec, FALSE);
- } else {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
- dst->u.atomic.prec);
- }
-
- } else if (first+1 == src->u.atomic.prec) {
- /*
- * Both the source and the destination are signed and the
- * source value is negative. We could experience overflow
- * if the destination isn't wide enough in which case the
- * destination is set to a negative number with the largest
- * possible magnitude.
- */
- ssize_t sfz = H5T_bit_find (s, src->u.atomic.offset,
- src->u.atomic.prec-1, H5T_BIT_MSB, FALSE);
- size_t fz = (size_t)sfz;
-
- if (sfz>=0 && fz+1>=dst->u.atomic.prec) {
- /*overflow*/
- if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec-1, FALSE);
- H5T_bit_set (d, (dst->u.atomic.offset + dst->u.atomic.prec-1), 1, TRUE);
+
+ /*
+ * What is the bit number for the msb bit of S which is set? The
+ * bit number is relative to the significant part of the number.
+ */
+ sfirst = H5T_bit_find (s, src->u.atomic.offset, src->u.atomic.prec,
+ H5T_BIT_MSB, TRUE);
+ first = (size_t)sfirst;
+
+ if (sfirst<0) {
+ /*
+ * The source has no bits set and must therefore be zero.
+ * Set the destination to zero.
+ */
+ H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec, FALSE);
+
+ } else if (H5T_SGN_NONE==src->u.atomic.u.i.sign &&
+ H5T_SGN_NONE==dst->u.atomic.u.i.sign) {
+ /*
+ * Source and destination are both unsigned, but if the
+ * source has more precision bits than the destination then
+ * it's possible to overflow. When overflow occurs the
+ * destination will be set to the maximum possible value.
+ */
+ if (src->u.atomic.prec <= dst->u.atomic.prec) {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
+ src->u.atomic.prec);
+ H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec,
+ dst->u.atomic.prec-src->u.atomic.prec, FALSE);
+ } else if (first>=dst->u.atomic.prec) {
+ /*overflow*/
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
+ H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec, TRUE);
+ }
+ } else {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
+ dst->u.atomic.prec);
+ }
+
+ } else if (H5T_SGN_2==src->u.atomic.u.i.sign &&
+ H5T_SGN_NONE==dst->u.atomic.u.i.sign) {
+ /*
+ * If the source is signed and the destination isn't then we
+ * can have overflow if the source contains more bits than
+ * the destination (destination is set to the maximum
+ * possible value) or overflow if the source is negative
+ * (destination is set to zero).
+ */
+ if (first+1 == src->u.atomic.prec) {
+ /*overflow*/
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
+ H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec, FALSE);
+ }
+ } else if (src->u.atomic.prec < dst->u.atomic.prec) {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
+ src->u.atomic.prec-1);
+ H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec-1,
+ (dst->u.atomic.prec-src->u.atomic.prec)+1, FALSE);
+ } else if (first>=dst->u.atomic.prec) {
+ /*overflow*/
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
+ H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec, TRUE);
+ }
+ } else {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
+ dst->u.atomic.prec);
+ }
+
+ } else if (H5T_SGN_NONE==src->u.atomic.u.i.sign &&
+ H5T_SGN_2==dst->u.atomic.u.i.sign) {
+ /*
+ * If the source is not signed but the destination is then
+ * overflow can occur in which case the destination is set to
+ * the largest possible value (all bits set except the msb).
+ */
+ if (first+1 >= dst->u.atomic.prec) {
+ /*overflow*/
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
+ H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec-1, TRUE);
+ H5T_bit_set (d, (dst->u.atomic.offset + dst->u.atomic.prec-1), 1, FALSE);
+ }
+ } else if (src->u.atomic.prec<dst->u.atomic.prec) {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
+ src->u.atomic.prec);
+ H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec,
+ dst->u.atomic.prec-src->u.atomic.prec, FALSE);
+ } else {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
+ dst->u.atomic.prec);
+ }
+
+ } else if (first+1 == src->u.atomic.prec) {
+ /*
+ * Both the source and the destination are signed and the
+ * source value is negative. We could experience overflow
+ * if the destination isn't wide enough in which case the
+ * destination is set to a negative number with the largest
+ * possible magnitude.
+ */
+ ssize_t sfz = H5T_bit_find (s, src->u.atomic.offset,
+ src->u.atomic.prec-1, H5T_BIT_MSB, FALSE);
+ size_t fz = (size_t)sfz;
+
+ if (sfz>=0 && fz+1>=dst->u.atomic.prec) {
+ /*overflow*/
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
+ H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec-1, FALSE);
+ H5T_bit_set (d, (dst->u.atomic.offset + dst->u.atomic.prec-1), 1, TRUE);
+ }
+ } else if (src->u.atomic.prec<dst->u.atomic.prec) {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset, src->u.atomic.prec);
+ H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec, dst->u.atomic.prec-src->u.atomic.prec, TRUE);
+ } else {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset, dst->u.atomic.prec);
+ }
+
+ } else {
+ /*
+ * Source and destination are both signed but the source
+ * value is positive. We could have an overflow in which
+ * case the destination is set to the largest possible
+ * positive value.
+ */
+ if (first+1>=dst->u.atomic.prec) {
+ /*overflow*/
+ if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
+ H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec-1, TRUE);
+ H5T_bit_set (d, (dst->u.atomic.offset + dst->u.atomic.prec-1), 1, FALSE);
+ }
+ } else if (src->u.atomic.prec<dst->u.atomic.prec) {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
+ src->u.atomic.prec);
+ H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec,
+ dst->u.atomic.prec-src->u.atomic.prec, FALSE);
+ } else {
+ H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
+ dst->u.atomic.prec);
+ }
}
- } else if (src->u.atomic.prec<dst->u.atomic.prec) {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset, src->u.atomic.prec);
- H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec, dst->u.atomic.prec-src->u.atomic.prec, TRUE);
- } else {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset, dst->u.atomic.prec);
- }
-
- } else {
- /*
- * Source and destination are both signed but the source
- * value is positive. We could have an overflow in which
- * case the destination is set to the largest possible
- * positive value.
- */
- if (first+1>=dst->u.atomic.prec) {
- /*overflow*/
- if (!H5T_overflow_g || (H5T_overflow_g)(src_id, dst_id, s, d)<0) {
- H5T_bit_set (d, dst->u.atomic.offset, dst->u.atomic.prec-1, TRUE);
- H5T_bit_set (d, (dst->u.atomic.offset + dst->u.atomic.prec-1), 1, FALSE);
+
+ /*
+ * Set padding areas in destination.
+ */
+ if (dst->u.atomic.offset>0) {
+ assert (H5T_PAD_ZERO==dst->u.atomic.lsb_pad || H5T_PAD_ONE==dst->u.atomic.lsb_pad);
+ H5T_bit_set (d, 0, dst->u.atomic.offset, (hbool_t)(H5T_PAD_ONE==dst->u.atomic.lsb_pad));
+ }
+ if (dst->u.atomic.offset+dst->u.atomic.prec!=8*dst->size) {
+ assert (H5T_PAD_ZERO==dst->u.atomic.msb_pad || H5T_PAD_ONE==dst->u.atomic.msb_pad);
+ H5T_bit_set (d, dst->u.atomic.offset+dst->u.atomic.prec,
+ 8*dst->size - (dst->u.atomic.offset+ dst->u.atomic.prec),
+ (hbool_t)(H5T_PAD_ONE==dst->u.atomic.msb_pad));
}
- } else if (src->u.atomic.prec<dst->u.atomic.prec) {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
- src->u.atomic.prec);
- H5T_bit_set (d, dst->u.atomic.offset+src->u.atomic.prec,
- dst->u.atomic.prec-src->u.atomic.prec, FALSE);
- } else {
- H5T_bit_copy (d, dst->u.atomic.offset, s, src->u.atomic.offset,
- dst->u.atomic.prec);
- }
- }
- /*
- * Set padding areas in destination.
- */
- if (dst->u.atomic.offset>0) {
- assert (H5T_PAD_ZERO==dst->u.atomic.lsb_pad || H5T_PAD_ONE==dst->u.atomic.lsb_pad);
- H5T_bit_set (d, 0, dst->u.atomic.offset, (hbool_t)(H5T_PAD_ONE==dst->u.atomic.lsb_pad));
- }
- if (dst->u.atomic.offset+dst->u.atomic.prec!=8*dst->size) {
- assert (H5T_PAD_ZERO==dst->u.atomic.msb_pad || H5T_PAD_ONE==dst->u.atomic.msb_pad);
- H5T_bit_set (d, dst->u.atomic.offset+dst->u.atomic.prec,
- 8*dst->size - (dst->u.atomic.offset+ dst->u.atomic.prec),
- (hbool_t)(H5T_PAD_ONE==dst->u.atomic.msb_pad));
- }
+ /*
+ * Put the destination in the correct byte order. See note at
+ * beginning of loop.
+ */
+ if (H5T_ORDER_BE==dst->u.atomic.order) {
+ half_size = dst->size/2;
+ for (i=0; i<half_size; i++) {
+ uint8_t tmp = d[dst->size-(i+1)];
+ d[dst->size-(i+1)] = d[i];
+ d[i] = tmp;
+ }
+ }
- /*
- * Put the destination in the correct byte order. See note at
- * beginning of loop.
- */
- if (H5T_ORDER_BE==dst->u.atomic.order) {
- half_size = dst->size/2;
- for (i=0; i<half_size; i++) {
- uint8_t tmp = d[dst->size-(i+1)];
- d[dst->size-(i+1)] = d[i];
- d[i] = tmp;
+ /*
+ * If we had used a temporary buffer for the destination then we
+ * should copy the value to the true destination buffer.
+ */
+ if (d==dbuf)
+ HDmemcpy (dp, d, dst->size);
+ if (buf_stride) {
+ sp += direction * buf_stride;
+ dp += direction * buf_stride;
+ } else {
+ sp += direction * src->size;
+ dp += direction * dst->size;
+ }
}
- }
-
- /*
- * If we had used a temporary buffer for the destination then we
- * should copy the value to the true destination buffer.
- */
- if (d==dbuf)
- HDmemcpy (dp, d, dst->size);
- if (buf_stride) {
- sp += direction * buf_stride;
- dp += direction * buf_stride;
- } else {
- sp += direction * src->size;
- dp += direction * dst->size;
- }
- }
-
- break;
+
+ break;
- default:
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ default:
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
}
@@ -2941,313 +2892,224 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
hbool_t carry=0; /*carry after rounding mantissa */
size_t i; /*miscellaneous counters */
hsize_t implied; /*destination implied bits */
+
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_f_f, FAIL);
switch (cdata->command) {
- case H5T_CONV_INIT:
- if (NULL==(src_p=H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL==(dst_p=H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- src = src_p->u.atomic;
- dst = dst_p->u.atomic;
- if (H5T_ORDER_LE!=src.order &&
- H5T_ORDER_BE!=src.order) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unsupported byte order");
- }
- if (H5T_ORDER_LE!=dst.order &&
- H5T_ORDER_BE!=dst.order) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unsupported byte order");
- }
- if (dst_p->size>sizeof(dbuf)) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "destination size is too large");
- }
- if (8*sizeof(expo)-1<src.u.f.esize ||
- 8*sizeof(expo)-1<dst.u.f.esize) {
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "exponent field is too large");
- }
- cdata->need_bkg = H5T_BKG_NO;
- break;
+ case H5T_CONV_INIT:
+ if (NULL==(src_p=H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL==(dst_p=H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ src = src_p->u.atomic;
+ dst = dst_p->u.atomic;
+ if (H5T_ORDER_LE!=src.order && H5T_ORDER_BE!=src.order)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
+ if (H5T_ORDER_LE!=dst.order && H5T_ORDER_BE!=dst.order)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
+ if (dst_p->size>sizeof(dbuf))
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large");
+ if (8*sizeof(expo)-1<src.u.f.esize || 8*sizeof(expo)-1<dst.u.f.esize)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large");
+ cdata->need_bkg = H5T_BKG_NO;
+ break;
- case H5T_CONV_FREE:
- break;
+ case H5T_CONV_FREE:
+ break;
- case H5T_CONV_CONV:
- /* Get the data types */
- if (NULL==(src_p=H5I_object_verify(src_id,H5I_DATATYPE)) ||
- NULL==(dst_p=H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- src = src_p->u.atomic;
- dst = dst_p->u.atomic;
- expo_max = ((hssize_t)1 << dst.u.f.esize) - 1;
-
- /*
- * Do we process the values from beginning to end or vice versa? Also,
- * how many of the elements have the source and destination areas
- * overlapping?
- */
- if (src_p->size==dst_p->size || buf_stride) {
- sp = dp = (uint8_t*)buf;
- direction = 1;
- olap = nelmts;
- } else if (src_p->size>=dst_p->size) {
- double olap_d = HDceil((double)(dst_p->size)/
- (double)(src_p->size-dst_p->size));
- olap = (size_t)olap_d;
- sp = dp = (uint8_t*)buf;
- direction = 1;
- } else {
- double olap_d = HDceil((double)(src_p->size)/
- (double)(dst_p->size-src_p->size));
- olap = (size_t)olap_d;
- sp = (uint8_t*)buf + (nelmts-1) * src_p->size;
- dp = (uint8_t*)buf + (nelmts-1) * dst_p->size;
- direction = -1;
- }
+ case H5T_CONV_CONV:
+ /* Get the data types */
+ if (NULL==(src_p=H5I_object_verify(src_id,H5I_DATATYPE)) ||
+ NULL==(dst_p=H5I_object_verify(dst_id,H5I_DATATYPE)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ src = src_p->u.atomic;
+ dst = dst_p->u.atomic;
+ expo_max = ((hssize_t)1 << dst.u.f.esize) - 1;
- /* The conversion loop */
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- /*
- * If the source and destination buffers overlap then use a
- * temporary buffer for the destination.
- */
- if (direction>0) {
- s = sp;
- d = elmtno<olap ? dbuf : dp;
- } else {
- s = sp;
- d = elmtno+olap >= nelmts ? dbuf : dp;
- }
+ /*
+ * Do we process the values from beginning to end or vice versa? Also,
+ * how many of the elements have the source and destination areas
+ * overlapping?
+ */
+ if (src_p->size==dst_p->size || buf_stride) {
+ sp = dp = (uint8_t*)buf;
+ direction = 1;
+ olap = nelmts;
+ } else if (src_p->size>=dst_p->size) {
+ double olap_d = HDceil((double)(dst_p->size)/
+ (double)(src_p->size-dst_p->size));
+ olap = (size_t)olap_d;
+ sp = dp = (uint8_t*)buf;
+ direction = 1;
+ } else {
+ double olap_d = HDceil((double)(src_p->size)/
+ (double)(dst_p->size-src_p->size));
+ olap = (size_t)olap_d;
+ sp = (uint8_t*)buf + (nelmts-1) * src_p->size;
+ dp = (uint8_t*)buf + (nelmts-1) * dst_p->size;
+ direction = -1;
+ }
+
+ /* The conversion loop */
+ for (elmtno=0; elmtno<nelmts; elmtno++) {
+ /*
+ * If the source and destination buffers overlap then use a
+ * temporary buffer for the destination.
+ */
+ if (direction>0) {
+ s = sp;
+ d = elmtno<olap ? dbuf : dp;
+ } else {
+ s = sp;
+ d = elmtno+olap >= nelmts ? dbuf : dp;
+ }
#ifndef NDEBUG
- /* I don't quite trust the overlap calculations yet --rpm */
- if (d==dbuf) {
- assert ((dp>=sp && dp<sp+src_p->size) ||
- (sp>=dp && sp<dp+dst_p->size));
- } else {
- assert ((dp<sp && dp+dst_p->size<=sp) ||
- (sp<dp && sp+src_p->size<=dp));
- }
+ /* I don't quite trust the overlap calculations yet --rpm */
+ if (d==dbuf) {
+ assert ((dp>=sp && dp<sp+src_p->size) ||
+ (sp>=dp && sp<dp+dst_p->size));
+ } else {
+ assert ((dp<sp && dp+dst_p->size<=sp) ||
+ (sp<dp && sp+src_p->size<=dp));
+ }
#endif
-
- /*
- * Put the data in little endian order so our loops aren't so
- * complicated. We'll do all the conversion stuff assuming
- * little endian and then we'll fix the order at the end.
- */
- if (H5T_ORDER_BE==src.order) {
- half_size = src_p->size/2;
- for (i=0; i<half_size; i++) {
- uint8_t tmp = s[src_p->size-(i+1)];
- s[src_p->size-(i+1)] = s[i];
- s[i] = tmp;
- }
- }
-
- /*
- * Check for special cases: +0, -0, +Inf, -Inf, NaN
- */
- if (H5T_bit_find (s, src.u.f.mpos, src.u.f.msize,
- H5T_BIT_LSB, TRUE)<0) {
- if (H5T_bit_find (s, src.u.f.epos, src.u.f.esize,
- H5T_BIT_LSB, TRUE)<0) {
- /* +0 or -0 */
- H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1);
- H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, FALSE);
- H5T_bit_set (d, dst.u.f.mpos, dst.u.f.msize, FALSE);
- goto padding;
- } else if (H5T_bit_find (s, src.u.f.epos, src.u.f.esize,
- H5T_BIT_LSB, FALSE)<0) {
- /* +Inf or -Inf */
- H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1);
- H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, TRUE);
- H5T_bit_set (d, dst.u.f.mpos, dst.u.f.msize, FALSE);
- goto padding;
- }
- } else if (H5T_bit_find (s, src.u.f.epos, src.u.f.esize,
- H5T_BIT_LSB, FALSE)<0) {
- /*
- * NaN. There are many NaN values, so we just set all bits of
- * the significand.
- */
- H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1);
- H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, TRUE);
- H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, TRUE);
- goto padding;
- }
+
+ /*
+ * Put the data in little endian order so our loops aren't so
+ * complicated. We'll do all the conversion stuff assuming
+ * little endian and then we'll fix the order at the end.
+ */
+ if (H5T_ORDER_BE==src.order) {
+ half_size = src_p->size/2;
+ for (i=0; i<half_size; i++) {
+ uint8_t tmp = s[src_p->size-(i+1)];
+ s[src_p->size-(i+1)] = s[i];
+ s[i] = tmp;
+ }
+ }
- /*
- * Get the exponent as an unsigned quantity from the section of
- * the source bit field where it's located. Don't worry about
- * the exponent bias yet.
- */
- expo = H5T_bit_get_d(s, src.u.f.epos, src.u.f.esize);
-
- /*
- * Set markers for the source mantissa, excluding the leading `1'
- * (might be implied).
- */
- implied = 1;
- mpos = src.u.f.mpos;
- mrsh = 0;
- if (0==expo || H5T_NORM_NONE==src.u.f.norm) {
- if ((bitno=H5T_bit_find(s, src.u.f.mpos, src.u.f.msize,
- H5T_BIT_MSB, TRUE))>0) {
- msize = bitno;
- } else if (0==bitno) {
- msize = 1;
- H5T_bit_set(s, src.u.f.mpos, 1, FALSE);
- }
- } else if (H5T_NORM_IMPLIED==src.u.f.norm) {
- msize = src.u.f.msize;
- } else {
- assert("normalization method not implemented yet" && 0);
- HDabort();
- }
-
- /*
- * The sign for the destination is the same as the sign for the
- * source in all cases.
- */
- H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1);
+ /*
+ * Check for special cases: +0, -0, +Inf, -Inf, NaN
+ */
+ if (H5T_bit_find (s, src.u.f.mpos, src.u.f.msize,
+ H5T_BIT_LSB, TRUE)<0) {
+ if (H5T_bit_find (s, src.u.f.epos, src.u.f.esize,
+ H5T_BIT_LSB, TRUE)<0) {
+ /* +0 or -0 */
+ H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1);
+ H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, FALSE);
+ H5T_bit_set (d, dst.u.f.mpos, dst.u.f.msize, FALSE);
+ goto padding;
+ } else if (H5T_bit_find (s, src.u.f.epos, src.u.f.esize,
+ H5T_BIT_LSB, FALSE)<0) {
+ /* +Inf or -Inf */
+ H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1);
+ H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, TRUE);
+ H5T_bit_set (d, dst.u.f.mpos, dst.u.f.msize, FALSE);
+ goto padding;
+ }
+ } else if (H5T_bit_find (s, src.u.f.epos, src.u.f.esize,
+ H5T_BIT_LSB, FALSE)<0) {
+ /*
+ * NaN. There are many NaN values, so we just set all bits of
+ * the significand.
+ */
+ H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1);
+ H5T_bit_set (d, dst.u.f.epos, dst.u.f.esize, TRUE);
+ H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, TRUE);
+ goto padding;
+ }
- /*
- * Calculate the true source exponent by adjusting according to
- * the source exponent bias.
- */
- if (0==expo || H5T_NORM_NONE==src.u.f.norm) {
- bitno = H5T_bit_find(s, src.u.f.mpos, src.u.f.msize,
- H5T_BIT_MSB, TRUE);
- assert(bitno>=0);
- expo -= (src.u.f.ebias-1) + (src.u.f.msize-bitno);
- } else if (H5T_NORM_IMPLIED==src.u.f.norm) {
- expo -= src.u.f.ebias;
- } else {
- assert("normalization method not implemented yet" && 0);
- HDabort();
- }
+ /*
+ * Get the exponent as an unsigned quantity from the section of
+ * the source bit field where it's located. Don't worry about
+ * the exponent bias yet.
+ */
+ expo = H5T_bit_get_d(s, src.u.f.epos, src.u.f.esize);
+
+ /*
+ * Set markers for the source mantissa, excluding the leading `1'
+ * (might be implied).
+ */
+ implied = 1;
+ mpos = src.u.f.mpos;
+ mrsh = 0;
+ if (0==expo || H5T_NORM_NONE==src.u.f.norm) {
+ if ((bitno=H5T_bit_find(s, src.u.f.mpos, src.u.f.msize,
+ H5T_BIT_MSB, TRUE))>0) {
+ msize = bitno;
+ } else if (0==bitno) {
+ msize = 1;
+ H5T_bit_set(s, src.u.f.mpos, 1, FALSE);
+ }
+ } else if (H5T_NORM_IMPLIED==src.u.f.norm) {
+ msize = src.u.f.msize;
+ } else {
+ assert("normalization method not implemented yet" && 0);
+ HDabort();
+ }
+
+ /*
+ * The sign for the destination is the same as the sign for the
+ * source in all cases.
+ */
+ H5T_bit_copy (d, dst.u.f.sign, s, src.u.f.sign, 1);
- /*
- * If the destination is not normalized then right shift the
- * mantissa by one.
- */
- if (H5T_NORM_NONE==dst.u.f.norm) {
- mrsh++;
- }
+ /*
+ * Calculate the true source exponent by adjusting according to
+ * the source exponent bias.
+ */
+ if (0==expo || H5T_NORM_NONE==src.u.f.norm) {
+ bitno = H5T_bit_find(s, src.u.f.mpos, src.u.f.msize,
+ H5T_BIT_MSB, TRUE);
+ assert(bitno>=0);
+ expo -= (src.u.f.ebias-1) + (src.u.f.msize-bitno);
+ } else if (H5T_NORM_IMPLIED==src.u.f.norm) {
+ expo -= src.u.f.ebias;
+ } else {
+ assert("normalization method not implemented yet" && 0);
+ HDabort();
+ }
- /*
- * Calculate the destination exponent by adding the destination
- * bias and clipping by the minimum and maximum possible
- * destination exponent values.
- */
- expo += dst.u.f.ebias;
- if (expo < -(hssize_t)(dst.u.f.msize)) {
- /* The exponent is way too small. Result is zero. */
- expo = 0;
- H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE);
- msize = 0;
-
- } else if (expo<=0) {
- /*
- * The exponent is too small to fit in the exponent field,
- * but by shifting the mantissa to the right we can
- * accomodate that value. The mantissa of course is no
- * longer normalized.
- */
- H5_ASSIGN_OVERFLOW(mrsh,(mrsh+1-expo),hssize_t,size_t);
- /*mrsh += 1-expo;*/
- expo = 0;
-
- } else if (expo>=expo_max) {
- /*
- * The exponent is too large to fit in the available region
- * or it results in the maximum possible value. Use positive
- * or negative infinity instead unless the application
- * specifies something else. Before calling the overflow
- * handler make sure the source buffer we hand it is in the
- * original byte order.
- */
- if (H5T_overflow_g) {
- uint8_t over_src[256];
- assert(src_p->size<=sizeof over_src);
- if (H5T_ORDER_BE==src.order) {
- for (i=0; i<src_p->size; i++) {
- over_src[src_p->size-(i+1)] = s[i];
- }
- } else {
- for (i=0; i<src_p->size; i++) {
- over_src[i] = s[i];
- }
- }
- if ((H5T_overflow_g)(src_id, dst_id, over_src, d)>=0) {
- goto next;
- }
- }
- expo = expo_max;
- H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE);
- msize = 0;
- }
+ /*
+ * If the destination is not normalized then right shift the
+ * mantissa by one.
+ */
+ if (H5T_NORM_NONE==dst.u.f.norm)
+ mrsh++;
- /*
- * If the destination mantissa is smaller than the source
- * mantissa then round the source mantissa. Rounding may cause a
- * carry in which case the exponent has to be re-evaluated for
- * overflow. That is, if `carry' is clear then the implied
- * mantissa bit is `1', else it is `10' binary.
- */
- if (msize>0 && mrsh<=dst.u.f.msize && mrsh+msize>dst.u.f.msize) {
- bitno = (ssize_t)(mrsh+msize - dst.u.f.msize);
- assert(bitno>=0 && (size_t)bitno<=msize);
- carry = H5T_bit_inc(s, mpos+bitno-1, 1+msize-bitno);
- if (carry) implied = 2;
- }
- else
- carry=0;
+ /*
+ * Calculate the destination exponent by adding the destination
+ * bias and clipping by the minimum and maximum possible
+ * destination exponent values.
+ */
+ expo += dst.u.f.ebias;
+ if (expo < -(hssize_t)(dst.u.f.msize)) {
+ /* The exponent is way too small. Result is zero. */
+ expo = 0;
+ H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE);
+ msize = 0;
- /*
- * Write the mantissa to the destination
- */
- if (mrsh>dst.u.f.msize+1) {
- H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE);
- } else if (mrsh==dst.u.f.msize+1) {
- H5T_bit_set(d, dst.u.f.mpos+1, dst.u.f.msize-1, FALSE);
- H5T_bit_set(d, dst.u.f.mpos, 1, TRUE);
- } else if (mrsh==dst.u.f.msize) {
- H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE);
- H5T_bit_set_d(d, dst.u.f.mpos, MIN(2, dst.u.f.msize), implied);
- } else {
- if (mrsh>0) {
- H5T_bit_set(d, dst.u.f.mpos+dst.u.f.msize-mrsh, mrsh,
- FALSE);
- H5T_bit_set_d(d, dst.u.f.mpos+dst.u.f.msize-mrsh, 2,
- implied);
- }
- if (mrsh+msize>=dst.u.f.msize) {
- H5T_bit_copy(d, dst.u.f.mpos,
- s, (mpos+msize+mrsh-dst.u.f.msize),
- dst.u.f.msize-mrsh);
- } else {
- H5T_bit_copy(d, dst.u.f.mpos+dst.u.f.msize-(mrsh+msize),
- s, mpos, msize);
- H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize-(mrsh+msize),
- FALSE);
- }
- }
-
- /* Write the exponent */
- if (carry) {
- expo++;
- if (expo>=expo_max) {
+ } else if (expo<=0) {
+ /*
+ * The exponent is too small to fit in the exponent field,
+ * but by shifting the mantissa to the right we can
+ * accomodate that value. The mantissa of course is no
+ * longer normalized.
+ */
+ H5_ASSIGN_OVERFLOW(mrsh,(mrsh+1-expo),hssize_t,size_t);
+ /*mrsh += 1-expo;*/
+ expo = 0;
+
+ } else if (expo>=expo_max) {
/*
- * The exponent is too large to fit in the available
- * region or it results in the maximum possible value.
- * Use positive or negative infinity instead unless the
- * application specifies something else. Before
- * calling the overflow handler make sure the source
- * buffer we hand it is in the original byte order.
+ * The exponent is too large to fit in the available region
+ * or it results in the maximum possible value. Use positive
+ * or negative infinity instead unless the application
+ * specifies something else. Before calling the overflow
+ * handler make sure the source buffer we hand it is in the
+ * original byte order.
*/
if (H5T_overflow_g) {
uint8_t over_src[256];
@@ -3267,67 +3129,145 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
}
expo = expo_max;
H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE);
+ msize = 0;
}
- }
- H5_CHECK_OVERFLOW(expo,hssize_t,hsize_t);
- H5T_bit_set_d(d, dst.u.f.epos, dst.u.f.esize, (hsize_t)expo);
- padding:
+ /*
+ * If the destination mantissa is smaller than the source
+ * mantissa then round the source mantissa. Rounding may cause a
+ * carry in which case the exponent has to be re-evaluated for
+ * overflow. That is, if `carry' is clear then the implied
+ * mantissa bit is `1', else it is `10' binary.
+ */
+ if (msize>0 && mrsh<=dst.u.f.msize && mrsh+msize>dst.u.f.msize) {
+ bitno = (ssize_t)(mrsh+msize - dst.u.f.msize);
+ assert(bitno>=0 && (size_t)bitno<=msize);
+ carry = H5T_bit_inc(s, mpos+bitno-1, 1+msize-bitno);
+ if (carry)
+ implied = 2;
+ }
+ else
+ carry=0;
+
+ /*
+ * Write the mantissa to the destination
+ */
+ if (mrsh>dst.u.f.msize+1) {
+ H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE);
+ } else if (mrsh==dst.u.f.msize+1) {
+ H5T_bit_set(d, dst.u.f.mpos+1, dst.u.f.msize-1, FALSE);
+ H5T_bit_set(d, dst.u.f.mpos, 1, TRUE);
+ } else if (mrsh==dst.u.f.msize) {
+ H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, FALSE);
+ H5T_bit_set_d(d, dst.u.f.mpos, MIN(2, dst.u.f.msize), implied);
+ } else {
+ if (mrsh>0) {
+ H5T_bit_set(d, dst.u.f.mpos+dst.u.f.msize-mrsh, mrsh,
+ FALSE);
+ H5T_bit_set_d(d, dst.u.f.mpos+dst.u.f.msize-mrsh, 2,
+ implied);
+ }
+ if (mrsh+msize>=dst.u.f.msize) {
+ H5T_bit_copy(d, dst.u.f.mpos,
+ s, (mpos+msize+mrsh-dst.u.f.msize),
+ dst.u.f.msize-mrsh);
+ } else {
+ H5T_bit_copy(d, dst.u.f.mpos+dst.u.f.msize-(mrsh+msize),
+ s, mpos, msize);
+ H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize-(mrsh+msize),
+ FALSE);
+ }
+ }
+
+ /* Write the exponent */
+ if (carry) {
+ expo++;
+ if (expo>=expo_max) {
+ /*
+ * The exponent is too large to fit in the available
+ * region or it results in the maximum possible value.
+ * Use positive or negative infinity instead unless the
+ * application specifies something else. Before
+ * calling the overflow handler make sure the source
+ * buffer we hand it is in the original byte order.
+ */
+ if (H5T_overflow_g) {
+ uint8_t over_src[256];
+ assert(src_p->size<=sizeof over_src);
+ if (H5T_ORDER_BE==src.order) {
+ for (i=0; i<src_p->size; i++)
+ over_src[src_p->size-(i+1)] = s[i];
+ } else {
+ for (i=0; i<src_p->size; i++)
+ over_src[i] = s[i];
+ }
+ if ((H5T_overflow_g)(src_id, dst_id, over_src, d)>=0)
+ goto next;
+ }
+ expo = expo_max;
+ H5T_bit_set(d, dst.u.f.mpos, dst.u.f.msize, 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);
+
+ padding:
#ifndef LATER
- /*
- * Set internal padding areas
- */
+ /*
+ * Set internal padding areas
+ */
#endif
- /*
- * Set external padding areas
- */
- if (dst.offset>0) {
- assert (H5T_PAD_ZERO==dst.lsb_pad || H5T_PAD_ONE==dst.lsb_pad);
- H5T_bit_set (d, 0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad));
- }
- if (dst.offset+dst.prec!=8*dst_p->size) {
- assert (H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad);
- H5T_bit_set (d, dst.offset+dst.prec, 8*dst_p->size - (dst.offset+dst.prec),
- (hbool_t)(H5T_PAD_ONE==dst.msb_pad));
- }
+ /*
+ * Set external padding areas
+ */
+ if (dst.offset>0) {
+ assert (H5T_PAD_ZERO==dst.lsb_pad || H5T_PAD_ONE==dst.lsb_pad);
+ H5T_bit_set (d, 0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad));
+ }
+ if (dst.offset+dst.prec!=8*dst_p->size) {
+ assert (H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad);
+ H5T_bit_set (d, dst.offset+dst.prec, 8*dst_p->size - (dst.offset+dst.prec),
+ (hbool_t)(H5T_PAD_ONE==dst.msb_pad));
+ }
- /*
- * Put the destination in the correct byte order. See note at
- * beginning of loop.
- */
- if (H5T_ORDER_BE==dst.order) {
- half_size = dst_p->size/2;
- for (i=0; i<half_size; i++) {
- uint8_t tmp = d[dst_p->size-(i+1)];
- d[dst_p->size-(i+1)] = d[i];
- d[i] = tmp;
- }
- }
+ /*
+ * Put the destination in the correct byte order. See note at
+ * beginning of loop.
+ */
+ if (H5T_ORDER_BE==dst.order) {
+ half_size = dst_p->size/2;
+ for (i=0; i<half_size; i++) {
+ uint8_t tmp = d[dst_p->size-(i+1)];
+ d[dst_p->size-(i+1)] = d[i];
+ d[i] = tmp;
+ }
+ }
- /*
- * If we had used a temporary buffer for the destination then we
- * should copy the value to the true destination buffer.
- */
- next:
- if (d==dbuf) HDmemcpy (dp, d, dst_p->size);
- if (buf_stride) {
- sp += direction * buf_stride;
- dp += direction * buf_stride;
- } else {
- sp += direction * src_p->size;
- dp += direction * dst_p->size;
- }
- }
-
- break;
-
- default:
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ /*
+ * If we had used a temporary buffer for the destination then we
+ * should copy the value to the true destination buffer.
+ */
+ next:
+ if (d==dbuf)
+ HDmemcpy (dp, d, dst_p->size);
+ if (buf_stride) {
+ sp += direction * buf_stride;
+ dp += direction * buf_stride;
+ } else {
+ sp += direction * src_p->size;
+ dp += direction * dst_p->size;
+ }
+ }
+
+ break;
+
+ default:
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
}
@@ -3362,7 +3302,7 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
size_t nchars=0; /*number of characters copied */
uint8_t *s, *sp, *d, *dp; /*src and dst traversal pointers*/
uint8_t *dbuf=NULL; /*temp buf for overlap convers. */
- herr_t ret_value=FAIL; /*return value */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_s_s, FAIL);
@@ -3371,22 +3311,15 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- if (8*src->size != src->u.atomic.prec ||
- 8*dst->size != dst->u.atomic.prec) {
+ if (8*src->size != src->u.atomic.prec || 8*dst->size != dst->u.atomic.prec)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad precision");
- }
- if (0 != src->u.atomic.offset ||
- 0 != dst->u.atomic.offset) {
+ if (0 != src->u.atomic.offset || 0 != dst->u.atomic.offset)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad offset");
- }
- if (H5T_CSET_ASCII != src->u.atomic.u.s.cset ||
- H5T_CSET_ASCII != dst->u.atomic.u.s.cset) {
+ if (H5T_CSET_ASCII != src->u.atomic.u.s.cset || H5T_CSET_ASCII != dst->u.atomic.u.s.cset)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad character set");
- }
if (src->u.atomic.u.s.pad<0 || src->u.atomic.u.s.pad>=H5T_NPAD ||
- dst->u.atomic.u.s.pad<0 || dst->u.atomic.u.s.pad>=H5T_NPAD) {
+ dst->u.atomic.u.s.pad<0 || dst->u.atomic.u.s.pad>=H5T_NPAD)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad character padding");
- }
cdata->need_bkg = H5T_BKG_NO;
break;
@@ -3428,10 +3361,8 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
}
/* Allocate the overlap buffer */
- if (NULL==(dbuf=H5MM_malloc(dst->size))) {
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "memory allocation failed for string conversion");
- }
+ if (NULL==(dbuf=H5MM_malloc(dst->size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for string conversion");
/* The conversion loop. */
for (elmtno=0; elmtno<nelmts; elmtno++) {
@@ -3441,21 +3372,21 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
* temporary buffer for the destination.
*/
if (direction>0) {
- s = sp;
- d = elmtno<olap ? dbuf : dp;
+ s = sp;
+ d = elmtno<olap ? dbuf : dp;
} else {
- s = sp;
- d = elmtno+olap >= nelmts ? dbuf : dp;
+ s = sp;
+ d = elmtno+olap >= nelmts ? dbuf : dp;
}
#ifndef NDEBUG
/* I don't quite trust the overlap calculations yet --rpm */
if (src->size==dst->size || buf_stride) {
- assert(s==d);
+ assert(s==d);
} else if (d==dbuf) {
- assert((dp>=sp && dp<sp+src->size) ||
+ assert((dp>=sp && dp<sp+src->size) ||
(sp>=dp && sp<dp+dst->size));
} else {
- assert((dp<sp && dp+dst->size<=sp) ||
+ assert((dp<sp && dp+dst->size<=sp) ||
(sp<dp && sp+src->size<=dp));
}
#endif
@@ -3500,8 +3431,7 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
case H5T_STR_RESERVED_14:
case H5T_STR_RESERVED_15:
case H5T_STR_ERROR:
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "source string padding method not supported");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "source string padding method not supported");
}
/* Terminate or pad the destination */
@@ -3536,8 +3466,7 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
case H5T_STR_RESERVED_14:
case H5T_STR_RESERVED_15:
case H5T_STR_ERROR:
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "destination string padding method not supported");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination string padding method not supported");
}
/*
@@ -3557,12 +3486,10 @@ H5T_conv_s_s (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
break;
default:
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown converson command");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown converson command");
}
- ret_value = SUCCEED;
- done:
+done:
H5MM_xfree(dbuf);
FUNC_LEAVE(ret_value);
}
@@ -3590,12 +3517,14 @@ H5T_conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_schar_uchar, FAIL);
- H5T_CONV_su(SCHAR, UCHAR,
- signed char, unsigned char);
+ H5T_CONV_su(SCHAR, UCHAR, signed char, unsigned char);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3621,13 +3550,14 @@ H5T_conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uchar_schar, FAIL);
- H5T_CONV_us(UCHAR, SCHAR,
- unsigned char, signed char,
- SCHAR_MAX);
+ H5T_CONV_us(UCHAR, SCHAR, unsigned char, signed char, SCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3653,12 +3583,14 @@ H5T_conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_schar_short, FAIL);
- H5T_CONV_sS(SCHAR, SHORT,
- signed char, short);
+ H5T_CONV_sS(SCHAR, SHORT, signed char, short);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3684,12 +3616,14 @@ H5T_conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_schar_ushort, FAIL);
- H5T_CONV_sU(SCHAR, USHORT,
- signed char, unsigned short);
+ H5T_CONV_sU(SCHAR, USHORT, signed char, unsigned short);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3715,13 +3649,14 @@ H5T_conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uchar_short, FAIL);
- H5T_CONV_uS(UCHAR, SHORT,
- unsigned char, short,
- SHRT_MAX);
+ H5T_CONV_uS(UCHAR, SHORT, unsigned char, short, SHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3747,12 +3682,14 @@ H5T_conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uchar_ushort, FAIL);
- H5T_CONV_uU(UCHAR, USHORT,
- unsigned char, unsigned short);
+ H5T_CONV_uU(UCHAR, USHORT, unsigned char, unsigned short);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3777,12 +3714,14 @@ H5T_conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_schar_int, FAIL);
- H5T_CONV_sS(SCHAR, INT,
- signed char, int);
+ H5T_CONV_sS(SCHAR, INT, signed char, int);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3807,12 +3746,14 @@ H5T_conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_schar_uint, FAIL);
- H5T_CONV_sU(SCHAR, UINT,
- signed char, unsigned);
+ H5T_CONV_sU(SCHAR, UINT, signed char, unsigned);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3837,13 +3778,14 @@ H5T_conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uchar_int, FAIL);
- H5T_CONV_uS(UCHAR, INT,
- unsigned char, int,
- INT_MAX);
+ H5T_CONV_uS(UCHAR, INT, unsigned char, int, INT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3868,12 +3810,14 @@ H5T_conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uchar_uint, FAIL);
- H5T_CONV_uU(UCHAR, UINT,
- unsigned char, unsigned);
+ H5T_CONV_uU(UCHAR, UINT, unsigned char, unsigned);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3898,12 +3842,14 @@ H5T_conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_schar_long, FAIL);
- H5T_CONV_sS(SCHAR, LONG,
- signed char, long);
+ H5T_CONV_sS(SCHAR, LONG, signed char, long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3929,12 +3875,14 @@ H5T_conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_schar_ulong, FAIL);
- H5T_CONV_sU(SCHAR, ULONG,
- signed char, unsigned long);
+ H5T_CONV_sU(SCHAR, ULONG, signed char, unsigned long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3959,13 +3907,14 @@ H5T_conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uchar_long, FAIL);
- H5T_CONV_uS(UCHAR, LONG,
- unsigned char, long,
- LONG_MAX);
+ H5T_CONV_uS(UCHAR, LONG, unsigned char, long, LONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -3991,12 +3940,14 @@ H5T_conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uchar_ulong, FAIL);
- H5T_CONV_uU(UCHAR, ULONG,
- unsigned char, unsigned long);
+ H5T_CONV_uU(UCHAR, ULONG, unsigned char, unsigned long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4022,12 +3973,14 @@ H5T_conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_schar_llong, FAIL);
- H5T_CONV_sS(SCHAR, LLONG,
- signed char, long_long);
+ H5T_CONV_sS(SCHAR, LLONG, signed char, long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4053,12 +4006,14 @@ H5T_conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_schar_ullong, FAIL);
- H5T_CONV_sU(SCHAR, ULLONG,
- signed char, unsigned long_long);
+ H5T_CONV_sU(SCHAR, ULLONG, signed char, unsigned long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4084,13 +4039,14 @@ H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uchar_llong, FAIL);
- H5T_CONV_uS(UCHAR, LLONG,
- unsigned char, long_long,
- LLONG_MAX);
+ H5T_CONV_uS(UCHAR, LLONG, unsigned char, long_long, LLONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4116,12 +4072,14 @@ H5T_conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uchar_ullong, FAIL);
- H5T_CONV_uU(UCHAR, ULLONG,
- unsigned char, unsigned long_long);
+ H5T_CONV_uU(UCHAR, ULLONG, unsigned char, unsigned long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4147,13 +4105,14 @@ H5T_conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_short_schar, FAIL);
- H5T_CONV_Ss(SHORT, SCHAR,
- short, signed char,
- SCHAR_MIN, SCHAR_MAX);
+ H5T_CONV_Ss(SHORT, SCHAR, short, signed char, SCHAR_MIN, SCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4179,13 +4138,14 @@ H5T_conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_short_uchar, FAIL);
- H5T_CONV_Su(SHORT, UCHAR,
- short, unsigned char,
- UCHAR_MAX);
+ H5T_CONV_Su(SHORT, UCHAR, short, unsigned char, UCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4211,13 +4171,14 @@ H5T_conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ushort_schar, FAIL);
- H5T_CONV_Us(USHORT, SCHAR,
- unsigned short, signed char,
- SCHAR_MAX);
+ H5T_CONV_Us(USHORT, SCHAR, unsigned short, signed char, SCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4243,13 +4204,14 @@ H5T_conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ushort_uchar, FAIL);
- H5T_CONV_Uu(USHORT, UCHAR,
- unsigned short, unsigned char,
- UCHAR_MAX);
+ H5T_CONV_Uu(USHORT, UCHAR, unsigned short, unsigned char, UCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4275,12 +4237,14 @@ H5T_conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_short_ushort, FAIL);
- H5T_CONV_su(SHORT, USHORT,
- short, unsigned short);
+ H5T_CONV_su(SHORT, USHORT, short, unsigned short);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4306,13 +4270,14 @@ H5T_conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ushort_short, FAIL);
- H5T_CONV_us(USHORT, SHORT,
- unsigned short, short,
- SHRT_MAX);
+ H5T_CONV_us(USHORT, SHORT, unsigned short, short, SHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4338,12 +4303,14 @@ H5T_conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_short_int, FAIL);
- H5T_CONV_sS(SHORT, INT,
- short, int);
+ H5T_CONV_sS(SHORT, INT, short, int);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4369,12 +4336,14 @@ H5T_conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_short_uint, FAIL);
- H5T_CONV_sU(SHORT, UINT,
- short, unsigned);
+ H5T_CONV_sU(SHORT, UINT, short, unsigned);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4400,13 +4369,14 @@ H5T_conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ushort_int, FAIL);
- H5T_CONV_uS(USHORT, INT,
- unsigned short, int,
- INT_MAX);
+ H5T_CONV_uS(USHORT, INT, unsigned short, int, INT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4432,12 +4402,14 @@ H5T_conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ushort_uint, FAIL);
- H5T_CONV_uU(USHORT, UINT,
- unsigned short, unsigned);
+ H5T_CONV_uU(USHORT, UINT, unsigned short, unsigned);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4463,12 +4435,14 @@ H5T_conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_short_long, FAIL);
- H5T_CONV_sS(SHORT, LONG,
- short, long);
+ H5T_CONV_sS(SHORT, LONG, short, long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4494,12 +4468,14 @@ H5T_conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_short_ulong, FAIL);
- H5T_CONV_sU(SHORT, ULONG,
- short, unsigned long);
+ H5T_CONV_sU(SHORT, ULONG, short, unsigned long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4525,13 +4501,14 @@ H5T_conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ushort_long, FAIL);
- H5T_CONV_uS(USHORT, LONG,
- unsigned short, long,
- LONG_MAX);
+ H5T_CONV_uS(USHORT, LONG, unsigned short, long, LONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4557,12 +4534,14 @@ H5T_conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ushort_ulong, FAIL);
- H5T_CONV_uU(USHORT, ULONG,
- unsigned short, unsigned long);
+ H5T_CONV_uU(USHORT, ULONG, unsigned short, unsigned long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4588,12 +4567,14 @@ H5T_conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_short_llong, FAIL);
- H5T_CONV_sS(SHORT, LLONG,
- short, long_long);
+ H5T_CONV_sS(SHORT, LLONG, short, long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4619,12 +4600,14 @@ H5T_conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_short_ullong, FAIL);
- H5T_CONV_sU(SHORT, ULLONG,
- short, unsigned long_long);
+ H5T_CONV_sU(SHORT, ULLONG, short, unsigned long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4650,13 +4633,14 @@ H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ushort_llong, FAIL);
- H5T_CONV_uS(USHORT, LLONG,
- unsigned short, long_long,
- LLONG_MAX);
+ H5T_CONV_uS(USHORT, LLONG, unsigned short, long_long, LLONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4682,12 +4666,14 @@ H5T_conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ushort_ullong, FAIL);
- H5T_CONV_uU(USHORT, ULLONG,
- unsigned short, unsigned long_long);
+ H5T_CONV_uU(USHORT, ULLONG, unsigned short, unsigned long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4713,13 +4699,14 @@ H5T_conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_int_schar, FAIL);
- H5T_CONV_Ss(INT, SCHAR,
- int, signed char,
- SCHAR_MIN, SCHAR_MAX);
+ H5T_CONV_Ss(INT, SCHAR, int, signed char, SCHAR_MIN, SCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4745,13 +4732,14 @@ H5T_conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_int_uchar, FAIL);
- H5T_CONV_Su(INT, UCHAR,
- int, unsigned char,
- UCHAR_MAX);
+ H5T_CONV_Su(INT, UCHAR, int, unsigned char, UCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4777,13 +4765,14 @@ H5T_conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uint_schar, FAIL);
- H5T_CONV_Us(UINT, SCHAR,
- unsigned, signed char,
- SCHAR_MAX);
+ H5T_CONV_Us(UINT, SCHAR, unsigned, signed char, SCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4809,13 +4798,14 @@ H5T_conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uint_uchar, FAIL);
- H5T_CONV_Uu(UINT, UCHAR,
- unsigned, unsigned char,
- UCHAR_MAX);
+ H5T_CONV_Uu(UINT, UCHAR, unsigned, unsigned char, UCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4841,13 +4831,14 @@ H5T_conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_int_short, FAIL);
- H5T_CONV_Ss(INT, SHORT,
- int, short,
- SHRT_MIN, SHRT_MAX);
+ H5T_CONV_Ss(INT, SHORT, int, short, SHRT_MIN, SHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4873,13 +4864,14 @@ H5T_conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_int_ushort, FAIL);
- H5T_CONV_Su(INT, USHORT,
- int, unsigned short,
- USHRT_MAX);
+ H5T_CONV_Su(INT, USHORT, int, unsigned short, USHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4905,13 +4897,14 @@ H5T_conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uint_short, FAIL);
- H5T_CONV_Us(UINT, SHORT,
- unsigned, short,
- SHRT_MAX);
+ H5T_CONV_Us(UINT, SHORT, unsigned, short, SHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4937,13 +4930,14 @@ H5T_conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uint_ushort, FAIL);
- H5T_CONV_Uu(UINT, USHORT,
- unsigned, unsigned short,
- USHRT_MAX);
+ H5T_CONV_Uu(UINT, USHORT, unsigned, unsigned short, USHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4968,12 +4962,14 @@ H5T_conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_int_uint, FAIL);
- H5T_CONV_su(INT, UINT,
- int, unsigned);
+ H5T_CONV_su(INT, UINT, int, unsigned);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -4998,13 +4994,14 @@ H5T_conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uint_int, FAIL);
- H5T_CONV_us(UINT, INT,
- unsigned, int,
- INT_MAX);
+ H5T_CONV_us(UINT, INT, unsigned, int, INT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5029,12 +5026,14 @@ H5T_conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_int_long, FAIL);
- H5T_CONV_sS(INT, LONG,
- int, long);
+ H5T_CONV_sS(INT, LONG, int, long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5059,12 +5058,14 @@ H5T_conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_int_ulong, FAIL);
- H5T_CONV_sU(INT, LONG,
- int, unsigned long);
+ H5T_CONV_sU(INT, LONG, int, unsigned long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5089,13 +5090,14 @@ H5T_conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uint_long, FAIL);
- H5T_CONV_uS(UINT, LONG,
- unsigned, long,
- LONG_MAX);
+ H5T_CONV_uS(UINT, LONG, unsigned, long, LONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5120,12 +5122,14 @@ H5T_conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uint_ulong, FAIL);
- H5T_CONV_uU(UINT, ULONG,
- unsigned, unsigned long);
+ H5T_CONV_uU(UINT, ULONG, unsigned, unsigned long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5150,12 +5154,14 @@ H5T_conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_int_llong, FAIL);
- H5T_CONV_sS(INT, LLONG,
- int, long_long);
+ H5T_CONV_sS(INT, LLONG, int, long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5180,12 +5186,14 @@ H5T_conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_int_ullong, FAIL);
- H5T_CONV_sU(INT, ULLONG,
- int, unsigned long_long);
+ H5T_CONV_sU(INT, ULLONG, int, unsigned long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5210,13 +5218,14 @@ H5T_conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uint_llong, FAIL);
- H5T_CONV_uS(UINT, LLONG,
- unsigned, long_long,
- LLONG_MAX);
+ H5T_CONV_uS(UINT, LLONG, unsigned, long_long, LLONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5242,12 +5251,14 @@ H5T_conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_uint_ullong, FAIL);
- H5T_CONV_uU(UINT, ULLONG,
- unsigned, unsigned long_long);
+ H5T_CONV_uU(UINT, ULLONG, unsigned, unsigned long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5272,13 +5283,14 @@ H5T_conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_schar, FAIL);
- H5T_CONV_Ss(LONG, SCHAR,
- long, signed char,
- SCHAR_MIN, SCHAR_MAX);
+ H5T_CONV_Ss(LONG, SCHAR, long, signed char, SCHAR_MIN, SCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5303,13 +5315,14 @@ H5T_conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_uchar, FAIL);
- H5T_CONV_Su(LONG, UCHAR,
- long, unsigned char,
- UCHAR_MAX);
+ H5T_CONV_Su(LONG, UCHAR, long, unsigned char, UCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5335,13 +5348,14 @@ H5T_conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ulong_schar, FAIL);
- H5T_CONV_Us(ULONG, SCHAR,
- unsigned long, signed char,
- SCHAR_MAX);
+ H5T_CONV_Us(ULONG, SCHAR, unsigned long, signed char, SCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5367,13 +5381,14 @@ H5T_conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ulong_uchar, FAIL);
- H5T_CONV_Uu(ULONG, UCHAR,
- unsigned long, unsigned char,
- UCHAR_MAX);
+ H5T_CONV_Uu(ULONG, UCHAR, unsigned long, unsigned char, UCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5398,13 +5413,14 @@ H5T_conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_short, FAIL);
- H5T_CONV_Ss(LONG, SHORT,
- long, short,
- SHRT_MIN, SHRT_MAX);
+ H5T_CONV_Ss(LONG, SHORT, long, short, SHRT_MIN, SHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5430,13 +5446,14 @@ H5T_conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_ushort, FAIL);
- H5T_CONV_Su(LONG, USHORT,
- long, unsigned short,
- USHRT_MAX);
+ H5T_CONV_Su(LONG, USHORT, long, unsigned short, USHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5461,13 +5478,14 @@ H5T_conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ulong_short, FAIL);
- H5T_CONV_Us(ULONG, SHORT,
- unsigned long, short,
- SHRT_MAX);
+ H5T_CONV_Us(ULONG, SHORT, unsigned long, short, SHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5493,13 +5511,14 @@ H5T_conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ulong_ushort, FAIL);
- H5T_CONV_Uu(ULONG, USHORT,
- unsigned long, unsigned short,
- USHRT_MAX);
+ H5T_CONV_Uu(ULONG, USHORT, unsigned long, unsigned short, USHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5524,13 +5543,14 @@ H5T_conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_int, FAIL);
- H5T_CONV_Ss(LONG, INT,
- long, int,
- INT_MIN, INT_MAX);
+ H5T_CONV_Ss(LONG, INT, long, int, INT_MIN, INT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5555,13 +5575,14 @@ H5T_conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_uint, FAIL);
- H5T_CONV_Su(LONG, UINT,
- long, unsigned,
- UINT_MAX);
+ H5T_CONV_Su(LONG, UINT, long, unsigned, UINT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5586,13 +5607,14 @@ H5T_conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ulong_int, FAIL);
- H5T_CONV_Us(ULONG, INT,
- unsigned long, int,
- INT_MAX);
+ H5T_CONV_Us(ULONG, INT, unsigned long, int, INT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5617,13 +5639,14 @@ H5T_conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ulong_uint, FAIL);
- H5T_CONV_Uu(ULONG, UINT,
- unsigned long, unsigned,
- UINT_MAX);
+ H5T_CONV_Uu(ULONG, UINT, unsigned long, unsigned, UINT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5648,12 +5671,14 @@ H5T_conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_ulong, FAIL);
- H5T_CONV_su(LONG, ULONG,
- long, unsigned long);
+ H5T_CONV_su(LONG, ULONG, long, unsigned long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5678,13 +5703,14 @@ H5T_conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ulong_long, FAIL);
- H5T_CONV_us(ULONG, LONG,
- unsigned long, long,
- LONG_MAX);
+ H5T_CONV_us(ULONG, LONG, unsigned long, long, LONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5709,12 +5735,14 @@ H5T_conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_llong, FAIL);
- H5T_CONV_sS(LONG, LLONG,
- long, long_long);
+ H5T_CONV_sS(LONG, LLONG, long, long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5740,12 +5768,14 @@ H5T_conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_ullong, FAIL);
- H5T_CONV_sU(LONG, ULLONG,
- long, unsigned long_long);
+ H5T_CONV_sU(LONG, ULLONG, long, unsigned long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5771,13 +5801,14 @@ H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_long_llong, FAIL);
- H5T_CONV_uS(ULONG, LLONG,
- unsigned long, long_long,
- LLONG_MAX);
+ H5T_CONV_uS(ULONG, LLONG, unsigned long, long_long, LLONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5803,12 +5834,14 @@ H5T_conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ulong_ullong, FAIL);
- H5T_CONV_uU(ULONG, ULLONG,
- unsigned long, unsigned long_long);
+ H5T_CONV_uU(ULONG, ULLONG, unsigned long, unsigned long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5834,13 +5867,14 @@ H5T_conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_llong_schar, FAIL);
- H5T_CONV_Ss(LLONG, SCHAR,
- long_long, signed char,
- SCHAR_MIN, SCHAR_MAX);
+ H5T_CONV_Ss(LLONG, SCHAR, long_long, signed char, SCHAR_MIN, SCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5866,13 +5900,14 @@ H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_llong_uchar, FAIL);
- H5T_CONV_Su(LLONG, UCHAR,
- long_long, unsigned char,
- UCHAR_MAX);
+ H5T_CONV_Su(LLONG, UCHAR, long_long, unsigned char, UCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5898,13 +5933,14 @@ H5T_conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ullong_schar, FAIL);
- H5T_CONV_Us(ULLONG, SCHAR,
- unsigned long_long, signed char,
- SCHAR_MAX);
+ H5T_CONV_Us(ULLONG, SCHAR, unsigned long_long, signed char, SCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5930,13 +5966,14 @@ H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ullong_uchar, FAIL);
- H5T_CONV_Uu(ULLONG, UCHAR,
- unsigned long_long, unsigned char,
- UCHAR_MAX);
+ H5T_CONV_Uu(ULLONG, UCHAR, unsigned long_long, unsigned char, UCHAR_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5962,13 +5999,14 @@ H5T_conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_llong_short, FAIL);
- H5T_CONV_Ss(LLONG, SHORT,
- long_long, short,
- SHRT_MIN, SHRT_MAX);
+ H5T_CONV_Ss(LLONG, SHORT, long_long, short, SHRT_MIN, SHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -5994,13 +6032,14 @@ H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_llong_ushort, FAIL);
- H5T_CONV_Su(LLONG, USHORT,
- long_long, unsigned short,
- USHRT_MAX);
+ H5T_CONV_Su(LLONG, USHORT, long_long, unsigned short, USHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6026,13 +6065,14 @@ H5T_conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ullong_short, FAIL);
- H5T_CONV_Us(ULLONG, SHORT,
- unsigned long_long, short,
- SHRT_MAX);
+ H5T_CONV_Us(ULLONG, SHORT, unsigned long_long, short, SHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6058,13 +6098,14 @@ H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ullong_ushort, FAIL);
- H5T_CONV_Uu(ULLONG, USHORT,
- unsigned long_long, unsigned short,
- USHRT_MAX);
+ H5T_CONV_Uu(ULLONG, USHORT, unsigned long_long, unsigned short, USHRT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6089,13 +6130,14 @@ H5T_conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_llong_int, FAIL);
- H5T_CONV_Ss(LLONG, INT,
- long_long, int,
- INT_MIN, INT_MAX);
+ H5T_CONV_Ss(LLONG, INT, long_long, int, INT_MIN, INT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6120,13 +6162,14 @@ H5T_conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_llong_uint, FAIL);
- H5T_CONV_Su(LLONG, UINT,
- long_long, unsigned,
- UINT_MAX);
+ H5T_CONV_Su(LLONG, UINT, long_long, unsigned, UINT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6151,13 +6194,14 @@ H5T_conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ullong_int, FAIL);
- H5T_CONV_Us(ULLONG, INT,
- unsigned long_long, int,
- INT_MAX);
+ H5T_CONV_Us(ULLONG, INT, unsigned long_long, int, INT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6183,13 +6227,14 @@ H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ullong_uint, FAIL);
- H5T_CONV_Uu(ULLONG, UINT,
- unsigned long_long, unsigned,
- UINT_MAX);
+ H5T_CONV_Uu(ULLONG, UINT, unsigned long_long, unsigned, UINT_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6214,13 +6259,14 @@ H5T_conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
hsize_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride,
void *buf, void UNUSED *bkg, hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_llong_long, FAIL);
- H5T_CONV_Ss(LLONG, LONG,
- long_long, long,
- LONG_MIN, LONG_MAX);
+ H5T_CONV_Ss(LLONG, LONG, long_long, long, LONG_MIN, LONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6246,13 +6292,14 @@ H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_llong_ulong, FAIL);
- H5T_CONV_Su(LLONG, ULONG,
- long_long, unsigned long,
- ULONG_MAX);
+ H5T_CONV_Su(LLONG, ULONG, long_long, unsigned long, ULONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6278,13 +6325,14 @@ H5T_conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ullong_long, FAIL);
- H5T_CONV_Us(ULLONG, LONG,
- unsigned long_long, long,
- LONG_MAX);
+ H5T_CONV_Us(ULLONG, LONG, unsigned long_long, long, LONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6310,13 +6358,14 @@ H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ullong_ulong, FAIL);
- H5T_CONV_Uu(ULLONG, ULONG,
- unsigned long_long, unsigned long,
- ULONG_MAX);
+ H5T_CONV_Uu(ULLONG, ULONG, unsigned long_long, unsigned long, ULONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6342,12 +6391,14 @@ H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_llong_ullong, FAIL);
- H5T_CONV_su(LLONG, ULLONG,
- long_long, unsigned long_long);
+ H5T_CONV_su(LLONG, ULLONG, long_long, unsigned long_long);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6373,13 +6424,14 @@ H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg,
hid_t UNUSED dset_xfer_plist)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI(H5T_conv_ullong_llong, FAIL);
- H5T_CONV_us(ULLONG, LLONG,
- unsigned long_long, long_long,
- LLONG_MAX);
+ H5T_CONV_us(ULLONG, LLONG, unsigned long_long, long_long, LLONG_MAX);
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -6414,6 +6466,7 @@ H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5T_t *st, *dt; /*type descriptors */
hbool_t src_mv, dst_mv; /*align data? */
double aligned; /*aligned data */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_float_double, FAIL);
@@ -6422,11 +6475,9 @@ H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
cdata->need_bkg = H5T_BKG_NO;
if (NULL==(st=H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL==(dt=H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to dereference data type object ID");
- if (st->size!=sizeof(float) || dt->size!=sizeof(double)) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "disagreement about data type size");
- }
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to dereference data type object ID");
+ if (st->size!=sizeof(float) || dt->size!=sizeof(double))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "disagreement about data type size");
CI_ALLOC_PRIV
break;
@@ -6493,11 +6544,11 @@ H5T_conv_float_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
break;
default:
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
}
@@ -6535,6 +6586,7 @@ H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5T_t *st, *dt; /*type descriptors */
hbool_t src_mv, dst_mv; /*align data? */
double aligned; /*aligned data */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_double_float, FAIL);
@@ -6543,11 +6595,9 @@ H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
cdata->need_bkg = H5T_BKG_NO;
if (NULL==(st=H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL==(dt=H5I_object_verify(dst_id,H5I_DATATYPE)))
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to dereference data type object ID");
- if (st->size!=sizeof(double) || dt->size!=sizeof(float)) {
- HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
- "disagreement about data type size");
- }
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to dereference data type object ID");
+ if (st->size!=sizeof(double) || dt->size!=sizeof(float))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "disagreement about data type size");
CI_ALLOC_PRIV
break;
@@ -6622,11 +6672,11 @@ H5T_conv_double_float (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
break;
default:
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
}
@@ -6665,6 +6715,7 @@ H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
unsigned mbits=0; /*mantissa bits */
unsigned exponent; /*exponent */
int i; /*counter */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5T_conv_i32le_f64le, FAIL);
@@ -6682,7 +6733,7 @@ H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
/* The conversion */
if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)) ||
NULL==H5I_object_verify(dst_id,H5I_DATATYPE))
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
s = (uint8_t*)buf + (buf_stride?buf_stride:4)*(nelmts-1);
d = (uint8_t*)buf + (buf_stride?buf_stride:8)*(nelmts-1);
@@ -6716,8 +6767,7 @@ H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
break;
default:
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unsupported integer sign method");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported integer sign method");
}
/*
@@ -7013,9 +7063,9 @@ H5T_conv_i32le_f64le (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
default:
/* Some other command we don't know about yet.*/
- HRETURN_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL,
- "unknown conversion command");
+ HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command");
}
- FUNC_LEAVE (SUCCEED);
+done:
+ FUNC_LEAVE (ret_value);
}