summaryrefslogtreecommitdiffstats
path: root/src/H5Oattr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-03-10 04:56:53 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-03-10 04:56:53 (GMT)
commita127510b7b3049d0e136b677b180c8e644bdc7ea (patch)
tree0a7144ca74266b0e6eed3d86febd2968c9af7d40 /src/H5Oattr.c
parent1bca28acc3294e465d22e4dee8ecfc92fbc55ebe (diff)
downloadhdf5-a127510b7b3049d0e136b677b180c8e644bdc7ea.zip
hdf5-a127510b7b3049d0e136b677b180c8e644bdc7ea.tar.gz
hdf5-a127510b7b3049d0e136b677b180c8e644bdc7ea.tar.bz2
[svn-r13486] Description:
Move attribute tracking information out of object header prefix and make it into a message that is inserted only when attributes are present on the object. Tested on: FreeBSD/32 6.2 (duty)
Diffstat (limited to 'src/H5Oattr.c')
-rw-r--r--src/H5Oattr.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 0db28fa..20af30c 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -711,7 +711,7 @@ H5O_attr_pre_copy_file(H5F_t UNUSED *file_src, const void UNUSED *native_src,
*-------------------------------------------------------------------------
*/
static void *
-H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type,
+H5O_attr_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t UNUSED *mesg_type,
void *native_src, H5F_t *file_dst, hid_t dxpl_id,
H5O_copy_t *cpy_info, void UNUSED *udata)
{
@@ -970,10 +970,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
- void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
+H5O_attr_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src,
+ H5O_loc_t *dst_oloc, void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
{
- H5A_t *attr_src = (H5A_t *)mesg_src;
+ const H5A_t *attr_src = (const H5A_t *)mesg_src;
H5A_t *attr_dst = (H5A_t *)mesg_dst;
H5F_t *file_src = src_oloc->file;
H5F_t *file_dst = dst_oloc->file;
@@ -988,30 +988,33 @@ H5O_attr_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc
HDassert(attr_dst);
HDassert(file_dst);
- /* only need to fix reference attribute */
- if ( (NULL == attr_src->data) ||
- (H5T_get_class(attr_src->dt, FALSE) != H5T_REFERENCE) ||
- (file_src == file_dst) )
- HGOTO_DONE(SUCCEED)
-
- /* copy object pointed by reference. The current implementation does not deal with
- nested reference such as reference in a compound structure */
-
- /* Check for expanding references */
- if(cpy_info->expand_ref) {
- size_t ref_count;
+ /* Only need to fix reference attribute with real data being copied to
+ * another file.
+ */
+ if((NULL != attr_src->data) &&
+ (H5T_get_class(attr_src->dt, FALSE) == H5T_REFERENCE) &&
+ (file_src != file_dst)) {
- /* Determine # of reference elements to copy */
- ref_count = attr_dst->data_size / H5T_get_size(attr_dst->dt);
+ /* copy object pointed by reference. The current implementation does not
+ * deal with nested reference such as reference in a compound structure
+ */
- /* Copy objects referenced in source buffer to destination file and set destination elements */
- if(H5O_copy_expand_ref(file_src, attr_src->data, dxpl_id,
- file_dst, attr_dst->data, ref_count, H5T_get_ref_type(attr_src->dt), cpy_info) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
+ /* Check for expanding references */
+ if(cpy_info->expand_ref) {
+ size_t ref_count;
+
+ /* Determine # of reference elements to copy */
+ ref_count = attr_dst->data_size / H5T_get_size(attr_dst->dt);
+
+ /* Copy objects referenced in source buffer to destination file and set destination elements */
+ if(H5O_copy_expand_ref(file_src, attr_src->data, dxpl_id,
+ file_dst, attr_dst->data, ref_count, H5T_get_ref_type(attr_src->dt), cpy_info) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
+ } /* end if */
+ else
+ /* Reset value to zero */
+ HDmemset(attr_dst->data, 0, attr_dst->data_size);
} /* end if */
- else
- /* Reset value to zero */
- HDmemset(attr_dst->data, 0, attr_dst->data_size);
done:
FUNC_LEAVE_NOAPI(ret_value)