diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-08-08 19:39:10 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-08-08 19:39:10 (GMT) |
commit | 637fe3d65b95e8f73a1c66291333a5171566790c (patch) | |
tree | 1bf94fa1afaa81cc0ee19b9e1450cca0c362e006 /tools/lib | |
parent | 4032cbf36056c98e44b6b32d9f531087af50c881 (diff) | |
download | hdf5-637fe3d65b95e8f73a1c66291333a5171566790c.zip hdf5-637fe3d65b95e8f73a1c66291333a5171566790c.tar.gz hdf5-637fe3d65b95e8f73a1c66291333a5171566790c.tar.bz2 |
[svn-r7327] Purpose:
Refactored code
Description:
Chase changes of 'objno' and 'fileno' fields in H5G_stat_t structure.
Platforms tested:
h5committested
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5tools_str.c | 15 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 22 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.h | 6 |
3 files changed, 19 insertions, 24 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 6553c5a..f160825 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -769,10 +769,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, H5Gget_objinfo(obj, ".", FALSE, &sb); if (info->dset_hidefileno) - h5tools_str_append(str, info->dset_format, sb.objno[1], sb.objno[0]); + h5tools_str_append(str, info->dset_format, sb.objno); else - h5tools_str_append(str, info->dset_format, - sb.fileno[1], sb.fileno[0], sb.objno[1], sb.objno[0]); + h5tools_str_append(str, info->dset_format, sb.fileno, sb.objno); h5tools_str_dump_region(str, region, info); H5Sclose(region); @@ -810,12 +809,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, } /* Print OID */ - if (info->obj_hidefileno) { - h5tools_str_append(str, info->obj_format, sb.objno[1], sb.objno[0]); - } else { - h5tools_str_append(str, info->obj_format, - sb.fileno[1], sb.fileno[0], sb.objno[1], sb.objno[0]); - } + if (info->obj_hidefileno) + h5tools_str_append(str, info->obj_format, sb.objno); + else + h5tools_str_append(str, info->obj_format, sb.fileno,sb.objno); } } else if (H5Tget_class(type) == H5T_ARRAY) { int k, ndims; diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 1a9882b..1f3accc 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -39,7 +39,7 @@ int opt_ind = 1; /*token pointer */ const char *opt_arg; /*flag argument (or value) */ /* local functions */ -static void add_obj(table_t *table, unsigned long *objno, char *objname); +static void add_obj(table_t *table, haddr_t objno, char *objname); /*------------------------------------------------------------------------- @@ -325,7 +325,7 @@ init_table(table_t **tbl) table->objs = HDmalloc(table->size * sizeof(obj_t)); for (i = 0; i < table->size; i++) { - table->objs[i].objno[0] = table->objs[i].objno[1] = 0; + table->objs[i].objno = 0; table->objs[i].displayed = 0; table->objs[i].recorded = 0; table->objs[i].objflag = 0; @@ -392,12 +392,12 @@ free_table(table_t **table) *------------------------------------------------------------------------- */ int -search_obj(table_t *table, unsigned long *objno) +search_obj(table_t *table, haddr_t objno) { int i; for (i = 0; i < table->nobjs; i++) - if (table->objs[i].objno[0] == *objno && table->objs[i].objno[1] == *(objno + 1)) + if (table->objs[i].objno == objno) return i; return FAIL; @@ -547,9 +547,8 @@ dump_table(char* tablename, table_t *table) printf("%s: # of entries = %d\n", tablename,table->nobjs); for (i = 0; i < table->nobjs; i++) - printf("\t%lu %lu %s %d\n", - table->objs[i].objno[0], - table->objs[i].objno[1], + HDfprintf(stdout,"\t%a %s %d\n", + table->objs[i].objno, table->objs[i].objname, table->objs[i].objflag); } @@ -569,7 +568,7 @@ dump_table(char* tablename, table_t *table) *------------------------------------------------------------------------- */ int -get_table_idx(table_t *table, unsigned long *objno) +get_table_idx(table_t *table, haddr_t objno) { return search_obj(table, objno); } @@ -649,7 +648,7 @@ get_objectname(table_t *table, int idx) *------------------------------------------------------------------------- */ static void -add_obj(table_t *table, unsigned long *objno, char *objname) +add_obj(table_t *table, haddr_t objno, char *objname) { int i; @@ -658,7 +657,7 @@ add_obj(table_t *table, unsigned long *objno, char *objname) table->objs = HDrealloc(table->objs, table->size * sizeof(obj_t)); for (i = table->nobjs; i < table->size; i++) { - table->objs[i].objno[0] = table->objs[i].objno[1] = 0; + table->objs[i].objno = 0; table->objs[i].displayed = 0; table->objs[i].recorded = 0; table->objs[i].objflag = 0; @@ -667,8 +666,7 @@ add_obj(table_t *table, unsigned long *objno, char *objname) } i = table->nobjs++; - table->objs[i].objno[0] = objno[0]; - table->objs[i].objno[1] = objno[1]; + table->objs[i].objno = objno; free(table->objs[i].objname); table->objs[i].objname = HDstrdup(objname); } diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 5240050..0c8d83c 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -79,7 +79,7 @@ extern int get_option(int argc, const char **argv, const char *opt, /*struct taken from the dumper. needed in table struct*/ typedef struct obj_t { - unsigned long objno[2]; + haddr_t objno; char *objname; int displayed; int recorded; @@ -113,12 +113,12 @@ extern void error_msg(const char *progname, const char *fmt, ...); extern void warn_msg(const char *progname, const char *fmt, ...); extern void free_table(table_t **table); extern void dump_table(char *name, table_t *table); -extern int get_table_idx(table_t *table, unsigned long *); +extern int get_table_idx(table_t *table, haddr_t objno); extern int get_tableflag(table_t*, int); extern int set_tableflag(table_t*, int); extern char *get_objectname(table_t*, int); extern herr_t find_objs(hid_t group, const char *name, void *op_data); -extern int search_obj(table_t *temp, unsigned long *); +extern int search_obj(table_t *temp, haddr_t objno); extern void init_table(table_t **tbl); extern void init_prefix(char **temp, size_t); |