summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-17 00:32:33 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-01-17 00:32:33 (GMT)
commit44739ccd4715cc9e15595575700e945341fcdbcc (patch)
tree732a9381da5d3f0246a8d931da0074e2c5756704 /tools/src
parent46c3bc6b98bc467d46ca22cfc1b912c741a9d886 (diff)
parent55670c88cfa07a4fd5a884502f8bd32768f70256 (diff)
downloadhdf5-44739ccd4715cc9e15595575700e945341fcdbcc.zip
hdf5-44739ccd4715cc9e15595575700e945341fcdbcc.tar.gz
hdf5-44739ccd4715cc9e15595575700e945341fcdbcc.tar.bz2
Merge branch 'develop' into stack_size_warnings
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5copy/h5copy.c4
-rw-r--r--tools/src/h5diff/ph5diff_main.c3
-rw-r--r--tools/src/h5dump/h5dump.c8
-rw-r--r--tools/src/h5dump/h5dump_ddl.c75
-rw-r--r--tools/src/h5dump/h5dump_xml.c193
-rw-r--r--tools/src/h5format_convert/h5format_convert.c8
-rw-r--r--tools/src/h5import/h5import.c12
-rw-r--r--tools/src/h5jam/h5jam.c4
-rw-r--r--tools/src/h5jam/h5unjam.c4
-rw-r--r--tools/src/h5ls/h5ls.c58
-rw-r--r--tools/src/h5repack/h5repack.c68
-rw-r--r--tools/src/h5repack/h5repack.h2
-rw-r--r--tools/src/h5repack/h5repack_copy.c46
-rw-r--r--tools/src/h5repack/h5repack_refs.c53
-rw-r--r--tools/src/h5repack/h5repack_verify.c38
-rw-r--r--tools/src/h5stat/h5stat.c55
-rw-r--r--tools/src/misc/h5clear.c4
17 files changed, 352 insertions, 283 deletions
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c
index 86bd6f6..e1370e2 100644
--- a/tools/src/h5copy/h5copy.c
+++ b/tools/src/h5copy/h5copy.c
@@ -211,8 +211,8 @@ main (int argc, const char *argv[])
H5E_auto2_t tools_func;
void *edata;
void *tools_edata;
- hid_t fid_src = -1;
- hid_t fid_dst = -1;
+ hid_t fid_src = H5I_INVALID_HID;
+ hid_t fid_dst = H5I_INVALID_HID;
unsigned flag = 0;
unsigned verbose = 0;
unsigned parents = 0;
diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
index 380ab3b..5ba5fb3 100644
--- a/tools/src/h5diff/ph5diff_main.c
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -126,7 +126,8 @@ int main(int argc, const char *argv[])
static void
ph5diff_worker(int nID)
{
- hid_t file1_id = -1, file2_id = -1;
+ hid_t file1_id = H5I_INVALID_HID;
+ hid_t file2_id = H5I_INVALID_HID;
while(1)
{
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 0222c8b..d97fdc0 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -1393,12 +1393,12 @@ error:
int
main(int argc, const char *argv[])
{
- hid_t fid = -1;
- hid_t gid = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
hid_t fapl_id = H5P_DEFAULT;
H5E_auto2_t func;
H5E_auto2_t tools_func;
- H5O_info_t oi;
+ H5O_info2_t oi;
struct handler_t *hand = NULL;
int i;
unsigned u;
@@ -1567,7 +1567,7 @@ main(int argc, const char *argv[])
}
/* Get object info for root group */
- if(H5Oget_info_by_name2(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index bc426f2..a410fda 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -31,7 +31,7 @@ typedef struct {
} trav_attr_udata_t;
/* callback function used by H5Literate() */
-static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data);
+static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void *op_data);
static int dump_extlink(hid_t group, const char *linkname, const char *objname);
/*-------------------------------------------------------------------------
@@ -152,7 +152,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
*-------------------------------------------------------------------------
*/
static herr_t
-dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
+dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATTR_UNUSED *op_data)
{
hid_t obj;
hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
@@ -200,10 +200,10 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
HDstrcat(obj_path, name);
if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
@@ -259,7 +259,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, oinfo.addr);
+ found_obj = search_obj(dset_table, &oinfo.token);
if(found_obj == NULL) {
ctx.indent_level++;
@@ -596,9 +596,9 @@ link_iteration(hid_t gid, unsigned crt_order_flags)
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
+ H5Literate2(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
else
- H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
+ H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
}
/*-------------------------------------------------------------------------
@@ -612,9 +612,9 @@ link_iteration(hid_t gid, unsigned crt_order_flags)
void
dump_named_datatype(hid_t tid, const char *name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
unsigned attr_crt_order_flags;
- hid_t tcpl_id = -1; /* datatype creation property list ID */
+ hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -670,7 +670,7 @@ dump_named_datatype(hid_t tid, const char *name)
h5tools_dump_header_format->datatypeblockbegin);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC);
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
@@ -678,7 +678,7 @@ dump_named_datatype(hid_t tid, const char *name)
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(type_table, oinfo.addr);
+ found_obj = search_obj(type_table, &oinfo.token);
if (found_obj == NULL) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
@@ -739,7 +739,7 @@ done:
void
dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
hid_t dset;
hid_t type;
hid_t gcpl_id;
@@ -816,9 +816,15 @@ dump_group(hid_t gid, const char *name)
/* dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++)
if(!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
+ HDsprintf(type_name, "#%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -830,7 +836,7 @@ dump_group(hid_t gid, const char *name)
h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
- H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC);
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
@@ -838,7 +844,7 @@ dump_group(hid_t gid, const char *name)
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(group_table, oinfo.addr);
+ found_obj = search_obj(group_table, &oinfo.token);
if (found_obj == NULL) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
@@ -1251,8 +1257,13 @@ dump_fcontents(hid_t fid)
unsigned u;
for (u = 0; u < type_table->nobjs; u++) {
- if (!type_table->objs[u].recorded)
- PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno);
+ if (!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
+ H5Otoken_to_str(fid, &type_table->objs[u].obj_token, &obj_addr_str);
+ PRINTSTREAM(rawoutstream, " %-10s /#%s\n", "datatype", obj_addr_str);
+ H5free_memory(obj_addr_str);
+ }
}
}
@@ -1319,7 +1330,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
} /* end attr_search() */
static herr_t
-obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
+obj_search(const char *path, const H5O_info2_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
{
trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
const char *op_name = handle_data->op_name;
@@ -1356,7 +1367,7 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al
} /* end obj_search() */
static herr_t
-lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
+lnk_search(const char *path, const H5L_info2_t *li, void *_op_data)
{
size_t search_len;
size_t k;
@@ -1415,7 +1426,7 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
void
handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
{
- hid_t gid = -1;
+ hid_t gid = H5I_INVALID_HID;
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
@@ -1469,8 +1480,8 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
void
handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
{
- hid_t oid = -1;
- hid_t attr_id = -1;
+ hid_t oid = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
char *obj_name = NULL;
char *attr_name = NULL;
int j;
@@ -1608,7 +1619,7 @@ error:
void
handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
hid_t dsetid;
hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
struct subset_t *sset = (struct subset_t *)data;
@@ -1719,11 +1730,11 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
} /* end if */
- H5Oget_info2(dsetid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(dsetid, &oinfo, H5O_INFO_BASIC);
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, oinfo.addr);
+ found_obj = search_obj(dset_table, &oinfo.token);
if(found_obj) {
if (found_obj->displayed) {
@@ -1812,9 +1823,9 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
void
handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
{
- H5L_info_t linfo;
+ H5L_info2_t linfo;
- if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ if(H5Lget_info2(fid, links, &linfo, H5P_DEFAULT) < 0) {
error_msg("unable to get link info from \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1903,8 +1914,12 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
char name[128];
if(!type_table->objs[idx].recorded) {
+ char *obj_addr_string = NULL;
+
/* unamed datatype */
- HDsprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
+ H5Otoken_to_str(fid, &type_table->objs[idx].obj_token, &obj_addr_string);
+ HDsprintf(name, "/#%s", obj_addr_string);
+ H5free_memory(obj_addr_string);
if(!HDstrcmp(name, real_name))
break;
@@ -1962,7 +1977,7 @@ static int
dump_extlink(hid_t group, const char *linkname, const char *objname)
{
hid_t oid;
- H5O_info_t oi;
+ H5O_info2_t oi;
table_t *old_group_table = group_table;
table_t *old_dset_table = dset_table;
table_t *old_type_table = type_table;
@@ -1974,7 +1989,7 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
goto fail;
/* Get object info */
- if (H5Oget_info2(oid, &oi, H5O_INFO_BASIC) < 0) {
+ if (H5Oget_info3(oid, &oi, H5O_INFO_BASIC) < 0) {
H5Oclose(oid);
goto fail;
}
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index b63e68d..7a3ad80 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -106,7 +106,7 @@ static h5tool_format_t xml_dataformat = {
/* internal functions */
-static int xml_name_to_XID(const char *, char *, int , int );
+static int xml_name_to_XID(hid_t, const char *, char *, int, int);
/* internal functions used by XML option */
static void xml_print_datatype(hid_t, unsigned);
@@ -130,7 +130,7 @@ static char *xml_escape_the_name(const char *);
*-------------------------------------------------------------------------
*/
static herr_t
-xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
+xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATTR_UNUSED *op_data)
{
hid_t obj;
herr_t ret = SUCCEED;
@@ -177,10 +177,10 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
HDstrcat(obj_path, name);
if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
@@ -225,7 +225,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, oinfo.addr);
+ found_obj = search_obj(dset_table, &oinfo.token);
if(found_obj == NULL) {
ctx.indent_level++;
@@ -272,8 +272,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char pointerxid[100];
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(obj, obj_path, dsetxid, (int)sizeof(dsetxid), 1);
+ xml_name_to_XID(obj, prefix, parentxid, (int)sizeof(parentxid), 1);
ctx.need_prefix = TRUE;
@@ -290,7 +290,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
t_prefix); /* H5ParentPaths */
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+ xml_name_to_XID(obj, found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
ctx.indent_level++;
@@ -393,11 +393,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
} /* end else */
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1);
/* Try to create an OBJ-XID for the object pointed to */
- res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
+ res = xml_name_to_XID(group, t_link_path, targetxid, (int)sizeof(targetxid), 0);
if (res == 0) {
/* target obj found */
ctx.need_prefix = TRUE;
@@ -482,8 +482,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char *t_targname = xml_escape_the_name(targname);
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1);
ctx.need_prefix = TRUE;
@@ -528,8 +528,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char *t_obj_path = xml_escape_the_name(obj_path);
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1);
ctx.need_prefix = TRUE;
@@ -575,20 +575,26 @@ done:
* 1 - generate a fake entry and return fake id.
*/
int
-xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
+xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen)
{
- haddr_t objno; /* Object ID for object at path */
+ H5O_token_t obj_token;
+ char *obj_addr_str = NULL;
+ int lookup_ret;
if (outlen < 22) return 1;
- objno = ref_path_table_lookup(str);
- if (objno == HADDR_UNDEF) {
+ lookup_ret = ref_path_table_lookup(str, &obj_token);
+ if (lookup_ret < 0) {
if (HDstrlen(str) == 0) {
- objno = ref_path_table_lookup("/");
- if (objno == HADDR_UNDEF) {
+ lookup_ret = ref_path_table_lookup("/", &obj_token);
+ if (lookup_ret < 0) {
if (gen) {
- objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ ref_path_table_gen_fake(str, &obj_token);
+
+ H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
+ HDsprintf(outstr, "xid_%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
return 0;
}
else {
@@ -598,8 +604,12 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
else {
if (gen) {
- objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ ref_path_table_gen_fake(str, &obj_token);
+
+ H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
+ HDsprintf(outstr, "xid_%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
return 0;
}
else {
@@ -608,7 +618,9 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
}
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
+ HDsprintf(outstr, "xid_%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
return 0;
}
@@ -878,12 +890,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
outputformat = &string_dataformat;
if(!in_group && H5Tcommitted(type) > 0) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
obj_t *found_obj; /* Found object */
/* detect a shared datatype, output only once */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- found_obj = search_obj(type_table, oinfo.addr);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
+ found_obj = search_obj(type_table, &oinfo.token);
if(found_obj) {
/* This should be defined somewhere else */
@@ -891,7 +903,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
probably will have something different eventually */
char * dtxid = (char *)HDmalloc((size_t)100);
- xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
+ xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
/* 'anonymous' NDT. Use it's object num.
as it's name. */
@@ -1531,19 +1543,19 @@ xml_dump_datatype(hid_t type)
dump_indent += COL;
if(H5Tcommitted(type) > 0) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
obj_t *found_obj; /* Found object */
/* Datatype is a shared or named datatype */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- found_obj = search_obj(type_table, oinfo.addr);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
+ found_obj = search_obj(type_table, &oinfo.token);
if(found_obj) {
/* Shared datatype, must be entered as an object */
/* These 2 cases are the same now, but may change */
char *dtxid = (char *)HDmalloc((size_t)100);
- xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
+ xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
/* anonymous stored datatype:
following the dumper's current
@@ -1783,9 +1795,9 @@ xml_dump_dataspace(hid_t space)
void
xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset, int H5_ATTR_UNUSED pindex)
{
- hid_t space = -1;
- hid_t type = -1;
- hid_t p_type = -1;
+ hid_t space = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hid_t p_type = H5I_INVALID_HID;
hsize_t size[64];
hsize_t nelmts = 1;
int ndims;
@@ -1950,9 +1962,9 @@ herr_t
xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info,
void H5_ATTR_UNUSED * op_data)
{
- hid_t attr_id = -1;
- hid_t type = -1;
- hid_t space = -1;
+ hid_t attr_id = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
H5S_class_t space_type;
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
@@ -2293,8 +2305,8 @@ xml_dump_named_datatype(hid_t type, const char *name)
t_prefix = xml_escape_the_name(prefix);
t_name = xml_escape_the_name(name);
- xml_name_to_XID(tmp, dtxid, 100, 1);
- xml_name_to_XID(prefix, parentxid, 100, 1);
+ xml_name_to_XID(type, tmp, dtxid, 100, 1);
+ xml_name_to_XID(type, prefix, parentxid, 100, 1);
if(HDstrncmp(name, "#", (size_t)1) == 0) {
/* Special: this is an 'anonymous' NDT, deleted but
still in use.
@@ -2317,7 +2329,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
ctx.need_prefix = TRUE;
@@ -2331,12 +2343,12 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Check uniqueness of named datatype */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
- found_obj = search_obj(type_table, oinfo.addr);
+ found_obj = search_obj(type_table, &oinfo.token);
if (found_obj == NULL) {
indentation(dump_indent);
@@ -2353,7 +2365,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
ctx.indent_level++;
- xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+ xml_name_to_XID(type, found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
ctx.need_prefix = TRUE;
@@ -2436,7 +2448,7 @@ done:
void
xml_dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
hid_t gcpl_id;
hid_t dset, type;
unsigned crt_order_flags;
@@ -2517,13 +2529,13 @@ xml_dump_group(hid_t gid, const char *name)
}
}
- H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC);
if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
- found_obj = search_obj(group_table, oinfo.addr);
+ found_obj = search_obj(group_table, &oinfo.token);
if (found_obj == NULL) {
indentation(dump_indent);
@@ -2541,7 +2553,7 @@ xml_dump_group(hid_t gid, const char *name)
/* already seen: enter a groupptr */
if(isRoot) {
/* probably can't happen! */
- xml_name_to_XID("/", grpxid, 100, 1);
+ xml_name_to_XID(gid, "/", grpxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2554,8 +2566,8 @@ xml_dump_group(hid_t gid, const char *name)
else {
t_objname = xml_escape_the_name(found_obj->objname);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp, grpxid, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, tmp, grpxid, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2573,8 +2585,8 @@ xml_dump_group(hid_t gid, const char *name)
t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
par_name = xml_escape_the_name(par);
- xml_name_to_XID(found_obj->objname, ptrstr, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, found_obj->objname, ptrstr, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2597,7 +2609,7 @@ xml_dump_group(hid_t gid, const char *name)
/* first time this group has been seen -- describe it */
if(isRoot) {
- xml_name_to_XID("/", grpxid, 100, 1);
+ xml_name_to_XID(gid, "/", grpxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2611,8 +2623,8 @@ xml_dump_group(hid_t gid, const char *name)
char *t_tmp = xml_escape_the_name(tmp);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp, grpxid, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, tmp, grpxid, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2652,9 +2664,15 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
+ HDsprintf(type_name, "#%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2665,9 +2683,9 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
- H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
dump_indent -= COL;
ctx.indent_level--;
@@ -2689,15 +2707,15 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_str_reset(&buffer);
if(isRoot) {
- xml_name_to_XID("/", grpxid, 100, 1);
+ xml_name_to_XID(gid, "/", grpxid, 100, 1);
h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/");
}
else {
char *t_tmp = xml_escape_the_name(tmp);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp, grpxid, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, tmp, grpxid, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
"Parents=\"%s\" H5ParentPaths=\"%s\" >",
xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
@@ -2734,9 +2752,15 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
+ HDsprintf(type_name, "#%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2747,9 +2771,9 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
- H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
dump_indent -= COL;
ctx.indent_level--;
@@ -2787,12 +2811,11 @@ static int
xml_print_refs(hid_t did, int source)
{
herr_t e;
- hid_t type = -1;
- hid_t space = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
hssize_t ssiz = -1;
hsize_t i;
- size_t tsiz;
- hobj_ref_t *refbuf = NULL;
+ H5R_ref_t *refbuf = NULL;
char *buf = NULL;
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -2823,13 +2846,11 @@ xml_print_refs(hid_t did, int source)
space = H5Dget_space(did);
if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if ((tsiz = H5Tget_size(type)) == 0)
- goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t));
if (buf == NULL)
goto error;
- e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ e = H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
/* need to check result here */
if (e < 0)
goto error;
@@ -2838,19 +2859,17 @@ xml_print_refs(hid_t did, int source)
space = H5Aget_space(did);
if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if ((tsiz = H5Tget_size(type)) == 0)
- goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t));
if (buf == NULL)
goto error;
- e = H5Aread(did, H5T_STD_REF_OBJ, buf);
+ e = H5Aread(did, H5T_STD_REF, buf);
/* need to check the result here */
if (e < 0)
goto error;
}
- refbuf = (hobj_ref_t *)((void *)buf);
+ refbuf = (H5R_ref_t *)((void *)buf);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2901,6 +2920,8 @@ xml_print_refs(hid_t did, int source)
}
ctx.indent_level--;
+ H5Rdestroy(refbuf);
+
refbuf++;
}
@@ -2936,8 +2957,8 @@ static int
xml_print_strs(hid_t did, int source)
{
herr_t e;
- hid_t type = -1;
- hid_t space = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
hssize_t ssiz = -1;
htri_t is_vlstr = FALSE;
size_t tsiz = 0;
@@ -3290,7 +3311,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
H5Pget_fill_value(dcpl, type, buf);
if (H5Tget_class(type) == H5T_REFERENCE) {
- const char * path = lookup_ref_path(*(hobj_ref_t *) buf);
+ const char * path = lookup_ref_path(*(H5R_ref_t *) buf);
ctx.need_prefix = TRUE;
@@ -3324,6 +3345,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ H5Rdestroy((H5R_ref_t *) buf);
}
else if (H5Tget_class(type) == H5T_STRING) {
/* ????? */
@@ -3610,8 +3633,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
string_dataformat.do_escape = display_escape;
outputformat = &string_dataformat;
- xml_name_to_XID(tmp, rstr, 100, 1);
- xml_name_to_XID(prefix, pstr, 100, 1);
+ xml_name_to_XID(did, tmp, rstr, 100, 1);
+ xml_name_to_XID(did, prefix, pstr, 100, 1);
ctx.need_prefix = TRUE;
@@ -4121,7 +4144,7 @@ xml_print_enum(hid_t type)
unsigned char *value = NULL; /*value array */
unsigned nmembs; /*number of members */
hid_t super; /*enum base integer type */
- hid_t native = -1; /*native integer datatype */
+ hid_t native = H5I_INVALID_HID; /*native integer datatype */
size_t dst_size; /*destination value type size */
unsigned i; /*miscellaneous counters */
size_t j;
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index 257a047..bb606ac 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -219,8 +219,8 @@ leave(int ret)
static int
convert(hid_t fid, const char *dname)
{
- hid_t dcpl = -1;
- hid_t did = -1;
+ hid_t dcpl = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
H5D_layout_t layout_type;
H5D_chunk_index_t idx_type;
@@ -362,7 +362,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_visited, void *_fid)
+convert_dsets_cb(const char *path, const H5O_info2_t *oi, const char *already_visited, void *_fid)
{
hid_t fid = *(hid_t *)_fid;
@@ -399,7 +399,7 @@ main(int argc, const char *argv[])
{
H5E_auto2_t func;
void *edata;
- hid_t fid = -1;
+ hid_t fid = H5I_INVALID_HID;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index a8cbc10..0c0e0fb 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -1089,12 +1089,12 @@ out:
*/
static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
{
- hid_t group_id = -1;
- hid_t dset_id = -1;
- hid_t space_id = -1;
- hid_t mspace_id = -1;
- hid_t type_id = -1;
- hid_t handle = -1;
+ hid_t group_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t mspace_id = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t handle = H5I_INVALID_HID;
char *str1 = NULL;
char *str2 = NULL;
char *str3 = NULL;
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 8222e06..07797c8 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -197,8 +197,8 @@ main (int argc, const char *argv[])
int ofid = -1;
void *edata;
H5E_auto2_t func;
- hid_t ifile = -1;
- hid_t plist = -1;
+ hid_t ifile = H5I_INVALID_HID;
+ hid_t plist = H5I_INVALID_HID;
herr_t status;
htri_t testval;
hsize_t usize;
diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c
index aa893f9..203522b 100644
--- a/tools/src/h5jam/h5unjam.c
+++ b/tools/src/h5jam/h5unjam.c
@@ -199,8 +199,8 @@ main(int argc, const char *argv[])
{
void *edata;
H5E_auto2_t func;
- hid_t ifile = -1;
- hid_t plist = -1;
+ hid_t ifile = H5I_INVALID_HID;
+ hid_t plist = H5I_INVALID_HID;
off_t fsize;
hsize_t usize;
htri_t testval;
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 03e7bed..88f1d2b 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -879,7 +879,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
if (nmembs > 0) {
char **name; /* member names */
unsigned char *value; /* value array */
- hid_t native = -1; /* native integer data type */
+ hid_t native = H5I_INVALID_HID; /* native integer data type */
size_t dst_size; /* destination value type size */
unsigned i; /* miscellaneous counters */
@@ -1260,10 +1260,17 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Shared? If so then print the type's OID */
if (H5Tcommitted(type)) {
- H5O_info_t oi;
+ H5O_info2_t oi;
- if (H5Oget_info2(type, &oi, H5O_INFO_BASIC) >= 0)
- h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr);
+ if (H5Oget_info3(type, &oi, H5O_INFO_BASIC) >= 0) {
+ char *type_string = NULL;
+
+ H5Otoken_to_str(type, &oi.token, &type_string);
+
+ h5tools_str_append(buffer,"shared-%lu:%s", oi.fileno, type_string);
+
+ H5free_memory(type_string);
+ } /* end if */
else
h5tools_str_append(buffer,"shared ");
} /* end if */
@@ -2284,7 +2291,7 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
*-------------------------------------------------------------------------
*/
static herr_t
-list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void *_iter)
+list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, void *_iter)
{
H5O_type_t obj_type = oinfo->type; /* Type of the object */
iter_t *iter = (iter_t*)_iter;
@@ -2355,6 +2362,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (verbose_g > 0) {
size_t buf_size = 0;
char* comment = NULL;
+ char* obj_addr_str = NULL;
ssize_t cmt_bufsize = -1;
/* Display attributes */
@@ -2363,11 +2371,15 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
H5Aiterate2(obj, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL);
/* Object location & reference count */
+ H5Otoken_to_str(obj, &oinfo->token, &obj_addr_str);
+
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr);
+ h5tools_str_append(&buffer, " %-10s %lu:%s\n", "Location:", oinfo->fileno, obj_addr_str);
h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc);
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ H5free_memory(obj_addr_str);
+
/* Modification time */
if (oinfo->mtime > 0) {
char buf[256];
@@ -2442,7 +2454,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
+list_lnk(const char *name, const H5L_info2_t *linfo, void *_iter)
{
char *buf = NULL;
iter_t *iter = (iter_t*)_iter;
@@ -2628,7 +2640,7 @@ static herr_t
visit_obj(hid_t file, const char *oname, iter_t *iter)
{
int retval = 0;
- H5O_info_t oi; /* Information for object */
+ H5O_info2_t oi; /* Information for object */
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -2640,7 +2652,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
h5tools_str_reset(&buffer);
/* Retrieve info for object to list */
- if (H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name3(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) {
if (iter->symlink_target) {
h5tools_str_append(&buffer, "{**NOT FOUND**}\n");
iter->symlink_target = FALSE;
@@ -2821,7 +2833,7 @@ leave(int ret)
int
main(int argc, const char *argv[])
{
- hid_t file = H5I_INVALID_HID;
+ hid_t file_id = H5I_INVALID_HID;
char *fname = NULL, *oname = NULL, *x;
const char *s = NULL;
char *rest;
@@ -3279,24 +3291,24 @@ main(int argc, const char *argv[])
* doesn't exist). */
show_file_name_g = (argc-argno > 1); /*show file names if more than one*/
while(argno < argc) {
- H5L_info_t li;
+ H5L_info2_t li;
iter_t iter;
symlink_trav_t symlink_list;
size_t u;
fname = HDstrdup(argv[argno++]);
oname = NULL;
- file = -1;
+ file_id = H5I_INVALID_HID;
while (fname && *fname) {
if (fapl_id != H5P_DEFAULT) {
- file = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id);
+ file_id = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id);
}
else {
- file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername);
+ file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername);
}
- if (file >= 0) {
+ if (file_id >= 0) {
if (verbose_g)
PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername);
break; /*success*/
@@ -3312,7 +3324,7 @@ main(int argc, const char *argv[])
*oname = '\0';
} /* end while */
- if (file < 0) {
+ if (file_id < 0) {
HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]);
HDfree(fname);
err_exit = 1;
@@ -3347,8 +3359,8 @@ main(int argc, const char *argv[])
/* Remember the file information for later */
iter.fname = fname;
- iter.fid = file;
- iter.gid = -1;
+ iter.fid = file_id;
+ iter.gid = H5I_INVALID_HID;
iter.symlink_target = FALSE;
iter.symlink_list = &symlink_list;
iter.symlink_list->dangle_link = FALSE;
@@ -3360,7 +3372,7 @@ main(int argc, const char *argv[])
/* Check for root group as object name */
if (HDstrcmp(oname, root_name)) {
/* Check the type of link given */
- if (H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) {
+ if (H5Lget_info2(file_id, oname, &li, H5P_DEFAULT) < 0) {
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -3381,18 +3393,18 @@ main(int argc, const char *argv[])
/* Open the object and display it's information */
if (li.type == H5L_TYPE_HARD) {
- if (visit_obj(file, oname, &iter) < 0) {
+ if (visit_obj(file_id, oname, &iter) < 0) {
H5Eset_auto2(H5E_DEFAULT, func, edata);
leave(EXIT_FAILURE);
}
} /* end if(li.type == H5L_TYPE_HARD) */
else {
/* Specified name is not for object -- list that link */
- /* Use file ID for root group ID */
- iter.gid = file;
+ /* Use file_id ID for root group ID */
+ iter.gid = file_id;
list_lnk(oname, &li, &iter);
}
- H5Fclose(file);
+ H5Fclose(file_id);
HDfree(fname);
if (x)
HDfree(oname);
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 6f0e4eb..8eeaa0e 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -222,18 +222,27 @@ h5repack_addlayout(const char *str, pack_opt_t *options)
hid_t
copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
{
- named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
- named_dt_t *dt_ret = NULL; /* Datatype to return */
- H5O_info_t oinfo; /* Object info of input dtype */
- hid_t ret_value = H5I_INVALID_HID;
+ named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
+ named_dt_t *dt_ret = NULL; /* Datatype to return */
+ H5O_info2_t oinfo; /* Object info of input dtype */
+ int token_cmp;
+ hid_t ret_value = H5I_INVALID_HID;
- if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info3(type_in, &oinfo, H5O_INFO_BASIC) < 0)
H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "H5Oget_info failed");
if (*named_dt_head_p) {
+ if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens");
+
/* Stack already exists, search for the datatype */
- while (dt && dt->addr_in != oinfo.addr)
+ while (dt && token_cmp) {
dt = dt->next;
+
+ if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens");
+ }
+
dt_ret = dt;
}
else {
@@ -249,13 +258,14 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
*named_dt_head_p = dt;
/* Update the address and id */
- dt->addr_in = travt->objs[i].objno;
- dt->id_out = -1;
+ HDmemcpy(&dt->obj_token, &travt->objs[i].obj_token, sizeof(H5O_token_t));
+ dt->id_out = H5I_INVALID_HID;
/* Check if this type is the one requested */
- if (oinfo.addr == dt->addr_in) {
+ if (H5Otoken_cmp(type_in, &oinfo.token, &dt->obj_token, &token_cmp) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens");
+ if (!token_cmp)
dt_ret = dt;
- }
} /* end if named datatype */
} /* end for each object in traversal table */
} /* end else (create the stack) */
@@ -271,8 +281,8 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
*named_dt_head_p = dt_ret;
/* Update the address and id */
- dt_ret->addr_in = oinfo.addr;
- dt_ret->id_out = -1;
+ HDmemcpy(&dt_ret->obj_token, &oinfo.token, sizeof(H5O_token_t));
+ dt_ret->id_out = H5I_INVALID_HID;
} /* end if requested datatype not found */
/* If the requested datatype does not yet exist in the output file, copy it
@@ -343,11 +353,11 @@ done:
int
copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
{
- hid_t attr_id = -1; /* attr ID */
- hid_t attr_out = -1; /* attr ID */
- hid_t space_id = -1; /* space ID */
- hid_t ftype_id = -1; /* file type ID */
- hid_t wtype_id = -1; /* read/write type ID */
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_out = H5I_INVALID_HID; /* attr ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
+ hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
size_t msize; /* size of type */
void *buf = NULL; /* data buffer */
hsize_t nelmts; /* number of elements in dataset */
@@ -355,14 +365,14 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
htri_t is_named; /* Whether the datatype is named */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* object info */
+ H5O_info2_t oinfo; /* object info */
int j;
unsigned u;
hbool_t is_ref = 0;
H5T_class_t type_class = -1;
int ret_value = 0;
- if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
/*-------------------------------------------------------------------------
@@ -385,7 +395,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
if ((is_named = H5Tcommitted(ftype_id)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tcommitted failed");
if (is_named && travt) {
- hid_t fidout = -1;
+ hid_t fidout = H5I_INVALID_HID;
/* Create out file id */
if ((fidout = H5Iget_file_id(loc_out)) < 0)
@@ -432,7 +442,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
type_class = H5Tget_class(wtype_id);
is_ref = (type_class == H5T_REFERENCE);
if (type_class == H5T_VLEN || type_class == H5T_ARRAY) {
- hid_t base_type = -1;
+ hid_t base_type = H5I_INVALID_HID;
base_type = H5Tget_super(ftype_id);
is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
@@ -500,16 +510,16 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
*/
if (H5Sclose(space_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- space_id = -1;
+ space_id = H5I_INVALID_HID;
if (H5Tclose(wtype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- wtype_id = -1;
+ wtype_id = H5I_INVALID_HID;
if (H5Tclose(ftype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- ftype_id = -1;
+ ftype_id = H5I_INVALID_HID;
if (H5Aclose(attr_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed");
- attr_id = -1;
+ attr_id = H5I_INVALID_HID;
} /* for u (each attribute) */
done:
@@ -725,9 +735,9 @@ done:
static int
check_objects(const char* fname, pack_opt_t *options)
{
- hid_t fid = -1;
- hid_t did = -1;
- hid_t sid = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
unsigned int i;
int ifil;
trav_table_t *travt = NULL;
@@ -752,7 +762,7 @@ check_objects(const char* fname, pack_opt_t *options)
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fid, &travt);
/* get the list of objects in the file */
if (h5trav_gettable(fid, travt) < 0)
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index a0e0387..52ecb0e 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -131,7 +131,7 @@ typedef struct {
typedef struct named_dt_t {
- haddr_t addr_in; /* Address of the named dtype in the in file */
+ H5O_token_t obj_token; /* Object token for the named dtype in the in file */
hid_t id_out; /* Open identifier for the dtype in the out file */
struct named_dt_t *next; /* Next dtype */
} named_dt_t;
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 613606f..1044244 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -61,11 +61,11 @@ static void print_user_block(const char *filename, hid_t fid);
int
copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
{
- hid_t fidin = -1;
- hid_t fidout = -1;
- hid_t fcpl_in = -1; /* file creation property list ID for input file */
- hid_t grp_in = -1; /* group ID */
- hid_t gcpl_in = -1; /* group creation property list */
+ hid_t fidin = H5I_INVALID_HID;
+ hid_t fidout = H5I_INVALID_HID;
+ hid_t fcpl_in = H5I_INVALID_HID; /* file creation property list ID for input file */
+ hid_t grp_in = H5I_INVALID_HID; /* group ID */
+ hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
hid_t fapl = H5P_DEFAULT; /* file access property list ID */
trav_table_t *travt = NULL;
@@ -316,7 +316,7 @@ print_user_block(fnamein, fidin);
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fidin, &travt);
if (travt) {
/* get the list of objects in the file */
@@ -580,19 +580,19 @@ int
do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- 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 gcpl_in = -1; /* group creation property list */
- hid_t gcpl_out = -1; /* group creation property list */
- hid_t type_in = -1; /* named type ID */
- hid_t type_out = -1; /* named type ID */
- hid_t dcpl_in = -1; /* dataset creation property list ID */
- hid_t dcpl_out = -1; /* dataset creation property list ID */
- hid_t f_space_id = -1; /* file space ID */
- hid_t ftype_id = -1; /* file type ID */
- hid_t wtype_id = -1; /* read/write type ID */
+ hid_t grp_in = H5I_INVALID_HID; /* group ID */
+ hid_t grp_out = H5I_INVALID_HID; /* group ID */
+ hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
+ hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
+ hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
+ hid_t gcpl_out = H5I_INVALID_HID; /* group creation property list */
+ hid_t type_in = H5I_INVALID_HID; /* named type ID */
+ hid_t type_out = H5I_INVALID_HID; /* named type ID */
+ hid_t dcpl_in = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t dcpl_out = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t f_space_id = H5I_INVALID_HID; /* file space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
+ hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
size_t msize; /* size of type */
hsize_t nelmts; /* number of elements in dataset */
@@ -946,7 +946,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
hsize_t zero[8]; /*vector of zeros */
int k;
H5D_layout_t dset_layout;
- hid_t dcpl_tmp = -1; /* dataset creation property list ID */
+ hid_t dcpl_tmp = H5I_INVALID_HID; /* dataset creation property list ID */
/* check if we have VL data in the dataset's datatype */
if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
@@ -1095,7 +1095,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
*-------------------------------------------------------------------------
*/
else {
- hid_t pid = -1;
+ hid_t pid = H5I_INVALID_HID;
/* create property to pass copy options */
if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
@@ -1167,7 +1167,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
if (H5Tclose(type_out) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- type_out = -1; /* named datatypes stack, named_dt_head, manages allocation */
+ type_out = H5I_INVALID_HID; /* named datatypes stack, named_dt_head, manages allocation */
break;
@@ -1429,7 +1429,7 @@ print_user_block(const char *filename, hid_t fid)
int fh = -1; /* file handle */
hsize_t ub_size; /* user block size */
hsize_t size; /* size read */
- hid_t fcpl = -1; /* file creation property list ID for HDF5 file */
+ hid_t fcpl = H5I_INVALID_HID; /* file creation property list ID for HDF5 file */
int i;
int ret_value = 0;
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index a7fbd3a..e6a747d 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -42,15 +42,15 @@ int do_copy_refobjs(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- hid_t grp_in = -1; /* read group ID */
- hid_t grp_out = -1; /* write 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 dcpl_id = -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 */
+ hid_t grp_in = H5I_INVALID_HID; /* read group ID */
+ hid_t grp_out = H5I_INVALID_HID; /* write group ID */
+ hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
+ hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
+ hid_t type_in = H5I_INVALID_HID; /* named type ID */
+ hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
size_t msize; /* memory size of memory type */
hsize_t nelmts; /* number of elements in dataset */
int rank; /* rank of dataset */
@@ -145,7 +145,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
- hid_t refobj_id = -1;
+ hid_t refobj_id = H5I_INVALID_HID;
hobj_ref_t *refbuf = NULL; /* buffer for object references */
hobj_ref_t *buf = NULL;
const char* refname;
@@ -221,7 +221,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
- hid_t refobj_id = -1;
+ hid_t refobj_id = H5I_INVALID_HID;
hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
hdset_reg_ref_t *buf = NULL; /* output buffer */
const char* refname;
@@ -260,7 +260,7 @@ int do_copy_refobjs(hid_t fidin,
* in the second traversal of the file
*/
if((refname = MapIdToName(refobj_id, travt)) != NULL) {
- hid_t region_id = -1; /* region id of the referenced dataset */
+ hid_t region_id = H5I_INVALID_HID; /* region id of the referenced dataset */
if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Rget_region failed");
@@ -430,16 +430,16 @@ static int copy_refs_attr(hid_t loc_in,
trav_table_t *travt,
hid_t fidout) /* for saving references */
{
- hid_t attr_id = -1; /* attr ID */
- hid_t attr_out = -1; /* attr 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 */
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_out = H5I_INVALID_HID; /* attr ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
size_t msize; /* memory size of type */
hsize_t nelmts; /* number of elements in dataset */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
unsigned u, i, j;
int rank;
H5T_class_t type_class = -1;
@@ -454,7 +454,7 @@ static int copy_refs_attr(hid_t loc_in,
int ref_comp_field_n = 0;
int ret_value = 0;
- if(H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if(H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
for(u = 0; u < (unsigned)oinfo.num_attrs; u++) {
@@ -796,16 +796,19 @@ MapIdToName(hid_t refobj_id, trav_table_t *travt)
if(travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET ||
travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP ||
travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) {
- H5O_info_t ref_oinfo; /* Stat for the refobj id */
+ H5O_info2_t ref_oinfo; /* Stat for the refobj id */
+ int token_cmp;
/* obtain information to identify the referenced object uniquely */
- if(H5Oget_info2(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
goto out;
- if(ref_oinfo.addr == travt->objs[u].objno) {
+ if(H5Otoken_cmp(refobj_id, &ref_oinfo.token, &travt->objs[u].obj_token, &token_cmp) < 0)
+ goto out;
+ if(!token_cmp) {
ret = travt->objs[u].name;
goto out;
- } /* end if */
+ }
} /* end if */
} /* u */
@@ -823,8 +826,8 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
hid_t fid_out, void *ref_out, trav_table_t *travt)
{
const char *ref_obj_name;
- hid_t space_id = -1;
- hid_t ref_obj_id = -1;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t ref_obj_id = H5I_INVALID_HID;
herr_t ret_value = SUCCEED;
ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in);
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index d84766a..683988c 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -39,17 +39,17 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
int
h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options)
{
- hid_t fidin = -1; /* file ID for input file*/
- hid_t fidout = -1; /* file ID for output file*/
- hid_t did = -1; /* dataset ID */
- hid_t pid = -1; /* dataset creation property list ID */
- hid_t sid = -1; /* space ID */
- hid_t tid = -1; /* type ID */
+ hid_t fidin = H5I_INVALID_HID; /* file ID for input file*/
+ hid_t fidout = H5I_INVALID_HID; /* file ID for output file*/
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t pid = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t sid = H5I_INVALID_HID; /* space ID */
+ hid_t tid = H5I_INVALID_HID; /* type ID */
int ok = 1; /* step results */
unsigned int i;
trav_table_t *travt = NULL;
- hid_t fcpl_in = -1; /* file creation property for input file */
- hid_t fcpl_out = -1; /* file creation property for output file */
+ hid_t fcpl_in = H5I_INVALID_HID; /* file creation property for input file */
+ hid_t fcpl_out = H5I_INVALID_HID; /* file creation property for output file */
H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
@@ -95,7 +95,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* close
*-------------------------------------------------------------------------
*/
- if(H5Pclose(pid) < 0)
+ if (H5Pclose(pid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
@@ -114,7 +114,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fidout, &travt);
/* get the list of objects in the file */
if(h5trav_gettable(fidout, travt) < 0)
@@ -355,14 +355,14 @@ int verify_layout(hid_t pid, pack_info_t *obj)
int h5repack_cmp_pl(const char *fname1, const char *fname2)
{
- hid_t fid1 =-1; /* file ID */
- hid_t fid2 =-1; /* file ID */
- hid_t dset1 =-1; /* dataset ID */
- hid_t dset2 =-1; /* dataset ID */
- hid_t gid =-1; /* group ID */
- hid_t dcpl1 =-1; /* dataset creation property list ID */
- hid_t dcpl2 =-1; /* dataset creation property list ID */
- hid_t gcplid =-1; /* group creation property list */
+ hid_t fid1 =H5I_INVALID_HID; /* file ID */
+ hid_t fid2 =H5I_INVALID_HID; /* file ID */
+ hid_t dset1 =H5I_INVALID_HID; /* dataset ID */
+ hid_t dset2 =H5I_INVALID_HID; /* dataset ID */
+ hid_t gid =H5I_INVALID_HID; /* group ID */
+ hid_t dcpl1 =H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t dcpl2 =H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t gcplid =H5I_INVALID_HID; /* group creation property list */
unsigned crt_order_flag1; /* group creation order flag */
unsigned crt_order_flag2; /* group creation order flag */
trav_table_t *trav = NULL;
@@ -386,7 +386,7 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&trav);
+ trav_table_init(fid1, &trav);
if(h5trav_gettable(fid1, trav) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index 9ce7327..adc905a 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -379,13 +379,13 @@ ceil_log10(unsigned long x)
*-------------------------------------------------------------------------
*/
static herr_t
-attribute_stats(iter_t *iter, const H5O_info_t *oi)
+attribute_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
unsigned bin; /* "bin" the number of objects falls in */
/* Update dataset & attribute metadata info */
- iter->attrs_btree_storage_size += oi->meta_size.attr.index_size;
- iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size;
+ iter->attrs_btree_storage_size += native_oi->meta_size.attr.index_size;
+ iter->attrs_heap_storage_size += native_oi->meta_size.attr.heap_size;
/* Update small # of attribute count & limits */
if(oi->num_attrs <= (hsize_t)sattrs_threshold)
@@ -440,7 +440,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
*-------------------------------------------------------------------------
*/
static herr_t
-group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+group_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
H5G_info_t ginfo; /* Group information */
unsigned bin; /* "bin" the number of objects falls in */
@@ -450,8 +450,8 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->uniq_groups++;
/* Get object header information */
- iter->group_ohdr_info.total_size += oi->hdr.space.total;
- iter->group_ohdr_info.free_size += oi->hdr.space.free;
+ iter->group_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->group_ohdr_info.free_size += native_oi->hdr.space.free;
/* Get group information */
if((ret_value = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT)) < 0)
@@ -484,11 +484,11 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
(iter->group_bins[bin])++;
/* Update group metadata info */
- iter->groups_btree_storage_size += oi->meta_size.obj.index_size;
- iter->groups_heap_storage_size += oi->meta_size.obj.heap_size;
+ iter->groups_btree_storage_size += native_oi->meta_size.obj.index_size;
+ iter->groups_heap_storage_size += native_oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats failed");
done:
@@ -510,7 +510,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+dataset_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
unsigned bin; /* "bin" the number of objects falls in */
hid_t did; /* Dataset ID */
@@ -533,18 +533,18 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->uniq_dsets++;
/* Get object header information */
- iter->dset_ohdr_info.total_size += oi->hdr.space.total;
- iter->dset_ohdr_info.free_size += oi->hdr.space.free;
+ iter->dset_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->dset_ohdr_info.free_size += native_oi->hdr.space.free;
if((did = H5Dopen2(iter->fid, name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen() failed");
/* Update dataset metadata info */
- iter->datasets_index_storage_size += oi->meta_size.obj.index_size;
- iter->datasets_heap_storage_size += oi->meta_size.obj.heap_size;
+ iter->datasets_index_storage_size += native_oi->meta_size.obj.index_size;
+ iter->datasets_heap_storage_size += native_oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
/* Get storage info */
@@ -702,7 +702,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-datatype_stats(iter_t *iter, const H5O_info_t *oi)
+datatype_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
herr_t ret_value = SUCCEED;
@@ -710,11 +710,11 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi)
iter->uniq_dtypes++;
/* Get object header information */
- iter->dtype_ohdr_info.total_size += oi->hdr.space.total;
- iter->dtype_ohdr_info.free_size += oi->hdr.space.free;
+ iter->dtype_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->dtype_ohdr_info.free_size += native_oi->hdr.space.free;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
done:
return ret_value;
@@ -735,31 +735,36 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
+obj_stats(const char *path, const H5O_info2_t *oi, const char *already_visited,
void *_iter)
{
+ H5O_native_info_t native_info;
iter_t *iter = (iter_t *)_iter;
herr_t ret_value = SUCCEED;
/* If the object has already been seen then just return */
if(NULL == already_visited) {
+ /* Retrieve the native info for the object */
+ if(H5Oget_native_info_by_name(iter->fid, path, &native_info, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_native_info_by_name failed");
+
/* Gather some general statistics about the object */
if(oi->rc > iter->max_links)
iter->max_links = oi->rc;
switch(oi->type) {
case H5O_TYPE_GROUP:
- if(group_stats(iter, path, oi) < 0)
+ if(group_stats(iter, path, oi, &native_info) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "group_stats failed");
break;
case H5O_TYPE_DATASET:
- if(dataset_stats(iter, path, oi) < 0)
+ if(dataset_stats(iter, path, oi, &native_info) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "dataset_stats failed");
break;
case H5O_TYPE_NAMED_DATATYPE:
- if(datatype_stats(iter, oi) < 0)
+ if(datatype_stats(iter, oi, &native_info) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "datatype_stats failed");
break;
@@ -792,7 +797,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter)
+lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info2_t *li, void *_iter)
{
iter_t *iter = (iter_t *)_iter;
@@ -1853,7 +1858,7 @@ main(int argc, const char *argv[])
{
iter_t iter;
const char *fname = NULL;
- hid_t fid = -1;
+ hid_t fid = H5I_INVALID_HID;
H5E_auto2_t func;
H5E_auto2_t tools_func;
void *edata;
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c
index ae57031..927167b 100644
--- a/tools/src/misc/h5clear.c
+++ b/tools/src/misc/h5clear.c
@@ -252,8 +252,8 @@ int
main (int argc, const char *argv[])
{
char *fname = NULL; /* File name */
- hid_t fapl = -1; /* File access property list */
- hid_t fid = -1; /* File ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
haddr_t image_addr;
hsize_t image_len;
unsigned flags = H5F_ACC_RDWR; /* file access flags */