From e143242ce101661a29c5a65f0dd9a4aa37a1af64 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Tue, 24 Jul 2007 16:52:51 -0500 Subject: [svn-r14011] Refactored part of the code in H5T_conv_struct_opt. Tested only on smirom because it's a simple change. --- src/H5Tconv.c | 47 +++++++++++++++++++---------------------------- 1 file 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; elmtnoshared->size); + copy_size = dst->shared->size; + else + copy_size = src->shared->size; - /* Update pointers */ - xbuf += buf_stride; - xbkg += bkg_stride; - } - } else { - for (elmtno=0; elmtnoshared->size); + for (elmtno=0; elmtnosmembs_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; elmtnoshared->size); + copy_size = src->shared->size; + else + copy_size = dst->shared->size; - /* Update pointers */ - xbuf += buf_stride; - xbkg += bkg_stride; - } - } else { - for (elmtno=0; elmtnoshared->size); + for (elmtno=0; elmtno