summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c55
-rw-r--r--tools/h5ls/h5ls.c73
-rw-r--r--tools/h5repack/h5repack_copy.c4
-rw-r--r--tools/h5repack/h5repack_refs.c2
-rw-r--r--tools/lib/h5diff.c8
-rw-r--r--tools/lib/h5tools_ref.c18
-rw-r--r--tools/lib/h5tools_str.c14
-rw-r--r--tools/lib/h5tools_utils.c20
-rw-r--r--tools/lib/h5trav.c29
-rw-r--r--tools/misc/h5stat.c24
10 files changed, 144 insertions, 103 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 029990e..2a6b33a 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -673,7 +673,6 @@ print_datatype(hid_t type,unsigned in_group)
hsize_t dims[H5DUMP_MAX_RANK];
H5T_str_t str_pad;
H5T_cset_t cset;
- H5G_stat_t statbuf;
H5T_order_t order;
hid_t super;
hid_t tmp_type;
@@ -683,10 +682,13 @@ print_datatype(hid_t type,unsigned in_group)
const char *sign_s=NULL; /* sign scheme string */
if (!in_group && H5Tcommitted(type) > 0) {
+ H5G_stat_t statbuf;
+ haddr_t objno; /* Compact form of object's location */
obj_t *obj; /* Found object */
H5Gget_objinfo(type, ".", TRUE, &statbuf);
- obj = search_obj(type_table, statbuf.u.obj.objno);
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
+ obj = search_obj(type_table, objno);
if (obj) {
if (!obj->recorded)
@@ -1420,7 +1422,7 @@ dump_all(hid_t group, const char *name, void * op_data)
char *targbuf;
indentation(indent);
- targbuf = HDmalloc(statbuf.u.slink.linklen);
+ targbuf = HDmalloc(statbuf.linklen);
HDassert(targbuf);
if (!doxml) {
@@ -1429,7 +1431,7 @@ dump_all(hid_t group, const char *name, void * op_data)
indentation(indent + COL);
}
- if (H5Gget_linkval(group, name, statbuf.u.slink.linklen, targbuf) < 0) {
+ if (H5Gget_linkval(group, name, statbuf.linklen, targbuf) < 0) {
error_msg(progname, "unable to get link value\n");
d_status = EXIT_FAILURE;
ret = FAIL;
@@ -1450,7 +1452,7 @@ dump_all(hid_t group, const char *name, void * op_data)
char *t_link_path;
int res;
- t_link_path = HDmalloc(HDstrlen(prefix) + statbuf.u.slink.linklen + 1);
+ t_link_path = HDmalloc(HDstrlen(prefix) + statbuf.linklen + 1);
if(targbuf[0] == '/')
HDstrcpy(t_link_path, targbuf);
else {
@@ -1543,13 +1545,16 @@ dump_all(hid_t group, const char *name, void * op_data)
case H5G_DATASET:
if ((obj = H5Dopen(group, name)) >= 0) {
+ haddr_t objno; /* Compact form of object's location */
+
/* hard link */
H5Gget_objinfo(obj, ".", TRUE, &statbuf);
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- if (statbuf.u.obj.nlink > 1) {
+ if (statbuf.nlink > 1) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, statbuf.u.obj.objno);
+ found_obj = search_obj(dset_table, objno);
if (found_obj == NULL) {
indentation(indent);
@@ -1709,6 +1714,7 @@ static void
dump_group(hid_t gid, const char *name)
{
H5G_stat_t statbuf;
+ haddr_t objno; /* Compact form of object's location */
hid_t dset, type;
char type_name[1024], *tmp;
int xtype = H5G_UNKNOWN; /* dump all */
@@ -1741,11 +1747,12 @@ dump_group(hid_t gid, const char *name)
} /* end if */
H5Gget_objinfo(gid, ".", TRUE, &statbuf);
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- if (statbuf.u.obj.nlink > 1) {
+ if (statbuf.nlink > 1) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(group_table, statbuf.u.obj.objno);
+ found_obj = search_obj(group_table, objno);
if (found_obj == NULL) {
indentation(indent);
@@ -2838,6 +2845,7 @@ static void
handle_datasets(hid_t fid, char *dset, void *data)
{
H5G_stat_t statbuf;
+ haddr_t objno; /* Compact form of object's location */
hid_t dsetid;
struct subset_t *sset = (struct subset_t *)data;
@@ -2904,11 +2912,12 @@ handle_datasets(hid_t fid, char *dset, void *data)
}
H5Gget_objinfo(dsetid, ".", TRUE, &statbuf);
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- if (statbuf.u.obj.nlink > 1) {
+ if (statbuf.nlink > 1) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, statbuf.u.obj.objno);
+ found_obj = search_obj(dset_table, objno);
if (found_obj) {
if (found_obj->displayed) {
@@ -2951,7 +2960,6 @@ handle_datasets(hid_t fid, char *dset, void *data)
static void
handle_groups(hid_t fid, char *group, void UNUSED * data)
{
- H5G_stat_t statbuf;
hid_t gid;
if ((gid = H5Gopen(fid, group)) < 0) {
@@ -2970,7 +2978,6 @@ handle_groups(hid_t fid, char *group, void UNUSED * data)
prefix = HDrealloc(prefix, prefix_len);
}
- H5Gget_objinfo(gid, ".", TRUE, &statbuf);
HDstrcpy(prefix, group);
dump_group(gid, group);
@@ -3002,13 +3009,13 @@ handle_links(hid_t fid, char *links, void UNUSED * data)
error_msg(progname, "unable to get obj info from \"%s\"\n", links);
d_status = EXIT_FAILURE;
} else if (statbuf.type == H5G_LINK) {
- char *buf = HDmalloc(statbuf.u.slink.linklen);
+ char *buf = HDmalloc(statbuf.linklen);
begin_obj(dump_header_format->softlinkbegin, links,
dump_header_format->softlinkblockbegin);
indentation(COL);
- if (H5Gget_linkval(fid, links, statbuf.u.slink.linklen, buf) >= 0) {
+ if (H5Gget_linkval(fid, links, statbuf.linklen, buf) >= 0) {
printf("LINKTARGET \"%s\"\n", buf);
} else {
error_msg(progname, "h5dump error: unable to get link value for \"%s\"\n",
@@ -4001,7 +4008,6 @@ xml_print_datatype(hid_t type, unsigned in_group)
hsize_t dims[H5DUMP_MAX_RANK];
H5T_str_t str_pad;
H5T_cset_t cset;
- H5G_stat_t statbuf;
hid_t super;
H5T_order_t ord;
H5T_sign_t sgn;
@@ -4015,11 +4021,14 @@ xml_print_datatype(hid_t type, unsigned in_group)
htri_t is_vlstr=FALSE;
if (!in_group && H5Tcommitted(type) > 0) {
+ H5G_stat_t statbuf;
+ haddr_t objno; /* Compact form of object's location */
obj_t *found_obj; /* Found object */
/* detect a shared datatype, output only once */
H5Gget_objinfo(type, ".", TRUE, &statbuf);
- found_obj = search_obj(type_table, statbuf.u.obj.objno);
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
+ found_obj = search_obj(type_table, objno);
if (found_obj) {
/* This should be defined somewhere else */
@@ -4378,17 +4387,19 @@ xml_print_datatype(hid_t type, unsigned in_group)
static void
xml_dump_datatype(hid_t type)
{
- H5G_stat_t statbuf;
indent += COL;
indentation(indent);
if (H5Tcommitted(type) > 0) {
+ H5G_stat_t statbuf;
+ haddr_t objno; /* Compact form of object's location */
obj_t *found_obj; /* Found object */
/* Data type is a shared or named data type */
H5Gget_objinfo(type, ".", TRUE, &statbuf);
- found_obj = search_obj(type_table, statbuf.u.obj.objno);
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
+ found_obj = search_obj(type_table, objno);
if (found_obj) {
/* Shared data type, must be entered as an object */
@@ -4833,6 +4844,7 @@ static void
xml_dump_group(hid_t gid, const char *name)
{
H5G_stat_t statbuf;
+ haddr_t objno; /* Compact form of object's location */
char *cp;
hid_t dset, type;
char type_name[1024], *tmp = NULL;
@@ -4865,12 +4877,13 @@ xml_dump_group(hid_t gid, const char *name)
indent += COL;
H5Gget_objinfo(gid, ".", TRUE, &statbuf);
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- if (statbuf.u.obj.nlink > 1) {
+ if (statbuf.nlink > 1) {
obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
- found_obj = search_obj(group_table, statbuf.u.obj.objno);
+ found_obj = search_obj(group_table, objno);
if (found_obj == NULL) {
indentation(indent);
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 792db23..a6a7e95 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -145,11 +145,12 @@ usage: %s [OPTIONS] [OBJECTS...]\n\
static void
sym_insert(H5G_stat_t *sb, const char *name)
{
+ haddr_t objno; /* Compact form of object's location */
int n;
/* Don't add it if the link count is 1 because such an object can only
* have one name. */
- if (sb->u.obj.nlink<2) return;
+ if (sb->nlink<2) return;
/* Extend the table */
if (idtab_g.nobjs>=idtab_g.nalloc) {
@@ -160,7 +161,8 @@ sym_insert(H5G_stat_t *sb, const char *name)
/* Insert the entry */
n = idtab_g.nobjs++;
- idtab_g.obj[n].id = sb->u.obj.objno;
+ objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long)));
+ idtab_g.obj[n].id = objno;
idtab_g.obj[n].name = HDstrdup(name);
}
@@ -184,11 +186,13 @@ sym_insert(H5G_stat_t *sb, const char *name)
static char *
sym_lookup(H5G_stat_t *sb)
{
+ haddr_t objno; /* Compact form of object's location */
int n;
- if (sb->u.obj.nlink<2) return NULL; /*only one name possible*/
+ if (sb->nlink<2) return NULL; /*only one name possible*/
+ objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long)));
for (n=0; n<idtab_g.nobjs; n++) {
- if (idtab_g.obj[n].id==sb->u.obj.objno)
+ if(idtab_g.obj[n].id == objno)
return idtab_g.obj[n].name;
}
return NULL;
@@ -1164,44 +1168,45 @@ static void
display_type(hid_t type, int ind)
{
H5T_class_t data_class = H5Tget_class(type);
- H5G_stat_t sb;
/* Bad data type */
if (type<0) {
- printf("<ERROR>");
- return;
+ printf("<ERROR>");
+ return;
}
/* Shared? If so then print the type's OID */
if (H5Tcommitted(type)) {
- if (H5Gget_objinfo(type, ".", FALSE, &sb)>=0) {
- printf("shared-%lu:"H5_PRINTF_HADDR_FMT" ",
- sb.fileno, sb.u.obj.objno);
- } else {
- printf("shared ");
- }
+ H5G_stat_t sb;
+
+ if (H5Gget_objinfo(type, ".", FALSE, &sb)>=0) {
+ haddr_t objno; /* Compact form of object's location */
+
+ objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
+ printf("shared-%lu:"H5_PRINTF_HADDR_FMT" ",
+ sb.fileno[0], objno);
+ } else
+ printf("shared ");
}
/* Print the type */
if ((!simple_output_g && display_native_type(type, ind)) ||
- display_ieee_type(type, ind) ||
- display_int_type(type, ind) ||
- display_float_type(type, ind) ||
- display_cmpd_type(type, ind) ||
- display_enum_type(type, ind) ||
- display_string_type(type, ind) ||
- display_reference_type(type, ind) ||
- display_vlen_type(type, ind) ||
- display_array_type(type, ind) ||
- display_opaque_type(type, ind) ||
- display_bitfield_type(type, ind)) {
- return;
- }
+ display_ieee_type(type, ind) ||
+ display_int_type(type, ind) ||
+ display_float_type(type, ind) ||
+ display_cmpd_type(type, ind) ||
+ display_enum_type(type, ind) ||
+ display_string_type(type, ind) ||
+ display_reference_type(type, ind) ||
+ display_vlen_type(type, ind) ||
+ display_array_type(type, ind) ||
+ display_opaque_type(type, ind) ||
+ display_bitfield_type(type, ind))
+ return;
/* Unknown type */
printf("%lu-byte class-%u unknown",
- (unsigned long)H5Tget_size(type),
- (unsigned)data_class);
+ (unsigned long)H5Tget_size(type), (unsigned)data_class);
}
@@ -1763,6 +1768,7 @@ list (hid_t group, const char *name, void *_iter)
hid_t obj=-1;
char buf[512], comment[50], *fullname=NULL, *s=NULL;
H5G_stat_t sb;
+ haddr_t objno; /* Compact form of object's location */
struct tm *tm;
herr_t status;
iter_t *iter = (iter_t*)_iter;
@@ -1792,6 +1798,7 @@ list (hid_t group, const char *name, void *_iter)
if (sb.type>=0 && dispatch_g[sb.type].name) {
fputs(dispatch_g[sb.type].name, stdout);
}
+ objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
/* If the object has already been printed then just show the object ID
* and return. */
@@ -1824,11 +1831,11 @@ list (hid_t group, const char *name, void *_iter)
if (verbose_g>0 && H5G_LINK!=sb.type) {
if (sb.type>=0)
H5Aiterate(obj, NULL, list_attr, NULL);
- printf(" %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", sb.fileno, sb.u.obj.objno);
- printf(" %-10s %u\n", "Links:", sb.u.obj.nlink);
- if (sb.u.obj.mtime>0) {
- if (simple_output_g) tm=gmtime(&(sb.u.obj.mtime));
- else tm=localtime(&(sb.u.obj.mtime));
+ printf(" %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", sb.fileno[0], objno);
+ printf(" %-10s %u\n", "Links:", sb.nlink);
+ if (sb.mtime>0) {
+ if (simple_output_g) tm=gmtime(&(sb.mtime));
+ else tm=localtime(&(sb.mtime));
if (tm) {
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
printf(" %-10s %s\n", "Modified:", buf);
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 55b56d1..7b11b93 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -572,9 +572,9 @@ int do_copy_objects(hid_t fidin,
if (H5Gget_objinfo(fidin,travt->objs[i].name,FALSE,&statbuf)<0)
goto error;
- targbuf = malloc(statbuf.u.slink.linklen);
+ targbuf = malloc(statbuf.linklen);
- if (H5Gget_linkval(fidin,travt->objs[i].name,statbuf.u.slink.linklen,targbuf)<0)
+ if (H5Gget_linkval(fidin,travt->objs[i].name,statbuf.linklen,targbuf)<0)
goto error;
if (H5Glink(fidout,
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 83b1c13..6e3156b 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -787,7 +787,7 @@ static const char* MapIdToName(hid_t refobj_id,
return NULL;
if (H5Dclose(id)<0)
return NULL;
- if (refstat.fileno==objstat.fileno && refstat.u.obj.objno==objstat.u.obj.objno)
+ if (!HDmemcmp(&refstat.fileno, &objstat.fileno, sizeof(refstat.fileno)) && !HDmemcmp(&refstat.objno, &objstat.objno, sizeof(refstat.objno)))
{
H5Fclose(fid);
return travt->objs[i].name;
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 4fd9c10..b4c9022 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1042,12 +1042,12 @@ hsize_t diff (hid_t file1_id,
if (H5Gget_objinfo (file1_id, path1, FALSE, &sb2) < 0)
goto out;
- buf1 = HDmalloc (sb1.u.slink.linklen);
- buf2 = HDmalloc (sb2.u.slink.linklen);
+ buf1 = HDmalloc (sb1.linklen);
+ buf2 = HDmalloc (sb2.linklen);
- if (H5Gget_linkval (file1_id, path1, sb1.u.slink.linklen, buf1) < 0)
+ if (H5Gget_linkval (file1_id, path1, sb1.linklen, buf1) < 0)
goto out;
- if (H5Gget_linkval (file2_id, path2, sb1.u.slink.linklen, buf2) < 0)
+ if (H5Gget_linkval (file2_id, path2, sb1.linklen, buf2) < 0)
goto out;
ret = HDstrcmp (buf1, buf2);
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 89bdaf1..f49cb07 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -65,7 +65,8 @@ static hbool_t ref_path_table_find(haddr_t objno);
int
init_ref_path_table(hid_t fid)
{
- H5G_stat_t sb;
+ H5G_stat_t sb;
+ haddr_t objno; /* Compact form of object's location */
char *root_path;
/* Set file ID for later queries (XXX: this should be fixed) */
@@ -83,9 +84,10 @@ init_ref_path_table(hid_t fid)
HDfree(root_path);
return (-1);
}
+ objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
/* Insert into table (takes ownership of path) */
- ref_path_table_put(root_path, sb.u.obj.objno);
+ ref_path_table_put(root_path, objno);
return(0);
}
@@ -156,6 +158,7 @@ haddr_t
ref_path_table_lookup(const char *thepath)
{
H5G_stat_t sb;
+ haddr_t objno; /* Compact form of object's location */
/* Check for external link first, so we don't return the OID of an object in another file */
if(H5Gget_objinfo(thefile, thepath, FALSE, &sb)<0)
@@ -169,13 +172,14 @@ ref_path_table_lookup(const char *thepath)
/* fatal error ? */
return HADDR_UNDEF;
} /* end if */
+ objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
/* All existing objects in the file had better be in the table */
- HDassert(ref_path_table_find(sb.u.obj.objno));
+ HDassert(ref_path_table_find(objno));
/* Return OID */
- return(sb.u.obj.objno);
+ return(objno);
}
/*-------------------------------------------------------------------------
@@ -332,11 +336,13 @@ fill_ref_path_table(hid_t group, const char *obj_name, void *op_data)
{
const char *obj_prefix = (const char *)op_data;
H5G_stat_t statbuf;
+ haddr_t objno; /* Compact form of object's location */
H5Gget_objinfo(group, obj_name, FALSE, &statbuf);
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
/* Check if the object is in the path table */
- if (!ref_path_table_find(statbuf.u.obj.objno)) {
+ if (!ref_path_table_find(objno)) {
size_t tmp_len;
char *thepath;
@@ -353,7 +359,7 @@ fill_ref_path_table(hid_t group, const char *obj_name, void *op_data)
HDstrcat(thepath, obj_name);
/* Insert the object into the path table */
- ref_path_table_put(thepath, statbuf.u.obj.objno);
+ ref_path_table_put(thepath, objno);
if(statbuf.type == H5G_GROUP) {
/* Iterate over objects in this group, using this group's
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 2286b4e..7ad5db7 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -841,14 +841,17 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if (h5tools_is_zero(vp, H5Tget_size(type))) {
h5tools_str_append(str, "NULL");
} else {
+ haddr_t objno; /* Compact form of object's location */
+
obj = H5Rdereference(container, H5R_DATASET_REGION, vp);
region = H5Rget_region(container, H5R_DATASET_REGION, vp);
H5Gget_objinfo(obj, ".", FALSE, &sb);
+ objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
if (info->dset_hidefileno)
- h5tools_str_append(str, info->dset_format, sb.u.obj.objno);
+ h5tools_str_append(str, info->dset_format, objno);
else
- h5tools_str_append(str, info->dset_format, sb.fileno, sb.u.obj.objno);
+ h5tools_str_append(str, info->dset_format, sb.fileno[0], objno);
h5tools_str_dump_region(str, region, info);
H5Sclose(region);
@@ -862,7 +865,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if (h5tools_is_zero(vp, H5Tget_size(type))) {
h5tools_str_append(str, "NULL");
} else {
+ haddr_t objno; /* Compact form of object's location */
const char *path;
+
otype = H5Rget_obj_type(container, H5R_OBJECT, vp);
obj = H5Rdereference(container, H5R_OBJECT, vp);
H5Gget_objinfo(obj, ".", FALSE, &sb);
@@ -887,10 +892,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
/* Print OID */
+ objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
if (info->obj_hidefileno)
- h5tools_str_append(str, info->obj_format, sb.u.obj.objno);
+ h5tools_str_append(str, info->obj_format, objno);
else
- h5tools_str_append(str, info->obj_format, sb.fileno,sb.u.obj.objno);
+ h5tools_str_append(str, info->obj_format, sb.fileno[0], objno);
/* Print name */
path = lookup_ref_path(*(haddr_t *)vp);
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 9eba7c5..c1fa292 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -488,15 +488,18 @@ find_objs_cb(hid_t group, const char *name, void *op_data)
if(H5Gget_objinfo(group, name, FALSE, &statbuf) < 0)
ret_value = FAIL;
else {
+ haddr_t objno; /* Compact form of object's location */
+
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
switch (statbuf.type) {
char *tmp;
case H5G_GROUP:
- if (search_obj(info->group_table, statbuf.u.obj.objno) == NULL) {
+ if (search_obj(info->group_table, objno) == NULL) {
char *old_prefix;
tmp = build_obj_path_name(info->prefix, name);
- add_obj(info->group_table, statbuf.u.obj.objno, tmp, TRUE);
+ add_obj(info->group_table, objno, tmp, TRUE);
old_prefix = info->prefix;
info->prefix = tmp;
@@ -509,11 +512,11 @@ find_objs_cb(hid_t group, const char *name, void *op_data)
break;
case H5G_DATASET:
- if (search_obj(info->dset_table, statbuf.u.obj.objno) == NULL) {
+ if (search_obj(info->dset_table, objno) == NULL) {
hid_t dset;
tmp = build_obj_path_name(info->prefix, name);
- add_obj(info->dset_table, statbuf.u.obj.objno, tmp, TRUE);
+ add_obj(info->dset_table, objno, tmp, TRUE);
if ((dset = H5Dopen (group, name)) >= 0) {
hid_t type;
@@ -522,11 +525,12 @@ find_objs_cb(hid_t group, const char *name, void *op_data)
if (H5Tcommitted(type) > 0) {
H5Gget_objinfo(type, ".", TRUE, &statbuf);
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
- if (search_obj(info->type_table, statbuf.u.obj.objno) == NULL) {
+ if (search_obj(info->type_table, objno) == NULL) {
char *type_name = HDstrdup(tmp);
- add_obj(info->type_table, statbuf.u.obj.objno, type_name, FALSE);
+ add_obj(info->type_table, objno, type_name, FALSE);
} /* end if */
}
@@ -543,8 +547,8 @@ find_objs_cb(hid_t group, const char *name, void *op_data)
obj_t *found_obj;
tmp = build_obj_path_name(info->prefix, name);
- if ((found_obj = search_obj(info->type_table, statbuf.u.obj.objno)) == NULL)
- add_obj(info->type_table, statbuf.u.obj.objno, tmp, TRUE);
+ if ((found_obj = search_obj(info->type_table, objno)) == NULL)
+ add_obj(info->type_table, objno, tmp, TRUE);
else {
/* Use latest version of name */
HDfree(found_obj->objname);
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index b59162a..f5c6e91 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -292,7 +292,7 @@ static int traverse( hid_t loc_id,
int *idx,
int print)
{
-
+ haddr_t objno; /* Compact form of object's location */
char *name=NULL;
H5G_obj_t type;
int n_names;
@@ -325,6 +325,7 @@ static int traverse( hid_t loc_id,
/* get info */
H5Gget_objinfo( loc_id, path, FALSE, &statbuf);
} H5E_END_TRY;
+ objno = (haddr_t)statbuf.objno[0] | ((haddr_t)statbuf.objno[1] << (8 * sizeof(long)));
/* add to array */
if ( info )
@@ -349,10 +350,10 @@ static int traverse( hid_t loc_id,
inserted_objs++;
/* nlink is number of hard links to object */
- if (statbuf.u.obj.nlink > 0 && trav_table_search(statbuf.u.obj.objno, table ) == -1)
+ if (statbuf.nlink > 0 && trav_table_search(objno, table ) == -1)
{
/* add object to table */
- trav_table_add(statbuf.u.obj.objno, path, H5G_GROUP, table );
+ trav_table_add(objno, path, H5G_GROUP, table );
/* print it */
if (print)
@@ -364,9 +365,9 @@ static int traverse( hid_t loc_id,
/* search table
group with more than one link to it */
- if (statbuf.u.obj.nlink > 1)
+ if (statbuf.nlink > 1)
{
- if ((j = trav_table_search(statbuf.u.obj.objno, table )) < 0 )
+ if ((j = trav_table_search(objno, table )) < 0 )
return -1;
trav_table_addlink(table,j,path);
@@ -397,10 +398,10 @@ static int traverse( hid_t loc_id,
inserted_objs++;
/* nlink is number of hard links to object */
- if (statbuf.u.obj.nlink > 0 && trav_table_search(statbuf.u.obj.objno, table ) == -1)
+ if (statbuf.nlink > 0 && trav_table_search(objno, table ) == -1)
{
/* add object to table */
- trav_table_add(statbuf.u.obj.objno, path, H5G_DATASET, table );
+ trav_table_add(objno, path, H5G_DATASET, table );
/* print it */
if (print)
@@ -409,9 +410,9 @@ static int traverse( hid_t loc_id,
/* search table
dataset with more than one link to it */
- if (statbuf.u.obj.nlink > 1)
+ if (statbuf.nlink > 1)
{
- if ((j = trav_table_search(statbuf.u.obj.objno, table )) < 0 )
+ if ((j = trav_table_search(objno, table )) < 0 )
return -1;
trav_table_addlink(table,j,path);
@@ -442,10 +443,10 @@ static int traverse( hid_t loc_id,
inserted_objs++;
/* nlink is number of hard links to object */
- if (statbuf.u.obj.nlink > 0 && trav_table_search(statbuf.u.obj.objno, table ) == -1)
+ if (statbuf.nlink > 0 && trav_table_search(objno, table ) == -1)
{
/* add object to table */
- trav_table_add(statbuf.u.obj.objno, path, H5G_TYPE, table );
+ trav_table_add(objno, path, H5G_TYPE, table );
/* print it */
if (print)
@@ -468,13 +469,13 @@ static int traverse( hid_t loc_id,
/* add object to table */
trav_table_add(HADDR_UNDEF, path, H5G_LINK, table );
- if (statbuf.u.slink.linklen>0)
+ if (statbuf.linklen>0)
{
char *targbuf;
- targbuf = HDmalloc(statbuf.u.slink.linklen);
+ targbuf = HDmalloc(statbuf.linklen);
assert(targbuf);
- H5Gget_linkval(loc_id,path,statbuf.u.slink.linklen,targbuf);
+ H5Gget_linkval(loc_id,path,statbuf.linklen,targbuf);
if (print)
printf(" %-10s %s -> %s\n", "link", path, targbuf);
free(targbuf);
diff --git a/tools/misc/h5stat.c b/tools/misc/h5stat.c
index e8f1647..e72f609 100644
--- a/tools/misc/h5stat.c
+++ b/tools/misc/h5stat.c
@@ -123,11 +123,12 @@ ceil_log10(unsigned long x)
static void
sym_insert(H5G_stat_t *sb, const char *name)
{
+ haddr_t objno; /* Compact form of object's location */
int n;
/* Don't add it if the link count is 1 because such an object can only
* have one name. */
- if (sb->u.obj.nlink<2) return;
+ if (sb->nlink<2) return;
/* Extend the table */
if (idtab_g.nobjs>=idtab_g.nalloc) {
@@ -138,7 +139,8 @@ sym_insert(H5G_stat_t *sb, const char *name)
/* Insert the entry */
n = idtab_g.nobjs++;
- idtab_g.obj[n].id = sb->u.obj.objno;
+ objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long)));
+ idtab_g.obj[n].id = objno;
idtab_g.obj[n].name = strdup(name);
}
@@ -162,12 +164,14 @@ sym_insert(H5G_stat_t *sb, const char *name)
static char *
sym_lookup(H5G_stat_t *sb)
{
+ haddr_t objno; /* Compact form of object's location */
int n;
- if (sb->u.obj.nlink<2)
+ if (sb->nlink<2)
return NULL; /*only one name possible*/
+ objno = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long)));
for (n=0; n<idtab_g.nobjs; n++) {
- if (idtab_g.obj[n].id==sb->u.obj.objno)
+ if(idtab_g.obj[n].id == objno)
return idtab_g.obj[n].name;
}
return NULL;
@@ -267,8 +271,8 @@ printf("walk: fullname = %s\n", fullname);
sym_insert(&sb, fullname);
/* Gather some statistics about the object */
- if(sb.u.obj.nlink > iter->max_links)
- iter->max_links = sb.u.obj.nlink;
+ if(sb.nlink > iter->max_links)
+ iter->max_links = sb.nlink;
switch(sb.type) {
case H5G_GROUP:
@@ -284,8 +288,8 @@ printf("walk: fullname = %s\n", fullname);
iter->max_depth = iter->curr_depth;
/* Get object header information */
- iter->group_ohdr_info.total_size += sb.u.obj.ohdr.size;
- iter->group_ohdr_info.free_size += sb.u.obj.ohdr.free;
+ iter->group_ohdr_info.total_size += sb.ohdr.size;
+ iter->group_ohdr_info.free_size += sb.ohdr.free;
gid = H5Gopen(group, name);
assert(gid > 0);
@@ -346,8 +350,8 @@ printf("walk: fullname = %s\n", fullname);
iter->uniq_dsets++;
/* Get object header information */
- iter->dset_ohdr_info.total_size += sb.u.obj.ohdr.size;
- iter->dset_ohdr_info.free_size += sb.u.obj.ohdr.free;
+ iter->dset_ohdr_info.total_size += sb.ohdr.size;
+ iter->dset_ohdr_info.free_size += sb.ohdr.free;
did = H5Dopen(group, name);
assert(did > 0);