From ff4a9d0ec2e85cf15f769006e92e756a79869ab8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 30 Jul 2020 11:25:24 -0500 Subject: Warnings reduction in tools --- tools/lib/h5diff.c | 2 +- tools/lib/h5diff.h | 1 + tools/lib/h5diff_array.c | 201 +++++++++++++++++++++--------------------- tools/lib/h5diff_attr.c | 12 ++- tools/lib/h5diff_dset.c | 14 ++- tools/lib/h5tools.c | 2 +- tools/lib/h5tools_dump.c | 6 +- tools/lib/h5tools_str.c | 16 ++-- tools/src/h5import/h5import.c | 4 +- tools/src/h5ls/h5ls.c | 2 - 10 files changed, 126 insertions(+), 134 deletions(-) diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 96c2d32..87a3b11 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -234,7 +234,7 @@ done: * 0 - not excluded path *------------------------------------------------------------------------*/ static int -is_exclude_attr (char *path, h5trav_type_t type, diff_opt_t *opts) +is_exclude_attr (const char *path, h5trav_type_t type, diff_opt_t *opts) { struct exclude_path_list *exclude_ptr; int ret_cmp; diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index c3c111f..f44f653 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -57,6 +57,7 @@ typedef struct { int mode_list_not_cmp; /* list not comparable messages */ int print_header; /* print header */ int print_percentage; /* print percentage */ + int print_dims; /* print dimension index */ int delta_bool; /* delta, absolute value to compare */ double delta; /* delta value */ int use_system_epsilon; /* flag to use system epsilon (1 or 0) */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 9b680ec..1a4c727 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -134,7 +134,7 @@ typedef struct mcomp_t { */ static hbool_t all_zero(const void *_mem, size_t size); static int ull2float(unsigned long long ull_value, float *f_value); -static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, ssize_t u, diff_opt_t *opts); +static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts); static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, 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); @@ -143,7 +143,7 @@ static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t #endif static int print_data(diff_opt_t *opts); -static void print_pos(diff_opt_t *opts, hsize_t elemtno, ssize_t u); +static void print_pos(diff_opt_t *opts, hsize_t elemtno, size_t u); static void h5diff_print_char(char ch); static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts); @@ -210,7 +210,6 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_ unsigned char *mem1 = (unsigned char*) _mem1; unsigned char *mem2 = (unsigned char*) _mem2; hsize_t i; - int j; mcomp_t members; H5T_class_t type_class; @@ -680,7 +679,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co */ nfound += 1; opts->print_percentage = 0; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(S_FORMAT, enum_name1, enum_name2); } @@ -690,7 +689,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co if (HDstrcmp(enum_name1, enum_name2) != 0) { nfound = 1; opts->print_percentage = 0; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(S_FORMAT, enum_name1, enum_name2); } @@ -1528,7 +1527,7 @@ done: *------------------------------------------------------------------------- */ -static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, ssize_t u, diff_opt_t *opts) +static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts) { hsize_t nfound = 0; /* differences found */ char temp1_uchar; @@ -1541,6 +1540,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, ssize_ if (temp1_uchar != temp2_uchar) { if (print_data(opts)) { opts->print_percentage = 0; + opts->print_dims = 1; print_pos(opts, elemtno, u); parallel_print(" "); h5diff_print_char(temp1_uchar); @@ -1580,7 +1580,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -1592,7 +1592,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } @@ -1604,7 +1604,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h PER_UNSIGN(signed char, temp1_uchar, temp2_uchar); if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } @@ -1613,7 +1613,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h } else if (temp1_uchar != temp2_uchar) { opts->print_percentage = 0; - print_pos(opts, elemtno, -1); + print_pos(opts, elemtno, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -1668,7 +1668,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz if (!isnan1 && !isnan2) { if ((double) ABS(temp1_float - temp2_float) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1678,7 +1678,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1704,7 +1704,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1712,7 +1712,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); @@ -1723,7 +1723,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1750,7 +1750,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1758,7 +1758,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float)); @@ -1769,7 +1769,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1783,7 +1783,7 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz else { if (equal_float(temp1_float, temp2_float, opts) == FALSE) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float)); } @@ -1836,7 +1836,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi if (!isnan1 && !isnan2) { if (ABS(temp1_double-temp2_double) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1846,7 +1846,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1873,7 +1873,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1881,7 +1881,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); @@ -1892,7 +1892,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1919,7 +1919,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1927,7 +1927,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); @@ -1938,7 +1938,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -1952,7 +1952,7 @@ static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsi else { if (equal_double(temp1_double, temp2_double, opts) == FALSE) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2009,7 +2009,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs if (!isnan1 && !isnan2) { if (ABS(temp1_double-temp2_double) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2019,7 +2019,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2046,7 +2046,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2054,7 +2054,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); } @@ -2064,7 +2064,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2091,7 +2091,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2099,7 +2099,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs } else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double)); } @@ -2109,7 +2109,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs /* only one is NaN, assume difference */ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2122,7 +2122,7 @@ static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hs */ else if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double)); } @@ -2159,7 +2159,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_char-temp2_char) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } @@ -2172,7 +2172,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } @@ -2180,7 +2180,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); } @@ -2193,7 +2193,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } @@ -2201,7 +2201,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && ABS(temp1_char - temp2_char) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per); } @@ -2210,7 +2210,7 @@ static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (temp1_char != temp2_char) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char)); } @@ -2246,7 +2246,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -2259,7 +2259,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -2267,7 +2267,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } @@ -2280,7 +2280,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -2288,7 +2288,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && PDIFF(temp1_uchar, temp2_uchar) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per); } @@ -2297,7 +2297,7 @@ static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (temp1_uchar != temp2_uchar) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } @@ -2333,7 +2333,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_short - temp2_short) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } @@ -2346,7 +2346,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } @@ -2354,7 +2354,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); } @@ -2367,7 +2367,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } @@ -2375,7 +2375,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && ABS(temp1_short - temp2_short) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per); } @@ -2384,7 +2384,7 @@ static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (temp1_short != temp2_short) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short)); } @@ -2420,7 +2420,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_ushort, temp2_ushort) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } @@ -2433,7 +2433,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } @@ -2441,7 +2441,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); } @@ -2454,7 +2454,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } @@ -2462,7 +2462,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent && PDIFF(temp1_ushort, temp2_ushort) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per); } @@ -2471,7 +2471,7 @@ static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (temp1_ushort != temp2_ushort) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort)); } @@ -2507,7 +2507,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_int-temp2_int) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } @@ -2520,7 +2520,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } @@ -2528,7 +2528,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); } @@ -2541,7 +2541,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } @@ -2549,7 +2549,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ } else if (per > opts->percent && ABS(temp1_int - temp2_int) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per); } @@ -2558,7 +2558,7 @@ static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_ } else if (temp1_int != temp2_int) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int)); } @@ -2594,7 +2594,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_uint, temp2_uint) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } @@ -2607,7 +2607,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } @@ -2615,7 +2615,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); } @@ -2628,7 +2628,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } @@ -2636,7 +2636,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (per > opts->percent && PDIFF(temp1_uint,temp2_uint) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per); } @@ -2645,7 +2645,7 @@ static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (temp1_uint != temp2_uint) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint)); } @@ -2681,7 +2681,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_long-temp2_long) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } @@ -2694,7 +2694,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } @@ -2702,7 +2702,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); } @@ -2715,7 +2715,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } @@ -2723,7 +2723,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per); } @@ -2732,7 +2732,7 @@ static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize } else if (temp1_long != temp2_long) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long)); } @@ -2768,7 +2768,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_ulong, temp2_ulong) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } @@ -2781,7 +2781,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } @@ -2789,7 +2789,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); } @@ -2802,7 +2802,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } @@ -2810,7 +2810,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per); } @@ -2819,7 +2819,7 @@ static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (temp1_ulong != temp2_ulong) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong)); } @@ -2856,7 +2856,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (opts->delta_bool && !opts->percent_bool) { if (ABS( temp1_llong-temp2_llong) > opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } @@ -2869,7 +2869,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } @@ -2877,7 +2877,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per); } @@ -2890,7 +2890,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } @@ -2898,7 +2898,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz } else if (per > opts->percent && ABS(temp1_llong-temp2_llong) > opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per); } @@ -2908,7 +2908,7 @@ static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsiz else { if (temp1_llong != temp2_llong) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong)); } @@ -2947,7 +2947,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } @@ -2962,7 +2962,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } @@ -2970,7 +2970,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong,temp2_ullong), per); } @@ -2985,7 +2985,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi if (not_comparable && !both_zero) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } @@ -2993,7 +2993,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi } else if (per > opts->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) { opts->print_percentage = 1; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong), per); } @@ -3003,7 +3003,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi else { if (temp1_ullong != temp2_ullong) { opts->print_percentage = 0; - print_pos(opts, elem_idx, -1); + print_pos(opts, elem_idx, 0); if (print_data(opts)) { parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong)); } @@ -3254,7 +3254,7 @@ void print_header(diff_opt_t *opts) *------------------------------------------------------------------------- */ static -void print_pos(diff_opt_t *opts, hsize_t idx, ssize_t u) +void print_pos(diff_opt_t *opts, hsize_t idx, size_t u) { int i,j; @@ -3317,7 +3317,7 @@ void print_pos(diff_opt_t *opts, hsize_t idx, ssize_t u) * Calculate the number of elements represented by a unit change in a * certain index position. */ - calc_acc_pos(opts->rank, curr_pos, opts->acc, opts->pos); + calc_acc_pos((unsigned)opts->rank, curr_pos, opts->acc, opts->pos); for (i = 0; i < opts->rank; i++) { H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld opts->sm_pos=%ld", i, opts->pos[i], opts->sm_pos[i]); @@ -3329,10 +3329,11 @@ void print_pos(diff_opt_t *opts, hsize_t idx, ssize_t u) parallel_print("]"); } else { - if (u >= 0) { + if (opts->print_dims) { parallel_print("[ "); parallel_print("%zu", u); parallel_print("]"); + opts->print_dims = 0; } else parallel_print(" "); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 774859b..b7ec2e8 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -387,18 +387,16 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, j = (int)HDstrlen(name1); H5TOOLS_DEBUG("attr1_name: %s - %d", name1, j); if (j > 0) { - opts->obj_name[0] = (char *)HDcalloc((size_t)j + 1, sizeof(char)); - HDstrncpy(opts->obj_name[0], name1, (size_t)j); - opts->obj_name[0][j] = '\0'; + opts->obj_name[0] = (char *)HDmalloc((size_t)j + 1); + HDstrncpy(opts->obj_name[0], name1, (size_t)j + 1); } } if (name2) { j = (int)HDstrlen(name2); H5TOOLS_DEBUG("attr2_name: %s - %d", name2, j); if (j > 0) { - opts->obj_name[1] = (char *)HDcalloc((size_t)j + 1, sizeof(char)); - HDstrncpy(opts->obj_name[1], name2, (size_t)j); - opts->obj_name[1][j] = '\0'; + opts->obj_name[1] = (char *)HDmalloc((size_t)j + 1); + HDstrncpy(opts->obj_name[1], name2, (size_t)j + 1); } } H5TOOLS_DEBUG("attr_names: %s - %s", opts->obj_name[0], opts->obj_name[1]); @@ -424,7 +422,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, opts->nelmts *= dims1[j]; } opts->rank = rank1; - init_acc_pos(opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx); + init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx); /*--------------------------------------------------------------------- * read diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 602255e..944440e 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -277,9 +277,8 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n j = (int)HDstrlen(obj1_name); H5TOOLS_DEBUG("obj1_name: %s - %d", obj1_name, j); if (j > 0) { - opts->obj_name[0] = (char *)HDcalloc((size_t)j + 1, sizeof(char)); - HDstrncpy(opts->obj_name[0], obj1_name, (size_t)j ); - opts->obj_name[0][j] = '\0'; + opts->obj_name[0] = (char *)HDmalloc((size_t)j + 1); + HDstrncpy(opts->obj_name[0], obj1_name, (size_t)j + 1); } } @@ -289,9 +288,8 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n j = (int)HDstrlen(obj2_name); H5TOOLS_DEBUG("obj2_name: %s - %d", obj2_name, j); if (j > 0) { - opts->obj_name[1] = (char *)HDcalloc((size_t)j + 1, sizeof(char)); - HDstrncpy(opts->obj_name[1], obj2_name, (size_t)j); - opts->obj_name[1][j] = '\0'; + opts->obj_name[1] = (char *)HDmalloc((size_t)j + 1); + HDstrncpy(opts->obj_name[1], obj2_name, (size_t)j + 1); } } @@ -451,7 +449,7 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n } /* end if */ /* Assume entire data space to be printed */ - init_acc_pos(opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx); + init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx); for(i = 0; i < opts->rank; i++) { opts->p_max_idx[i] = opts->dims[i]; @@ -792,7 +790,7 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n opts->sm_pos[j] = low[j]; /* Assume entire data space to be printed */ - init_acc_pos(opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx); + init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx); /* 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 */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index d9c6715..55c69a7 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1670,7 +1670,7 @@ calc_acc_pos(unsigned ndims, hsize_t elmtno, hsize_t *acc, hsize_t *pos) H5TOOLS_START_DEBUG(""); if(ndims > 0) { - for(i = 0; i < (size_t) ndims; i++) { + for(i = 0; i < (int)ndims; i++) { if(curr_pos > 0) { H5TOOLS_DEBUG("curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, acc[i]); pos[i] = curr_pos / acc[i]; diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 187ba18..b1be577 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1252,7 +1252,6 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c size_t j; /* counters */ hsize_t zero[1] = {0}; /* vector of zeros */ unsigned int flags; /* buffer extent flags */ - hsize_t elmtno; /* elemnt index */ hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */ hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */ size_t p_type_nbytes; /* size of memory type */ @@ -1565,9 +1564,8 @@ static herr_t h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type) { int sndims; - hid_t f_space = H5I_INVALID_HID; /* file data space */ - size_t i; /* counters */ - hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ + hid_t f_space = H5I_INVALID_HID; /* file data space */ + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ hbool_t past_catch = FALSE; herr_t ret_value = SUCCEED; diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index d612fbd..1c573a7 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -286,17 +286,14 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hs h5tools_context_t *ctx) { size_t i = 0; - hsize_t curr_pos = elmtno; H5TOOLS_START_DEBUG(""); H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); h5tools_str_reset(str); - curr_pos = calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos); + calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos); if(ctx->ndims > 0) { - HDassert(curr_pos == 0); - /* Print the index values */ for(i = 0; i < (size_t) ctx->ndims; i++) { if (i) @@ -329,17 +326,14 @@ h5tools_str_region_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *i hsize_t *ptdata, h5tools_context_t *ctx) { size_t i = 0; - hsize_t curr_pos = elmtno; H5TOOLS_START_DEBUG(""); H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); h5tools_str_reset(str); - curr_pos = calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos); + calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos); if(ctx->ndims > 0) { - HDassert(curr_pos == 0); - /* Print the index values */ for(i = 0; i < (size_t) ctx->ndims; i++) { ctx->pos[i] += (unsigned long) ptdata[ctx->sm_pos+i]; @@ -678,6 +672,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if(info->raw) { size_t i; + H5TOOLS_DEBUG("info->raw"); if(1 == nsize) h5tools_str_append(str, OPT(info->fmt_raw, "0x%02x"), ucp_vp[0]); else @@ -688,8 +683,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } } else { - if((type_class = H5Tget_class(type)) < 0) + H5TOOLS_DEBUG("H5Tget_class(type)"); + if((type_class = H5Tget_class(type)) < 0) { + H5TOOLS_ENDDEBUG(" with %s", "NULL"); return NULL; + } switch (type_class) { case H5T_FLOAT: H5TOOLS_DEBUG("H5T_FLOAT"); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index b11fe7f..4a642e0 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -3735,8 +3735,8 @@ static int getExternalFilename(struct Input *in, FILE *strm) return (-1); } - in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp)) * sizeof(char)); - (void) HDstrcpy(in->externFilename, temp); + in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp) + 1) * sizeof(char)); + (void) HDstrncpy(in->externFilename, temp, HDstrlen(temp) + 1); return (0); } diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index fef7aa9..e239cbc 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1313,7 +1313,6 @@ dump_dataset_values(hid_t dset) hid_t space = H5I_INVALID_HID; hsize_t total_size[H5S_MAX_RANK]; int ndims; - size_t i; char string_prefix[64]; static char fmt_double[16]; static char fmt_float[16]; @@ -1481,7 +1480,6 @@ dump_attribute_values(hid_t attr) hid_t space = H5I_INVALID_HID; hsize_t total_size[H5S_MAX_RANK]; int ndims; - size_t i; char string_prefix[64]; static char fmt_double[16]; static char fmt_float[16]; -- cgit v0.12