summaryrefslogtreecommitdiffstats
path: root/src/H5Dcompact.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-23 20:40:14 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-23 20:40:14 (GMT)
commite40557304fcfc662bb1a445abca516ee4b246d94 (patch)
treec9f1692443a62e0c481c7c0278e39d7b83d1b419 /src/H5Dcompact.c
parent1062b4f9d7080a3e439df7d3d527aee43f96d085 (diff)
downloadhdf5-e40557304fcfc662bb1a445abca516ee4b246d94.zip
hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.tar.gz
hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.tar.bz2
[svn-r12803] Description:
Finish new version of the I/O pipeline message, which is much smaller than the previous version. This version is used with the "use the latest version of the format" flag. Closed several memory leaks/overruns (found with valgrind). Also, lots of compiler & formatting cleanups. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Dcompact.c')
-rw-r--r--src/H5Dcompact.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 2d17a57..adc91eb 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -185,24 +185,33 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
if(!dt_src)
/* Type conversion not necessary */
HDmemcpy(layout_dst->u.compact.buf, layout_src->u.compact.buf, layout_src->u.compact.size);
- else if(dt_src && (H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) && (f_src != f_dst)) {
- /* Check for expanding references */
- if(cpy_info->expand_ref) {
- size_t ref_count;
-
- /* Determine # of reference elements to copy */
- ref_count = layout_src->u.compact.size / H5T_get_size(dt_src);
-
- /* Copy objects referenced in source buffer to destination file and set destination elements */
- if(H5O_copy_expand_ref(f_src, layout_src->u.compact.buf, dxpl_id, f_dst,
- layout_dst->u.compact.buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
+ else if(H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
+ /* Create datatype ID for src datatype, so it gets freed */
+ if((tid_src = H5I_register(H5I_DATATYPE, dt_src)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
+
+ if(f_src != f_dst) {
+ /* Check for expanding references */
+ if(cpy_info->expand_ref) {
+ size_t ref_count;
+
+ /* Determine # of reference elements to copy */
+ ref_count = layout_src->u.compact.size / H5T_get_size(dt_src);
+
+ /* Copy objects referenced in source buffer to destination file and set destination elements */
+ if(H5O_copy_expand_ref(f_src, layout_src->u.compact.buf, dxpl_id, f_dst,
+ layout_dst->u.compact.buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
+ } /* end if */
+ else
+ /* Reset value to zero */
+ HDmemset(layout_dst->u.compact.buf, 0, layout_src->u.compact.size);
} /* end if */
else
- /* Reset value to zero */
- HDmemset(layout_dst->u.compact.buf, 0, layout_src->u.compact.size);
+ /* Type conversion not necessary */
+ HDmemcpy(layout_dst->u.compact.buf, layout_src->u.compact.buf, layout_src->u.compact.size);
} /* end if */
- else if(dt_src && (H5T_detect_class(dt_src, H5T_VLEN) > 0) ) {
+ else if(H5T_detect_class(dt_src, H5T_VLEN) > 0) {
H5T_path_t *tpath_src_mem, *tpath_mem_dst; /* Datatype conversion paths */
H5T_t *dt_dst; /* Destination datatype */
H5T_t *dt_mem; /* Memory datatype */