summaryrefslogtreecommitdiffstats
path: root/src/H5Olayout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Olayout.c')
-rw-r--r--src/H5Olayout.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 67dbf4d..e413598 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -584,6 +584,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
H5O_layout_t *layout_src = (H5O_layout_t *) mesg_src;
H5O_layout_t *layout_dst = NULL;
+ hbool_t copied = FALSE; /* Whether the data was copied */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_layout_copy_file)
@@ -607,6 +608,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
/* copy compact raw data */
if(H5D_compact_copy(file_src, &layout_src->storage.u.compact, file_dst, &layout_dst->storage.u.compact, udata->src_dtype, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
+ copied = TRUE;
} /* end if */
break;
@@ -615,7 +617,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
* layout message less than version 3 because versions 1 & 2 would
* truncate the dimension sizes to 32-bits of information. - QAK 5/26/04
*/
- if(layout_src->version < 3)
+ if(layout_src->version < H5O_LAYOUT_VERSION_3)
layout_dst->storage.u.contig.size = H5S_extent_nelem(udata->src_space_extent) *
H5T_get_size(udata->src_dtype);
@@ -623,6 +625,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
/* copy contiguous raw data */
if(H5D_contig_copy(file_src, &layout_src->storage.u.contig, file_dst, &layout_dst->storage.u.contig, udata->src_dtype, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage")
+ copied = TRUE;
} /* end if */
break;
@@ -631,6 +634,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
/* Create chunked layout */
if(H5D_chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
+ copied = TRUE;
} /* end if */
break;
@@ -638,8 +642,9 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
} /* end switch */
- /* Freed by copy routine */
- udata->src_dtype = NULL;
+ /* Check if copy routine was invoked (which frees the source datatype) */
+ if(copied)
+ udata->src_dtype = NULL;
/* Set return value */
ret_value = layout_dst;