diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-04-01 20:14:11 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-04-01 20:14:11 (GMT) |
commit | 4659f50b832958636db672d9025a610eb70b04f1 (patch) | |
tree | 4d6f3e9c523dcd89e1b6d1f07f3cf184a3b007a7 /src/H5Dcompact.c | |
parent | 1cd1d6956a9d00ea5eaf57fcfad87b2c8651cf9c (diff) | |
download | hdf5-4659f50b832958636db672d9025a610eb70b04f1.zip hdf5-4659f50b832958636db672d9025a610eb70b04f1.tar.gz hdf5-4659f50b832958636db672d9025a610eb70b04f1.tar.bz2 |
[svn-r12189] Purpose:
New/expanded features
Description:
Check in Peter's changed for the object copy code:
- Allow/fix copying datasets using named variable-length datatypes
- Start adding framework for property list to control how object
copying occurs.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Too minor to require h5committest
Diffstat (limited to 'src/H5Dcompact.c')
-rw-r--r-- | src/H5Dcompact.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 0ad8e05..aaa04ea 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -167,6 +167,7 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, hid_t tid_dst = -1; /* Datatype ID for destination datatype */ hid_t tid_mem = -1; /* Datatype ID for memory datatype */ void *buf = NULL; /* Buffer for copying data */ + void *bkg = NULL; /* Temporary buffer for copying data */ void *reclaim_buf = NULL; /* Buffer for reclaiming data */ hid_t buf_sid = -1; /* ID for buffer dataspace */ herr_t ret_value = SUCCEED; /* Return value */ @@ -251,11 +252,11 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, /* Allocate memory for recclaim buf */ if(NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Allocate memory for copying the chunk */ if(NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") HDmemcpy(buf, layout_src->u.compact.buf, layout_src->u.compact.size); @@ -265,8 +266,12 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, HDmemcpy(reclaim_buf, buf, buf_size); + /* allocate temporary bkg buff for data conversion */ + if(NULL == (bkg = H5FL_BLK_CALLOC(type_conv, buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + /* Convert from memory to destination file */ - if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0) + if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") HDmemcpy(layout_dst->u.compact.buf, buf, layout_dst->u.compact.size); @@ -292,6 +297,8 @@ done: H5FL_BLK_FREE(type_conv, buf); if(reclaim_buf) H5FL_BLK_FREE(type_conv, reclaim_buf); + if(bkg) + H5FL_BLK_FREE(type_conv, bkg); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_compact_copy() */ |