summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5diff_array.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-10-19 20:15:44 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-10-19 20:15:44 (GMT)
commit6d7133bf01b40a013813377cd2eba29de787f1ce (patch)
treed103c5d579b548255f318dc75f0d346ae998d1c8 /tools/lib/h5diff_array.c
parent2dbd7c685fa09a5ec231212a4b0e237e5ff41ff5 (diff)
downloadhdf5-6d7133bf01b40a013813377cd2eba29de787f1ce.zip
hdf5-6d7133bf01b40a013813377cd2eba29de787f1ce.tar.gz
hdf5-6d7133bf01b40a013813377cd2eba29de787f1ce.tar.bz2
HDFFV-10297 merge from develop
Diffstat (limited to 'tools/lib/h5diff_array.c')
-rw-r--r--tools/lib/h5diff_array.c1820
1 files changed, 906 insertions, 914 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 1d53ec7..1125e45 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -131,21 +131,21 @@ typedef struct mcomp_t {
*-------------------------------------------------------------------------
*/
static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id,
- hid_t region2_id, diff_opt_t *options);
+ hid_t region2_id, diff_opt_t *opts);
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 i, unsigned u,
int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
- diff_opt_t *options, const char *obj1, const char *obj2, int *ph);
+ diff_opt_t *opts, const char *obj1, const char *obj2, int *ph);
static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
- diff_opt_t *options, const char *obj1, const char *obj2, int *ph);
-static hbool_t equal_float(float value, float expected, diff_opt_t *options);
-static hbool_t equal_double(double value, double expected, diff_opt_t *options);
+ diff_opt_t *opts, const char *obj1, const char *obj2, int *ph);
+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 *options);
+static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts);
#endif
-static int print_data(diff_opt_t *options);
+static int print_data(diff_opt_t *opts);
static void print_pos(int *ph, int pp, hsize_t curr_pos, hsize_t *acc,
hsize_t *pos, int rank, hsize_t *dims, const char *obj1, const char *obj2);
static void print_char_pos(int *ph, int pp, hsize_t curr_pos, unsigned u,
@@ -153,17 +153,17 @@ static void print_char_pos(int *ph, int pp, hsize_t curr_pos, unsigned u,
static void h5diff_print_char(char ch);
static hsize_t diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t index,
int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
- diff_opt_t *options, const char *obj1, const char *obj2,
+ diff_opt_t *opts, const char *obj1, const char *obj2,
hid_t container1_id, hid_t container2_id, /*where the reference came from*/
int *ph, /*print header */
mcomp_t *members); /*compound members */
static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
#if H5_SIZEOF_LONG_DOUBLE !=0
static hsize_t diff_ldouble(unsigned char *mem1,
@@ -174,50 +174,50 @@ static hsize_t diff_ldouble(unsigned char *mem1,
hsize_t *dims,
hsize_t *acc,
hsize_t *pos,
- diff_opt_t *options,
+ diff_opt_t *opts,
const char *obj1,
const char *obj2,
int *ph);
#endif
static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph);
/*-------------------------------------------------------------------------
@@ -254,11 +254,6 @@ static void close_member_types(mcomp_t *members);
* Purpose: compare two memory buffers;
*
* Return: number of differences found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 12, 2003
- *
*-------------------------------------------------------------------------
*/
@@ -269,7 +264,7 @@ hsize_t diff_array(
hsize_t hyper_start,
int rank,
hsize_t *dims,
- diff_opt_t *options,
+ diff_opt_t *opts,
const char *name1,
const char *name2,
hid_t m_type,
@@ -288,7 +283,7 @@ hsize_t diff_array(
mcomp_t members;
H5T_class_t type_class;
- h5difftrace("diff_array start\n");
+ h5diffdebug2("diff_array start - errstat:%d\n", opts->err_stat);
/* get the size. */
size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@@ -327,36 +322,36 @@ hsize_t diff_array(
*/
case H5T_FLOAT:
if (H5Tequal(m_type, H5T_NATIVE_FLOAT))
- nfound = diff_float(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_float(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
- nfound = diff_double(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_double(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
#if H5_SIZEOF_LONG_DOUBLE != 0
else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE))
- nfound = diff_ldouble(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_ldouble(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
#endif
break;
case H5T_INTEGER:
if (H5Tequal(m_type, H5T_NATIVE_SCHAR))
- nfound = diff_schar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_schar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_UCHAR))
- nfound = diff_uchar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_uchar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_SHORT))
- nfound = diff_short(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_short(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_USHORT))
- nfound = diff_ushort(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_ushort(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_INT))
- nfound = diff_int(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_int(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_UINT))
- nfound = diff_uint(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_uint(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_LONG))
- nfound = diff_long(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_long(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_ULONG))
- nfound = diff_ulong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_ulong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_LLONG))
- nfound = diff_llong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_llong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
else if (H5Tequal(m_type, H5T_NATIVE_ULLONG))
- nfound = diff_ullong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, name1, name2, &ph);
+ nfound = diff_ullong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
break;
/*-------------------------------------------------------------------------
@@ -374,16 +369,14 @@ hsize_t diff_array(
HDmemset(&members, 0, sizeof(mcomp_t));
get_member_types(m_type, &members);
for (i = 0; i < nelmts; i++) {
- nfound += diff_datum(mem1 + i * size, mem2 + i * size, m_type, i, rank, dims, acc, pos, options,
+ nfound += diff_datum(mem1 + i * size, mem2 + i * size, m_type, i, rank, dims, acc, pos, opts,
name1, name2, container1_id, container2_id, &ph, &members);
- if (options->n && nfound >= options->count) {
- close_member_types(&members);
- return nfound;
- }
+ if (opts->n && nfound >= opts->count)
+ break;
} /* i */
close_member_types(&members);
} /* switch */
- h5difftrace("diff_array finish\n");
+ h5diffdebug3("diff_array finish:%d - errstat:%d\n", nfound, opts->err_stat);
return nfound;
}
@@ -395,10 +388,6 @@ hsize_t diff_array(
*
* Return: number of differences found
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October 29, 2003
- *
* The comparison of the 2 buffers read from the files is made datum by datum.
*
* H5T_INTEGER and H5T_FLOAT
@@ -434,37 +423,35 @@ static hsize_t diff_datum(
hsize_t *dims,
hsize_t *acc,
hsize_t *pos,
- diff_opt_t *options,
+ diff_opt_t *opts,
const char *obj1,
const char *obj2,
hid_t container1_id,
hid_t container2_id, /*where the reference came from*/
- int *ph, /*print header */
- mcomp_t *members) /*compound members */
+ int *ph, /*print header */
+ mcomp_t *members) /*compound members */
{
- unsigned char *mem1 = (unsigned char*) _mem1;
- unsigned char *mem2 = (unsigned char*) _mem2;
- unsigned u;
- hid_t memb_type;
- size_t type_size;
- H5T_sign_t type_sign;
- H5T_class_t type_class;
- size_t offset;
- unsigned nmembs;
- unsigned j;
- hsize_t nelmts;
- size_t size = 0;
- hbool_t iszero1;
- hbool_t iszero2;
- hid_t obj1_id;
- hid_t obj2_id;
- hsize_t nfound = 0; /* differences found */
- int ret = 0; /* check return error */
- float f1, f2;
- double per;
- hbool_t both_zero;
+ unsigned char *mem1 = (unsigned char*) _mem1;
+ unsigned char *mem2 = (unsigned char*) _mem2;
+ unsigned u;
+ size_t type_size;
+ H5T_sign_t type_sign;
+ H5T_class_t type_class;
+ size_t offset;
+ unsigned nmembs;
+ unsigned j;
+ hsize_t nelmts;
+ size_t size = 0;
+ hbool_t iszero1;
+ hbool_t iszero2;
+ hsize_t nfound = 0; /* differences found */
+ hsize_t ret_value = opts->err_stat;
+ float f1, f2;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_datum start\n");
+
type_size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@@ -477,14 +464,14 @@ static hsize_t diff_datum(
type_class != H5T_STRING &&
type_class != H5T_VLEN &&
HDmemcmp(mem1, mem2, type_size) == 0)
- return 0;
+ HGOTO_DONE(opts->err_stat);
switch (H5Tget_class(m_type)) {
case H5T_NO_CLASS:
case H5T_TIME:
case H5T_NCLASSES:
default:
- HDassert(0);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Invalid type class");
break;
/*-------------------------------------------------------------------------
@@ -493,15 +480,17 @@ static hsize_t diff_datum(
*/
case H5T_COMPOUND:
h5difftrace("diff_datum H5T_COMPOUND\n");
+ {
+ hid_t memb_type = -1;
+ nmembs = members->n;
- nmembs = members->n;
-
- for (j = 0; j < nmembs; j++) {
- offset = members->offsets[j];
- memb_type = members->ids[j];
+ for (j = 0; j < nmembs; j++) {
+ offset = members->offsets[j];
+ memb_type = members->ids[j];
- nfound += diff_datum(mem1 + offset, mem2 + offset, memb_type, index,
- rank, dims, acc, pos, options, obj1, obj2, container1_id, container2_id, ph, members->m[j]);
+ nfound += diff_datum(mem1 + offset, mem2 + offset, memb_type, index,
+ rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members->m[j]);
+ }
}
break;
@@ -531,6 +520,7 @@ static hsize_t diff_datum(
size1 = HDstrlen(s1);
else
size1 = 0;
+
/* Get pointer to second string */
s2 = *(char**) mem2;
if (s2)
@@ -546,14 +536,17 @@ static hsize_t diff_datum(
size1 = HDstrlen(s1);
else
size1 = 0;
+
if (size1 > size_mtype)
size1 = size_mtype;
+
/* Get pointer to second string */
s2 = (char*) mem2;
if (s2)
size2 = HDstrlen(s2);
else
size2 = 0;
+
if (size2 > size_mtype)
size2 = size_mtype;
}
@@ -561,6 +554,7 @@ static hsize_t diff_datum(
/* Get pointer to first string */
s1 = (char *) mem1;
size1 = size_mtype;
+
/* Get pointer to second string */
s2 = (char *) mem2;
size2 = size_mtype;
@@ -572,6 +566,8 @@ static hsize_t diff_datum(
* of length of strings.
* For now mimic the previous way.
*/
+ h5diffdebug2("diff_datum string size:%d\n", size1);
+ h5diffdebug2("diff_datum string size:%d\n", size2);
if (size1 != size2) {
h5difftrace("diff_datum string sizes\n");
nfound++;
@@ -592,15 +588,15 @@ static hsize_t diff_datum(
/* check for NULL pointer for string */
if (s != NULL) {
/* try fast compare first */
- if (HDmemcmp(s1, s2, size) == 0) {
+ if (HDmemcmp(s, sx, size) == 0) {
if (size1 != size2)
- if (print_data(options))
+ if (print_data(opts))
for (u = size; u < sizex; u++)
- character_compare(s1 + u, s2 + u, index, u, rank, dims, acc, pos, options, obj1, obj2, ph);
+ character_compare(s + u, sx + u, index, u, rank, dims, acc, pos, opts, obj1, obj2, ph);
}
else
for (u = 0; u < size; u++)
- nfound += character_compare(s1 + u, s2 + u, index, u, rank, dims, acc, pos, options, obj1, obj2, ph);
+ nfound += character_compare(s + u, sx + u, index, u, rank, dims, acc, pos, opts, obj1, obj2, ph);
} /* end check for NULL pointer for string */
}
break;
@@ -613,7 +609,7 @@ static hsize_t diff_datum(
h5difftrace("diff_datum H5T_BITFIELD\n");
/* byte-by-byte comparison */
for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, options, obj1, obj2, ph);
+ nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph);
break;
/*-------------------------------------------------------------------------
@@ -624,7 +620,7 @@ static hsize_t diff_datum(
h5difftrace("diff_datum H5T_OPAQUE\n");
/* byte-by-byte comparison */
for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, options, obj1, obj2, ph);
+ nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph);
break;
/*-------------------------------------------------------------------------
@@ -664,7 +660,7 @@ static hsize_t diff_datum(
* don't attempt to convert them - just report errors.
*/
nfound += 1;
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(S_FORMAT, enum_name1, enum_name2);
@@ -674,7 +670,7 @@ static hsize_t diff_datum(
/* Both enum values were valid */
if (HDstrcmp(enum_name1, enum_name2) != 0) {
nfound = 1;
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(S_FORMAT, enum_name1, enum_name2);
@@ -682,7 +678,7 @@ static hsize_t diff_datum(
}
else {
for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, options, obj1, obj2, ph);
+ nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph);
}
}
/* enable error reporting */
@@ -696,8 +692,9 @@ static hsize_t diff_datum(
*/
case H5T_ARRAY:
{
+ hid_t memb_type = -1;
hsize_t adims[H5S_MAX_RANK];
- int ndims;
+ int ndims;
/* get the array's base datatype for each element */
memb_type = H5Tget_super(m_type);
@@ -711,7 +708,7 @@ static hsize_t diff_datum(
nelmts *= adims[u];
for (u = 0; u < nelmts; u++) {
nfound += diff_datum(mem1 + u * size, mem2 + u * size, memb_type, index,
- rank, dims, acc, pos, options, obj1, obj2, container1_id, container2_id, ph, members);
+ rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members);
}
H5Tclose(memb_type);
}
@@ -725,7 +722,8 @@ static hsize_t diff_datum(
iszero1 = all_zero(_mem1, H5Tget_size(m_type));
iszero2 = all_zero(_mem2, H5Tget_size(m_type));
if (iszero1 != iszero2) {
- return 1;
+ nfound++;
+ HGOTO_DONE (opts->err_stat);
}
else if (!iszero1 && !iszero2) {
/*-------------------------------------------------------------------------
@@ -733,25 +731,32 @@ static hsize_t diff_datum(
* Dataset region reference
*-------------------------------------------------------------------------
*/
- if (type_size == H5R_DSET_REG_REF_BUF_SIZE) {
- hid_t region1_id;
- hid_t region2_id;
+ hid_t obj1_id = -1;
+ hid_t obj2_id = -1;
- if ((obj1_id = H5Rdereference(container1_id, H5R_DATASET_REGION, _mem1)) < 0)
- ret = -1;
- if ((obj2_id = H5Rdereference(container2_id, H5R_DATASET_REGION, _mem2)) < 0)
- ret = -1;
- if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0)
- ret = -1;
- if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0)
- ret = -1;
+ if (type_size == H5R_DSET_REG_REF_BUF_SIZE) {
+ hid_t region1_id = -1;
+ hid_t region2_id = -1;
- if (ret == -1) {
- options->err_stat = 1;
- return 0;
+ if ((obj1_id = H5Rdereference(container1_id, H5R_DATASET_REGION, _mem1)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference object 1 failed");
+ }
+ if ((obj2_id = H5Rdereference(container2_id, H5R_DATASET_REGION, _mem2)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference object 2 failed");
+ }
+ if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 1 failed");
+ }
+ if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 2 failed");
}
- nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, options);
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts);
+
H5Oclose(obj1_id);
H5Oclose(obj2_id);
H5Sclose(region1_id);
@@ -767,41 +772,41 @@ static hsize_t diff_datum(
H5O_type_t obj1_type;
H5O_type_t obj2_type;
- if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0)
- ret = -1;
- if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0)
- ret = -1;
- if (ret == -1) {
- options->err_stat = 1;
- return 0;
- } /* end if */
+ if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 1 failed");
+ }
+ if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 2 failed");
+ }
/* check object type */
- if (obj1_type != obj2_type) {
- parallel_print(
- "Different object types referenced: <%s> and <%s>", obj1, obj2);
- options->not_cmp = 1;
- return 0;
- }
+ if (ret_value >= 0)
+ if (obj1_type != obj2_type) {
+ parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
+ opts->not_cmp = 1;
+ HGOTO_DONE (opts->err_stat);
+ }
- if ((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1)) < 0)
- ret = -1;
- if ((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2)) < 0)
- ret = -1;
- if (ret == -1) {
- options->err_stat = 1;
- return 0;
+ if ((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference object 1 failed");
+ }
+ if ((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference object 2 failed");
}
/* compare */
if (obj1_type == H5O_TYPE_DATASET)
- nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, options);
+ nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
else {
- if (options->m_verbose)
+ if (opts->m_verbose)
parallel_print(
"Warning: Comparison not possible of object types referenced: <%s> and <%s>\n",
obj1, obj2);
- options->not_cmp = 1;
+ opts->not_cmp = 1;
}
H5Oclose(obj1_id);
@@ -815,18 +820,22 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_VLEN:
- /* get the VL sequences's base datatype for each element */
- memb_type = H5Tget_super(m_type);
- size = H5Tget_size(memb_type);
+ {
+ hid_t memb_type = -1;
- /* get the number of sequence elements */
- nelmts = ((hvl_t *) mem1)->len;
+ /* get the VL sequences's base datatype for each element */
+ memb_type = H5Tget_super(m_type);
+ size = H5Tget_size(memb_type);
- for (j = 0; j < nelmts; j++)
- nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index,
- rank, dims, acc, pos, options, obj1, obj2, container1_id, container2_id, ph, members);
+ /* get the number of sequence elements */
+ nelmts = ((hvl_t *) mem1)->len;
- H5Tclose(memb_type);
+ for (j = 0; j < nelmts; j++)
+ nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index,
+ rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members);
+
+ H5Tclose(memb_type);
+ }
break;
/*-------------------------------------------------------------------------
@@ -842,13 +851,15 @@ static hsize_t diff_datum(
if (type_size == 1 && type_sign != H5T_SGN_NONE) {
char temp1_char;
char temp2_char;
- HDassert(type_size == sizeof(char));
+
+ if(type_size != sizeof(char))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not char size");
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
/* -d and !-p */
- if (options->d && !options->p) {
- if (ABS(temp1_char-temp2_char) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (ABS(temp1_char-temp2_char) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
@@ -857,19 +868,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER(temp1_char, temp2_char);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
@@ -878,19 +889,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER(temp1_char, temp2_char);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_char - temp2_char) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_char - temp2_char) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
@@ -899,7 +910,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_char != temp2_char) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
@@ -915,14 +926,16 @@ static hsize_t diff_datum(
else if (type_size == 1 && type_sign == H5T_SGN_NONE) {
unsigned char temp1_uchar;
unsigned char temp2_uchar;
- HDassert(type_size == sizeof(unsigned char));
+
+ if(type_size != sizeof(unsigned char))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned char size");
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_uchar, temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -931,19 +944,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -952,19 +965,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_uchar, temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -973,7 +986,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_uchar != temp2_uchar) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -989,14 +1002,16 @@ static hsize_t diff_datum(
else if (type_size == 2 && type_sign != H5T_SGN_NONE) {
short temp1_short;
short temp2_short;
- HDassert(type_size == sizeof(short));
+
+ if(type_size != sizeof(short))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not short size");
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
/* -d and !-p */
- if (options->d && !options->p) {
- if (ABS(temp1_short - temp2_short) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (ABS(temp1_short - temp2_short) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
@@ -1005,19 +1020,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER(temp1_short, temp2_short);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
@@ -1026,19 +1041,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER(temp1_short, temp2_short);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_short - temp2_short) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_short - temp2_short) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
@@ -1047,7 +1062,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_short != temp2_short) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
@@ -1063,14 +1078,16 @@ static hsize_t diff_datum(
else if (type_size == 2 && type_sign == H5T_SGN_NONE) {
unsigned short temp1_ushort;
unsigned short temp2_ushort;
- HDassert(type_size == sizeof(short));
+
+ if(type_size != sizeof(unsigned short))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned short size");
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_ushort, temp2_ushort) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_ushort, temp2_ushort) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
@@ -1079,19 +1096,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
@@ -1100,19 +1117,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_ushort, temp2_ushort) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_ushort, temp2_ushort) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
@@ -1121,7 +1138,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_ushort != temp2_ushort) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
@@ -1137,14 +1154,16 @@ static hsize_t diff_datum(
else if (type_size == 4 && type_sign != H5T_SGN_NONE) {
int temp1_int;
int temp2_int;
- HDassert(type_size == sizeof(int));
+
+ if(type_size != sizeof(int))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not int size");
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
/* -d and !-p */
- if (options->d && !options->p) {
- if (ABS(temp1_int-temp2_int) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (ABS(temp1_int-temp2_int) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
@@ -1153,19 +1172,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER(temp1_int, temp2_int);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
@@ -1174,19 +1193,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER(temp1_int, temp2_int);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_int - temp2_int) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_int - temp2_int) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
@@ -1195,7 +1214,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_int != temp2_int) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
@@ -1211,14 +1230,16 @@ static hsize_t diff_datum(
else if (type_size == 4 && type_sign == H5T_SGN_NONE) {
unsigned int temp1_uint;
unsigned int temp2_uint;
- HDassert(type_size == sizeof(int));
+
+ if(type_size != sizeof(unsigned int))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned int size");
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_uint, temp2_uint) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_uint, temp2_uint) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
@@ -1227,19 +1248,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed int, temp1_uint, temp2_uint);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
@@ -1248,19 +1269,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed int, temp1_uint, temp2_uint);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_uint,temp2_uint) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
@@ -1269,7 +1290,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_uint != temp2_uint) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
@@ -1285,14 +1306,16 @@ static hsize_t diff_datum(
else if (type_size == 8 && type_sign != H5T_SGN_NONE) {
long temp1_long;
long temp2_long;
- HDassert(type_size == sizeof(long));
+
+ if(type_size != sizeof(long))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long size");
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
/* -d and !-p */
- if (options->d && !options->p) {
- if (ABS(temp1_long-temp2_long) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (ABS(temp1_long-temp2_long) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
@@ -1301,19 +1324,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER(temp1_long, temp2_long);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
@@ -1322,19 +1345,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER(temp1_long, temp2_long);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_long-temp2_long) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
@@ -1343,7 +1366,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_long != temp2_long) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
@@ -1359,14 +1382,16 @@ static hsize_t diff_datum(
else if (type_size == 8 && type_sign == H5T_SGN_NONE) {
unsigned long temp1_ulong;
unsigned long temp2_ulong;
- HDassert(type_size == sizeof(unsigned long));
+
+ if(type_size != sizeof(unsigned long))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned long size");
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_ulong, temp2_ulong) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_ulong, temp2_ulong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
@@ -1375,19 +1400,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
@@ -1396,19 +1421,19 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
@@ -1417,7 +1442,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_ulong != temp2_ulong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
@@ -1433,14 +1458,16 @@ static hsize_t diff_datum(
else if (type_size == 8 && type_sign != H5T_SGN_NONE) {
long long temp1_llong;
long long temp2_llong;
- HDassert(type_size == sizeof(long long));
+
+ if(type_size != sizeof(long long))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long long size");
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
/* -d and !-p */
- if (options->d && !options->p) {
- if (ABS(temp1_llong-temp2_llong) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (ABS(temp1_llong-temp2_llong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
@@ -1449,19 +1476,19 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER(temp1_llong, temp2_llong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
@@ -1470,11 +1497,11 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER(temp1_llong, temp2_llong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
@@ -1482,9 +1509,8 @@ static hsize_t diff_datum(
nfound++;
}
- else if (per > options->percent
- && ABS(temp1_llong-temp2_llong) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_llong-temp2_llong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
@@ -1493,7 +1519,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_llong != temp2_llong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
@@ -1511,14 +1537,16 @@ static hsize_t diff_datum(
else if (type_size == 8 && type_sign == H5T_SGN_NONE) {
unsigned long long temp1_ullong;
unsigned long long temp2_ullong;
- HDassert(type_size == sizeof(unsigned long long));
+
+ if(type_size != sizeof(unsigned long long))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned long long size");
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
/* -d and !-p */
- if (options->d && !options->p) {
- if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
@@ -1527,13 +1555,13 @@ static hsize_t diff_datum(
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
ull2float(temp1_ullong, &f1);
ull2float(temp2_ullong, &f2);
PER(f1, f2);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
@@ -1541,9 +1569,9 @@ static hsize_t diff_datum(
nfound++;
}
- else if (per > options->percent) {
+ else if (per > opts->percent) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong),per);
@@ -1552,21 +1580,21 @@ static hsize_t diff_datum(
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
ull2float(temp1_ullong, &f1);
ull2float(temp2_ullong, &f2);
PER(f1, f2);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong),per);
@@ -1575,7 +1603,7 @@ static hsize_t diff_datum(
}
}
else if (temp1_ullong != temp2_ullong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
@@ -1602,31 +1630,32 @@ static hsize_t diff_datum(
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- HDassert(type_size == sizeof(float));
+ if(type_size != sizeof(float))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not float size");
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
- /* logic for detecting NaNs is different with options -d, -p and no options */
+ /* logic for detecting NaNs is different with opts -d, -p and no opts */
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_float-temp2_float) > (float) options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_float-temp2_float) > (float) opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1636,7 +1665,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1648,12 +1677,12 @@ static hsize_t diff_datum(
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
@@ -1663,15 +1692,15 @@ static hsize_t diff_datum(
PER(temp1_float, temp2_float);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- else if (per > options->percent && (double) ABS(temp1_float - temp2_float) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
@@ -1682,7 +1711,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1694,12 +1723,12 @@ static hsize_t diff_datum(
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
@@ -1709,15 +1738,15 @@ static hsize_t diff_datum(
PER(temp1_float, temp2_float);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
@@ -1728,7 +1757,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1740,8 +1769,8 @@ static hsize_t diff_datum(
* no -d and -p
*-------------------------------------------------------------------------
*/
- else if (equal_float(temp1_float, temp2_float, options) == FALSE) {
- if (print_data(options)) {
+ else if (equal_float(temp1_float, temp2_float, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -1760,30 +1789,31 @@ static hsize_t diff_datum(
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- HDassert(type_size == sizeof(double));
+ if(type_size != sizeof(double))
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not double size");
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
- /* logic for detecting NaNs is different with options -d, -p and no options */
+ /* logic for detecting NaNs is different with opts -d, -p and no opts */
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1793,24 +1823,24 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- } /* options->d && !options->p */
+ } /* opts->d && !opts->p */
/*-------------------------------------------------------------------------
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
@@ -1820,15 +1850,15 @@ static hsize_t diff_datum(
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
@@ -1838,7 +1868,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1850,12 +1880,12 @@ static hsize_t diff_datum(
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
@@ -1865,16 +1895,16 @@ static hsize_t diff_datum(
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent &&
- ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent &&
+ ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
@@ -1884,7 +1914,7 @@ static hsize_t diff_datum(
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1896,8 +1926,8 @@ static hsize_t diff_datum(
* no -d and -p
*-------------------------------------------------------------------------
*/
- else if (equal_double(temp1_double, temp2_double, options) == FALSE) {
- if (print_data(options)) {
+ else if (equal_double(temp1_double, temp2_double, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1918,7 +1948,9 @@ static hsize_t diff_datum(
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- HDassert(type_size == sizeof(long double));
+ if(type_size != sizeof(long double)) {
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long double size");
+ }
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
@@ -1929,20 +1961,20 @@ static hsize_t diff_datum(
* -d and !-p
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1952,7 +1984,7 @@ static hsize_t diff_datum(
} /* NaN */
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -1964,12 +1996,12 @@ static hsize_t diff_datum(
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
@@ -1979,15 +2011,15 @@ static hsize_t diff_datum(
PER(temp1_double,temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
@@ -1997,7 +2029,7 @@ static hsize_t diff_datum(
} /* NaN */
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2009,30 +2041,30 @@ static hsize_t diff_datum(
* -d and -p
*-------------------------------------------------------------------------
*/
- else if ( options->d && options->p) {
+ else if (opts->d && opts->p) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
- if ( !isnan1 && !isnan2) {
+ if (!isnan1 && !isnan2) {
PER(temp1_double,temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
@@ -2042,7 +2074,7 @@ static hsize_t diff_datum(
} /* NaN */
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2054,8 +2086,8 @@ static hsize_t diff_datum(
* no -d and -p
*-------------------------------------------------------------------------
*/
- else if (equal_ldouble(temp1_double, temp2_double, options) == FALSE) {
- if (print_data(options)) {
+ else if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, index, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2068,7 +2100,11 @@ static hsize_t diff_datum(
break; /* H5T_FLOAT class */
} /* switch */
- h5difftrace("diff_datum finish\n");
+
+done:
+ opts->err_stat = opts->err_stat | ret_value;
+
+ h5diffdebug3("diff_datum finish:%d - errstat:%d\n", nfound, opts->err_stat);
return nfound;
}
@@ -2079,7 +2115,6 @@ static hsize_t diff_datum(
* Purpose: Determines if memory is initialized to all zero bytes.
*
* Return: TRUE if all bytes are zero; FALSE otherwise
- *
*-------------------------------------------------------------------------
*/
@@ -2099,7 +2134,6 @@ static hbool_t all_zero(const void *_mem, size_t size) {
* Purpose: print start coordinates and opposite corner of a region block
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
@@ -2122,7 +2156,6 @@ void print_region_block(int i, hsize_t *ptdata, int ndims) {
* Purpose: print points of a region reference
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
@@ -2143,18 +2176,18 @@ void print_points(int i, hsize_t *ptdata, int ndims) {
* Purpose: diff a dataspace region
*
* Return: number of differences
- *
*-------------------------------------------------------------------------
*/
-static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *options)
+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)
{
+ hsize_t ret_value = 0;
hssize_t nblocks1, npoints1;
hssize_t nblocks2, npoints2;
hsize_t alloc_size;
- hsize_t *ptdata1;
- hsize_t *ptdata2;
+ hsize_t *ptdata1 = NULL;
+ hsize_t *ptdata2 = NULL;
int ndims1;
int ndims2;
int i, j;
@@ -2169,18 +2202,17 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
* respectively. They do not currently know how to translate from one to
* the other.
*/
- H5E_BEGIN_TRY
- {
- nblocks1 = H5Sget_select_hyper_nblocks(region1_id);
- nblocks2 = H5Sget_select_hyper_nblocks(region2_id);
+ H5E_BEGIN_TRY {
+ nblocks1 = H5Sget_select_hyper_nblocks(region1_id);
+ nblocks2 = H5Sget_select_hyper_nblocks(region2_id);
- npoints1 = H5Sget_select_elem_npoints(region1_id);
- npoints2 = H5Sget_select_elem_npoints(region2_id);
- }H5E_END_TRY;
+ npoints1 = H5Sget_select_elem_npoints(region1_id);
+ npoints2 = H5Sget_select_elem_npoints(region2_id);
+ } H5E_END_TRY;
if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) {
- options->not_cmp = 1;
- return 0;
+ opts->not_cmp = 1;
+ HGOTO_DONE (0);
}
/*-------------------------------------------------------------------------
@@ -2189,57 +2221,62 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
*/
if (nblocks1 > 0) {
HDassert(ndims1 > 0);
- alloc_size = (hsize_t) nblocks1 * (unsigned) ndims1 * 2
- * sizeof(ptdata1[0]);
+ alloc_size = (hsize_t) nblocks1 * (unsigned) ndims1 * 2 * sizeof(ptdata1[0]);
HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
- ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size);
- H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region1_id, (hsize_t) 0,
- (hsize_t) nblocks1, ptdata1);
-
- ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size);
- H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region2_id, (hsize_t) 0,
- (hsize_t) nblocks2, ptdata2);
-
- for (i = 0; i < nblocks1; i++) {
- /* start coordinates and opposite corner */
- for (j = 0; j < ndims1; j++) {
- hsize_t start1, start2, end1, end2;
+ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed");
+ }
+ else {
+ H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
+ H5Sget_select_hyper_blocklist(region1_id, (hsize_t) 0, (hsize_t) nblocks1, ptdata1);
- start1 = ptdata1[i * 2 * ndims1 + j];
- start2 = ptdata2[i * 2 * ndims1 + j];
- end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
- end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
- if (start1 != start2 || end1 != end2)
- nfound_b++;
+ if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed");
}
- }
+ else {
+ H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
+ H5Sget_select_hyper_blocklist(region2_id, (hsize_t) 0, (hsize_t) nblocks2, ptdata2);
+
+ for (i = 0; i < nblocks1; i++) {
+ /* start coordinates and opposite corner */
+ for (j = 0; j < ndims1; j++) {
+ hsize_t start1, start2, end1, end2;
+
+ start1 = ptdata1[i * 2 * ndims1 + j];
+ start2 = ptdata2[i * 2 * ndims1 + j];
+ end1 = ptdata1[i * 2 * ndims1 + j + ndims1];
+ end2 = ptdata2[i * 2 * ndims1 + j + ndims1];
+ if (start1 != start2 || end1 != end2)
+ nfound_b++;
+ }
+ }
- /* print differences if found */
- if (nfound_b && options->m_verbose) {
- H5O_info_t oi1, oi2;
+ /* print differences if found */
+ if (nfound_b && opts->m_verbose) {
+ H5O_info_t oi1, oi2;
- H5Oget_info(obj1_id, &oi1);
- H5Oget_info(obj2_id, &oi2);
+ H5Oget_info(obj1_id, &oi1);
+ H5Oget_info(obj2_id, &oi2);
- parallel_print("Referenced dataset %lu %lu\n",
- (unsigned long) oi1.addr, (unsigned long) oi2.addr);
- parallel_print(
- "------------------------------------------------------------\n");
+ parallel_print("Referenced dataset %lu %lu\n", (unsigned long) oi1.addr, (unsigned long) oi2.addr);
+ parallel_print( "------------------------------------------------------------\n");
- parallel_print("Region blocks\n");
- for (i = 0; i < nblocks1; i++) {
- parallel_print("block #%d", i);
- print_region_block(i, ptdata1, ndims1);
- print_region_block(i, ptdata2, ndims1);
- parallel_print("\n");
- }
- }
+ parallel_print("Region blocks\n");
+ for (i = 0; i < nblocks1; i++) {
+ parallel_print("block #%d", i);
+ print_region_block(i, ptdata1, ndims1);
+ print_region_block(i, ptdata2, ndims1);
+ parallel_print("\n");
+ }
+ }
+ HDfree(ptdata2);
+ } /* else ptdata2 */
- HDfree(ptdata1);
- HDfree(ptdata2);
+ HDfree(ptdata1);
+ } /* else ptdata1 */
}
/*-------------------------------------------------------------------------
@@ -2247,98 +2284,107 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
*-------------------------------------------------------------------------
*/
if (npoints1 > 0) {
- alloc_size = (hsize_t) npoints1 * (unsigned) ndims1
- * sizeof(ptdata1[0]);
+ alloc_size = (hsize_t) npoints1 * (unsigned) ndims1 * sizeof(ptdata1[0]);
HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
- ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size);
- H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
- H5Sget_select_elem_pointlist(region1_id, (hsize_t) 0,
- (hsize_t) npoints1, ptdata1);
-
- ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size);
- H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
- H5Sget_select_elem_pointlist(region2_id, (hsize_t) 0,
- (hsize_t) npoints2, ptdata2);
-
- for (i = 0; i < npoints1; i++) {
- hsize_t pt1, pt2;
+ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed");
+ }
+ else {
+ H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
+ H5Sget_select_elem_pointlist(region1_id, (hsize_t) 0, (hsize_t) npoints1, ptdata1);
- for (j = 0; j < ndims1; j++) {
- pt1 = ptdata1[i * ndims1 + j];
- pt2 = ptdata2[i * ndims1 + j];
- if (pt1 != pt2)
- nfound_p++;
+ if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed");
}
- }
+ else {
+ H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
+ H5Sget_select_elem_pointlist(region2_id, (hsize_t) 0, (hsize_t) npoints2, ptdata2);
- if (nfound_p && options->m_verbose) {
- parallel_print("Region points\n");
- for (i = 0; i < npoints1; i++) {
- hsize_t pt1, pt2;
- int diff_data = 0;
-
- for (j = 0; j < ndims1; j++) {
- pt1 = ptdata1[i * ndims1 + j];
- pt2 = ptdata2[i * ndims1 + j];
- if (pt1 != pt2) {
- diff_data = 1;
- break;
+ for (i = 0; i < npoints1; i++) {
+ hsize_t pt1, pt2;
+
+ for (j = 0; j < ndims1; j++) {
+ pt1 = ptdata1[i * ndims1 + j];
+ pt2 = ptdata2[i * ndims1 + j];
+ if (pt1 != pt2)
+ nfound_p++;
}
}
- if (diff_data) {
- parallel_print("point #%d", i);
- print_points(i, ptdata1, ndims1);
- print_points(i, ptdata2, ndims1);
- parallel_print("\n");
+
+ if (nfound_p && opts->m_verbose) {
+ parallel_print("Region points\n");
+ for (i = 0; i < npoints1; i++) {
+ hsize_t pt1, pt2;
+ int diff_data = 0;
+
+ for (j = 0; j < ndims1; j++) {
+ pt1 = ptdata1[i * ndims1 + j];
+ pt2 = ptdata2[i * ndims1 + j];
+ if (pt1 != pt2) {
+ diff_data = 1;
+ break;
+ }
+ }
+ if (diff_data) {
+ parallel_print("point #%d", i);
+ print_points(i, ptdata1, ndims1);
+ print_points(i, ptdata2, ndims1);
+ parallel_print("\n");
+ }
+ }
}
- }
- }
+ HDfree(ptdata2);
+ } /* else ptdata2 */
#if defined (H5DIFF_DEBUG)
- for (i = 0; i < npoints1; i++) {
- int j;
-
- parallel_print("%sPt%lu: " , i ? "," : "", (unsigned long)i);
+ for (i = 0; i < npoints1; i++) {
+ parallel_print("%sPt%lu: " , i ? "," : "", (unsigned long)i);
- for (j = 0; j < ndims1; j++)
- parallel_print("%s%lu", j ? "," : "(",
- (unsigned long)(ptdata1[i * ndims1 + j]));
+ for (j = 0; j < ndims1; j++)
+ parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata1[i * ndims1 + j]));
- parallel_print(")");
- }
+ parallel_print(")");
+ }
#endif
- HDfree(ptdata1);
- HDfree(ptdata2);
+ HDfree(ptdata1);
+ } /* else ptdata1 */
}
nfound_b = nfound_b / (unsigned) ndims1;
nfound_p = nfound_p / (unsigned) ndims1;
- return (nfound_p + nfound_b);
+
+ ret_value = nfound_p + nfound_b;
+
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: character_compare
*
- * Purpose: do a byte-by-byte comparison and print in char format
- *
- * Return: number of differences found
+ * Purpose: do a byte-by-byte comparison and print in char format
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, unsigned u,
- int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1, const char *obj2, int *ph) {
+ int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
+{
hsize_t nfound = 0; /* differences found */
char temp1_uchar;
char temp2_uchar;
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); h5diffdebug3("character_compare start %d=%d\n",temp1_uchar,temp2_uchar);
+ HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+ h5diffdebug3("character_compare start %d=%d\n",temp1_uchar,temp2_uchar);
if (temp1_uchar != temp2_uchar) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_char_pos(ph, 0, i, u, acc, pos, rank, dims, obj1, obj2);
parallel_print(" ");
h5diff_print_char(temp1_uchar);
@@ -2356,20 +2402,20 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, unsigned u,
/*-------------------------------------------------------------------------
* Function: character_compare_opt
*
- * Purpose: do a byte-by-byte comparison and print in numerical format
- *
- * Return: number of differences found
+ * Purpose: do a byte-by-byte comparison and print in numerical format
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
- hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1, const char *obj2, int *ph) {
- hsize_t nfound = 0; /* differences found */
+ hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
+{
+ hsize_t nfound = 0; /* differences found */
unsigned char temp1_uchar;
unsigned char temp2_uchar;
- double per;
- hbool_t both_zero;
+ double per;
+ hbool_t both_zero;
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -2377,9 +2423,9 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
h5difftrace("character_compare_opt start\n");
/* -d and !-p */
- if (options->d && !options->p) {
- if (PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ if (opts->d && !opts->p) {
+ if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -2388,10 +2434,10 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
- if (per > options->percent) {
- if (print_data(options)) {
+ if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -2400,10 +2446,10 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
- if (per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -2412,7 +2458,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
}
}
else if (temp1_uchar != temp2_uchar) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -2426,14 +2472,14 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_float
*
- * Purpose: diff a H5T_NATIVE_FLOAT type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_FLOAT type
*
+ * Return: number of differences found
+*
*-------------------------------------------------------------------------
*/
static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
@@ -2453,7 +2499,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
@@ -2462,15 +2508,15 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if ((double) ABS(temp1_float - temp2_float) > options->delta) {
- if (print_data(options)) {
+ if ((double) ABS(temp1_float - temp2_float) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2480,7 +2526,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2490,7 +2536,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(float);
mem2 += sizeof(float);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2498,7 +2544,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
@@ -2507,7 +2553,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
@@ -2516,15 +2562,15 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
PER(temp1_float, temp2_float);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
@@ -2535,7 +2581,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2545,7 +2591,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(float);
mem2 += sizeof(float);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2553,7 +2599,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
@@ -2562,7 +2608,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_FLOAT, &temp1_float);
isnan2 = my_isnan(FLT_FLOAT, &temp2_float);
}
@@ -2572,15 +2618,15 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
PER(temp1_float, temp2_float);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
}
- else if (per > options->percent && (double) ABS(temp1_float - temp2_float) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
@@ -2592,7 +2638,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2602,7 +2648,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(float);
mem2 += sizeof(float);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2616,8 +2662,8 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
- if (equal_float(temp1_float, temp2_float, options) == FALSE) {
- if (print_data(options)) {
+ if (equal_float(temp1_float, temp2_float, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
@@ -2627,7 +2673,7 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(float);
mem2 += sizeof(float);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -2639,23 +2685,22 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_double
*
- * Purpose: diff a H5T_NATIVE_DOUBLE type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_DOUBLE type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
- double temp1_double;
- double temp2_double;
+ double temp1_double;
+ double temp2_double;
hsize_t i;
- double per;
+ double per;
hbool_t both_zero;
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
@@ -2666,7 +2711,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
@@ -2675,15 +2720,15 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2693,7 +2738,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2703,7 +2748,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(double);
mem2 += sizeof(double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2712,7 +2757,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
@@ -2721,7 +2766,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
@@ -2730,15 +2775,15 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double,
@@ -2749,7 +2794,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2759,7 +2804,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(double);
mem2 += sizeof(double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2767,7 +2812,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(double));
@@ -2777,7 +2822,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_DOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_DOUBLE, &temp2_double);
}
@@ -2787,15 +2832,15 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double,
@@ -2806,7 +2851,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2815,7 +2860,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(double);
mem2 += sizeof(double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2828,8 +2873,8 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
- if (equal_double(temp1_double, temp2_double, options) == FALSE) {
- if (print_data(options)) {
+ if (equal_double(temp1_double, temp2_double, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2839,7 +2884,7 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(double);
mem2 += sizeof(double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -2851,10 +2896,9 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_ldouble
*
- * Purpose: diff a H5T_NATIVE_LDOUBLE type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_LDOUBLE type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
@@ -2867,13 +2911,13 @@ static hsize_t diff_ldouble(unsigned char *mem1,
hsize_t *dims,
hsize_t *acc,
hsize_t *pos,
- diff_opt_t *options,
+ diff_opt_t *opts,
const char *obj1,
const char *obj2,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
long double temp1_double;
long double temp2_double;
hsize_t i;
@@ -2889,7 +2933,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
*-------------------------------------------------------------------------
*/
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for ( i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
@@ -2898,15 +2942,15 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double);
}
/* both not NaN, do the comparison */
if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2916,7 +2960,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -2926,7 +2970,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
mem1 += sizeof(long double);
mem2 += sizeof(long double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2935,7 +2979,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
@@ -2944,7 +2988,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
@@ -2953,15 +2997,15 @@ static hsize_t diff_ldouble(unsigned char *mem1,
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double,
@@ -2972,8 +3016,8 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
+ if (print_data(opts)) {
+ print_pos(ph, 0, hyper_start+i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
@@ -2981,7 +3025,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
mem1 += sizeof(long double);
mem2 += sizeof(long double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -2989,7 +3033,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
@@ -2998,7 +3042,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
* detect NaNs
*-------------------------------------------------------------------------
*/
- if (options->do_nans) {
+ if (opts->do_nans) {
isnan1 = my_isnan(FLT_LDOUBLE, &temp1_double);
isnan2 = my_isnan(FLT_LDOUBLE, &temp2_double);
}
@@ -3008,15 +3052,15 @@ static hsize_t diff_ldouble(unsigned char *mem1,
PER(temp1_double, temp2_double);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_double - temp2_double) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_double - temp2_double) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1-temp2_double / temp1_double));
@@ -3026,7 +3070,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
/* only one is NaN, assume difference */
else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -3035,7 +3079,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
mem1 += sizeof(long double);
mem2 += sizeof(long double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* i */
}
@@ -3048,8 +3092,8 @@ static hsize_t diff_ldouble(unsigned char *mem1,
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
- if (equal_ldouble(temp1_double, temp2_double, options) == FALSE) {
- if (print_data(options)) {
+ if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
@@ -3058,7 +3102,7 @@ static hsize_t diff_ldouble(unsigned char *mem1,
}
mem1 += sizeof(long double);
mem2 += sizeof(long double);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3071,34 +3115,33 @@ static hsize_t diff_ldouble(unsigned char *mem1,
/*-------------------------------------------------------------------------
* Function: diff_schar
*
- * Purpose: diff a H5T_NATIVE_SCHAR type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_SCHAR type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
- char temp1_char;
- char temp2_char;
+ char temp1_char;
+ char temp2_char;
hsize_t i;
- double per;
+ double per;
hbool_t both_zero;
h5difftrace("diff_schar start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
- if (ABS(temp1_char-temp2_char) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_char-temp2_char) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
@@ -3107,12 +3150,12 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(char);
mem2 += sizeof(char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
@@ -3120,15 +3163,15 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
PER(temp1_char, temp2_char);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
@@ -3137,12 +3180,12 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(char);
mem2 += sizeof(char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
@@ -3150,15 +3193,15 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
PER(temp1_char, temp2_char);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_char-temp2_char) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_char-temp2_char) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
@@ -3167,7 +3210,7 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(char);
mem2 += sizeof(char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3177,7 +3220,7 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_char, mem2, sizeof(char));
if (temp1_char != temp2_char) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
@@ -3187,7 +3230,7 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(char);
mem2 += sizeof(char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3199,33 +3242,32 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_uchar
*
- * Purpose: diff a H5T_NATIVE_UCHAR type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_UCHAR type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned char temp1_uchar;
unsigned char temp2_uchar;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_uchar start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- if (PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -3234,12 +3276,12 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned char);
mem2 += sizeof(unsigned char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -3247,15 +3289,15 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -3264,12 +3306,12 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned char);
mem2 += sizeof(unsigned char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -3277,15 +3319,15 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
@@ -3294,7 +3336,7 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned char);
mem2 += sizeof(unsigned char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3304,7 +3346,7 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
if (temp1_uchar != temp2_uchar) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
@@ -3314,7 +3356,7 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned char);
mem2 += sizeof(unsigned char);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3326,33 +3368,32 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_short
*
- * Purpose: diff a H5T_NATIVE_SHORT type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_SHORT type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
- short temp1_short;
- short temp2_short;
+ short temp1_short;
+ short temp2_short;
hsize_t i;
- double per;
+ double per;
hbool_t both_zero;
h5difftrace("diff_short start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
- if (ABS(temp1_short-temp2_short) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_short-temp2_short) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
@@ -3361,12 +3402,12 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(short);
mem2 += sizeof(short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
@@ -3374,15 +3415,15 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
PER(temp1_short, temp2_short);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
@@ -3391,12 +3432,12 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(short);
mem2 += sizeof(short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
@@ -3404,15 +3445,15 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
PER(temp1_short, temp2_short);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_short-temp2_short) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_short-temp2_short) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
@@ -3421,7 +3462,7 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(short);
mem2 += sizeof(short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3431,7 +3472,7 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_short, mem2, sizeof(short));
if (temp1_short != temp2_short) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
@@ -3441,7 +3482,7 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(short);
mem2 += sizeof(short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3453,34 +3494,33 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_ushort
*
- * Purpose: diff a H5T_NATIVE_USHORT type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_USHORT type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned short temp1_ushort;
unsigned short temp2_ushort;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_ushort start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
- if (PDIFF(temp1_ushort,temp2_ushort) > options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_ushort,temp2_ushort) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
@@ -3489,12 +3529,12 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned short);
mem2 += sizeof(unsigned short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
@@ -3502,15 +3542,15 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
@@ -3519,12 +3559,12 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned short);
mem2 += sizeof(unsigned short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
@@ -3532,15 +3572,15 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
- else if (per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && PDIFF(temp1_ushort,temp2_ushort) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
@@ -3549,7 +3589,7 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned short);
mem2 += sizeof(unsigned short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3559,7 +3599,7 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
if (temp1_ushort != temp2_ushort) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
@@ -3569,7 +3609,7 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned short);
mem2 += sizeof(unsigned short);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3579,35 +3619,34 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
}
/*-------------------------------------------------------------------------
- * Function: diff_int
+ * Function: diff_int
*
- * Purpose: diff a H5T_NATIVE_INT type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_INT type
*
- *-------------------------------------------------------------------------
+ * Return: number of differences found
+ *-------------------------------------------------------------------------
*/
static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
- int temp1_int;
- int temp2_int;
+ int temp1_int;
+ int temp2_int;
hsize_t i;
- double per;
+ double per;
hbool_t both_zero;
h5difftrace("diff_int start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
- if (ABS(temp1_int-temp2_int) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_int-temp2_int) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
@@ -3616,12 +3655,12 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(int);
mem2 += sizeof(int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
@@ -3629,15 +3668,15 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
PER(temp1_int, temp2_int);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
@@ -3646,12 +3685,12 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(int);
mem2 += sizeof(int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
@@ -3659,15 +3698,15 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
PER(temp1_int, temp2_int);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_int-temp2_int) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_int-temp2_int) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
@@ -3676,7 +3715,7 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(int);
mem2 += sizeof(int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3686,7 +3725,7 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_int, mem2, sizeof(int));
if (temp1_int != temp2_int) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
@@ -3696,7 +3735,7 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(int);
mem2 += sizeof(int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
@@ -3708,15 +3747,14 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_uint
*
- * Purpose: diff a H5T_NATIVE_UINT type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_UINT type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
@@ -3728,13 +3766,13 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
h5difftrace("diff_uint start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
- if (PDIFF(temp1_uint,temp2_uint) > options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_uint,temp2_uint) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
@@ -3743,12 +3781,12 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned int);
mem2 += sizeof(unsigned int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
@@ -3756,15 +3794,15 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed int, temp1_uint, temp2_uint);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
@@ -3773,12 +3811,12 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned int);
mem2 += sizeof(unsigned int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
@@ -3786,16 +3824,16 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed int, temp1_uint, temp2_uint);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
nfound++;
}
- else if (per > options->percent
- && PDIFF(temp1_uint,temp2_uint) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent
+ && PDIFF(temp1_uint,temp2_uint) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
@@ -3804,7 +3842,7 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned int);
mem2 += sizeof(unsigned int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3814,7 +3852,7 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
if (temp1_uint != temp2_uint) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
@@ -3824,7 +3862,7 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned int);
mem2 += sizeof(unsigned int);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3836,15 +3874,14 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_long
*
- * Purpose: diff a H5T_NATIVE_LONG type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_LONG type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
hsize_t nfound = 0; /* number of differences found */
@@ -3856,14 +3893,14 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
h5difftrace("diff_long start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
- if (ABS(temp1_long-temp2_long) > options->delta) {
- if (print_data(options)) {
+ if (ABS(temp1_long-temp2_long) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
@@ -3872,13 +3909,13 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long);
mem2 += sizeof(long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
@@ -3886,15 +3923,15 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
PER(temp1_long, temp2_long);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
@@ -3903,12 +3940,12 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long);
mem2 += sizeof(long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
@@ -3916,15 +3953,15 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
PER(temp1_long, temp2_long);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
nfound++;
}
- else if (per > options->percent && ABS(temp1_long-temp2_long) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
@@ -3933,7 +3970,7 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long);
mem2 += sizeof(long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -3943,7 +3980,7 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_long, mem2, sizeof(long));
if (temp1_long != temp2_long) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
@@ -3953,7 +3990,7 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(long);
mem2 += sizeof(long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -3965,35 +4002,34 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_ulong
*
- * Purpose: diff a H5T_NATIVE_ULONG type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_ULONG type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned long temp1_ulong;
unsigned long temp2_ulong;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_ulong start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
- if (PDIFF(temp1_ulong,temp2_ulong) > options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
@@ -4002,13 +4038,13 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long);
mem2 += sizeof(unsigned long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
@@ -4016,15 +4052,15 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
@@ -4033,12 +4069,12 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long);
mem2 += sizeof(unsigned long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
@@ -4046,16 +4082,16 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
nfound++;
}
- else if (per > options->percent
- && PDIFF(temp1_ulong,temp2_ulong) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent
+ && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
@@ -4064,7 +4100,7 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long);
mem2 += sizeof(unsigned long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -4074,7 +4110,7 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
if (temp1_ulong != temp2_ulong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
@@ -4084,7 +4120,7 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned long);
mem2 += sizeof(unsigned long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -4096,33 +4132,32 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_llong
*
- * Purpose: diff a H5T_NATIVE_LLONG type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_LLONG type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *options, const char *obj1,
+ hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
long long temp1_llong;
long long temp2_llong;
- hsize_t i;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_llong start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
- if (ABS( temp1_llong-temp2_llong) > options->delta) {
- if (print_data(options)) {
+ if (ABS( temp1_llong-temp2_llong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
@@ -4131,12 +4166,12 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long long);
mem2 += sizeof(long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
@@ -4144,15 +4179,15 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
PER(temp1_llong, temp2_llong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
@@ -4161,12 +4196,12 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long long);
mem2 += sizeof(long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_llong, mem1, sizeof(long long));
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
@@ -4174,16 +4209,16 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
PER(temp1_llong, temp2_llong);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
nfound++;
}
- else if (per > options->percent
- && ABS(temp1_llong-temp2_llong) > options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent
+ && ABS(temp1_llong-temp2_llong) > opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
@@ -4192,7 +4227,7 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(long long);
mem2 += sizeof(long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -4202,7 +4237,7 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_llong, mem2, sizeof(long long));
if (temp1_llong != temp2_llong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
@@ -4212,7 +4247,7 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(long long);
mem2 += sizeof(long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -4224,34 +4259,33 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
/*-------------------------------------------------------------------------
* Function: diff_ullong
*
- * Purpose: diff a H5T_NATIVE_ULLONG type
- *
- * Return: number of differences found
+ * Purpose: diff a H5T_NATIVE_ULLONG type
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc,
- hsize_t *pos, diff_opt_t *options, const char *obj1, const char *obj2, int *ph)
+ hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
{
- hsize_t nfound = 0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
unsigned long long temp1_ullong;
unsigned long long temp2_ullong;
- hsize_t i;
- float f1, f2;
- double per;
- hbool_t both_zero;
+ hsize_t i;
+ float f1, f2;
+ double per;
+ hbool_t both_zero;
h5difftrace("diff_ullong start\n");
/* -d and !-p */
- if (options->d && !options->p) {
+ if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
- if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) {
- if (print_data(options)) {
+ if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
@@ -4260,12 +4294,12 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long long);
mem2 += sizeof(unsigned long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* !-d and -p */
- else if (!options->d && options->p) {
+ else if (!opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
@@ -4275,15 +4309,15 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
PER(f1, f2);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
}
nfound++;
}
- else if (per > options->percent) {
- if (print_data(options)) {
+ else if (per > opts->percent) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
@@ -4292,12 +4326,12 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long long);
mem2 += sizeof(unsigned long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
/* -d and -p */
- else if (options->d && options->p) {
+ else if (opts->d && opts->p) {
for (i = 0; i < nelmts; i++) {
HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
@@ -4307,16 +4341,16 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
PER(f1, f2);
if (not_comparable && !both_zero) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
}
nfound++;
}
- else if (per > options->percent
- && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) {
- if (print_data(options)) {
+ else if (per > opts->percent
+ && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ if (print_data(opts)) {
print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
@@ -4325,7 +4359,7 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
}
mem1 += sizeof(unsigned long long);
mem2 += sizeof(unsigned long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
}
}
@@ -4335,7 +4369,7 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
if (temp1_ullong != temp2_ullong) {
- if (print_data(options)) {
+ if (print_data(opts)) {
print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
@@ -4345,7 +4379,7 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
mem1 += sizeof(unsigned long long);
mem2 += sizeof(unsigned long long);
- if (options->n && nfound >= options->count)
+ if (opts->n && nfound >= opts->count)
return nfound;
} /* nelmts */
}
@@ -4358,69 +4392,59 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
* Function: ull2float
*
* Purpose: convert unsigned long long to float
- *
- * Programmer: pvn
- * Mar 22, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static
-int ull2float(unsigned long long ull_value, float *f_value) {
- hid_t dxpl_id;
+int ull2float(unsigned long long ull_value, float *f_value)
+{
+ int ret_value = SUCCEED;
+ hid_t dxpl_id = -1;
unsigned char *buf = NULL;
- size_t src_size;
- size_t dst_size;
+ size_t src_size;
+ size_t dst_size;
h5difftrace("ull2float start\n");
if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
src_size = H5Tget_size(H5T_NATIVE_ULLONG);
dst_size = H5Tget_size(H5T_NATIVE_FLOAT);
- buf = (unsigned char*) HDcalloc((size_t )1, MAX(src_size, dst_size));
- if (!buf)
- goto error;
+ if((buf = (unsigned char*) HDcalloc((size_t )1, MAX(src_size, dst_size))) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
HDmemcpy(buf, &ull_value, src_size);
/* do conversion */
if (H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t) 1, buf, NULL, dxpl_id) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tconvert failed");
HDmemcpy(f_value, buf, dst_size);
if (buf)
- HDfree(buf);h5difftrace("ull2float finish\n");
-
- return 0;
+ HDfree(buf);
-error:
- H5E_BEGIN_TRY
- {
+done:
+ H5E_BEGIN_TRY {
H5Pclose(dxpl_id);
- }H5E_END_TRY;
+ } H5E_END_TRY;
+
if (buf)
- HDfree(buf);h5difftrace("ull2float errored\n");
+ HDfree(buf);
+
+ h5difftrace("ull2float finish\n");
- return -1;
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: equal_double
*
- * Purpose: use a absolute error formula to deal with floating point
- * uncertainty
- *
- * Modifications:
- * 8/1/2007. handle NaNs
- *
+ * Purpose: use a absolute error formula to deal with floating point uncertainty
*-------------------------------------------------------------------------
*/
-static hbool_t equal_double(double value, double expected, diff_opt_t *options) {
+static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
h5difftrace("equal_double start\n");
- if (options->do_nans) {
+ if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
@@ -4432,26 +4456,24 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *options)
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
*/
- if (isnan1 && isnan2) {
+ if (isnan1 && isnan2)
return TRUE;
- }
/*-------------------------------------------------------------------------
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
*/
- if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
return FALSE;
- }
}
if (value == expected)
return TRUE;
- if (options->use_system_epsilon) {
- if ( ABS( (value-expected) ) < DBL_EPSILON)
+ if (opts->use_system_epsilon)
+ if (ABS((value-expected)) < DBL_EPSILON)
return TRUE;
- }
+
h5difftrace("equal_double finish\n");
return FALSE;
@@ -4460,18 +4482,16 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *options)
/*-------------------------------------------------------------------------
* Function: equal_ldouble
*
- * Purpose: use a absolute error formula to deal with floating point
- * uncertainty
- *
+ * Purpose: use a absolute error formula to deal with floating point uncertainty
*-------------------------------------------------------------------------
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
static
-hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *options)
+hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
{
h5difftrace("equal_ldouble start\n");
- if (options->do_nans) {
+ if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
@@ -4483,26 +4503,24 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
*/
- if (isnan1 && isnan2) {
+ if (isnan1 && isnan2)
return TRUE;
- }
/*-------------------------------------------------------------------------
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
*/
- if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
return FALSE;
- }
}
if (value == expected)
return TRUE;
- if (options->use_system_epsilon) {
+ if (opts->use_system_epsilon)
if (ABS((value-expected)) < DBL_EPSILON)
return TRUE;
- }
+
h5difftrace("equal_ldouble finish\n");
return FALSE;
@@ -4513,17 +4531,12 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
/*-------------------------------------------------------------------------
* Function: equal_float
*
- * Purpose: use a absolute error formula to deal with floating point
- * uncertainty
- *
- * Modifications:
- * 8/1/2007. handle NaNs
- *
+ * Purpose: use a absolute error formula to deal with floating point uncertainty
*-------------------------------------------------------------------------
*/
-static hbool_t equal_float(float value, float expected, diff_opt_t *options) {
+static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
h5difftrace("equal_float start\n");
- if (options->do_nans) {
+ if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
@@ -4535,46 +4548,35 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *options) {
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
*/
- if (isnan1 && isnan2) {
+ if (isnan1 && isnan2)
return TRUE;
- }
/*-------------------------------------------------------------------------
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
*/
- if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ if ((isnan1 && !isnan2) || (!isnan1 && isnan2))
return FALSE;
- }
}
if (value == expected)
return TRUE;
- if (options->use_system_epsilon) {
- if ( ABS( (value-expected) ) < FLT_EPSILON)
+ if (opts->use_system_epsilon)
+ if (ABS( (value-expected) ) < FLT_EPSILON)
return TRUE;
- }
+
h5difftrace("equal_float finish\n");
return FALSE;
-
}
/*-------------------------------------------------------------------------
* Function: my_isnan
*
- * Purpose: Determines whether VAL points to NaN.
- *
- * Return: TRUE or FALSE
- *
- * Programmer: Robb Matzke
- * Monday, July 6, 1998
- *
- * Modifications:
- * Pedro Vicente, 12 October 2007.
- * Add a string detection type for WIN32
+ * Purpose: Determines whether VAL points to NaN.
*
+ * Return: TRUE or FALSE
*-------------------------------------------------------------------------
*/
static hbool_t my_isnan(dtype_t type, void *val) {
@@ -4602,9 +4604,8 @@ static hbool_t my_isnan(dtype_t type, void *val) {
retval = (x!=x);
}
#endif
- else {
+ else
return FALSE;
- }
/*
* Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if
@@ -4631,9 +4632,8 @@ static hbool_t my_isnan(dtype_t type, void *val) {
HDsnprintf(s, sizeof(s), "%Lg", x);
}
#endif
- else {
+ else
return FALSE;
- }
if (HDstrstr(s, "NaN") ||
HDstrstr(s, "NAN") ||
@@ -4658,24 +4658,25 @@ static hbool_t my_isnan(dtype_t type, void *val) {
/*-------------------------------------------------------------------------
* Function: print_data
*
- * Purpose: print data only in report or verbose modes, and do not print in quiet mode
+ * Purpose: print data only in report or verbose modes, and do not print in quiet mode
*-------------------------------------------------------------------------
*/
static
-int print_data(diff_opt_t *options) {
- return ((options->m_report || options->m_verbose) && !options->m_quiet) ? 1 : 0;
+int print_data(diff_opt_t *opts)
+{
+ return ((opts->m_report || opts->m_verbose) && !opts->m_quiet) ? 1 : 0;
}
/*-------------------------------------------------------------------------
* Function: print_header
*
- * Purpose: print header for difference
- *
+ * Purpose: print header for difference
*-------------------------------------------------------------------------
*/
static
void print_header(int pp, /* print percentage */
- int rank, hsize_t *dims, const char *obj1, const char *obj2) {
+ int rank, hsize_t *dims, const char *obj1, const char *obj2)
+{
/* print header */
parallel_print("%-16s", "size:");
print_dimensions(rank, dims);
@@ -4685,8 +4686,7 @@ void print_header(int pp, /* print percentage */
if (pp) {
parallel_print("%-15s %-15s %-15s %-15s %-15s\n", "position",
- (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference",
- "relative");
+ (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference", "relative");
parallel_print(
"------------------------------------------------------------------------\n");
}
@@ -4701,15 +4701,15 @@ void print_header(int pp, /* print percentage */
/*-------------------------------------------------------------------------
* Function: print_pos
*
- * Purpose: print in matrix notation, converting from an array index position
- *
+ * Purpose: print in matrix notation, converting from an array index position
*-------------------------------------------------------------------------
*/
static
void print_pos(int *ph, /* print header */
int pp, /* print percentage */
hsize_t curr_pos, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims,
- const char *obj1, const char *obj2) {
+ const char *obj1, const char *obj2)
+{
int i;
/* print header */
@@ -4733,30 +4733,22 @@ void print_pos(int *ph, /* print header */
}
parallel_print("]");
}
- else {
+ else
parallel_print(" ");
- }
}
/*-------------------------------------------------------------------------
* Function: print_char_pos
*
- * Purpose: print character position in string
- *
+ * Purpose: print character position in string
*-------------------------------------------------------------------------
*/
static
-void print_char_pos(
- int *ph, /* print header */
+void print_char_pos(int *ph, /* print header */
int pp, /* print percentage */
- hsize_t curr_pos,
- unsigned u,
- hsize_t *acc,
- hsize_t *pos,
- int rank,
- hsize_t *dims,
- const char *obj1,
- const char *obj2) {
+ hsize_t curr_pos, unsigned u, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims,
+ const char *obj1, const char *obj2)
+{
int i;
/* print header */
@@ -4780,20 +4772,20 @@ void print_char_pos(
}
}
- else {
+ else
parallel_print("%zu", u);
- }
+
parallel_print("]");
}
/*-------------------------------------------------------------------------
- * Function: h5diff_print_char. Adapted from h5tools_print_char
- *
- * Purpose: Print a char
+ * Function: h5diff_print_char. Adapted from h5tools_print_char
*
+ * Purpose: Print a char
*-------------------------------------------------------------------------
*/
-static void h5diff_print_char(char ch) {
+static void h5diff_print_char(char ch)
+{
switch (ch) {
case '"':
parallel_print("\\\"");
@@ -4826,12 +4818,13 @@ static void h5diff_print_char(char ch) {
}
/*-------------------------------------------------------------------------
- * XCAO, 11/10/2010
* added to improve performance for compound datasets
* set up compound datatype structures.
+ *-------------------------------------------------------------------------
*/
-static void get_member_types(hid_t tid, mcomp_t *members) {
- int tclass;
+static void get_member_types(hid_t tid, mcomp_t *members)
+{
+ int tclass;
unsigned u;
if (tid <= 0 || !members)
@@ -4846,8 +4839,7 @@ static void get_member_types(hid_t tid, mcomp_t *members) {
else if (tclass == H5T_COMPOUND) {
int nmembs;
- nmembs = H5Tget_nmembers(tid);
- if (nmembs <= 0)
+ if ((nmembs = H5Tget_nmembers(tid)) <= 0)
return;
members->n = (unsigned) nmembs;
@@ -4865,15 +4857,15 @@ static void get_member_types(hid_t tid, mcomp_t *members) {
}
return;
-
}
/*-------------------------------------------------------------------------
- * XCAO, 11/10/2010
* added to improve performance for compound datasets
* clean and close compound members.
+ *-------------------------------------------------------------------------
*/
-static void close_member_types(mcomp_t *members) {
+static void close_member_types(mcomp_t *members)
+{
unsigned u;
if (!members || members->n <= 0 || !members->ids)