summaryrefslogtreecommitdiffstats
path: root/src/H5Tconv.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-10-02 20:40:01 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-10-02 20:40:01 (GMT)
commiteed2ea424b233c451c81569aa2df48c99bc8c79e (patch)
treea555761e54042fe829b05539874d081fc4fa76d8 /src/H5Tconv.c
parentc53e577d1485c4d3e1985c3b7fb38a67fa42ec3f (diff)
downloadhdf5-eed2ea424b233c451c81569aa2df48c99bc8c79e.zip
hdf5-eed2ea424b233c451c81569aa2df48c99bc8c79e.tar.gz
hdf5-eed2ea424b233c451c81569aa2df48c99bc8c79e.tar.bz2
[svn-r17585] 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;