summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-12-10 17:43:14 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-12-10 17:43:14 (GMT)
commit9d06256018fbebbefa08879ae9f16696a5bbef19 (patch)
treedb84f4d812d122c8c9fafbcc4b828fc12cbf6a8e /tools/h5dump
parenta4750dfae7e187f95c4515939968e6fce880efed (diff)
downloadhdf5-9d06256018fbebbefa08879ae9f16696a5bbef19.zip
hdf5-9d06256018fbebbefa08879ae9f16696a5bbef19.tar.gz
hdf5-9d06256018fbebbefa08879ae9f16696a5bbef19.tar.bz2
[svn-r17987] Description:
Bring r17945:17986 from trunk to revise_chunks branch (needs to have autotools files regenerated before testing, those will be checked in in a few minutes)
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c6
-rw-r--r--tools/h5dump/h5dumpgentest.c93
2 files changed, 69 insertions, 30 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index a437619..abe97ea 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -5749,7 +5749,6 @@ xml_dump_group(hid_t gid, const char *name)
char type_name[1024], *tmp = NULL;
char *par = NULL;
int isRoot = 0;
- char *ptrstr;
char *t_objname;
char *par_name;
unsigned crt_order_flags;
@@ -5802,6 +5801,7 @@ xml_dump_group(hid_t gid, const char *name)
indent += COL;
H5Oget_info(gid, &oinfo);
+
if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
@@ -5819,6 +5819,8 @@ xml_dump_group(hid_t gid, const char *name)
char *parentxid = malloc(100);
if(found_obj->displayed) {
+ char *ptrstr = malloc(100);
+
/* already seen: enter a groupptr */
if(isRoot) {
/* probably can't happen! */
@@ -5839,7 +5841,6 @@ xml_dump_group(hid_t gid, const char *name)
}
indentation(indent + COL);
- ptrstr = malloc(100);
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);
@@ -5850,6 +5851,7 @@ xml_dump_group(hid_t gid, const char *name)
ptrstr, t_objname, parentxid, par_name);
free(t_objname);
free(par_name);
+ free(ptrstr);
} else {
/* first time this group has been seen -- describe it */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index b42b675..ab60807 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -5813,12 +5813,12 @@ gent_binary(void)
static void
gent_bigdims(void)
{
- hid_t fid;
- hid_t did;
- hid_t f_sid;
- hid_t m_sid;
- hid_t tid;
- hid_t dcpl;
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t f_sid = -1;
+ hid_t m_sid = -1;
+ hid_t tid = -1;
+ hid_t dcpl = -1;
hsize_t dims[1]={DIM_4GB}; /* dataset dimensions */
hsize_t chunk_dims[1]={1024}; /* chunk dimensions */
hsize_t hs_start[1];
@@ -5876,14 +5876,21 @@ gent_bigdims(void)
buf=NULL;
/* close */
+ if(H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
if(H5Sclose(f_sid) < 0)
goto out;
+ f_sid = -1;
if(H5Sclose(m_sid) < 0)
goto out;
+ m_sid = -1;
if(H5Pclose(dcpl) < 0)
goto out;
+ dcpl = -1;
if(H5Dclose(did) < 0)
goto out;
+ did = -1;
ret = H5Fclose(fid);
assert(ret >= 0);
@@ -5896,11 +5903,11 @@ out:
H5Pclose(dcpl);
H5Sclose(f_sid);
H5Sclose(m_sid);
+ H5Tclose(tid);
H5Dclose(did);
H5Fclose(fid);
} H5E_END_TRY;
return;
-
}
@@ -5947,10 +5954,10 @@ gent_hyperslab(void)
static void
gent_group_creation_order(void)
{
- hid_t fid; /* file ID */
- hid_t gid; /* group ID */
- hid_t gcpl_id; /* group creation property list ID */
- hid_t fcpl_id; /* file creation property list ID (to set root group order) */
+ hid_t fid = -1; /* file ID */
+ hid_t gid = -1; /* group ID */
+ hid_t gcpl_id = -1; /* group creation property list ID */
+ hid_t fcpl_id = -1; /* file creation property list ID (to set root group order) */
if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto out;
@@ -5976,37 +5983,45 @@ gent_group_creation_order(void)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
/*-------------------------------------------------------------------------
@@ -6021,45 +6036,56 @@ gent_group_creation_order(void)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
if(H5Pclose(gcpl_id) < 0)
goto out;
+ gcpl_id = -1;
if(H5Pclose(fcpl_id) < 0)
goto out;
+ fcpl_id = -1;
if(H5Fclose(fid) < 0)
goto out;
+ fid = -1;
return;
@@ -6087,15 +6113,15 @@ out:
static void
gent_attr_creation_order(void)
{
- hid_t fid; /* file id */
- hid_t gid; /* group id */
- hid_t did; /* dataset id */
- hid_t sid; /* space id */
- hid_t aid; /* attribute id */
- hid_t tid; /* datatype id */
- hid_t gcpl_id; /* group creation property list ID */
- hid_t dcpl_id; /* dataset creation property list ID */
- hid_t tcpl_id; /* datatype creation property list ID */
+ hid_t fid = -1; /* file id */
+ hid_t gid = -1; /* group id */
+ hid_t did = -1; /* dataset id */
+ hid_t sid = -1; /* space id */
+ hid_t aid = -1; /* attribute id */
+ hid_t tid = -1; /* datatype id */
+ hid_t gcpl_id = -1; /* group creation property list ID */
+ hid_t dcpl_id = -1; /* dataset creation property list ID */
+ hid_t tcpl_id = -1; /* datatype creation property list ID */
int i;
const char *attr_name[3] = {"c", "b", "a" };
@@ -6148,10 +6174,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
+ aid = -1;
} /* end for */
if(H5Dclose(did) < 0)
goto out;
+ did = -1;
/*-------------------------------------------------------------------------
@@ -6172,10 +6200,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
+ aid = -1;
} /* end for */
if(H5Dclose(did) < 0)
goto out;
+ did = -1;
@@ -6196,11 +6226,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
-
+ aid = -1;
} /* end for */
if(H5Gclose(gid) < 0)
goto out;
+ gid = -1;
/*-------------------------------------------------------------------------
* create a group without creation order tracked for attributes and atributes in it
@@ -6219,12 +6250,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
-
+ aid = -1;
} /* end for */
if(H5Gclose(gid) < 0)
goto out;
-
+ gid = -1;
/*-------------------------------------------------------------------------
* create a named datatype with creation order tracked for attributes and atributes in it
@@ -6246,11 +6277,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
-
+ aid = -1;
} /* end for */
if(H5Tclose(tid) < 0)
goto out;
+ tid = -1;
/*-------------------------------------------------------------------------
* create a named datatype without creation order tracked for attributes and atributes in it
@@ -6272,11 +6304,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
-
+ aid = -1;
} /* end for */
if(H5Tclose(tid) < 0)
goto out;
+ tid = -1;
/*-------------------------------------------------------------------------
* add some attributes to the root group
@@ -6294,12 +6327,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
-
+ aid = -1;
} /* end for */
if(H5Gclose(gid) < 0)
goto out;
-
+ gid = -1;
/*-------------------------------------------------------------------------
* close
@@ -6307,15 +6340,19 @@ gent_attr_creation_order(void)
*/
if(H5Sclose(sid) < 0)
goto out;
-
+ sid = -1;
if(H5Pclose(dcpl_id) < 0)
goto out;
+ dcpl_id = -1;
if(H5Pclose(gcpl_id) < 0)
goto out;
+ gcpl_id = -1;
if(H5Pclose(tcpl_id) < 0)
goto out;
+ tcpl_id = -1;
if(H5Fclose(fid) < 0)
goto out;
+ fid = -1;