summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-10-11 20:11:39 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-10-11 20:11:39 (GMT)
commitfbc86cfb3d503d7e7091c4cc58bd72aa9a97aac7 (patch)
tree2e8d1075edc764fca8e22f509f97365d73b41880 /tools/lib
parent005444208330c7c4ece3f60278b36802ad93dbba (diff)
downloadhdf5-fbc86cfb3d503d7e7091c4cc58bd72aa9a97aac7.zip
hdf5-fbc86cfb3d503d7e7091c4cc58bd72aa9a97aac7.tar.gz
hdf5-fbc86cfb3d503d7e7091c4cc58bd72aa9a97aac7.tar.bz2
HDFFV-10297 merge from develop
Also cleaned up some other non-merged changes
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff_attr.c8
-rw-r--r--tools/lib/h5diff_dset.c105
-rw-r--r--tools/lib/h5tools_dump.c138
-rw-r--r--tools/lib/h5tools_error.h16
-rw-r--r--tools/lib/h5tools_filters.c207
-rw-r--r--tools/lib/h5tools_ref.c3
-rw-r--r--tools/lib/h5tools_str.c10
-rw-r--r--tools/lib/io_timer.c10
8 files changed, 232 insertions, 265 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 3018f18..aa33727 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -322,8 +322,8 @@ hsize_t diff_attr(hid_t loc1_id,
hid_t space2_id=-1; /* space ID */
hid_t ftype1_id=-1; /* file data type ID */
hid_t ftype2_id=-1; /* file data type ID */
- int vstrtype1=0; /* ftype1 is a variable string */
- int vstrtype2=0; /* ftype2 is a variable string */
+ int vstrtype1=0; /* ftype1 is a variable string */
+ int vstrtype2=0; /* ftype2 is a variable string */
hid_t mtype1_id=-1; /* memory data type ID */
hid_t mtype2_id=-1; /* memory data type ID */
size_t msize1; /* memory size of memory type */
@@ -461,8 +461,8 @@ hsize_t diff_attr(hid_t loc1_id,
for(j = 0; j < rank1; j++)
nelmts1 *= dims1[j];
- buf1 = (void *)HDmalloc((size_t)(nelmts1 * msize1));
- buf2 = (void *)HDmalloc((size_t)(nelmts1 * msize2));
+ buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1);
+ buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2);
if(buf1 == NULL || buf2 == NULL) {
parallel_print("cannot read into memory\n");
goto error;
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index cf8b537..7125f5f 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -170,6 +170,7 @@ hsize_t diff_datasetid( hid_t did1,
const char *obj2_name,
diff_opt_t *options)
{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
hid_t sid1=-1;
hid_t sid2=-1;
hid_t f_tid1=-1;
@@ -211,30 +212,31 @@ hsize_t diff_datasetid( hid_t did1,
int i;
unsigned int vl_data = 0; /*contains VL datatypes */
+ options->err_stat = 1;
h5difftrace("diff_datasetid start\n");
/* Get the dataspace handle */
if((sid1 = H5Dget_space(did1)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
/* Get rank */
if((rank1 = H5Sget_simple_extent_ndims(sid1)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
/* Get the dataspace handle */
if((sid2 = H5Dget_space(did2)) < 0 )
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
/* Get rank */
if((rank2 = H5Sget_simple_extent_ndims(sid2)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
/* Get dimensions */
if(H5Sget_simple_extent_dims(sid1, dims1, maxdim1) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
/* Get dimensions */
if(H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
h5diffdebug3("rank: %ld - %ld\n", rank1, rank2);
/*-------------------------------------------------------------------------
@@ -244,25 +246,25 @@ hsize_t diff_datasetid( hid_t did1,
/* Get the data type */
if((f_tid1 = H5Dget_type(did1)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
/* Get the data type */
if((f_tid2 = H5Dget_type(did2)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
/*-------------------------------------------------------------------------
* get the storage layout type
*-------------------------------------------------------------------------
*/
if((dcpl1 = H5Dget_create_plist(did1)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((dcpl2 = H5Dget_create_plist(did2)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((stl1 = H5Pget_layout(dcpl1)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
if((stl2 = H5Pget_layout(dcpl2)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
/*-------------------------------------------------------------------------
* check for empty datasets
@@ -297,10 +299,10 @@ hsize_t diff_datasetid( hid_t did1,
*/
h5difftrace("check for memory type and sizes\n");
if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
m_size1 = H5Tget_size(m_tid1);
m_size2 = H5Tget_size(m_tid2);
@@ -362,14 +364,14 @@ hsize_t diff_datasetid( hid_t did1,
if (FAIL == match_up_memsize (f_tid1, f_tid2,
&m_tid1, &m_tid2,
&m_size1, &m_size2))
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "match_up_memsize failed");
h5diffdebug3("m_size: %ld - %ld\n", m_size1, m_size2);
dadims = dims1;
dam_size = m_size1;
dam_tid = m_tid1;
danelmts = nelmts1;
need = (size_t)(nelmts1 * m_size1); /* bytes needed */
- }
+ }
else {
h5diffdebug3("Array dims: %d - %d\n", dims1[0], dims2[0]);
/* Compare the smallest array, but create the largest buffer */
@@ -407,10 +409,10 @@ hsize_t diff_datasetid( hid_t did1,
if(buf1 != NULL && buf2 != NULL) {
h5difftrace("buf1 != NULL && buf2 != NULL\n");
if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
h5difftrace("H5Dread did2\n");
if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
/* array diff */
nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims,
@@ -421,6 +423,14 @@ hsize_t diff_datasetid( hid_t did1,
H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
} /* end if */
+ if(buf1 != NULL) {
+ HDfree(buf1);
+ buf1 = NULL;
+ }
+ if(buf2 != NULL) {
+ HDfree(buf2);
+ buf2 = NULL;
+ }
} /* end if */
else { /* possibly not enough memory, read/compare by hyperslabs */
size_t p_type_nbytes = dam_size; /*size of memory type */
@@ -462,9 +472,9 @@ hsize_t diff_datasetid( hid_t did1,
* E.g., sm_space.
*/
if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
sm_nelmts = sm_nbytes / p_type_nbytes;
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
@@ -481,19 +491,19 @@ hsize_t diff_datasetid( hid_t did1,
hs_nelmts *= hs_size[i];
} /* end for */
if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
} /* end if */
else
hs_nelmts = 1;
if(H5Dread(did1, m_tid1, sm_space, sid1, H5P_DEFAULT, sm_buf1) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
if(H5Dread(did2, m_tid2, sm_space, sid2, H5P_DEFAULT, sm_buf2) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
/* get array differences. in the case of hyperslab read, increment the number of differences
found in each hyperslab and pass the position at the beginning for printing */
@@ -515,6 +525,14 @@ hsize_t diff_datasetid( hid_t did1,
carry = 0;
} /* i */
} /* elmtno */
+ if(sm_buf1 != NULL) {
+ HDfree(sm_buf1);
+ sm_buf1 = NULL;
+ }
+ if(sm_buf2 != NULL) {
+ HDfree(sm_buf2);
+ sm_buf2 = NULL;
+ }
H5Sclose(sm_space);
} /* hyperslab read */
@@ -525,40 +543,11 @@ hsize_t diff_datasetid( hid_t did1,
* close
*-------------------------------------------------------------------------
*/
- h5difftrace("compare attributes?\n");
-
- /* free */
- if(buf1 != NULL) {
- HDfree(buf1);
- buf1 = NULL;
- } /* end if */
- if(buf2 != NULL) {
- HDfree(buf2);
- buf2 = NULL;
- } /* end if */
- if(sm_buf1 != NULL) {
- HDfree(sm_buf1);
- sm_buf1 = NULL;
- } /* end if */
- if(sm_buf2 != NULL) {
- HDfree(sm_buf2);
- sm_buf2 = NULL;
- } /* end if */
+ h5difftrace("reclaim any VL memory\n");
- H5E_BEGIN_TRY {
- H5Sclose(sid1);
- H5Sclose(sid2);
- H5Tclose(f_tid1);
- H5Tclose(f_tid2);
- H5Tclose(m_tid1);
- H5Tclose(m_tid2);
- } H5E_END_TRY;
- h5difftrace("diff_datasetid finish\n");
-
- return nfound;
+done:
-error:
- options->err_stat=1;
+ options->err_stat = ret_value;
/* free */
if(buf1 != NULL) {
@@ -600,7 +589,7 @@ error:
H5Tclose(m_tid2);
/* enable error reporting */
} H5E_END_TRY;
- h5difftrace("diff_datasetid errored\n");
+ h5diffdebug3("diff_datasetid return:%d with nfound:%d\n", ret_value, nfound);
return nfound;
}
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index f8f1810..c9b0807 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -12,16 +12,10 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Thursday, July 23, 1998
- *
* Purpose: A library for displaying the values of a dataset in a human
* readable format.
*/
-#include <stdio.h>
-#include <stdlib.h>
-
#include "h5tools.h"
#include "h5tools_dump.h"
#include "h5tools_ref.h"
@@ -29,72 +23,72 @@
#include "H5private.h"
h5tool_format_t h5tools_dataformat = {
-0, /*raw */
-
-"", /*fmt_raw */
-"%d", /*fmt_int */
-"%u", /*fmt_uint */
-"%hhd", /*fmt_schar */
-"%u", /*fmt_uchar */
-"%d", /*fmt_short */
-"%u", /*fmt_ushort */
-"%ld", /*fmt_long */
-"%lu", /*fmt_ulong */
-NULL, /*fmt_llong */
-NULL, /*fmt_ullong */
-"%g", /*fmt_double */
-"%g", /*fmt_float */
-
-0, /*ascii */
-0, /*str_locale */
-0, /*str_repeat */
-
-"[ ", /*arr_pre */
-",", /*arr_sep */
-" ]", /*arr_suf */
-1, /*arr_linebreak */
-
-"", /*cmpd_name */
-",\n", /*cmpd_sep */
-"{", /*cmpd_pre */
-"}", /*cmpd_suf */
-"\n", /*cmpd_end */
-
-", ", /*vlen_sep */
-"(", /*vlen_pre */
-")", /*vlen_suf */
-"", /*vlen_end */
-
-"%s", /*elmt_fmt */
-",", /*elmt_suf1 */
-" ", /*elmt_suf2 */
-
-"", /*idx_n_fmt */
-"", /*idx_sep */
-"", /*idx_fmt */
-
-80, /*line_ncols *//*standard default columns */
-0, /*line_per_line */
-"", /*line_pre */
-"%s", /*line_1st */
-"%s", /*line_cont */
-"", /*line_suf */
-"", /*line_sep */
-1, /*line_multi_new */
-" ", /*line_indent */
-
-1, /*skip_first */
-
-1, /*obj_hidefileno */
-" "H5_PRINTF_HADDR_FMT, /*obj_format */
-
-1, /*dset_hidefileno */
-"DATASET %s ", /*dset_format */
-"%s", /*dset_blockformat_pre */
-"%s", /*dset_ptformat_pre */
-"%s", /*dset_ptformat */
-1, /*array indices */
-1 /*escape non printable characters */
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%hhd", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "[ ", /*arr_pre */
+ ",", /*arr_sep */
+ " ]", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ ",\n", /*cmpd_sep */
+ "{", /*cmpd_pre */
+ "}", /*cmpd_suf */
+ "\n", /*cmpd_end */
+
+ ", ", /*vlen_sep */
+ "(", /*vlen_pre */
+ ")", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ ",", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ "", /*idx_n_fmt */
+ "", /*idx_sep */
+ "", /*idx_fmt */
+
+ 80, /*line_ncols *//*standard default columns */
+ 0, /*line_per_line */
+ "", /*line_pre */
+ "%s", /*line_1st */
+ "%s", /*line_cont */
+ "", /*line_suf */
+ "", /*line_sep */
+ 1, /*line_multi_new */
+ " ", /*line_indent */
+
+ 1, /*skip_first */
+
+ 1, /*obj_hidefileno */
+ " "H5_PRINTF_HADDR_FMT, /*obj_format */
+
+ 1, /*dset_hidefileno */
+ "DATASET %s ", /*dset_format */
+ "%s", /*dset_blockformat_pre */
+ "%s", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
+ 1, /*array indices */
+ 1 /*escape non printable characters */
};
const h5tools_dump_header_t h5tools_standardformat = {
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index a556b0a..2cdaf74 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -65,16 +65,16 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g;
* H5TOOLS_INFO macro, used to facilitate error reporting . The arguments are the major
* error number, the minor error number, and a description of the error.
*/
-#define H5TOOLS_INFO(min_id, str) { \
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, str); \
+#define H5TOOLS_INFO(min_id, ...) { \
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \
}
/*
* HERROR macro, used to facilitate error reporting . The arguments are the major
* error number, the minor error number, and a description of the error.
*/
-#define HERROR(maj_id, min_id, str) { \
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, str); \
+#define HERROR(maj_id, min_id, ...) { \
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \
ret_value = FAIL; \
}
@@ -103,8 +103,8 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g;
* The return value is assigned to a variable `ret_value' and control branches
* to the `catch_except' label, if we're not already past it.
*/
-#define H5E_THROW(fail_value, min_id, str) { \
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, str); \
+#define H5E_THROW(fail_value, min_id, ...) { \
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \
H5_LEAVE(fail_value) \
}
@@ -114,8 +114,8 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g;
* error string. The return value is assigned to a variable `ret_value' and
* control branches to the `done' label.
*/
-#define HGOTO_ERROR(fail_value, min_id, str) { \
- HERROR(H5E_tools_g, min_id, str); \
+#define HGOTO_ERROR(fail_value, min_id, ...) { \
+ HERROR(H5E_tools_g, min_id, __VA_ARGS__); \
HGOTO_DONE(fail_value) \
}
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 65be089..9b5df25 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -20,9 +20,9 @@
*/
static void print_warning(const char *dname, const char *fname)
{
- fprintf(stderr,
- "warning: dataset <%s> cannot be read, %s filter is not available\n",
- dname, fname);
+ fprintf(stderr,
+ "warning: dataset <%s> cannot be read, %s filter is not available\n",
+ dname, fname);
}
/*-------------------------------------------------------------------------
@@ -34,100 +34,97 @@ static void print_warning(const char *dname, const char *fname)
* 2) the internal filters might be turned off
*
* Return: 1, can read, 0, cannot, -1 error
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: March 1, 2004
- *
*-------------------------------------------------------------------------
*/
int h5tools_canreadf(const char* name, /* object name, serves also as boolean print */
hid_t dcpl_id) /* dataset creation property list */
{
+ int ret_value = 1; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int nfilters; /* number of filters */
+ H5Z_filter_t filtn; /* filter identification number */
+ int i; /* index */
+ int udfilter_avail; /* index */
+
+ /* get information about filters */
+ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed");
+
+ /* if we do not have filters, we can read the dataset safely */
+ if (!nfilters)
+ HGOTO_DONE(1);
+
+ /* check availability of filters */
+ for (i = 0; i < nfilters; i++) {
+ if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, 0, 0, 0, (size_t) 0, 0, NULL)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_filter2 failed");
+
+ switch (filtn) {
+ /*-------------------------------------------------------------------------
+ * user defined filter
+ *-------------------------------------------------------------------------
+ */
+ default:
+ if ((udfilter_avail = H5Zfilter_avail(filtn)) < 0) {
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Zfilter_avail failed");
+ }
+ else if (!udfilter_avail) {
+ if (name)
+ print_warning(name, "user defined");
+ ret_value = 0;
+ }
+ break;
- int nfilters; /* number of filters */
- H5Z_filter_t filtn; /* filter identification number */
- int i; /* index */
- int udfilter_avail; /* index */
-
- /* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
- return -1;
-
- /* if we do not have filters, we can read the dataset safely */
- if (!nfilters)
- return 1;
-
- /* check availability of filters */
- for (i = 0; i < nfilters; i++) {
- if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, 0, 0, 0, (size_t) 0, 0, NULL)) < 0)
- return -1;
-
- switch (filtn) {
- /*-------------------------------------------------------------------------
- * user defined filter
- *-------------------------------------------------------------------------
- */
- default:
- if ((udfilter_avail = H5Zfilter_avail(filtn)) < 0)
- return -1;
- else if (udfilter_avail == 0) {
- if (name)
- print_warning(name, "user defined");
- return 0;
- }
- break;
-
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_DEFLATE:
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_DEFLATE:
#ifndef H5_HAVE_FILTER_DEFLATE
- if (name)
- print_warning(name,"deflate");
- return 0;
+ if (name)
+ print_warning(name,"deflate");
+ ret_value = 0;
#endif
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP 4 , szip compression
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SZIP:
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP 4 , szip compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SZIP:
#ifndef H5_HAVE_FILTER_SZIP
- if (name)
- print_warning(name,"SZIP");
- return 0;
+ if (name)
+ print_warning(name,"SZIP");
+ ret_value = 0;
#endif
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SHUFFLE 2 , shuffle the data
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SHUFFLE:
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_FLETCHER32:
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_NBIT
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_NBIT:
- break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SCALEOFFSET:
- break;
- }/*switch*/
- }/*for*/
-
- return 1;
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SHUFFLE:
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_FLETCHER32:
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_NBIT
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_NBIT:
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SCALEOFFSET
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SCALEOFFSET:
+ break;
+ }/*switch*/
+ }/*for*/
+
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -138,30 +135,26 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
* except SZIP, which may be configured decoder-only.
*
* Return: 1, can write, 0, cannot, -1 error
- *
- * Programmer:
- *
- * Date: October 5, 2004
- *
*-------------------------------------------------------------------------
*/
-int h5tools_can_encode(H5Z_filter_t filtn) {
- switch (filtn) {
- /* user defined filter */
- default:
+int
+h5tools_can_encode(H5Z_filter_t filtn) {
+ switch (filtn) {
+ /* user defined filter */
+ default:
return 0;
- case H5Z_FILTER_DEFLATE:
+ case H5Z_FILTER_DEFLATE:
#ifndef H5_HAVE_FILTER_DEFLATE
return 0;
#endif
break;
- case H5Z_FILTER_SZIP:
+ case H5Z_FILTER_SZIP:
#ifndef H5_HAVE_FILTER_SZIP
return 0;
#else
- {
+ {
unsigned int filter_config_flags;
if (H5Zget_filter_info(filtn, &filter_config_flags) < 0)
@@ -170,36 +163,36 @@ int h5tools_can_encode(H5Z_filter_t filtn) {
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
/* filter present but neither encode nor decode is supported (???) */
return -1;
- }
+ }
else if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) {
/* decoder only: read but not write */
return 0;
- }
+ }
else if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
/* encoder only: write but not read (???) */
return -1;
- }
+ }
else if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED))
== (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
return 1;
}
- }
+ }
#endif
break;
- case H5Z_FILTER_SHUFFLE:
+ case H5Z_FILTER_SHUFFLE:
break;
- case H5Z_FILTER_FLETCHER32:
+ case H5Z_FILTER_FLETCHER32:
break;
- case H5Z_FILTER_NBIT:
+ case H5Z_FILTER_NBIT:
break;
- case H5Z_FILTER_SCALEOFFSET:
+ case H5Z_FILTER_SCALEOFFSET:
break;
}/*switch*/
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 6153f0c..d6e5f01 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -166,7 +166,8 @@ haddr_t
ref_path_table_lookup(const char *thepath)
{
H5O_info_t oi;
- if((HDstrlen(thepath) == 0) || (thepath == NULL))
+
+ if((thepath == NULL) || (HDstrlen(thepath) == 0))
return HADDR_UNDEF;
/* Allow lookups on the root group, even though it doesn't have any link info */
if(HDstrcmp(thepath, "/")) {
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 1719929..c4df03a 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -12,20 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Bill Wendling <wendling@ncsa.uiuc.edu>
- * Monday, 19. February 2001
- *
* Purpose: These are string functions for us to use and abuse.
*/
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "H5private.h"
#include "h5tools.h" /* for h5tool_format_t structure */
#include "h5tools_ref.h"
-#include "h5tools_str.h" /*function prototypes */
+#include "h5tools_str.h" /* function prototypes */
/*
* If REPEAT_VERBOSE is defined then character strings will be printed so
diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c
index 6a5df98..c894598 100644
--- a/tools/lib/io_timer.c
+++ b/tools/lib/io_timer.c
@@ -22,9 +22,6 @@
* This is a module of useful timing functions for performance testing.
*/
-#include <stdio.h>
-#include <stdlib.h>
-
#include "H5private.h"
#include "hdf5.h"
@@ -53,9 +50,9 @@ io_time_t *timer_g; /* timer: global for stub functions */
static double sub_time(struct timeval* a, struct timeval* b)
{
return (((double)a->tv_sec +
- ((double)a->tv_usec) / MICROSECOND) -
+ ((double)a->tv_usec) / (double)MICROSECOND) -
((double)b->tv_sec +
- ((double)b->tv_usec) / MICROSECOND));
+ ((double)b->tv_usec) / (double)MICROSECOND));
}
@@ -195,8 +192,9 @@ set_time(io_time_t *pt, timer_type t, int start_stop)
}
break;
+
default:
- HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type);
+ HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type);
return NULL;
} /* end switch */