diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-01-16 21:29:34 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-01-16 21:29:34 (GMT) |
commit | a92c735c9b57049e8c4037d3490f7e10f8eef4d6 (patch) | |
tree | 74da25151de6d1e32329dfcd62e17c863e2e3de1 /tools/src/h5dump | |
parent | 024f7ba09250110c19b070c9699cfbc0f9dc2b96 (diff) | |
download | hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.zip hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.tar.gz hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.tar.bz2 |
Squashed commit of the token_refactoring branch:
Diffstat (limited to 'tools/src/h5dump')
-rw-r--r-- | tools/src/h5dump/h5dump.c | 4 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump_ddl.c | 67 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump_xml.c | 171 |
3 files changed, 140 insertions, 102 deletions
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 731fcd7..d97fdc0 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1398,7 +1398,7 @@ main(int argc, const char *argv[]) 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 2eb11fd..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,7 +612,7 @@ 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 = H5I_INVALID_HID; /* datatype creation property list ID */ hsize_t curr_pos = 0; /* total data element position */ @@ -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; @@ -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 c116da8..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 @@ -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--; @@ -2791,8 +2815,7 @@ xml_print_refs(hid_t did, int source) 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++; } @@ -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; |