summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-09-08 17:25:06 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-09-08 17:25:06 (GMT)
commit7285fb801daf0e350b7ecbac13e6edc8a6fc75bb (patch)
treed80a4801754ebc01498bdd59e985309f13535244 /tools
parent663ff104455b79bd3e431aada6e44402f057a002 (diff)
downloadhdf5-7285fb801daf0e350b7ecbac13e6edc8a6fc75bb.zip
hdf5-7285fb801daf0e350b7ecbac13e6edc8a6fc75bb.tar.gz
hdf5-7285fb801daf0e350b7ecbac13e6edc8a6fc75bb.tar.bz2
HDFFV-9774 Add missing error commands
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff.c283
-rw-r--r--tools/lib/h5diff_array.c797
-rw-r--r--tools/lib/h5tools_error.h8
3 files changed, 418 insertions, 670 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 20b5136..d5d0dee 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -11,8 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <stdlib.h>
-
#include "H5private.h"
#include "h5tools.h"
#include "h5tools_utils.h"
@@ -451,32 +449,27 @@ static herr_t trav_grp_objs(const char *path, const H5O_info_t *oinfo,
static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
void *udata)
{
- trav_info_t *tinfo = (trav_info_t *)udata;
- diff_opt_t *opts = (diff_opt_t *)tinfo->opts;
- int ret;
+ int ret_value = 0;
+ trav_info_t *tinfo = (trav_info_t *)udata;
+ diff_opt_t *opts = (diff_opt_t *)tinfo->opts;
h5tool_link_info_t lnk_info;
- const char *ext_fname;
- const char *ext_path;
+ const char *ext_fname;
+ const char *ext_path;
/* init linkinfo struct */
HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t));
- if (!opts->follow_links)
- {
+ if (!opts->follow_links) {
trav_info_visit_lnk(path, linfo, tinfo);
goto done;
}
- switch(linfo->type)
- {
+ switch(linfo->type) {
case H5L_TYPE_SOFT:
- ret = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links);
- /* error */
- if (ret < 0)
+ if((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0)
goto done;
/* no dangling link option given and detect dangling link */
- else if (ret == 0)
- {
+ else if (ret_value == 0) {
tinfo->symlink_visited.dangle_link = TRUE;
trav_info_visit_lnk(path, linfo, tinfo);
if (opts->no_dangle_links)
@@ -493,22 +486,18 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
goto done;
if(h5trav_visit(tinfo->fid, path, TRUE, TRUE,
- trav_grp_objs,trav_grp_symlinks, tinfo) < 0)
- {
+ trav_grp_objs,trav_grp_symlinks, tinfo) < 0) {
parallel_print("Error: Could not get file contents\n");
opts->err_stat = 1;
- goto done;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
}
break;
case H5L_TYPE_EXTERNAL:
- ret = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links);
- /* error */
- if (ret < 0)
+ if ((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0)
goto done;
/* no dangling link option given and detect dangling link */
- else if (ret == 0)
- {
+ else if (ret_value == 0) {
tinfo->symlink_visited.dangle_link = TRUE;
trav_info_visit_lnk(path, linfo, tinfo);
if (opts->no_dangle_links)
@@ -528,11 +517,10 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
goto done;
if(h5trav_visit(tinfo->fid, path, TRUE, TRUE,
- trav_grp_objs,trav_grp_symlinks, tinfo) < 0)
- {
+ trav_grp_objs,trav_grp_symlinks, tinfo) < 0) {
parallel_print("Error: Could not get file contents\n");
opts->err_stat = 1;
- goto done;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents\n");
}
break;
@@ -542,7 +530,7 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
default:
parallel_print("Error: Invalid link type\n");
opts->err_stat = 1;
- goto done;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Invalid link type");
break;
} /* end of switch */
@@ -571,8 +559,9 @@ hsize_t h5diff(const char *fname1,
const char *fname2,
const char *objname1,
const char *objname2,
- diff_opt_t *options)
+ diff_opt_t *opts)
{
+ int ret_value = 0;
hid_t file1_id = (-1);
hid_t file2_id = (-1);
char filenames[2][MAX_FILENAME];
@@ -614,10 +603,10 @@ hsize_t h5diff(const char *fname1,
/*-------------------------------------------------------------------------
* check invalid combination of options
*-----------------------------------------------------------------------*/
- if(!is_valid_options(options))
- goto out;
+ if(!is_valid_options(opts))
+ goto done;
- options->cmn_objs = 1; /* eliminate warning */
+ opts->cmn_objs = 1; /* eliminate warning */
/*-------------------------------------------------------------------------
* open the files first; if they are not valid, no point in continuing
@@ -628,20 +617,18 @@ hsize_t h5diff(const char *fname1,
H5E_BEGIN_TRY
{
/* open file 1 */
- if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0)
- {
+ if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
parallel_print("h5diff: <%s>: unable to open file\n", fname1);
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ goto done;
} /* end if */
/* open file 2 */
- if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0)
- {
+ if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
parallel_print("h5diff: <%s>: unable to open file\n", fname2);
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ goto done;
} /* end if */
/* enable error reporting */
} H5E_END_TRY;
@@ -655,15 +642,13 @@ hsize_t h5diff(const char *fname1,
h5difftrace("trav_info_init initialized\n");
/* if any object is specified */
- if (objname1)
- {
+ if (objname1) {
/* make the given object1 fullpath, start with "/" */
- if (HDstrncmp(objname1, "/", 1))
- {
+ if (HDstrncmp(objname1, "/", 1)) {
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
if(HDasprintf(&obj1fullname, "/%s", objname1) < 0)
- goto out;
+ goto done;
#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2);
@@ -675,12 +660,11 @@ hsize_t h5diff(const char *fname1,
obj1fullname = HDstrdup(objname1);
/* make the given object2 fullpath, start with "/" */
- if (HDstrncmp(objname2, "/", 1))
- {
+ if (HDstrncmp(objname2, "/", 1)) {
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
if(HDasprintf(&obj2fullname, "/%s", objname2) < 0)
- goto out;
+ goto done;
#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2);
@@ -695,24 +679,21 @@ hsize_t h5diff(const char *fname1,
* check if obj1 is root, group, single object or symlink
*/
h5difftrace("h5diff check if obj1 is root, group, single object or symlink\n");
- if(!HDstrcmp(obj1fullname, "/"))
- {
+ if(!HDstrcmp(obj1fullname, "/")) {
obj1type = H5TRAV_TYPE_GROUP;
}
- else
- {
+ else {
/* check if link itself exist */
- if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0)
- {
+ if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) {
parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
}
/* get info from link */
- if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0)
- {
+ if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) {
parallel_print("Unable to get link info from <%s>\n", obj1fullname);
- goto out;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Unable to get link info\n");
+ goto done;
}
info1_lp = info1_obj;
@@ -720,18 +701,16 @@ hsize_t h5diff(const char *fname1,
/*
* check the type of specified path for hard and symbolic links
*/
- if(src_linfo1.type == H5L_TYPE_HARD)
- {
+ if(src_linfo1.type == H5L_TYPE_HARD) {
size_t idx;
/* optional data pass */
- info1_obj->opts = (diff_opt_t*)options;
+ info1_obj->opts = (diff_opt_t*)opts;
- if(H5Oget_info_by_name(file1_id, obj1fullname, &oinfo1, H5P_DEFAULT) < 0)
- {
+ if(H5Oget_info_by_name(file1_id, obj1fullname, &oinfo1, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
}
obj1type = (h5trav_type_t)oinfo1.type;
trav_info_add(info1_obj, obj1fullname, obj1type);
@@ -739,13 +718,11 @@ hsize_t h5diff(const char *fname1,
info1_obj->paths[idx].objno = oinfo1.addr;
info1_obj->paths[idx].fileno = oinfo1.fileno;
}
- else if (src_linfo1.type == H5L_TYPE_SOFT)
- {
+ else if (src_linfo1.type == H5L_TYPE_SOFT) {
obj1type = H5TRAV_TYPE_LINK;
trav_info_add(info1_obj, obj1fullname, obj1type);
}
- else if (src_linfo1.type == H5L_TYPE_EXTERNAL)
- {
+ else if (src_linfo1.type == H5L_TYPE_EXTERNAL) {
obj1type = H5TRAV_TYPE_UDLINK;
trav_info_add(info1_obj, obj1fullname, obj1type);
}
@@ -755,24 +732,20 @@ hsize_t h5diff(const char *fname1,
* check if obj2 is root, group, single object or symlink
*/
h5difftrace("h5diff check if obj2 is root, group, single object or symlink\n");
- if(!HDstrcmp(obj2fullname, "/"))
- {
+ if(!HDstrcmp(obj2fullname, "/")) {
obj2type = H5TRAV_TYPE_GROUP;
}
- else
- {
+ else {
/* check if link itself exist */
- if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0)
- {
+ if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) {
parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
}
/* get info from link */
- if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0)
- {
+ if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) {
parallel_print("Unable to get link info from <%s>\n", obj2fullname);
- goto out;
+ goto done;
}
info2_lp = info2_obj;
@@ -780,18 +753,16 @@ hsize_t h5diff(const char *fname1,
/*
* check the type of specified path for hard and symbolic links
*/
- if(src_linfo2.type == H5L_TYPE_HARD)
- {
+ if(src_linfo2.type == H5L_TYPE_HARD) {
size_t idx;
/* optional data pass */
- info2_obj->opts = (diff_opt_t*)options;
+ info2_obj->opts = (diff_opt_t*)opts;
- if(H5Oget_info_by_name(file2_id, obj2fullname, &oinfo2, H5P_DEFAULT) < 0)
- {
+ if(H5Oget_info_by_name(file2_id, obj2fullname, &oinfo2, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
}
obj2type = (h5trav_type_t)oinfo2.type;
trav_info_add(info2_obj, obj2fullname, obj2type);
@@ -799,21 +770,18 @@ hsize_t h5diff(const char *fname1,
info2_obj->paths[idx].objno = oinfo2.addr;
info2_obj->paths[idx].fileno = oinfo2.fileno;
}
- else if (src_linfo2.type == H5L_TYPE_SOFT)
- {
+ else if (src_linfo2.type == H5L_TYPE_SOFT) {
obj2type = H5TRAV_TYPE_LINK;
trav_info_add(info2_obj, obj2fullname, obj2type);
}
- else if (src_linfo2.type == H5L_TYPE_EXTERNAL)
- {
+ else if (src_linfo2.type == H5L_TYPE_EXTERNAL) {
obj2type = H5TRAV_TYPE_UDLINK;
trav_info_add(info2_obj, obj2fullname, obj2type);
}
}
}
/* if no object specified */
- else
- {
+ else {
h5difftrace("h5diff no object specified\n");
/* set root group */
obj1fullname = (char*)HDstrdup("/");
@@ -824,16 +792,15 @@ hsize_t h5diff(const char *fname1,
/* get any symbolic links info */
- l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, options->follow_links);
- l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, options->follow_links);
+ l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, opts->follow_links);
+ l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, opts->follow_links);
/*---------------------------------------------
* check for following symlinks
*/
- if (options->follow_links)
- {
+ if (opts->follow_links) {
/* pass how to handle printing warning to linkinfo option */
- if(print_warn(options))
+ if(print_warn(opts))
trg_linfo1.opt.msg_mode = trg_linfo2.opt.msg_mode = 1;
/*-------------------------------
@@ -841,37 +808,31 @@ hsize_t h5diff(const char *fname1,
*/
h5difftrace("h5diff check symbolic link (object1)\n");
/* dangling link */
- if (l_ret1 == 0)
- {
+ if (l_ret1 == 0) {
h5difftrace("h5diff ... dangling link\n");
- if (options->no_dangle_links)
- {
- /* treat dangling link is error */
- if(options->m_verbose)
+ if (opts->no_dangle_links) {
+ /* treat dangling link as error */
+ if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname);
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: treat dangling link as error");
}
- else
- {
- if(options->m_verbose)
+ else {
+ if(opts->m_verbose)
parallel_print("obj1 <%s> is a dangling link.\n", obj1fullname);
- if (l_ret1 != 0 || l_ret2 != 0)
- {
+ if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
print_found(nfound);
- goto out;
+ goto done;
}
}
}
- else if(l_ret1 < 0) /* fail */
- {
+ else if(l_ret1 < 0) { /* fail */
parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
}
- else if(l_ret1 != 2) /* symbolic link */
- {
+ else if(l_ret1 != 2) { /* symbolic link */
obj1type = (h5trav_type_t)trg_linfo1.trg_type;
h5difftrace("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD\n");
if (info1_lp != NULL) {
@@ -890,37 +851,31 @@ hsize_t h5diff(const char *fname1,
*/
h5difftrace("h5diff check symbolic link (object2)\n");
/* dangling link */
- if (l_ret2 == 0)
- {
+ if (l_ret2 == 0) {
h5difftrace("h5diff ... dangling link\n");
- if (options->no_dangle_links)
- {
- /* treat dangling link is error */
- if(options->m_verbose)
+ if (opts->no_dangle_links) {
+ /* treat dangling link as error */
+ if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname);
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: treat dangling link as error");
}
- else
- {
- if(options->m_verbose)
+ else {
+ if(opts->m_verbose)
parallel_print("obj2 <%s> is a dangling link.\n", obj2fullname);
- if (l_ret1 != 0 || l_ret2 != 0)
- {
+ if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
print_found(nfound);
- goto out;
+ goto done;
}
}
}
- else if(l_ret2 < 0) /* fail */
- {
+ else if(l_ret2 < 0) { /* fail */
parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
}
- else if(l_ret2 != 2) /* symbolic link */
- {
+ else if(l_ret2 != 2) { /* symbolic link */
obj2type = (h5trav_type_t)trg_linfo2.trg_type;
if (info2_lp != NULL) {
size_t idx = info2_lp->nused - 1;
@@ -941,32 +896,29 @@ hsize_t h5diff(const char *fname1,
* comparing details of same objects.
*/
- if(!(options->m_verbose || options->m_report))
- {
- h5difftrace("h5diff NOT (options->m_verbose || options->m_report)\n");
+ if(!(opts->m_verbose || opts->m_report)) {
+ h5difftrace("h5diff NOT (opts->m_verbose || opts->m_report)\n");
/* if no danglink links */
if ( l_ret1 > 0 && l_ret2 > 0 )
if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname)!=0)
- goto out;
+ goto done;
}
both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP);
- if (both_objs_grp)
- {
+ if (both_objs_grp) {
h5difftrace("h5diff both_objs_grp TRUE\n");
/*
* traverse group1
*/
trav_info_init(fname1, file1_id, &info1_grp);
/* optional data pass */
- info1_grp->opts = (diff_opt_t*)options;
+ info1_grp->opts = (diff_opt_t*)opts;
if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE,
- trav_grp_objs, trav_grp_symlinks, info1_grp) < 0)
- {
+ trav_grp_objs, trav_grp_symlinks, info1_grp) < 0) {
parallel_print("Error: Could not get file contents\n");
- options->err_stat = 1;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
}
info1_lp = info1_grp;
@@ -975,25 +927,22 @@ hsize_t h5diff(const char *fname1,
*/
trav_info_init(fname2, file2_id, &info2_grp);
/* optional data pass */
- info2_grp->opts = (diff_opt_t*)options;
+ info2_grp->opts = (diff_opt_t*)opts;
if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE,
- trav_grp_objs, trav_grp_symlinks, info2_grp) < 0)
- {
+ trav_grp_objs, trav_grp_symlinks, info2_grp) < 0) {
parallel_print("Error: Could not get file contents\n");
- options->err_stat = 1;
- goto out;
- } /* end if */
+ opts->err_stat = 1;
+ HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ } /* end if */
info2_lp = info2_grp;
}
#ifdef H5_HAVE_PARALLEL
- if(g_Parallel)
- {
+ if(g_Parallel) {
int i;
- if((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME))
- {
+ if((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME)) {
HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME);
MPI_Abort(MPI_COMM_WORLD, 0);
} /* end if */
@@ -1009,13 +958,12 @@ hsize_t h5diff(const char *fname1,
/* process the objects */
build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp,
- &match_list, options);
- if (both_objs_grp)
- {
+ &match_list, opts);
+ if (both_objs_grp) {
/*------------------------------------------------------
* print the list
*/
- if(options->m_verbose)
+ if(opts->m_verbose)
{
unsigned u;
@@ -1026,8 +974,7 @@ hsize_t h5diff(const char *fname1,
else
parallel_print("file1 file2\n");
parallel_print("---------------------------------------\n");
- for(u = 0; u < match_list->nobjs; u++)
- {
+ for(u = 0; u < match_list->nobjs; u++) {
char c1, c2;
c1 = (match_list->objs[u].flags[0]) ? 'x' : ' ';
c2 = (match_list->objs[u].flags[1]) ? 'x' : ' ';
@@ -1038,9 +985,9 @@ hsize_t h5diff(const char *fname1,
}
nfound = diff_match(file1_id, obj1fullname, info1_lp,
file2_id, obj2fullname, info2_lp,
- match_list, options);
+ match_list, opts);
-out:
+done:
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
/* All done at this point, let tasks know that they won't be needed */
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 6480cf6..0140e64 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -97,27 +97,27 @@
static hbool_t not_comparable;
#define PER(A,B) { \
- per = -1; \
- not_comparable = FALSE; \
- both_zero = FALSE; \
- if(0 == (A) && 0 == (B)) \
+ per = -1; \
+ not_comparable = FALSE; \
+ both_zero = FALSE; \
+ if(0 == (A) && 0 == (B)) \
both_zero = TRUE; \
- if(0 != (A)) \
+ if(0 != (A)) \
per = (double)ABS((double)((B) - (A)) / (double)(A)); \
- else \
+ else \
not_comparable = TRUE; \
}
#define PER_UNSIGN(TYPE,A,B) { \
- per = -1; \
- not_comparable = FALSE; \
- both_zero = FALSE; \
- if((A) == 0 && (B) == 0) \
+ per = -1; \
+ not_comparable = FALSE; \
+ both_zero = FALSE; \
+ if((A) == 0 && (B) == 0) \
both_zero = TRUE; \
- if((A) != 0) \
+ if((A) != 0) \
per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \
- else \
+ else \
not_comparable = TRUE; \
}
@@ -154,7 +154,7 @@ static void h5diff_print_char(char ch);
static hsize_t diff_datum(void *_mem1,
void *_mem2,
hid_t m_type,
- hsize_t i,
+ hsize_t index,
int rank,
hsize_t *dims,
hsize_t *acc,
@@ -385,13 +385,13 @@ hsize_t diff_array( void *_mem1,
hid_t container1_id,
hid_t container2_id) /* dataset where the reference came from*/
{
- hsize_t nfound=0; /* number of differences found */
+ hsize_t nfound = 0; /* number of differences found */
size_t size; /* size of datum */
unsigned char *mem1 = (unsigned char*)_mem1;
unsigned char *mem2 = (unsigned char*)_mem2;
- hsize_t acc[32]; /* accumulator position */
- hsize_t pos[32]; /* matrix position */
- int ph=1; /* print header */
+ hsize_t acc[32]; /* accumulator position */
+ hsize_t pos[32]; /* matrix position */
+ int ph = 1; /* print header */
hsize_t i;
int j;
mcomp_t members;
@@ -399,7 +399,7 @@ hsize_t diff_array( void *_mem1,
h5difftrace("diff_array start\n");
/* get the size. */
- size = H5Tget_size( m_type );
+ size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
/* Fast comparison first for atomic type by memcmp().
@@ -407,22 +407,19 @@ hsize_t diff_array( void *_mem1,
* by the condition, but it gives more clarity for code planning
*/
if (type_class != H5T_REFERENCE &&
- type_class != H5T_COMPOUND &&
- type_class != H5T_STRING &&
- type_class != H5T_VLEN &&
- HDmemcmp(mem1, mem2, size*nelmts)==0)
+ type_class != H5T_COMPOUND &&
+ type_class != H5T_STRING &&
+ type_class != H5T_VLEN &&
+ HDmemcmp(mem1, mem2, size*nelmts) == 0)
return 0;
- if ( rank > 0 )
- {
-
- acc[rank-1]=1;
- for(j=(rank-2); j>=0; j--)
- {
- acc[j]=acc[j+1]*dims[j+1];
+ if (rank > 0) {
+ acc[rank-1] = 1;
+ for(j = (rank-2); j >= 0; j--) {
+ acc[j] = acc[j+1] * dims[j+1];
}
- for ( j = 0; j < rank; j++)
- pos[j]=0;
+ for (j = 0; j < rank; j++)
+ pos[j] = 0;
}
switch (type_class)
@@ -441,37 +438,37 @@ hsize_t diff_array( void *_mem1,
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, options, 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);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+ nfound = diff_double(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, options, 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, options, 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, options, 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, options, 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, options, 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, options, 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, options, 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, options, 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, options, 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, options, 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, options, 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, options, name1, name2, &ph);
break;
@@ -490,25 +487,16 @@ hsize_t diff_array( void *_mem1,
case H5T_REFERENCE:
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, /* offset */
+ for (i = 0; i < nelmts; i++) {
+ nfound += diff_datum(
+ mem1 + i * size, mem2 + i * size,
m_type,
- i,
- rank,
- dims,
- acc,
- pos,
+ i, rank, dims, acc, pos,
options,
- name1,
- name2,
- container1_id,
- container2_id,
+ name1, name2,
+ container1_id, container2_id,
&ph, &members);
- if (options->n && nfound>=options->count)
- {
+ if (options->n && nfound >= options->count) {
close_member_types(&members);
return nfound;
}
@@ -560,7 +548,7 @@ hsize_t diff_array( void *_mem1,
static hsize_t diff_datum(void *_mem1,
void *_mem2,
hid_t m_type,
- hsize_t i,
+ hsize_t index,
int rank,
hsize_t *dims,
hsize_t *acc,
@@ -584,19 +572,19 @@ static hsize_t diff_datum(void *_mem1,
unsigned nmembs;
unsigned j;
hsize_t nelmts;
- size_t size=0;
+ 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 */
+ hsize_t nfound = 0; /* differences found */
+ int ret = 0; /* check return error */
float f1, f2;
double per;
hbool_t both_zero;
h5difftrace("diff_datum start\n");
- type_size = H5Tget_size( m_type );
+ type_size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
/* Fast comparison first for atomic type by memcmp().
@@ -604,10 +592,10 @@ static hsize_t diff_datum(void *_mem1,
* by the condition, but it gives more clarity for code planning
*/
if (type_class != H5T_REFERENCE &&
- type_class != H5T_COMPOUND &&
- type_class != H5T_STRING &&
- type_class != H5T_VLEN &&
- HDmemcmp(mem1, mem2, type_size)==0)
+ type_class != H5T_COMPOUND &&
+ type_class != H5T_STRING &&
+ type_class != H5T_VLEN &&
+ HDmemcmp(mem1, mem2, type_size) == 0)
return 0;
switch (H5Tget_class(m_type))
@@ -629,25 +617,17 @@ static hsize_t diff_datum(void *_mem1,
nmembs = members->n;
- for (j = 0; j < nmembs; j++)
- {
- offset = members->offsets[j];
+ for (j = 0; j < nmembs; j++) {
+ offset = members->offsets[j];
memb_type = members->ids[j];
- nfound+=diff_datum(
- mem1 + offset,
- mem2 + offset,
+ nfound += diff_datum(
+ mem1 + offset, mem2 + offset,
memb_type,
- i,
- rank,
- dims,
- acc,
- pos,
+ index, rank, dims, acc, pos,
options,
- obj1,
- obj2,
- container1_id,
- container2_id,
+ obj1, obj2,
+ container1_id, container2_id,
ph, members->m[j]);
}
break;
@@ -739,43 +719,28 @@ static hsize_t diff_datum(void *_mem1,
}
/* check for NULL pointer for string */
- if(s!=NULL) {
+ if(s != NULL) {
/* try fast compare first */
- if(HDmemcmp(s1, s2, size)==0) {
+ if(HDmemcmp(s1, s2, size) == 0) {
if(size1 != size2)
if(print_data(options))
- for (u=size; u<sizex; u++)
+ for (u = size; u < sizex; u++)
character_compare(
- s1 + u,
- s2 + u, /* offset */
- i, /* index position */
- u, /* string character position */
- rank,
- dims,
- acc,
- pos,
+ s1 + u, s2 + u,
+ index, u, rank, dims, acc, pos,
options,
- obj1,
- obj2,
+ obj1, obj2,
ph);
}
else
- for (u=0; u<size; u++)
- nfound+=character_compare(
- s1 + u,
- s2 + u, /* offset */
- i, /* index position */
- u, /* string character position */
- rank,
- dims,
- acc,
- pos,
+ for (u = 0; u < size; u++)
+ nfound += character_compare(
+ s1 + u, s2 + u,
+ i, u, rank, dims, acc, pos,
options,
- obj1,
- obj2,
+ obj1, obj2,
ph);
- }
-
+ } /* end check for NULL pointer for string */
}
break;
@@ -785,22 +750,14 @@ static hsize_t diff_datum(void *_mem1,
*/
case H5T_BITFIELD:
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, /* offset */
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
+ for (u = 0; u < type_size; u++)
+ nfound += character_compare_opt(
+ mem1 + u, mem2 + u,
+ i, rank, dims, acc, pos,
options,
- obj1,
- obj2,
+ obj1, obj2,
ph);
-
break;
/*-------------------------------------------------------------------------
@@ -810,46 +767,34 @@ static hsize_t diff_datum(void *_mem1,
case H5T_OPAQUE:
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, /* offset */
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
+ for (u = 0; u < type_size; u++)
+ nfound += character_compare_opt(
+ mem1 + u, mem2 + u,
+ i, rank, dims, acc, pos,
options,
- obj1,
- obj2,
+ obj1, obj2,
ph);
-
break;
-
/*-------------------------------------------------------------------------
* H5T_ENUM
*-------------------------------------------------------------------------
*/
case H5T_ENUM:
- h5difftrace("diff_datum H5T_ENUM\n");
-
- /* For enumeration types we compare the names instead of the
- integer values. For each pair of elements being
- compared, we convert both bit patterns to their corresponding
- enumeration constant and do a string comparison
- */
-
+ /* For enumeration types we compare the names instead of the
+ * integer values. For each pair of elements being
+ * compared, we convert both bit patterns to their corresponding
+ * enumeration constant and do a string comparison
+ */
{
- char enum_name1[1024];
- char enum_name2[1024];
-
- herr_t err1;
- herr_t err2;
+ h5difftrace("diff_datum H5T_ENUM\n");
+ char enum_name1[1024];
+ char enum_name2[1024];
+ herr_t err1;
+ herr_t err2;
/* disable error reporting */
H5E_BEGIN_TRY {
-
/* If the enum value cannot be converted to a string
* it is set to an error string for later output.
*/
@@ -861,58 +806,42 @@ static hsize_t diff_datum(void *_mem1,
if(err2 < 0)
HDsnprintf(enum_name2, sizeof(enum_name2), "**INVALID VALUE**");
- if(err1 < 0 || err2 < 0)
- {
- /* One or more bad enum values */
-
+ /* One or more bad enum values */
+ if(err1 < 0 || err2 < 0) {
/* If the two values cannot be converted to a string
* (probably due to them being invalid enum values),
* don't attempt to convert them - just report errors.
*/
nfound += 1;
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(S_FORMAT,enum_name1,enum_name2);
+ parallel_print(S_FORMAT, enum_name1, enum_name2);
}
}
- else
- {
+ else {
/* Both enum values were valid */
-
- if (HDstrcmp(enum_name1,enum_name2)!=0)
- {
- nfound=1;
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (HDstrcmp(enum_name1, enum_name2) != 0){
+ nfound = 1;
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(S_FORMAT,enum_name1,enum_name2);
+ parallel_print(S_FORMAT, enum_name1, enum_name2);
}
}
- else
- {
- for (u=0; u<type_size; u++)
+ else {
+ for (u = 0; u < type_size; u++)
nfound+=character_compare_opt(
- mem1 + u,
- mem2 + u, /* offset */
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
+ mem1 + u, mem2 + u,
+ i, rank, dims, acc, pos,
options,
- obj1,
- obj2,
+ obj1, obj2,
ph);
}
}
/* enable error reporting */
} H5E_END_TRY;
}
-
-
break;
/*-------------------------------------------------------------------------
@@ -920,9 +849,8 @@ static hsize_t diff_datum(void *_mem1,
*-------------------------------------------------------------------------
*/
case H5T_ARRAY:
-
{
- hsize_t adims[H5S_MAX_RANK];
+ hsize_t adims[H5S_MAX_RANK];
int ndims;
/* get the array's base datatype for each element */
@@ -937,84 +865,65 @@ static hsize_t diff_datum(void *_mem1,
nelmts *= adims[u];
for (u = 0; u < nelmts; u++) {
nfound += diff_datum(
- mem1 + u * size,
- mem2 + u * size, /* offset */
+ mem1 + u * size, mem2 + u * size,
memb_type,
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
+ i, rank, dims, acc, pos,
options,
- obj1,
- obj2,
- container1_id,
- container2_id,
+ obj1, obj2,
+ container1_id, container2_id,
ph, members);
}
H5Tclose(memb_type);
}
break;
-
-
/*-------------------------------------------------------------------------
* H5T_REFERENCE
*-------------------------------------------------------------------------
*/
-
case H5T_REFERENCE:
-
iszero1=all_zero(_mem1, H5Tget_size(m_type));
iszero2=all_zero(_mem2, H5Tget_size(m_type));
- if (iszero1 != iszero2)
- {
+ if (iszero1 != iszero2) {
return 1;
}
- else if (!iszero1 && !iszero2)
- {
-
+ else if (!iszero1 && !iszero2) {
/*-------------------------------------------------------------------------
- * H5T_STD_REF_DSETREG
- * Dataset region reference
- *-------------------------------------------------------------------------
- */
- if (type_size==H5R_DSET_REG_REF_BUF_SIZE)
- {
+ * H5T_STD_REF_DSETREG
+ * Dataset region reference
+ *-------------------------------------------------------------------------
+ */
+ if (type_size == H5R_DSET_REG_REF_BUF_SIZE) {
hid_t region1_id;
hid_t region2_id;
- 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 (ret==-1) {
- options->err_stat=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 (ret == -1) {
+ options->err_stat = 1;
return 0;
}
- nfound = diff_region(obj1_id,obj2_id,region1_id,region2_id,options);
-
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, options);
H5Oclose(obj1_id);
H5Oclose(obj2_id);
H5Sclose(region1_id);
H5Sclose(region2_id);
-
}/*dataset reference*/
-
/*-------------------------------------------------------------------------
* H5T_STD_REF_OBJ
* Object references. get the type and OID of the referenced object
*-------------------------------------------------------------------------
*/
- else if (type_size == H5R_OBJ_REF_BUF_SIZE)
- {
+ else if (type_size == H5R_OBJ_REF_BUF_SIZE) {
H5O_type_t obj1_type;
H5O_type_t obj2_type;
@@ -1028,8 +937,7 @@ static hsize_t diff_datum(void *_mem1,
} /* end if */
/* check object type */
- if(obj1_type != obj2_type)
- {
+ if(obj1_type != obj2_type) {
parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
options->not_cmp = 1;
return 0;
@@ -1042,39 +950,32 @@ static hsize_t diff_datum(void *_mem1,
if(ret == -1) {
options->err_stat = 1;
return 0;
- } /* end if */
+ }
/* compare */
if(obj1_type == H5O_TYPE_DATASET)
- nfound = diff_datasetid(obj1_id,
- obj2_id,
- NULL,
- NULL,
+ nfound = diff_datasetid(
+ obj1_id, obj2_id,
+ NULL, NULL,
options);
else {
if(options->m_verbose)
- parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n",
- obj1, obj2);
+ parallel_print(
+ "Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
options->not_cmp = 1;
}
H5Oclose(obj1_id);
H5Oclose(obj2_id);
-
}/*object reference*/
-
}/*is zero*/
-
-
break;
/*-------------------------------------------------------------------------
* H5T_VLEN
*-------------------------------------------------------------------------
*/
-
case H5T_VLEN:
-
/* get the VL sequences's base datatype for each element */
memb_type = H5Tget_super(m_type);
size = H5Tget_size(memb_type);
@@ -1085,421 +986,313 @@ static hsize_t diff_datum(void *_mem1,
for (j = 0; j < nelmts; j++)
nfound += diff_datum(
((char *)(((hvl_t *)mem1)->p)) + j * size,
- ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */
+ ((char *)(((hvl_t *)mem2)->p)) + j * size,
memb_type,
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
+ i, rank, dims, acc, pos,
options,
- obj1,
- obj2,
- container1_id,
- container2_id,
+ obj1, obj2,
+ container1_id, container2_id,
ph, members);
H5Tclose(memb_type);
-
break;
-
-
/*-------------------------------------------------------------------------
* H5T_INTEGER
*-------------------------------------------------------------------------
*/
-
case H5T_INTEGER:
type_sign = H5Tget_sign(m_type);
-
/*-------------------------------------------------------------------------
* H5T_NATIVE_SCHAR
*-------------------------------------------------------------------------
*/
- if (type_size==1 && type_sign!=H5T_SGN_NONE)
- {
+ if (type_size == 1 && type_sign != H5T_SGN_NONE) {
char temp1_char;
char temp2_char;
- HDassert(type_size==sizeof(char));
+ HDassert(type_size == sizeof(char));
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) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (ABS(temp1_char-temp2_char) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER(temp1_char,temp2_char);
+ else if (!options->d && options->p) {
+ PER(temp1_char, temp2_char);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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));
+ 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) )
- {
- print_pos(ph,1,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);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER(temp1_char,temp2_char);
+ else if (options->d && options->p) {
+ PER(temp1_char, temp2_char);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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));
+ 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) )
- {
- print_pos(ph,1,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);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_char - temp2_char) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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);
}
+ nfound++;
+ }
}
- else if (temp1_char != temp2_char)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_char != temp2_char) {
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
nfound++;
}
-
} /*H5T_NATIVE_SCHAR*/
/*-------------------------------------------------------------------------
* H5T_NATIVE_UCHAR
*-------------------------------------------------------------------------
*/
- else if (type_size==1 && type_sign==H5T_SGN_NONE)
- {
+ else if (type_size == 1 && type_sign == H5T_SGN_NONE) {
unsigned char temp1_uchar;
unsigned char temp2_uchar;
- HDassert(type_size==sizeof(unsigned char));
+ HDassert(type_size == sizeof(unsigned char));
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) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (PDIFF(temp1_uchar, temp2_uchar) > options->delta) {
+ if ( print_data(options)) {
+ 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));
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
+ else if (!options->d && options->p) {
+ PER_UNSIGN(signed char,temp1_uchar, temp2_uchar);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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));
+ 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) )
- {
- 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);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ 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);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
+ else if (options->d && options->p) {
+ PER_UNSIGN(signed char,temp1_uchar, temp2_uchar);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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));
+ 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) )
- {
- 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);
- }
- nfound++;
+ else if (per > options->percent && PDIFF(temp1_uchar, temp2_uchar) > options->delta) {
+ if (print_data(options)) {
+ 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);
}
+ nfound++;
+ }
}
- else if (temp1_uchar != temp2_uchar)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_uchar != temp2_uchar) {
+ if (print_data(options)) {
+ 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));
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
-
} /*H5T_NATIVE_UCHAR*/
-
/*-------------------------------------------------------------------------
* H5T_NATIVE_SHORT
*-------------------------------------------------------------------------
*/
-
- else if (type_size==2 && type_sign!=H5T_SGN_NONE)
- {
+ else if (type_size == 2 && type_sign != H5T_SGN_NONE) {
short temp1_short;
short temp2_short;
- HDassert(type_size==sizeof(short));
+ HDassert(type_size == sizeof(short));
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) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if (ABS(temp1_short - temp2_short) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
+ else if (!options->d && options->p) {
PER(temp1_short,temp2_short);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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));
+ 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) )
- {
- print_pos(ph,1,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);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
+ else if ( options->d && options->p) {
PER(temp1_short,temp2_short);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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));
+ 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) )
- {
- print_pos(ph,1,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);
- }
- nfound++;
+ else if (per > options->percent && ABS(temp1_short - temp2_short) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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);
}
+ nfound++;
+ }
}
- else if (temp1_short != temp2_short)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_short != temp2_short) {
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
nfound++;
}
-
-
} /*H5T_NATIVE_SHORT*/
/*-------------------------------------------------------------------------
* H5T_NATIVE_USHORT
*-------------------------------------------------------------------------
*/
-
- else if (type_size==2 && type_sign==H5T_SGN_NONE)
- {
+ else if (type_size == 2 && type_sign == H5T_SGN_NONE) {
unsigned short temp1_ushort;
unsigned short temp2_ushort;
- HDassert(type_size==sizeof(short));
+ HDassert(type_size == sizeof(short));
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) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ if (options->d && !options->p) {
+ if ( PDIFF(temp1_ushort, temp2_ushort) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
}
/* !-d and -p */
- else if (!options->d && options->p)
- {
- PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
+ else if (!options->d && options->p) {
+ PER_UNSIGN(signed short,temp1_ushort, temp2_ushort);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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));
+ 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) )
- {
- print_pos(ph,1,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);
- }
- nfound++;
+ else if (per > options->percent) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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);
}
+ nfound++;
+ }
}
/* -d and -p */
- else if ( options->d && options->p)
- {
- PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
+ else if (options->d && options->p) {
+ PER_UNSIGN(signed short,temp1_ushort, temp2_ushort);
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
+ if (not_comparable && !both_zero) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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));
+ 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) )
- {
- print_pos(ph,1,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);
- }
- nfound++;
+ else if (per > options->percent && PDIFF(temp1_ushort, temp2_ushort) > options->delta) {
+ if (print_data(options)) {
+ print_pos(ph, 1, 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);
}
+ nfound++;
+ }
}
- else if (temp1_ushort != temp2_ushort)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ else if (temp1_ushort != temp2_ushort) {
+ if (print_data(options)) {
+ print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
+ parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
nfound++;
}
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index 136c5ed..a556b0a 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -62,6 +62,14 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g;
/*
+ * H5TOOLS_INFO macro, used to facilitate error reporting . The arguments are the major
+ * error number, the minor error number, and a description of the error.
+ */
+#define H5TOOLS_INFO(min_id, str) { \
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, str); \
+}
+
+/*
* HERROR macro, used to facilitate error reporting . The arguments are the major
* error number, the minor error number, and a description of the error.
*/