summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-12-08 17:40:30 (GMT)
committerGitHub <noreply@github.com>2021-12-08 17:40:30 (GMT)
commit0247538fc5226b0899f00c45adab2a454627de02 (patch)
tree2e56201d9a70296920e96e9ba2edb09353ce2d5f /tools/lib
parent1ca806a04eb28c1b1307fcc804a45e4722ff8563 (diff)
downloadhdf5-0247538fc5226b0899f00c45adab2a454627de02.zip
hdf5-0247538fc5226b0899f00c45adab2a454627de02.tar.gz
hdf5-0247538fc5226b0899f00c45adab2a454627de02.tar.bz2
VFD SWMR: Normalization with develop (#1270)
Brings many October-November changes from develop
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff_array.c47
-rw-r--r--tools/lib/h5diff_util.c2
-rw-r--r--tools/lib/h5tools.c14
-rw-r--r--tools/lib/h5tools_str.c2
-rw-r--r--tools/lib/h5tools_utils.c1
5 files changed, 22 insertions, 44 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 2d6c66c..1b0d36f 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -24,12 +24,8 @@
*-------------------------------------------------------------------------
*/
-#define F_FORMAT "%-15g %-15g %-15g\n"
-
-#if H5_SIZEOF_LONG_DOUBLE != 0
-#define LD_FORMAT "%-15Lg %-15Lg %-15Lg\n"
-#endif
-
+#define F_FORMAT "%-15g %-15g %-15g\n"
+#define LD_FORMAT "%-15Lg %-15Lg %-15Lg\n"
#define I_FORMAT "%-15d %-15d %-15d\n"
#define S_FORMAT "%-16s %-17s\n"
#define UI_FORMAT "%-15u %-15u %-15u\n"
@@ -39,12 +35,8 @@
#define ULLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u\n"
/* with -p option */
-#define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n"
-
-#if H5_SIZEOF_LONG_DOUBLE != 0
-#define LD_FORMAT_P "%-15.10Lg %-15.10Lg %-15.10Lg %-14.10Lg\n"
-#endif
-
+#define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n"
+#define LD_FORMAT_P "%-15.10Lg %-15.10Lg %-15.10Lg %-14.10Lg\n"
#define I_FORMAT_P "%-15d %-15d %-15d %-14f\n"
#define UI_FORMAT_P "%-15u %-15u %-15u %-14f\n"
#define LI_FORMAT_P "%-15ld %-15ld %-15ld %-14f\n"
@@ -56,12 +48,8 @@
#define SPACES " "
/* not comparable */
-#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n"
-
-#if H5_SIZEOF_LONG_DOUBLE != 0
-#define LD_FORMAT_P_NOTCOMP "%-15.10Lg %-15.10Lg %-15.10Lg not comparable\n"
-#endif
-
+#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n"
+#define LD_FORMAT_P_NOTCOMP "%-15.10Lg %-15.10Lg %-15.10Lg not comparable\n"
#define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n"
#define UI_FORMAT_P_NOTCOMP "%-15u %-15u %-15u not comparable\n"
#define LI_FORMAT_P_NOTCOMP "%-15ld %-15ld %-15ld not comparable\n"
@@ -145,9 +133,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h
diff_opt_t *opts);
static hbool_t equal_float(float value, float expected, diff_opt_t *opts);
static hbool_t equal_double(double value, double expected, diff_opt_t *opts);
-#if H5_SIZEOF_LONG_DOUBLE != 0
static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts);
-#endif
static int print_data(diff_opt_t *opts);
static void print_pos(diff_opt_t *opts, hsize_t elemtno, size_t u);
@@ -162,10 +148,8 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
diff_opt_t *opts);
static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
diff_opt_t *opts);
-#if H5_SIZEOF_LONG_DOUBLE != 0
static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
diff_opt_t *opts);
-#endif
static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
diff_opt_t *opts);
static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
@@ -191,12 +175,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
typedef enum dtype_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE } dtype_t;
-#else
-
-typedef enum dtype_t { FLT_FLOAT, FLT_DOUBLE } dtype_t;
-#endif
/*-------------------------------------------------------------------------
* XCAO, 11/10/2010
@@ -278,7 +257,6 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
return nfound;
} /* nelmts */
}
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (H5Tequal(opts->m_tid, H5T_NATIVE_LDOUBLE)) {
for (i = 0; i < opts->hs_nelmts; i++) {
nfound += diff_ldouble_element(mem1, mem2, i, opts);
@@ -289,7 +267,6 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
return nfound;
} /* nelmts */
}
-#endif
break;
case H5T_INTEGER:
@@ -1620,6 +1597,9 @@ character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno,
hbool_t both_zero = FALSE;
double per;
+ /* both_zero is set in the PER_UNSIGN macro but not used in this function */
+ (void)both_zero;
+
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
H5TOOLS_START_DEBUG(" %d=%d", temp1_uchar, temp2_uchar);
@@ -2034,7 +2014,6 @@ diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
static hsize_t
diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
@@ -2070,7 +2049,7 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double - temp2_double) > opts->delta) {
+ if ((double)ABS(temp1_double - temp2_double) > opts->delta) {
opts->print_percentage = 0;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2163,7 +2142,7 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
}
nfound++;
}
- else if (per > opts->percent && ABS(temp1_double - temp2_double) > opts->delta) {
+ else if (per > opts->percent && (double)ABS(temp1_double - temp2_double) > opts->delta) {
opts->print_percentage = 1;
print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
@@ -2200,7 +2179,6 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
return nfound;
}
-#endif /* H5_SIZEOF_LONG_DOUBLE */
/*-------------------------------------------------------------------------
* Function: diff_schar_element
@@ -3203,7 +3181,6 @@ equal_double(double value, double expected, diff_opt_t *opts)
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
static hbool_t
equal_ldouble(long double value, long double expected, diff_opt_t *opts)
{
@@ -3244,8 +3221,6 @@ equal_ldouble(long double value, long double expected, diff_opt_t *opts)
return FALSE;
}
-#endif /* #if H5_SIZEOF_LONG_DOUBLE !=0 */
-
/*-------------------------------------------------------------------------
* Function: equal_float
*
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index e487a12..c40de9d 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -133,10 +133,8 @@ print_type(hid_t type)
parallel_print("H5T_NATIVE_FLOAT");
else if (H5Tequal(type, H5T_NATIVE_DOUBLE))
parallel_print("H5T_NATIVE_DOUBLE");
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (H5Tequal(type, H5T_NATIVE_LDOUBLE))
parallel_print("H5T_NATIVE_LDOUBLE");
-#endif
else
parallel_print("undefined float");
break;
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 5e60941..78e5c48 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1903,15 +1903,21 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
hid_t region_id = H5I_INVALID_HID;
hid_t region_space = H5I_INVALID_HID;
H5S_sel_type region_type;
+ H5R_ref_t tref;
+
+ if (size > sizeof(tref))
+ H5TOOLS_THROW((-1), "unexpectedly large ref");
+
+ HDmemset(&tref, 0, sizeof(tref));
for (block_index = 0; block_index < block_nelmts; block_index++) {
mem = ((unsigned char *)_mem) + block_index * size;
- if ((region_id = H5Ropen_object((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HDmemcpy(&tref, mem, size);
+ if ((region_id = H5Ropen_object(&tref, H5P_DEFAULT, H5P_DEFAULT)) < 0)
H5TOOLS_INFO("H5Ropen_object H5T_STD_REF failed");
else {
- if ((region_space = H5Ropen_region((H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >=
- 0) {
- if (!h5tools_is_zero(mem, H5Tget_size(H5T_STD_REF))) {
+ if ((region_space = H5Ropen_region(&tref, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (!h5tools_is_zero(&tref, H5Tget_size(H5T_STD_REF))) {
region_type = H5Sget_select_type(region_space);
if (region_type == H5S_SEL_POINTS)
render_bin_output_region_points(region_space, region_id, stream,
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index abc0058..3cd12bb 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -705,7 +705,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&tempdouble, vp, sizeof(double));
h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
-#if H5_SIZEOF_LONG_DOUBLE != 0
}
else if (sizeof(long double) == nsize) {
/* if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) */
@@ -713,7 +712,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&templdouble, vp, sizeof(long double));
h5tools_str_append(str, "%Lg", templdouble);
-#endif
}
else {
size_t i;
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index f2407bf..ea9812b 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -450,6 +450,7 @@ free_table(table_t *table)
HDfree(table->objs[u].objname);
HDfree(table->objs);
+ HDfree(table);
}
#ifdef H5DUMP_DEBUG