summaryrefslogtreecommitdiffstats
path: root/tools/h5stat
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2012-06-06 21:12:34 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2012-06-06 21:12:34 (GMT)
commit596d5b2662e0cd9003efdfce6dd0fa160395ba67 (patch)
tree89e20ff22e826fa7b2a486c72b7a85c61deb7f69 /tools/h5stat
parent71ca559f81df96e2e792e4bb831f4f07db860cf9 (diff)
downloadhdf5-596d5b2662e0cd9003efdfce6dd0fa160395ba67.zip
hdf5-596d5b2662e0cd9003efdfce6dd0fa160395ba67.tar.gz
hdf5-596d5b2662e0cd9003efdfce6dd0fa160395ba67.tar.bz2
[svn-r22438] (1) fix for making MEM_GHEAP as MEM_DRAW
(2) fix to extend into the aggregator based on threshold (3) fix for the "flavor" logging problem (4) fix for test failures due to the above fixes (5) bug fix for h5stat when h5stat against a non-existing file --Ths line, and th se below, will be ignored-- M test/mf.c M src/H5MFaggr.c M src/H5FDpublic.h M src/H5MF.c M src/H5FDmulti.c M src/H5FDlog.c M src/H5Faccum.c M tools/h5copy/testfiles/h5copytst.out.ls M tools/h5copy/testfiles/h5copy_ref.out.ls M tools/h5stat/testh5stat.sh.in M tools/h5stat/h5stat.c
Diffstat (limited to 'tools/h5stat')
-rw-r--r--tools/h5stat/h5stat.c39
-rw-r--r--tools/h5stat/testh5stat.sh.in3
2 files changed, 10 insertions, 32 deletions
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index 9e414a8..961e758 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -845,36 +845,9 @@ error:
/*-------------------------------------------------------------------------
- * Function: init_iter
+ * Function: iter_free
*
- * Purpose: Initialize iter structure
- *
- * Return: Success: 0
- *
- * Failure: Never fails
- *
- * Programmer: Elena Pourmal
- * Saturday, August 12, 2006
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-iter_init(iter_t *iter, hid_t fid)
-{
- /* Clear everything to zeros */
- HDmemset(iter, 0, sizeof(*iter));
-
- /* Set the file ID for later use in callbacks */
- iter->fid = fid;
-
- return 0;
-} /* iter_init() */
-
-
-/*-------------------------------------------------------------------------
- * Function: free_iter
- *
- * Purpose: Freee iter structure
+ * Purpose: Free iter structure
*
* Return: Success: 0
*
@@ -1452,7 +1425,7 @@ main(int argc, const char *argv[])
{
iter_t iter;
const char *fname = NULL;
- hid_t fid;
+ hid_t fid = -1;
hid_t fcpl;
struct handler_t *hand = NULL;
H5F_info_t finfo;
@@ -1475,6 +1448,8 @@ main(int argc, const char *argv[])
printf("Filename: %s\n", fname);
+ HDmemset(&iter, 0, sizeof(iter));
+
fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);
if(fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
@@ -1483,7 +1458,7 @@ main(int argc, const char *argv[])
} /* end if */
/* Initialize iter structure */
- iter_init(&iter, fid);
+ iter.fid = fid;
if(H5Fget_filesize(fid, &iter.filesize) < 0)
warn_msg("Unable to retrieve file size\n");
@@ -1539,7 +1514,7 @@ done:
/* Free iter structure */
iter_free(&iter);
- if(H5Fclose(fid) < 0) {
+ if(fid >= 0 && H5Fclose(fid) < 0) {
error_msg("unable to close file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
}
diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in
index c5cb3e8..c594a97 100644
--- a/tools/h5stat/testh5stat.sh.in
+++ b/tools/h5stat/testh5stat.sh.in
@@ -77,6 +77,7 @@ $SRC_H5STAT_TESTFILES/h5stat_newgrat.h5
LIST_OTHER_TEST_FILES="
$SRC_H5STAT_TESTFILES/h5stat_help1.ddl
$SRC_H5STAT_TESTFILES/h5stat_help2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_notexist.ddl
$SRC_H5STAT_TESTFILES/h5stat_filters.ddl
$SRC_H5STAT_TESTFILES/h5stat_filters-file.ddl
$SRC_H5STAT_TESTFILES/h5stat_filters-F.ddl
@@ -189,6 +190,8 @@ COPY_TESTFILES_TO_TESTDIR
# Test for help flag
TOOLTEST h5stat_help1.ddl -h
TOOLTEST h5stat_help2.ddl --help
+# Test when h5stat a file that does not exist
+TOOLTEST h5stat_notexist.ddl notexist.h5
# Test file with groups, compressed datasets, user-applied fileters, etc.
# h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4