diff options
author | James Laird <jlaird@hdfgroup.org> | 2006-12-12 21:41:42 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2006-12-12 21:41:42 (GMT) |
commit | bcc000dd8a37ab792ba2fc3b9b45ff83c94edfa1 (patch) | |
tree | 07df7c97eca2ae788d709ad97066e2c48356a411 /src | |
parent | e9522de4e1ec02209673fb45378d1525cd723949 (diff) | |
download | hdf5-bcc000dd8a37ab792ba2fc3b9b45ff83c94edfa1.zip hdf5-bcc000dd8a37ab792ba2fc3b9b45ff83c94edfa1.tar.gz hdf5-bcc000dd8a37ab792ba2fc3b9b45ff83c94edfa1.tar.bz2 |
[svn-r13057] Added a copy_file callback for datatype messages. This sets their location
in the destination file, fixing a bug in the (not yet checked-in)
shared message copying changes.
Tested on kagiso, smirom, copper, and Windows.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Odtype.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/H5Odtype.c b/src/H5Odtype.c index f6c1f3f..f42120f 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -38,6 +38,9 @@ static herr_t H5O_dtype_set_share(void *_mesg, const H5O_shared_t *sh); static herr_t H5O_dtype_is_shared(const void *_mesg); static herr_t H5O_dtype_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *_udata); +static void *H5O_dtype_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_type, + void *native_src, H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata); + static herr_t H5O_dtype_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -58,7 +61,7 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{ H5O_dtype_set_share, /* set share method */ H5O_dtype_is_shared, /* is shared method */ H5O_dtype_pre_copy_file, /* pre copy native value to file */ - NULL, /* copy native value to file */ + H5O_dtype_copy_file, /* copy native value to file */ NULL, /* post copy native value to file */ H5O_dtype_debug /* debug the message */ }}; @@ -1426,6 +1429,47 @@ done: } /* end H5O_dtype_pre_copy_file() */ +/*------------------------------------------------------------------------- + * Function: H5O_dtype_copy_file + * + * Purpose: Copy a native datatype message from one file to another. + * + * Return: Success: Native copy of message + * Failure: NULL + * + * Programmer: James Laird + * December 12, 2006 + * + *------------------------------------------------------------------------- + */ +static void * +H5O_dtype_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t *mesg_type, + void *native_src, H5F_t *file_dst, hid_t UNUSED dxpl_id, + H5O_copy_t UNUSED *cpy_info, void UNUSED *udata) +{ + H5T_t *dst_mesg = NULL; /* Destination datatype */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_copy_file) + + /* Perform a normal copy of the object header message */ + if(NULL == (dst_mesg = H5O_dtype_copy(native_src, NULL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy") + + /* The datatype will be in the new file; set its location. */ + if(H5T_set_loc(dst_mesg, file_dst, H5T_LOC_DISK) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to set location") + + ret_value = dst_mesg; + +done: + if(NULL == ret_value) { + H5O_msg_free(mesg_type->id, dst_mesg); + } + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_dtype_copy_file() */ + + /*-------------------------------------------------------------------------- NAME H5O_dtype_debug |