From e4e6daee0ccf4bd8e64a215e70c2096049877440 Mon Sep 17 00:00:00 2001 From: "Robert E. McGrath" Date: Thu, 22 Feb 2001 14:15:01 -0500 Subject: [svn-r3484] Purpose: fix bug in XML output Description: OBJ-XID, Parents, etc. were messed up in several cases. Solution: Fixed. Updated tests to have correct results in them Platforms tested: Solaris 2.7 --- tools/h5dump.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tools/h5dump.c b/tools/h5dump.c index 110aaf7..dab11d7 100644 --- a/tools/h5dump.c +++ b/tools/h5dump.c @@ -1225,7 +1225,7 @@ static herr_t dump_all(hid_t group, const char *name, void * op_data) { hid_t obj; - char *buf, *tmp; + char *buf, *tmp, *tmp2; H5G_stat_t statbuf; int i; @@ -1254,11 +1254,22 @@ dump_all(hid_t group, const char *name, void * op_data) printf("LINKTARGET \"%s\"\n", buf); } else { /* XML */ + tmp2 = (char *) malloc(strlen(prefix) + statbuf.linklen + 2); + strcpy(tmp2, prefix); + if (buf && buf[0] == '/') { + strcat(tmp2, buf); + } else { + strcat(strcat(tmp2, "/"), buf); + } + strcat(strcat(tmp, "/"), name); printf ("\n", - xml_escape_the_name(name), xml_escape_the_name(buf), - xml_escape_the_name(buf), xml_escape_the_name(name), + xml_escape_the_name(name), + xml_escape_the_name(buf), + xml_escape_the_name(tmp2), + xml_escape_the_name(tmp), (strcmp(prefix, "") ? xml_escape_the_name(prefix) : "root")); + free(tmp2); } } else { fflush(stdout); @@ -1323,6 +1334,7 @@ dump_all(hid_t group, const char *name, void * op_data) dump_header_format->datasetblockend); } else { /* the XML version */ + strcat(strcat(tmp, "/"), name); printf ("\n", xml_escape_the_name(name), @@ -3835,12 +3847,14 @@ xml_dump_named_datatype(hid_t type, const char *name) the future. */ printf("\n", - name, tmp, name); + name, + xml_escape_the_name(tmp), + (strcmp(prefix, "") ? xml_escape_the_name(prefix) : "root")); } else { printf("\n", xml_escape_the_name(name), xml_escape_the_name(tmp), - (strcmp(prefix, "") ? xml_escape_the_name(name) : "root")); + (strcmp(prefix, "") ? xml_escape_the_name(prefix) : "root")); } indent += COL; @@ -3952,7 +3966,8 @@ xml_dump_group(hid_t gid, const char *name) } else { printf("\n", xml_escape_the_name(name), - xml_escape_the_name(tmp), xml_escape_the_name(par)); + xml_escape_the_name(tmp), + (strcmp(prefix, "") ? xml_escape_the_name(par) : "root")); } indent += COL; H5Gget_objinfo(gid, ".", TRUE, &statbuf); -- cgit v0.12