From afb64c0bac1527046047f704000cf68ff023740f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 2 Dec 2000 10:13:38 -0500 Subject: [svn-r3066] Purpose: Bug Fix. Description: Attributes whose datatype was an object or dataset region reference weren't dumping correctly. Solution: Pass along attribute ID to the code which prints the attributes, so the reference types can be dereferenced and printed. Platforms tested: FreeBSD 4.2 (hawkwind) & IRIX64 6.5 (modi4) --- tools/h5dump.c | 3 +-- tools/h5ls.c | 2 +- tools/h5tools.c | 9 ++++----- tools/h5tools.h | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tools/h5dump.c b/tools/h5dump.c index c22944d..c45f8a9 100644 --- a/tools/h5dump.c +++ b/tools/h5dump.c @@ -1281,7 +1281,6 @@ dump_data(hid_t obj_id, int obj_data) /* need to call h5dump_mem for the attribute data */ type = H5Aget_type(obj_id); p_type = h5dump_fixtype(type); - H5Tclose(type); space = H5Aget_space(obj_id); ndims = H5Sget_simple_extent_dims(space, size, NULL); @@ -1292,7 +1291,7 @@ dump_data(hid_t obj_id, int obj_data) assert(buf); if (H5Aread(obj_id, p_type, buf) >= 0) - d_status = h5dump_mem(stdout, outputformat, p_type, space, buf, depth); + d_status = h5dump_mem(stdout, outputformat, obj_id, p_type, space, buf, depth); free(buf); H5Tclose(p_type); diff --git a/tools/h5ls.c b/tools/h5ls.c index f792a19..56c9821 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -1328,7 +1328,7 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data) buf = malloc(need); assert(buf); if (H5Aread(attr, p_type, buf)>=0) { - h5dump_mem(stdout, &info, p_type, space, buf,-1); + h5dump_mem(stdout, &info, attr, p_type, space, buf,-1); } free(buf); H5Tclose(p_type); diff --git a/tools/h5tools.c b/tools/h5tools.c index 4e8290b..978f30b 100644 --- a/tools/h5tools.c +++ b/tools/h5tools.c @@ -1081,7 +1081,6 @@ h5dump_sprint(h5dump_str_t *str/*in,out*/, const h5dump_t *info, H5Tclose(memb); } else if (H5T_VLEN==H5Tget_class(type)) { unsigned int i; - hid_t space; /* Get the VL sequences's base datatype for each element */ memb=H5Tget_super(type); @@ -1619,7 +1618,7 @@ h5dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, *------------------------------------------------------------------------- */ static int -h5dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t type, +h5dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type, hid_t space, void *mem, int indentlevel) { hsize_t i; /*counters */ @@ -1655,7 +1654,7 @@ h5dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t type, ctx.size_last_dim = ctx.p_max_idx[ctx.ndims - 1]; /* Print it */ - h5dump_simple_data(stream, info, -1/*no dataset*/, &ctx, + h5dump_simple_data(stream, info, obj_id, &ctx, START_OF_DATA|END_OF_DATA, nelmts, type, mem); /* Terminate the output */ @@ -1973,7 +1972,7 @@ done: *------------------------------------------------------------------------- */ int -h5dump_mem(FILE *stream, const h5dump_t *info, hid_t type, hid_t space, +h5dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type, hid_t space, void *mem,int indentlevel) { h5dump_t info_dflt; @@ -1991,7 +1990,7 @@ h5dump_mem(FILE *stream, const h5dump_t *info, hid_t type, hid_t space, if (H5Sis_simple(space) <= 0) return -1; - return h5dump_simple_mem(stream, info, type, space, mem, indentlevel); + return h5dump_simple_mem(stream, info, obj_id, type, space, mem, indentlevel); } /*************************************************************************/ diff --git a/tools/h5tools.h b/tools/h5tools.h index f133774..e9638a5 100644 --- a/tools/h5tools.h +++ b/tools/h5tools.h @@ -369,8 +369,8 @@ typedef struct dump_header{ hid_t h5dump_fixtype(hid_t f_type); int h5dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_typ, int indentlevel); -int h5dump_mem(FILE *stream, const h5dump_t *info, hid_t type, hid_t space, - void *mem, int indentlevel); +int h5dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type, + hid_t space, void *mem, int indentlevel); hid_t h5dump_fopen(const char *fname, char *drivername, size_t drivername_len); -- cgit v0.12