summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_copy.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2006-08-02 23:41:53 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2006-08-02 23:41:53 (GMT)
commit3e755623cb24eb37c19fa645d74dc46948318253 (patch)
tree66e0a3807f37d50a8d6e5f3469864c604cd837c6 /tools/h5repack/h5repack_copy.c
parent71a4d0e9c48c4e02e5384cd3f6e38a2a530e9d22 (diff)
downloadhdf5-3e755623cb24eb37c19fa645d74dc46948318253.zip
hdf5-3e755623cb24eb37c19fa645d74dc46948318253.tar.gz
hdf5-3e755623cb24eb37c19fa645d74dc46948318253.tar.bz2
[svn-r12528] Added User-Defined links to the library.
Users can create external links using H5L_create_external(). These links point to an object in another HDF5 file. Users can alter the behavior of external links or create new kinds of links by registering callbacks using the H5L interface. Added tests, tools support, etc. Also a number of other, minor changes have been made (some restructuring of the H5L interface, for instance). Additional documentation and examples are forthcoming.
Diffstat (limited to 'tools/h5repack/h5repack_copy.c')
-rw-r--r--tools/h5repack/h5repack_copy.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index dee6c3f..e59b6d0 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -264,17 +264,17 @@ int do_copy_objects(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- hid_t grp_in; /* group ID */
- hid_t grp_out; /* group ID */
- hid_t dset_in; /* read dataset ID */
- hid_t dset_out; /* write dataset ID */
- hid_t type_in; /* named type ID */
- hid_t type_out; /* named type ID */
- hid_t dcpl_id; /* dataset creation property list ID */
- hid_t dcpl_out; /* dataset creation property list ID */
- hid_t space_id; /* space ID */
- hid_t ftype_id; /* file data type ID */
- hid_t mtype_id; /* memory data type ID */
+ hid_t grp_in=-1; /* group ID */
+ hid_t grp_out=-1; /* group ID */
+ hid_t dset_in=-1; /* read dataset ID */
+ hid_t dset_out=-1; /* write dataset ID */
+ hid_t type_in=-1; /* named type ID */
+ hid_t type_out=-1; /* named type ID */
+ hid_t dcpl_id=-1; /* dataset creation property list ID */
+ hid_t dcpl_out=-1; /* dataset creation property list ID */
+ hid_t space_id=-1; /* space ID */
+ hid_t ftype_id=-1; /* file data type ID */
+ hid_t mtype_id=-1; /* memory data type ID */
size_t msize; /* memory size of memory type */
void *buf=NULL; /* data buffer */
hsize_t nelmts; /* number of elements in dataset */
@@ -561,30 +561,18 @@ int do_copy_objects(hid_t fidin,
/*-------------------------------------------------------------------------
* H5G_LINK
+ * H5G_UDLINK
+ *
+ * Only handles external links; H5Lcopy will fail for other UD link types
+ * since we don't have creation or copy callbacks for them.
*-------------------------------------------------------------------------
*/
case H5G_LINK:
+ case H5G_UDLINK:
{
- H5G_stat_t statbuf;
- char *targbuf=NULL;
-
- if (H5Gget_objinfo(fidin,travt->objs[i].name,FALSE,&statbuf)<0)
- goto error;
-
- targbuf = malloc(statbuf.linklen);
-
- if (H5Gget_linkval(fidin,travt->objs[i].name,statbuf.linklen,targbuf)<0)
- goto error;
-
- if (H5Glink(fidout,
- H5G_LINK_SOFT,
- targbuf, /* current name of object */
- travt->objs[i].name /* new name of object */
- )<0)
- goto error;
-
- free(targbuf);
+ if(H5Lcopy(fidin, travt->objs[i].name,fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto error;
if (options->verbose)
printf(FORMAT_OBJ,"link",travt->objs[i].name );
@@ -592,6 +580,14 @@ int do_copy_objects(hid_t fidin,
}
break;
+/*-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
+ */
+ {
+
+ }
+ break;
+
default:
goto error;
}