summaryrefslogtreecommitdiffstats
path: root/src/H5Tconv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Tconv.c')
-rw-r--r--src/H5Tconv.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 075cce8..ad7d4a6 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2206,6 +2206,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5T_cmemb_t *dst_memb = NULL; /*destination struct memb desc. */
size_t offset; /*byte offset wrt struct */
size_t elmtno; /*element counter */
+ size_t copy_size; /*size of element for copying */
unsigned u; /*counters */
int i; /*counters */
H5T_conv_struct_t *priv = NULL; /*private data */
@@ -2328,7 +2329,7 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* in the top of the destination, simply copy the source members to background buffer. */
xbuf = buf;
xbkg = bkg;
- if(dst->shared->size <= src->shared->size) {
+ if(dst->shared->size <= src->shared->size)
/* This is to deal with a very special situation when the fields and their
* offset for both source and destination are identical but the datatype
* sizes of source and destination are different. The library still
@@ -2336,21 +2337,16 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* in table API test (hdf5/hl/test/test_table.c) when a table field is
* deleted.
*/
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbkg, xbuf, dst->shared->size);
+ copy_size = dst->shared->size;
+ else
+ copy_size = src->shared->size;
- /* Update pointers */
- xbuf += buf_stride;
- xbkg += bkg_stride;
- }
- } else {
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbkg, xbuf, src->shared->size);
+ for (elmtno=0; elmtno<nelmts; elmtno++) {
+ HDmemmove(xbkg, xbuf, copy_size);
- /* Update pointers */
- xbuf += buf_stride;
- xbkg += bkg_stride;
- }
+ /* Update pointers */
+ xbuf += buf_stride;
+ xbkg += bkg_stride;
}
} else if(priv->smembs_subset == H5T_SUBSET_DST) {
/* If the optimization flag is set to indicate destination members are a subset
@@ -2359,26 +2355,21 @@ H5T_conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
xbuf = buf;
xbkg = bkg;
- if(src->shared->size <= dst->shared->size) {
+ if(src->shared->size <= dst->shared->size)
/* This is to deal with a very special situation when the fields and their
* offset for both source and destination are identical but the datatype
* sizes of source and destination are different.
*/
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbkg, xbuf, src->shared->size);
+ copy_size = src->shared->size;
+ else
+ copy_size = dst->shared->size;
- /* Update pointers */
- xbuf += buf_stride;
- xbkg += bkg_stride;
- }
- } else {
- for (elmtno=0; elmtno<nelmts; elmtno++) {
- HDmemmove(xbkg, xbuf, dst->shared->size);
+ for (elmtno=0; elmtno<nelmts; elmtno++) {
+ HDmemmove(xbkg, xbuf, copy_size);
- /* Update pointers */
- xbuf += buf_stride;
- xbkg += bkg_stride;
- }
+ /* Update pointers */
+ xbuf += buf_stride;
+ xbkg += bkg_stride;
}
} else {
/*