summaryrefslogtreecommitdiffstats
path: root/src/H5Tconv.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-10-02 20:54:51 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-10-02 20:54:51 (GMT)
commitc26ed138a65b2840c057e437fa061a4749ba7ea1 (patch)
tree6d8d51e95f944b9783020bfd2e01fcc15205fe8b /src/H5Tconv.c
parente8e9b163c3239c2a4384c152d9c0171f4882c394 (diff)
downloadhdf5-c26ed138a65b2840c057e437fa061a4749ba7ea1.zip
hdf5-c26ed138a65b2840c057e437fa061a4749ba7ea1.tar.gz
hdf5-c26ed138a65b2840c057e437fa061a4749ba7ea1.tar.bz2
[svn-r17586] Purpose: Fix bug 1597
Description: When copying a dataset using a vlen inside a compound, the various dataset copying callbacks would allocate a background buffer but would not use it when converting from disk to memory, only memory to disk. This caused an assertion failure as compounds always need a background buffer. These callbacks have been modified to use the background buffer for both conversions. Tested: jam, linew, smirom (h5committest)
Diffstat (limited to 'src/H5Tconv.c')
-rw-r--r--src/H5Tconv.c85
1 files changed, 41 insertions, 44 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 08e7fa1..ab9e703 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -1935,51 +1935,48 @@ H5T_conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, hid_t dxpl_id)
} /* end if */
} /* end for */
- /* Check if we need a background buffer */
- if(H5T_detect_class(src, H5T_COMPOUND) == TRUE || H5T_detect_class(dst, H5T_COMPOUND) == TRUE) {
- cdata->need_bkg = H5T_BKG_YES;
-
- if(src_nmembs < dst_nmembs) {
- priv->subset_info.subset = H5T_SUBSET_SRC;
- for(i = 0; i < src_nmembs; i++) {
- /* If any of source members doesn't have counterpart in the same
- * order or there's conversion between members, don't do the
- * optimization.
- */
- if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
- priv->subset_info.subset = H5T_SUBSET_FALSE;
- break;
- } /* end if */
- } /* end for */
- /* Compute the size of the data to be copied for each element. It
- * may be smaller than either src or dst if there is extra space at
- * the end of src.
- */
- if(priv->subset_info.subset == H5T_SUBSET_SRC)
- priv->subset_info.copy_size = src->shared->u.compnd.memb[src_nmembs-1].offset
- + src->shared->u.compnd.memb[src_nmembs-1].size;
- } else if(dst_nmembs < src_nmembs) {
- priv->subset_info.subset = H5T_SUBSET_DST;
- for(i = 0; i < dst_nmembs; i++) {
- /* If any of source members doesn't have counterpart in the same order or
- * there's conversion between members, don't do the optimization. */
- if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
- priv->subset_info.subset = H5T_SUBSET_FALSE;
- break;
- }
- } /* end for */
- /* Compute the size of the data to be copied for each element. It
- * may be smaller than either src or dst if there is extra space at
- * the end of dst.
- */
- if(priv->subset_info.subset == H5T_SUBSET_DST)
- priv->subset_info.copy_size = dst->shared->u.compnd.memb[dst_nmembs-1].offset
- + dst->shared->u.compnd.memb[dst_nmembs-1].size;
- } else /* If the numbers of source and dest members are equal and no conversion is needed,
- * the case should have been handled as noop earlier in H5Dio.c. */
- ;
+ /* The compound conversion functions need a background buffer */
+ cdata->need_bkg = H5T_BKG_YES;
- } /* end if */
+ if(src_nmembs < dst_nmembs) {
+ priv->subset_info.subset = H5T_SUBSET_SRC;
+ for(i = 0; i < src_nmembs; i++) {
+ /* If any of source members doesn't have counterpart in the same
+ * order or there's conversion between members, don't do the
+ * optimization.
+ */
+ if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
+ priv->subset_info.subset = H5T_SUBSET_FALSE;
+ break;
+ } /* end if */
+ } /* end for */
+ /* Compute the size of the data to be copied for each element. It
+ * may be smaller than either src or dst if there is extra space at
+ * the end of src.
+ */
+ if(priv->subset_info.subset == H5T_SUBSET_SRC)
+ priv->subset_info.copy_size = src->shared->u.compnd.memb[src_nmembs-1].offset
+ + src->shared->u.compnd.memb[src_nmembs-1].size;
+ } else if(dst_nmembs < src_nmembs) {
+ priv->subset_info.subset = H5T_SUBSET_DST;
+ for(i = 0; i < dst_nmembs; i++) {
+ /* If any of source members doesn't have counterpart in the same order or
+ * there's conversion between members, don't do the optimization. */
+ if(src2dst[i] != i || (src->shared->u.compnd.memb[i].offset != dst->shared->u.compnd.memb[i].offset) || (priv->memb_path[i])->is_noop == FALSE) {
+ priv->subset_info.subset = H5T_SUBSET_FALSE;
+ break;
+ }
+ } /* end for */
+ /* Compute the size of the data to be copied for each element. It
+ * may be smaller than either src or dst if there is extra space at
+ * the end of dst.
+ */
+ if(priv->subset_info.subset == H5T_SUBSET_DST)
+ priv->subset_info.copy_size = dst->shared->u.compnd.memb[dst_nmembs-1].offset
+ + dst->shared->u.compnd.memb[dst_nmembs-1].size;
+ } else /* If the numbers of source and dest members are equal and no conversion is needed,
+ * the case should have been handled as noop earlier in H5Dio.c. */
+ ;
cdata->recalc = FALSE;