summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_refs.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2010-03-25 17:46:21 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2010-03-25 17:46:21 (GMT)
commit25fb34872982389e1f6483f7255669753372c76c (patch)
treef92ddaf3f204af7ca29eb66cb7da0f47b2514bdf /tools/h5repack/h5repack_refs.c
parent24ac7627d80b9098d479f058f471173597af971f (diff)
downloadhdf5-25fb34872982389e1f6483f7255669753372c76c.zip
hdf5-25fb34872982389e1f6483f7255669753372c76c.tar.gz
hdf5-25fb34872982389e1f6483f7255669753372c76c.tar.bz2
[svn-r18455] Purpose:
Fix for the bug1726 - NPOESS: h5repack loses attributes for datasets of type H5T_REFERENCE. Description: Merged from hdf5 trunk rXXX Tested: jam
Diffstat (limited to 'tools/h5repack/h5repack_refs.c')
-rw-r--r--tools/h5repack/h5repack_refs.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 9945f49..fcdfbd5 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -68,6 +68,8 @@ int do_copy_refobjs(hid_t fidin,
hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
unsigned int i, j;
int k;
+ named_dt_t *named_dt_head=NULL; /* Pointer to the stack of named datatypes
+ copied */
/*-------------------------------------------------------------------------
* browse
@@ -220,13 +222,20 @@ int do_copy_refobjs(hid_t fidin,
HDfree(buf);
if(refbuf)
HDfree(refbuf);
+
+ /*------------------------------------------------------
+ * copy attrs
+ *----------------------------------------------------*/
+ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ goto error;
} /*H5T_STD_REF_OBJ*/
/*-------------------------------------------------------------------------
* dataset region references
*-------------------------------------------------------------------------
*/
- else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
+ else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
+ {
hid_t refobj_id;
hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
hdset_reg_ref_t *buf = NULL; /* output buffer */
@@ -305,6 +314,12 @@ int do_copy_refobjs(hid_t fidin,
HDfree(buf);
if(refbuf)
HDfree(refbuf);
+
+ /*-----------------------------------------------------
+ * copy attrs
+ *----------------------------------------------------*/
+ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ goto error;
} /* H5T_STD_REF_DSETREG */
/*-------------------------------------------------------------------------
* not references, open previously created object in 1st traversal
@@ -380,6 +395,12 @@ int do_copy_refobjs(hid_t fidin,
} /* end switch */
} /* end for */
+ /* Finalize (link) the stack of named datatypes (if any)
+ * This function is paired with copy_named_datatype() which is called
+ * in copy_attr(), so need to free.
+ */
+ named_datatype_free(&named_dt_head, 0);
+
return 0;
error:
@@ -393,6 +414,7 @@ error:
H5Tclose(ftype_id);
H5Tclose(mtype_id);
H5Tclose(type_in);
+ named_datatype_free(&named_dt_head, 0);
} H5E_END_TRY;
return -1;