summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_refs.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2010-03-25 17:29:51 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2010-03-25 17:29:51 (GMT)
commit20fd1f47b757873e6e8e9b7e283f4264ad9c4f1f (patch)
treeca9f4be0e25512350917c72215a698f75044a3f0 /tools/h5repack/h5repack_refs.c
parent1267cda98921c760bcca9d90767f83248ad28314 (diff)
downloadhdf5-20fd1f47b757873e6e8e9b7e283f4264ad9c4f1f.zip
hdf5-20fd1f47b757873e6e8e9b7e283f4264ad9c4f1f.tar.gz
hdf5-20fd1f47b757873e6e8e9b7e283f4264ad9c4f1f.tar.bz2
[svn-r18454] Purpose:
Fix for the bug1726 - NPOESS: h5repack loses attributes for datasets of type H5T_REFERENCE. Description: include test cases. also test cases for attribute with object and region reference. Tested: jam, amani, linew
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;