summaryrefslogtreecommitdiffstats
path: root/src/H5Dcontig.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Dcontig.c')
-rw-r--r--src/H5Dcontig.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 2a9f178..0407736 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -239,7 +239,7 @@ H5D__contig_fill(H5D_t *dset)
/* Initialize the fill value buffer */
if (H5D__fill_init(&fb_info, NULL, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill,
- dset->shared->type, dset->shared->type_id, npoints, max_temp_buf) < 0)
+ dset->shared->type, npoints, max_temp_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info");
fb_info_init = true;
@@ -1596,9 +1596,6 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f
H5T_path_t *tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */
H5T_t *dt_dst = NULL; /* Destination datatype */
H5T_t *dt_mem = NULL; /* Memory datatype */
- hid_t tid_src = -1; /* Datatype ID for source datatype */
- hid_t tid_dst = -1; /* Datatype ID for destination datatype */
- hid_t tid_mem = -1; /* Datatype ID for memory datatype */
size_t src_dt_size = 0; /* Source datatype size */
size_t mem_dt_size = 0; /* Memory datatype size */
size_t dst_dt_size = 0; /* Destination datatype size */
@@ -1643,21 +1640,11 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f
H5_CHECK_OVERFLOW(total_src_nbytes, hsize_t, size_t);
buf_size = MIN(H5D_TEMP_BUF_SIZE, (size_t)total_src_nbytes);
- /* Create datatype ID for src datatype. We may or may not use this ID,
- * but this ensures that the src datatype will be freed.
- */
- if ((tid_src = H5I_register(H5I_DATATYPE, dt_src, false)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype");
-
/* If there's a VLEN source datatype, set up type conversion information */
if (H5T_detect_class(dt_src, H5T_VLEN, false) > 0) {
/* create a memory copy of the variable-length datatype */
if (NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy");
- if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, false)) < 0) {
- (void)H5T_close_real(dt_mem);
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register memory datatype");
- } /* end if */
/* create variable-length datatype at the destination file */
if (NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
@@ -1666,10 +1653,6 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f
(void)H5T_close_real(dt_dst);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "cannot mark datatype on disk");
} /* end if */
- if ((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, false)) < 0) {
- (void)H5T_close_real(dt_dst);
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype");
- } /* end if */
/* Set up the conversion functions */
if (NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem)))
@@ -1793,8 +1776,8 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f
/* Perform datatype conversion, if necessary */
if (is_vlen) {
/* Convert from source file to memory */
- if (H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed");
+ if (H5T_convert(tpath_src_mem, dt_src, dt_mem, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "datatype conversion failed");
/* Copy into another buffer, to reclaim memory later */
H5MM_memcpy(reclaim_buf, buf, mem_nbytes);
@@ -1803,18 +1786,18 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f
memset(bkg, 0, buf_size);
/* Convert from memory to destination file */
- if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed");
+ if (H5T_convert(tpath_mem_dst, dt_mem, dt_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "datatype conversion failed");
/* Reclaim space from variable length data */
- if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data");
+ if (H5T_reclaim(dt_mem, buf_space, reclaim_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reclaim variable-length data");
} /* end if */
else if (fix_ref) {
/* Check for expanding references */
if (cpy_info->expand_ref) {
/* Copy the reference elements */
- if (H5O_copy_expand_ref(f_src, tid_src, dt_src, buf, buf_size, f_dst, bkg, cpy_info) < 0)
+ if (H5O_copy_expand_ref(f_src, dt_src, buf, buf_size, f_dst, bkg, cpy_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute");
/* After fix ref, copy the new reference elements to the buffer to write out */
@@ -1838,12 +1821,13 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f
done:
if (buf_sid > 0 && H5I_dec_ref(buf_sid) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID");
- if (tid_src > 0 && H5I_dec_ref(tid_src) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID");
- if (tid_dst > 0 && H5I_dec_ref(tid_dst) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID");
- if (tid_mem > 0 && H5I_dec_ref(tid_mem) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID");
+ /* Caller expects that source datatype will be freed */
+ if (dt_src && (H5T_close(dt_src) < 0))
+ HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close temporary datatype");
+ if (dt_dst && (H5T_close(dt_dst) < 0))
+ HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close temporary datatype");
+ if (dt_mem && (H5T_close(dt_mem) < 0))
+ HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close temporary datatype");
if (buf)
buf = H5FL_BLK_FREE(type_conv, buf);
if (reclaim_buf)