summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.c1093
-rw-r--r--tools/lib/h5diff.h22
-rw-r--r--tools/lib/h5diff_array.c1721
-rw-r--r--tools/lib/h5diff_attr.c260
-rw-r--r--tools/lib/h5diff_dset.c572
-rw-r--r--tools/lib/h5diff_util.c84
-rw-r--r--tools/lib/h5tools_dump.c180
-rw-r--r--tools/lib/h5tools_filters.c65
-rw-r--r--tools/lib/h5tools_type.c124
-rw-r--r--tools/lib/h5tools_utils.c219
-rw-r--r--tools/lib/h5trav.c533
-rw-r--r--tools/lib/ph5diff.h2
12 files changed, 2195 insertions, 2680 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 0be6f5c..94cca58 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -21,25 +21,25 @@
/*-------------------------------------------------------------------------
* Function: print_objname
*
- * Purpose: check if object name is to be printed, only when:
- * 1) verbose mode
- * 2) when diff was found (normal mode)
+ * Purpose: check if object name is to be printed, only when:
+ * 1) verbose mode
+ * 2) when diff was found (normal mode)
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE int
-print_objname (diff_opt_t * options, hsize_t nfound)
+print_objname (diff_opt_t * opts, hsize_t nfound)
{
- return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0;
+ return ((opts->m_verbose || nfound) && !opts->m_quiet) ? 1 : 0;
}
/*-------------------------------------------------------------------------
* Function: do_print_objname
*
- * Purpose: print object name
- *
+ * Purpose: print object name
*-------------------------------------------------------------------------
*/
-void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts)
+void
+do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts)
{
/* if verbose level is higher than 0, put space line before
* displaying any object or symbolic links. This improves
@@ -53,8 +53,7 @@ void do_print_objname (const char *OBJ, const char *path1, const char *path2, di
/*-------------------------------------------------------------------------
* Function: do_print_attrname
*
- * Purpose: print attribute name
- *
+ * Purpose: print attribute name
*-------------------------------------------------------------------------
*/
void
@@ -66,17 +65,16 @@ do_print_attrname (const char *attr, const char *path1, const char *path2)
/*-------------------------------------------------------------------------
* Function: print_warn
*
- * Purpose: check print warning condition.
+ * Purpose: check print warning condition.
* Return:
- * 1 if verbose mode
- * 0 if not verbos mode
- * Programmer: Jonathan Kim
- * Date: Feb 4, 2010
+ * 1 if verbose mode
+ * 0 if not verbos mode
*-------------------------------------------------------------------------
*/
-static int print_warn(diff_opt_t *options)
+static int
+print_warn(diff_opt_t *opts)
{
- return ((options->m_verbose))?1:0;
+ return ((opts->m_verbose)) ? 1: 0;
}
@@ -84,20 +82,16 @@ static int print_warn(diff_opt_t *options)
/*-------------------------------------------------------------------------
* Function: phdiff_dismiss_workers
*
- * Purpose: tell all workers to end.
- *
- * Return: none
- *
- * Programmer: Albert Cheng
- *
- * Date: Feb 6, 2005
+ * Purpose: tell all workers to end.
*
+ * Return: none
*-------------------------------------------------------------------------
*/
-void phdiff_dismiss_workers(void)
+void
+phdiff_dismiss_workers(void)
{
int i;
- for(i=1; i<g_nTasks; i++)
+ for (i = 1; i < g_nTasks; i++)
MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD);
}
@@ -105,29 +99,23 @@ void phdiff_dismiss_workers(void)
/*-------------------------------------------------------------------------
* Function: print_incoming_data
*
- * Purpose: special function that prints any output that has been sent to the manager
- * and is currently sitting in the incoming message queue
- *
- * Return: none
- *
- * Programmer: Leon Arber
- *
- * Date: March 7, 2005
+ * Purpose: special function that prints any output that has been sent to the manager
+ * and is currently sitting in the incoming message queue
*
+ * Return: none
*-------------------------------------------------------------------------
*/
-static void print_incoming_data(void)
+static void
+print_incoming_data(void)
{
- char data[PRINT_DATA_MAX_SIZE+1];
+ char data[PRINT_DATA_MAX_SIZE + 1];
int incomingMessage;
MPI_Status Status;
- do
- {
+ do {
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage)
- {
+ if(incomingMessage) {
HDmemset(data, 0, PRINT_DATA_MAX_SIZE+1);
MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status);
@@ -140,81 +128,68 @@ static void print_incoming_data(void)
/*-------------------------------------------------------------------------
* Function: is_valid_options
*
- * Purpose: check if options are valid
+ * Purpose: check if options are valid
*
* Return:
- * 1 : Valid
- * 0 : Not valid
- *
- * Programmer: Jonathan Kim
- *
- * Date: Feb 17, 2010
- *
+ * 1 : Valid
+ * 0 : Not valid
*------------------------------------------------------------------------*/
-static int is_valid_options(diff_opt_t *options)
+static int
+is_valid_options(diff_opt_t *opts)
{
- int ret=1; /* init to valid */
+ int ret_value = 1; /* init to valid */
/*-----------------------------------------------
* no -q(quiet) with -v (verbose) or -r (report) */
- if(options->m_quiet && (options->m_verbose || options->m_report))
- {
+ if(opts->m_quiet && (opts->m_verbose || opts->m_report)) {
parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
- options->err_stat=1;
- ret = 0;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_DONE(0);
}
/* -------------------------------------------------------
* only allow --no-dangling-links along with --follow-symlinks */
- if(options->no_dangle_links && !options->follow_links)
- {
+ if(opts->no_dangle_links && !opts->follow_links) {
parallel_print("Error: --no-dangling-links must be used along with --follow-symlinks option.\n");
- options->err_stat=1;
- ret = 0;
- goto out;
+ opts->err_stat = 1;
+ HGOTO_DONE(0);
}
-out:
+done:
- return ret;
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: is_exclude_path
*
- * Purpose: check if 'paths' are part of exclude path list
+ * Purpose: check if 'paths' are part of exclude path list
*
* Return:
- * 1 - excluded path
- * 0 - not excluded path
- *
- * Programmer: Jonathan Kim
- * Date: Aug 23, 2010
+ * 1 - excluded path
+ * 0 - not excluded path
*------------------------------------------------------------------------*/
-static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options)
+static int
+is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *opts)
{
struct exclude_path_list * exclude_path_ptr;
- int ret_cmp;
- int ret = 0;
+ int ret_cmp;
+ int ret_value = 0;
/* check if exclude path option is given */
- if (!options->exclude_path)
- goto out;
+ if (!opts->exclude_path)
+ HGOTO_DONE(0);
/* assign to local exclude list pointer */
- exclude_path_ptr = options->exclude;
+ exclude_path_ptr = opts->exclude;
/* search objects in exclude list */
- while (NULL != exclude_path_ptr)
- {
+ while (NULL != exclude_path_ptr) {
/* if exclude path is is group, exclude its members as well */
- if (exclude_path_ptr->obj_type == H5TRAV_TYPE_GROUP)
- {
+ if (exclude_path_ptr->obj_type == H5TRAV_TYPE_GROUP) {
ret_cmp = HDstrncmp(exclude_path_ptr->obj_path, path,
HDstrlen(exclude_path_ptr->obj_path));
- if (ret_cmp == 0) /* found matching members */
- {
+ if (ret_cmp == 0) { /* found matching members */
size_t len_grp;
/* check if given path belong to an excluding group, if so
@@ -223,22 +198,19 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options
* not under “/grp1xxx/” group.
*/
len_grp = HDstrlen(exclude_path_ptr->obj_path);
- if (path[len_grp] == '/')
- {
+ if (path[len_grp] == '/') {
/* belong to excluded group! */
- ret = 1;
+ ret_value = 1;
break; /* while */
}
}
}
/* exclude target is not group, just exclude the object */
- else
- {
+ else {
ret_cmp = HDstrcmp(exclude_path_ptr->obj_path, path);
- if (ret_cmp == 0) /* found matching object */
- {
+ if (ret_cmp == 0) { /* found matching object */
/* excluded non-group object */
- ret = 1;
+ ret_value = 1;
/* remember the type of this maching object.
* if it's group, it can be used for excluding its member
* objects in this while() loop */
@@ -249,26 +221,23 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options
exclude_path_ptr = exclude_path_ptr->next;
}
-out:
- return ret;
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: free_exclude_path_list
*
- * Purpose: free exclud object list from diff options
- *
- * Programmer: Jonathan Kim
- * Date: Aug 23, 2010
+ * Purpose: free exclude object list from diff options
*------------------------------------------------------------------------*/
-static void free_exclude_path_list(diff_opt_t *options)
+static void
+free_exclude_path_list(diff_opt_t *opts)
{
- struct exclude_path_list * curr = options->exclude;
- struct exclude_path_list * next;
+ struct exclude_path_list *curr = opts->exclude;
+ struct exclude_path_list *next;
- while (NULL != curr)
- {
+ while (NULL != curr) {
next = curr->next;
HDfree(curr);
curr = next;
@@ -278,44 +247,43 @@ static void free_exclude_path_list(diff_opt_t *options)
/*-------------------------------------------------------------------------
* Function: build_match_list
*
- * Purpose: get list of matching path_name from info1 and info2
+ * Purpose: get list of matching path_name from info1 and info2
*
* Note:
- * Find common objects; the algorithm used for this search is the
- * cosequential match algorithm and is described in
- * Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley.
- * Moved out from diff_match() to make code more flexible.
+ * Find common objects; the algorithm used for this search is the
+ * cosequential match algorithm and is described in
+ * Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley.
+ * Moved out from diff_match() to make code more flexible.
*
* Parameter:
- * table_out [OUT] : return the list
- *
- * Programmer: Jonathan Kim
- *
- * Date: Aug 18, 2010
+ * table_out [OUT] : return the list
*------------------------------------------------------------------------*/
-static void build_match_list (const char *objname1, trav_info_t *info1, const char *objname2, trav_info_t *info2, trav_table_t ** table_out, diff_opt_t *options)
+static void
+build_match_list (const char *objname1, trav_info_t *info1, const char *objname2, trav_info_t *info2,
+ trav_table_t ** table_out, diff_opt_t *opts)
{
- size_t curr1 = 0;
- size_t curr2 = 0;
+ size_t curr1 = 0;
+ size_t curr2 = 0;
unsigned infile[2];
- char * path1_lp;
- char * path2_lp;
+ char *path1_lp = NULL;
+ char *path2_lp = NULL;
h5trav_type_t type1_l;
h5trav_type_t type2_l;
- size_t path1_offset = 0;
- size_t path2_offset = 0;
- int cmp;
- trav_table_t *table;
- size_t idx;
+ size_t path1_offset = 0;
+ size_t path2_offset = 0;
+ int cmp;
+ trav_table_t *table = NULL;
+ size_t idx;
h5difftrace("build_match_list start\n");
/* init */
- trav_table_init( &table );
-
+ trav_table_init(&table);
+ if (table == NULL)
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create tarverse table");
/*
* This is necessary for the case that given objects are group and
* have different names (ex: obj1 is /grp1 and obj2 is /grp5).
- * All the objects belong to given groups are the cadidates.
+ * All the objects belong to given groups are the candidates.
* So prepare to compare paths without the group names.
*/
@@ -329,8 +297,7 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/*--------------------------------------------------
* build the list
*/
- while(curr1 < info1->nused && curr2 < info2->nused)
- {
+ while(curr1 < info1->nused && curr2 < info2->nused) {
path1_lp = (info1->paths[curr1].path) + path1_offset;
path2_lp = (info2->paths[curr2].path) + path2_offset;
type1_l = info1->paths[curr1].type;
@@ -338,19 +305,15 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/* criteria is string compare */
cmp = HDstrcmp(path1_lp, path2_lp);
-
- if(cmp == 0)
- {
- if(!is_exclude_path(path1_lp, type1_l, options))
- {
+ if(cmp == 0) {
+ if(!is_exclude_path(path1_lp, type1_l, opts)) {
infile[0] = 1;
infile[1] = 1;
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
/* if the two point to the same target object,
* mark that in table */
if (info1->paths[curr1].fileno == info2->paths[curr2].fileno &&
- info1->paths[curr1].objno == info2->paths[curr2].objno )
- {
+ info1->paths[curr1].objno == info2->paths[curr2].objno) {
idx = table->nobjs - 1;
table->objs[idx].is_same_trgobj = 1;
}
@@ -358,20 +321,16 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
curr1++;
curr2++;
} /* end if */
- else if(cmp < 0)
- {
- if(!is_exclude_path(path1_lp, type1_l, options))
- {
+ else if(cmp < 0) {
+ if(!is_exclude_path(path1_lp, type1_l, opts)) {
infile[0] = 1;
infile[1] = 0;
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
}
curr1++;
} /* end else-if */
- else
- {
- if (!is_exclude_path(path2_lp, type2_l, options))
- {
+ else {
+ if (!is_exclude_path(path2_lp, type2_l, opts)) {
infile[0] = 0;
infile[1] = 1;
trav_table_addflags(infile, path2_lp, info2->paths[curr2].type, table);
@@ -383,13 +342,11 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/* list1 did not end */
infile[0] = 1;
infile[1] = 0;
- while(curr1 < info1->nused)
- {
+ while(curr1 < info1->nused) {
path1_lp = (info1->paths[curr1].path) + path1_offset;
type1_l = info1->paths[curr1].type;
- if(!is_exclude_path(path1_lp, type1_l, options))
- {
+ if(!is_exclude_path(path1_lp, type1_l, opts)) {
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
}
curr1++;
@@ -398,19 +355,17 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/* list2 did not end */
infile[0] = 0;
infile[1] = 1;
- while(curr2 < info2->nused)
- {
+ while(curr2 < info2->nused) {
path2_lp = (info2->paths[curr2].path) + path2_offset;
type2_l = info2->paths[curr2].type;
- if (!is_exclude_path(path2_lp, type2_l, options))
- {
+ if (!is_exclude_path(path2_lp, type2_l, opts)) {
trav_table_addflags(infile, path2_lp, info2->paths[curr2].type, table);
}
curr2++;
} /* end while */
- free_exclude_path_list (options);
+ free_exclude_path_list (opts);
*table_out = table;
h5difftrace("build_match_list finish\n");
@@ -420,15 +375,11 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch
/*-------------------------------------------------------------------------
* Function: trav_grp_objs
*
- * Purpose:
- * Call back function from h5trav_visit().
- *
- * Programmer: Jonathan Kim
- *
- * Date: Aug 16, 2010
+ * Purpose: Call back function from h5trav_visit().
*------------------------------------------------------------------------*/
-static herr_t trav_grp_objs(const char *path, const H5O_info_t *oinfo,
- const char *already_visited, void *udata)
+static herr_t
+trav_grp_objs(const char *path, const H5O_info_t *oinfo,
+ const char *already_visited, void *udata)
{
trav_info_visit_obj(path, oinfo, already_visited, udata);
@@ -438,18 +389,13 @@ static herr_t trav_grp_objs(const char *path, const H5O_info_t *oinfo,
/*-------------------------------------------------------------------------
* Function: trav_grp_symlinks
*
- * Purpose:
- * Call back function from h5trav_visit().
- * Track and extra checkings while visiting all symbolic-links.
- *
- * Programmer: Jonathan Kim
- *
- * Date: Aug 16, 2010
+ * Purpose: Call back function from h5trav_visit().
+ * Track and extra checkings while visiting all symbolic-links.
*------------------------------------------------------------------------*/
-static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
- void *udata)
+static herr_t
+trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
{
- int ret_value = 0;
+ herr_t 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;
@@ -461,66 +407,68 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo,
if (!opts->follow_links) {
trav_info_visit_lnk(path, linfo, tinfo);
- goto done;
+ HGOTO_DONE(0);
}
switch(linfo->type) {
case H5L_TYPE_SOFT:
- 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 */
+ if((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) {
+ HGOTO_DONE(FAIL);
+ }
else if (ret_value == 0) {
- tinfo->symlink_visited.dangle_link = TRUE;
+ /* no dangling link option given and detect dangling link */
+ tinfo->symlink_visited.dangle_link = TRUE;
trav_info_visit_lnk(path, linfo, tinfo);
if (opts->no_dangle_links)
opts->err_stat = 1; /* make dangling link is error */
- goto done;
+ HGOTO_DONE(0);
}
/* check if already visit the target object */
if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path))
- goto done;
+ HGOTO_DONE(0);
/* add this link as visited link */
if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0)
- goto done;
+ HGOTO_DONE(0);
if(h5trav_visit(tinfo->fid, path, TRUE, TRUE,
trav_grp_objs,trav_grp_symlinks, tinfo) < 0) {
parallel_print("Error: Could not get file contents\n");
opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents");
}
break;
case H5L_TYPE_EXTERNAL:
- 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 */
+ if ((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) {
+ HGOTO_DONE(FAIL);
+ }
else if (ret_value == 0) {
+ /* no dangling link option given and detect dangling link */
tinfo->symlink_visited.dangle_link = TRUE;
trav_info_visit_lnk(path, linfo, tinfo);
if (opts->no_dangle_links)
opts->err_stat = 1; /* make dangling link is error */
- goto done;
+ HGOTO_DONE(0);
}
if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0)
- goto done;
+ HGOTO_DONE(0);
/* check if already visit the target object */
if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path))
- goto done;
+ HGOTO_DONE(0);
/* add this link as visited link */
if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0)
- goto done;
+ HGOTO_DONE(0);
if(h5trav_visit(tinfo->fid, path, TRUE, TRUE,
trav_grp_objs,trav_grp_symlinks, tinfo) < 0) {
parallel_print("Error: Could not get file contents\n");
opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents\n");
}
break;
@@ -530,52 +478,48 @@ 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;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Invalid link type");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Invalid link type");
break;
} /* end of switch */
done:
if (lnk_info.trg_path)
HDfree(lnk_info.trg_path);
- return 0;
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: h5diff
*
- * Purpose: public function, can be called in an application program.
- * return differences between 2 HDF5 files
- *
- * Return: Number of differences found.
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: October 22, 2003
+ * Purpose: public function, can be called in an application program.
+ * return differences between 2 HDF5 files
*
+ * Return: Number of differences found.
*-------------------------------------------------------------------------
*/
-hsize_t h5diff(const char *fname1,
+hsize_t
+h5diff(const char *fname1,
const char *fname2,
const char *objname1,
const char *objname2,
diff_opt_t *opts)
{
- int ret_value = 0;
- hid_t file1_id = (-1);
- hid_t file2_id = (-1);
- char filenames[2][MAX_FILENAME];
- hsize_t nfound = 0;
- int l_ret1 = -1;
- int l_ret2 = -1;
- char * obj1fullname = NULL;
- char * obj2fullname = NULL;
- int both_objs_grp = 0;
+ int ret_value = 0;
+ hid_t file1_id = -1;
+ hid_t file2_id = -1;
+ char filenames[2][MAX_FILENAME];
+ hsize_t nfound = 0;
+ int l_ret1 = -1;
+ int l_ret2 = -1;
+ char *obj1fullname = NULL;
+ char *obj2fullname = NULL;
+ int both_objs_grp = 0;
/* init to group type */
h5trav_type_t obj1type = H5TRAV_TYPE_GROUP;
h5trav_type_t obj2type = H5TRAV_TYPE_GROUP;
/* for single object */
- H5O_info_t oinfo1, oinfo2; /* object info */
+ H5O_info_t oinfo1, oinfo2; /* object info */
trav_info_t *info1_obj = NULL;
trav_info_t *info2_obj = NULL;
/* for group object */
@@ -585,8 +529,8 @@ hsize_t h5diff(const char *fname1,
trav_info_t *info1_lp = NULL;
trav_info_t *info2_lp = NULL;
/* link info from specified object */
- H5L_info_t src_linfo1;
- H5L_info_t src_linfo2;
+ H5L_info_t src_linfo1;
+ H5L_info_t src_linfo2;
/* link info from member object */
h5tool_link_info_t trg_linfo1;
h5tool_link_info_t trg_linfo2;
@@ -604,34 +548,27 @@ hsize_t h5diff(const char *fname1,
* check invalid combination of options
*-----------------------------------------------------------------------*/
if(!is_valid_options(opts))
- goto done;
+ HGOTO_DONE(0);
opts->cmn_objs = 1; /* eliminate warning */
+ opts->err_stat = 0; /* initialize error status */
/*-------------------------------------------------------------------------
* open the files first; if they are not valid, no point in continuing
*-------------------------------------------------------------------------
*/
-
- /* disable error reporting */
- H5E_BEGIN_TRY
- {
- /* open file 1 */
- 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);
- opts->err_stat = 1;
- goto done;
- } /* end if */
+ /* open file 1 */
+ 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);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname1);
+ } /* end if */
- /* open file 2 */
- 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);
- opts->err_stat = 1;
- goto done;
- } /* end if */
- /* enable error reporting */
- } H5E_END_TRY;
+ /* open file 2 */
+ 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);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname2);
+ } /* end if */
/*-------------------------------------------------------------------------
* Initialize the info structs
@@ -648,10 +585,12 @@ hsize_t h5diff(const char *fname1,
#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 done;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
- obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2);
+ if ((obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2)) == NULL)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+
HDstrcpy(obj1fullname, "/");
HDstrcat(obj1fullname, objname1);
#endif /* H5_HAVE_ASPRINTF */
@@ -664,10 +603,11 @@ hsize_t h5diff(const char *fname1,
#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 done;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
- obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2);
+ if ((obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2)) == NULL)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
HDstrcpy(obj2fullname, "/");
HDstrcat(obj2fullname, objname2);
#endif /* H5_HAVE_ASPRINTF */
@@ -686,14 +626,12 @@ hsize_t h5diff(const char *fname1,
/* check if link itself exist */
if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) {
parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
+ HGOTO_ERROR(1, 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) {
parallel_print("Unable to get link info from <%s>\n", obj1fullname);
- H5TOOLS_INFO(H5E_tools_min_id_g, "Unable to get link info\n");
- goto done;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed");
}
info1_lp = info1_obj;
@@ -709,8 +647,7 @@ hsize_t h5diff(const char *fname1,
if(H5Oget_info_by_name(file1_id, obj1fullname, &oinfo1, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(1, 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 +676,12 @@ hsize_t h5diff(const char *fname1,
/* check if link itself exist */
if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) {
parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
+ HGOTO_ERROR(1, 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) {
parallel_print("Unable to get link info from <%s>\n", obj2fullname);
- goto done;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed");
}
info2_lp = info2_obj;
@@ -761,8 +697,7 @@ hsize_t h5diff(const char *fname1,
if(H5Oget_info_by_name(file2_id, obj2fullname, &oinfo2, H5P_DEFAULT) < 0) {
parallel_print("Error: Could not get file contents\n");
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents");
}
obj2type = (h5trav_type_t)oinfo2.type;
trav_info_add(info2_obj, obj2fullname, obj2type);
@@ -790,7 +725,7 @@ hsize_t h5diff(const char *fname1,
obj2type = H5TRAV_TYPE_GROUP;
}
-
+ h5diffdebug2("get any symbolic links info - errstat:%d\n", opts->err_stat);
/* get any symbolic links info */
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);
@@ -814,8 +749,7 @@ hsize_t h5diff(const char *fname1,
/* treat dangling link as error */
if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: treat dangling link as error");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error");
}
else {
if(opts->m_verbose)
@@ -823,14 +757,13 @@ hsize_t h5diff(const char *fname1,
if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
print_found(nfound);
- goto done;
+ HGOTO_DONE(0);
}
}
}
else if(l_ret1 < 0) { /* fail */
parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found");
}
else if(l_ret1 != 2) { /* symbolic link */
obj1type = (h5trav_type_t)trg_linfo1.trg_type;
@@ -857,23 +790,21 @@ hsize_t h5diff(const char *fname1,
/* treat dangling link as error */
if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: treat dangling link as error");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error");
}
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 done;
+ HGOTO_DONE(0);
}
}
}
else if(l_ret2 < 0) { /* fail */
parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found");
}
else if(l_ret2 != 2) { /* symbolic link */
obj2type = (h5trav_type_t)trg_linfo2.trg_type;
@@ -899,9 +830,9 @@ hsize_t h5diff(const char *fname1,
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 done;
+ if (l_ret1 > 0 && l_ret2 > 0)
+ if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname) != 0)
+ HGOTO_DONE(0);
}
both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP);
@@ -917,8 +848,7 @@ hsize_t h5diff(const char *fname1,
if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE,
trav_grp_objs, trav_grp_symlinks, info1_grp) < 0) {
parallel_print("Error: Could not get file contents\n");
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents");
}
info1_lp = info1_grp;
@@ -932,11 +862,11 @@ hsize_t h5diff(const char *fname1,
if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE,
trav_grp_objs, trav_grp_symlinks, info2_grp) < 0) {
parallel_print("Error: Could not get file contents\n");
- opts->err_stat = 1;
- HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents");
} /* end if */
info2_lp = info2_grp;
}
+ h5diffdebug2("groups traversed - errstat:%d\n", opts->err_stat);
#ifdef H5_HAVE_PARALLEL
if(g_Parallel) {
@@ -957,14 +887,12 @@ hsize_t h5diff(const char *fname1,
#endif
/* process the objects */
- build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp,
- &match_list, opts);
+ build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, &match_list, opts);
if (both_objs_grp) {
/*------------------------------------------------------
* print the list
*/
- if(opts->m_verbose)
- {
+ if(opts->m_verbose) {
unsigned u;
parallel_print("\n");
@@ -988,6 +916,8 @@ hsize_t h5diff(const char *fname1,
match_list, opts);
done:
+ opts->err_stat = opts->err_stat | ret_value;
+
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
/* All done at this point, let tasks know that they won't be needed */
@@ -1022,6 +952,7 @@ done:
H5Fclose(file1_id);
H5Fclose(file2_id);
} H5E_END_TRY;
+
h5difftrace("h5diff finish\n");
return nfound;
@@ -1032,43 +963,34 @@ done:
/*-------------------------------------------------------------------------
* Function: diff_match
*
- * Purpose:
- * Compare common objects in given groups according to table structure.
- * The table structure has flags which can be used to find common objects
- * and will be compared.
- * Common object means same name (absolute path) objects in both location.
- *
- * Return: Number of differences found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Purpose: Compare common objects in given groups according to table structure.
+ * The table structure has flags which can be used to find common objects
+ * and will be compared.
+ * Common object means same name (absolute path) objects in both location.
*
- * Date: May 9, 2003
+ * Return: Number of differences found
*
- * Modifications: Jan 2005 Leon Arber, larber@uiuc.edu
- * Added support for parallel diffing
- *
- * Pedro Vicente, pvn@hdfgroup.org, Nov 4, 2008
- * Compare the graph and make h5diff return 1 for difference if
- * 1) the number of objects in file1 is not the same as in file2
- * 2) the graph does not match, i.e same names (absolute path)
- * 3) objects with the same name are not of the same type
+ * Modifications: Compare the graph and make h5diff return 1 for difference if
+ * 1) the number of objects in file1 is not the same as in file2
+ * 2) the graph does not match, i.e same names (absolute path)
+ * 3) objects with the same name are not of the same type
*-------------------------------------------------------------------------
*/
-hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
+hsize_t
+diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
hid_t file2_id, const char *grp2, trav_info_t *info2,
- trav_table_t *table, diff_opt_t *options)
+ trav_table_t *table, diff_opt_t *opts)
{
hsize_t nfound = 0;
unsigned i;
-
- const char * grp1_path = "";
- const char * grp2_path = "";
- char * obj1_fullpath = NULL;
- char * obj2_fullpath = NULL;
- diff_args_t argdata;
- size_t idx1 = 0;
- size_t idx2 = 0;
-
+ int ret_value = opts->err_stat;
+ const char *grp1_path = "";
+ const char *grp2_path = "";
+ char *obj1_fullpath = NULL;
+ char *obj2_fullpath = NULL;
+ diff_args_t argdata;
+ size_t idx1 = 0;
+ size_t idx2 = 0;
h5difftrace("diff_match start\n");
/*
@@ -1081,85 +1003,89 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
grp2_path = grp2;
/*-------------------------------------------------------------------------
- * regarding the return value of h5diff (0, no difference in files, 1 difference )
- * 1) the number of objects in file1 must be the same as in file2
- * 2) the graph must match, i.e same names (absolute path)
- * 3) objects with the same name must be of the same type
- *-------------------------------------------------------------------------
- */
+ * regarding the return value of h5diff (0, no difference in files, 1 difference )
+ * 1) the number of objects in file1 must be the same as in file2
+ * 2) the graph must match, i.e same names (absolute path)
+ * 3) objects with the same name must be of the same type
+ *-------------------------------------------------------------------------
+ */
/* not valid compare used when --exclude-path option is used */
- if (!options->exclude_path)
- {
+ if (!opts->exclude_path) {
/* number of different objects */
- if ( info1->nused != info2->nused )
- {
- options->contents = 0;
+ if (info1->nused != info2->nused) {
+ opts->contents = 0;
}
}
/* objects in one file and not the other */
- for( i = 0; i < table->nobjs; i++)
- {
- if( table->objs[i].flags[0] != table->objs[i].flags[1] )
- {
- options->contents = 0;
+ for(i = 0; i < table->nobjs; i++) {
+ if(table->objs[i].flags[0] != table->objs[i].flags[1]) {
+ opts->contents = 0;
break;
}
}
-
/*-------------------------------------------------------------------------
- * do the diff for common objects
- *-------------------------------------------------------------------------
- */
+ * do the diff for common objects
+ *-------------------------------------------------------------------------
+ */
#ifdef H5_HAVE_PARALLEL
{
- char *workerTasks = (char*)HDmalloc((g_nTasks - 1) * sizeof(char));
- int n;
- int busyTasks = 0;
- struct diffs_found nFoundbyWorker;
- struct diff_mpi_args args;
- int havePrintToken = 1;
- MPI_Status Status;
-
- /*set all tasks as free */
- HDmemset(workerTasks, 1, (g_nTasks - 1));
+ char *workerTasks = (char*)HDmalloc((g_nTasks - 1) * sizeof(char));
+ int n;
+ int busyTasks = 0;
+ struct diffs_found nFoundbyWorker;
+ struct diff_mpi_args args;
+ int havePrintToken = 1;
+ MPI_Status Status;
+
+ /*set all tasks as free */
+ HDmemset(workerTasks, 1, (g_nTasks - 1));
#endif
- for(i = 0; i < table->nobjs; i++)
- {
- if( table->objs[i].flags[0] && table->objs[i].flags[1])
- {
+ for(i = 0; i < table->nobjs; i++) {
+ h5diffdebug3("diff for common objects[%d] - errstat:%d\n", i, opts->err_stat);
+ if(table->objs[i].flags[0] && table->objs[i].flags[1]) {
/* make full path for obj1 */
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
- if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0)
- goto out;
+ if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0) {
+ HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+ }
#else /* H5_HAVE_ASPRINTF */
- obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1);
- HDstrcpy(obj1_fullpath, grp1_path);
- HDstrcat(obj1_fullpath, table->objs[i].name);
+ if((obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) {
+ HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+ }
+ else {
+ HDstrcpy(obj1_fullpath, grp1_path);
+ HDstrcat(obj1_fullpath, table->objs[i].name);
+ }
#endif /* H5_HAVE_ASPRINTF */
+ h5diffdebug2("diff_match path1 - %s\n", obj1_fullpath);
/* make full path for obj2 */
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
- if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0)
- goto out;
+ if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0) {
+ HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+ }
#else /* H5_HAVE_ASPRINTF */
- obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1);
- HDstrcpy(obj2_fullpath, grp2_path);
- HDstrcat(obj2_fullpath, table->objs[i].name);
+ if((obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) {
+ HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed");
+ }
+ else {
+ HDstrcpy(obj2_fullpath, grp2_path);
+ HDstrcat(obj2_fullpath, table->objs[i].name);
+ }
#endif /* H5_HAVE_ASPRINTF */
+ h5diffdebug2("diff_match path2 - %s\n", obj2_fullpath);
/* get index to figure out type of the object in file1 */
- while(info1->paths[idx1].path &&
- (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0))
+ while(info1->paths[idx1].path && (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0))
idx1++;
/* get index to figure out type of the object in file2 */
- while(info2->paths[idx2].path &&
- (HDstrcmp(obj2_fullpath, info2->paths[idx2].path) != 0))
+ while(info2->paths[idx2].path && (HDstrcmp(obj2_fullpath, info2->paths[idx2].path) != 0))
idx2++;
/* Set argdata to pass other args into diff() */
@@ -1167,16 +1093,14 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
argdata.type[1] = info2->paths[idx2].type;
argdata.is_same_trgobj = table->objs[i].is_same_trgobj;
- options->cmn_objs = 1;
- if(!g_Parallel)
- {
+ opts->cmn_objs = 1;
+ if(!g_Parallel) {
nfound += diff(file1_id, obj1_fullpath,
file2_id, obj2_fullpath,
- options, &argdata);
+ opts, &argdata);
} /* end if */
#ifdef H5_HAVE_PARALLEL
- else
- {
+ else {
int workerFound = 0;
h5difftrace("Beginning of big else block\n");
@@ -1190,8 +1114,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/*Set up args to pass to worker task. */
if(HDstrlen(obj1_fullpath) > 255 ||
- HDstrlen(obj2_fullpath) > 255)
- {
+ HDstrlen(obj2_fullpath) > 255) {
printf("The parallel diff only supports object names up to 255 characters\n");
MPI_Abort(MPI_COMM_WORLD, 0);
} /* end if */
@@ -1199,32 +1122,29 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* set args struct to pass */
HDstrcpy(args.name1, obj1_fullpath);
HDstrcpy(args.name2, obj2_fullpath);
- args.options = *options;
+ args.opts = *opts;
args.argdata.type[0] = info1->paths[idx1].type;
args.argdata.type[1] = info2->paths[idx2].type;
args.argdata.is_same_trgobj = table->objs[i].is_same_trgobj;
/* if there are any outstanding print requests, let's handle one. */
- if(busyTasks > 0)
- {
+ if(busyTasks > 0) {
int incomingMessage;
/* check if any tasks freed up, and didn't need to print. */
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status);
/* first block*/
- if(incomingMessage)
- {
+ if(incomingMessage) {
workerTasks[Status.MPI_SOURCE - 1] = 1;
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
} /* end if */
/* check to see if the print token was returned. */
- if(!havePrintToken)
- {
+ if(!havePrintToken) {
/* If we don't have the token, someone is probably sending us output */
print_incoming_data();
@@ -1236,19 +1156,17 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
workerTasks[Status.MPI_SOURCE - 1] = 1;
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
havePrintToken = 1;
} /* end if */
} /* end if */
/* check to see if anyone needs the print token. */
- if(havePrintToken)
- {
+ if(havePrintToken) {
/* check incoming queue for print token requests */
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage)
- {
+ if(incomingMessage) {
MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
havePrintToken = 0;
@@ -1259,10 +1177,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* check array of tasks to see which ones are free.
* Manager task never does work, so freeTasks[0] is really
* worker task 0. */
- for(n = 1; (n < g_nTasks) && !workerFound; n++)
- {
- if(workerTasks[n-1])
- {
+ for(n = 1; (n < g_nTasks) && !workerFound; n++) {
+ if(workerTasks[n-1]) {
/* send file id's and names to first free worker */
MPI_Send(&args, sizeof(args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD);
@@ -1275,55 +1191,47 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
} /* end if */
} /* end for */
- if(!workerFound)
- {
+ if(!workerFound) {
/* if they were all busy, we've got to wait for one free up
* before we can move on. If we don't have the token, some
* task is currently printing so we'll wait for that task to
* return it.
*/
- if(!havePrintToken)
- {
- while(!havePrintToken)
- {
+ if(!havePrintToken) {
+ while(!havePrintToken) {
int incomingMessage;
print_incoming_data();
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage)
- {
+ if(incomingMessage) {
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
havePrintToken = 1;
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
/* send this task the work unit. */
MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
} /* end if */
} /* end while */
} /* end if */
/* if we do have the token, check for task to free up, or wait for a task to request it */
- else
- {
+ else {
/* But first print all the data in our incoming queue */
print_incoming_data();
MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
- if(Status.MPI_TAG == MPI_TAG_DONE)
- {
+ if(Status.MPI_TAG == MPI_TAG_DONE) {
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
} /* end if */
- else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST)
- {
+ else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
int incomingMessage;
MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
- do
- {
+ do {
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
print_incoming_data();
@@ -1331,11 +1239,10 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD);
} /* end else-if */
- else
- {
+ else {
printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG);
MPI_Abort(MPI_COMM_WORLD, 0);
MPI_Finalize();
@@ -1350,27 +1257,22 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
HDfree(obj2_fullpath);
} /* end if */
} /* end for */
- h5difftrace("done with for loop\n");
+ h5diffdebug2("done with for loop - errstat:%d\n", opts->err_stat);
#ifdef H5_HAVE_PARALLEL
- if(g_Parallel)
- {
+ if(g_Parallel) {
/* make sure all tasks are done */
- while(busyTasks > 0)
- {
+ while(busyTasks > 0) {
MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
- if(Status.MPI_TAG == MPI_TAG_DONE)
- {
+ if(Status.MPI_TAG == MPI_TAG_DONE) {
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
} /* end if */
- else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST)
- {
+ else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) {
MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status);
- if(havePrintToken)
- {
+ if(havePrintToken) {
int incomingMessage;
MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
@@ -1383,17 +1285,15 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
} /* end if */
/* someone else must have it...wait for them to return it, then give it to the task that just asked for it. */
- else
- {
+ else {
int source = Status.MPI_SOURCE;
int incomingMessage;
- do
- {
+ do {
MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status);
print_incoming_data();
@@ -1402,21 +1302,19 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
MPI_Send(NULL, 0, MPI_BYTE, source, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD);
} /* end else */
} /* end else-if */
- else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN)
- {
+ else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) {
MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status);
nfound += nFoundbyWorker.nfound;
- options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp;
+ opts->not_cmp = opts->not_cmp | nFoundbyWorker.not_cmp;
busyTasks--;
havePrintToken = 1;
} /* end else-if */
- else if(Status.MPI_TAG == MPI_TAG_PRINT_DATA)
- {
+ else if(Status.MPI_TAG == MPI_TAG_PRINT_DATA) {
char data[PRINT_DATA_MAX_SIZE + 1];
HDmemset(data, 0, PRINT_DATA_MAX_SIZE + 1);
@@ -1424,8 +1322,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
printf("%s", data);
} /* end else-if */
- else
- {
+ else {
printf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG);
MPI_Abort(MPI_COMM_WORLD, 0);
} /* end else */
@@ -1444,10 +1341,12 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
#endif /* H5_HAVE_PARALLEL */
out:
- /* free table */
+ opts->err_stat = opts->err_stat | ret_value;
+
+/* free table */
if (table)
trav_table_free(table);
- h5difftrace("diff_match finish\n");
+ h5diffdebug2("diff_match finish:%d\n", nfound);
return nfound;
}
@@ -1456,47 +1355,36 @@ out:
/*-------------------------------------------------------------------------
* Function: diff
*
- * Purpose: switch between types and choose the diff function
- * TYPE is either
- * H5G_GROUP Object is a group
- * H5G_DATASET Object is a dataset
- * H5G_TYPE Object is a named data type
- * H5G_LINK Object is a symbolic link
- *
- * Return: Number of differences found
+ * Purpose: switch between types and choose the diff function
+ * TYPE is either
+ * H5G_GROUP Object is a group
+ * H5G_DATASET Object is a dataset
+ * H5G_TYPE Object is a named data type
+ * H5G_LINK Object is a symbolic link
*
- * Programmer: Jonathan Kim
- * - Move follow symlinks code toward top. (March 2812)
- * - Add following symlinks feature (Feb 11,2010)
- * - Change to use diff_args_t to pass the rest of args.
- * Passing through it instead of individual args provides smoother
- * extensibility through its members along with MPI code update for ph5diff
- * as it doesn't require interface change.
- * (May 6,2011)
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- * Date: May 9, 2003
+ * Return: Number of differences found
*-------------------------------------------------------------------------
*/
-
-hsize_t diff(hid_t file1_id,
+hsize_t
+diff(hid_t file1_id,
const char *path1,
hid_t file2_id,
const char *path2,
- diff_opt_t * options,
+ diff_opt_t * opts,
diff_args_t *argdata)
{
- hid_t dset1_id = (-1);
- hid_t dset2_id = (-1);
- hid_t type1_id = (-1);
- hid_t type2_id = (-1);
- hid_t grp1_id = (-1);
- hid_t grp2_id = (-1);
- int ret;
- hbool_t is_dangle_link1 = FALSE;
- hbool_t is_dangle_link2 = FALSE;
- hbool_t is_hard_link = FALSE;
- hsize_t nfound = 0;
+ int ret_value = opts->err_stat;
+ int status = -1;
+ hid_t dset1_id = -1;
+ hid_t dset2_id = -1;
+ hid_t type1_id = -1;
+ hid_t type2_id = -1;
+ hid_t grp1_id = -1;
+ hid_t grp2_id = -1;
+ hbool_t is_dangle_link1 = FALSE;
+ hbool_t is_dangle_link2 = FALSE;
+ hbool_t is_hard_link = FALSE;
+ hsize_t nfound = 0;
h5trav_type_t object_type;
/* to get link info */
@@ -1506,11 +1394,11 @@ hsize_t diff(hid_t file1_id,
h5difftrace("diff start\n");
/*init link info struct */
- HDmemset(&linkinfo1,0,sizeof(h5tool_link_info_t));
- HDmemset(&linkinfo2,0,sizeof(h5tool_link_info_t));
+ HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t));
+ HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t));
/* pass how to handle printing warnings to linkinfo option */
- if(print_warn(options))
+ if(print_warn(opts))
linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1;
/* for symbolic links, take care follow symlink and no dangling link
@@ -1518,78 +1406,69 @@ hsize_t diff(hid_t file1_id,
if (argdata->type[0] == H5TRAV_TYPE_LINK ||
argdata->type[0] == H5TRAV_TYPE_UDLINK ||
argdata->type[1] == H5TRAV_TYPE_LINK ||
- argdata->type[1] == H5TRAV_TYPE_UDLINK )
- {
+ argdata->type[1] == H5TRAV_TYPE_UDLINK) {
/*
* check dangling links for path1 and path2
*/
/* target object1 - get type and name */
- ret = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, options->follow_links);
+ if ((status = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, opts->follow_links)) < 0)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed");
+
/* dangling link */
- if (ret == 0)
- {
- if (options->no_dangle_links)
- {
+ if (status == 0) {
+ if (opts->no_dangle_links) {
/* dangling link is error */
- if(options->m_verbose)
+ if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", path1);
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "dangling link is error");
}
else
is_dangle_link1 = TRUE;
}
- else if (ret < 0)
- goto out;
/* target object2 - get type and name */
- ret = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, options->follow_links );
+ if ((status = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, opts->follow_links)) < 0)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed");
/* dangling link */
- if (ret == 0)
- {
- if (options->no_dangle_links)
- {
+ if (status == 0) {
+ if (opts->no_dangle_links) {
/* dangling link is error */
- if(options->m_verbose)
+ if(opts->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", path2);
- goto out;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "dangling link is error");
}
else
is_dangle_link2 = TRUE;
}
- else if (ret < 0)
- goto out;
/* found dangling link */
- if (is_dangle_link1 || is_dangle_link2)
- goto out2;
+ if (is_dangle_link1 || is_dangle_link2) {
+ HGOTO_DONE(0);
+ }
/* follow symbolic link option */
- if (options->follow_links)
- {
+ if (opts->follow_links) {
if (linkinfo1.linfo.type == H5L_TYPE_SOFT ||
linkinfo1.linfo.type == H5L_TYPE_EXTERNAL)
argdata->type[0] = (h5trav_type_t)linkinfo1.trg_type;
- if (linkinfo2.linfo.type == H5L_TYPE_SOFT ||
- linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
+ if (linkinfo2.linfo.type == H5L_TYPE_SOFT || linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
argdata->type[1] = (h5trav_type_t)linkinfo2.trg_type;
}
}
/* if objects are not the same type */
- if (argdata->type[0] != argdata->type[1])
- {
- if (options->m_verbose||options->m_list_not_cmp)
- {
+ if (argdata->type[0] != argdata->type[1]) {
+ if (opts->m_verbose||opts->m_list_not_cmp) {
parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n",
path1, get_type(argdata->type[0]),
path2, get_type(argdata->type[1]));
}
- options->not_cmp=1;
+ opts->not_cmp = 1;
/* TODO: will need to update non-comparable is different
- * options->contents = 0;
+ * opts->contents = 0;
*/
- goto out2;
+ HGOTO_DONE(0);
}
else /* now both object types are same */
object_type = argdata->type[0];
@@ -1602,88 +1481,79 @@ hsize_t diff(hid_t file1_id,
*
* Perform this to match the outputs as bypassing.
*/
- if (argdata->is_same_trgobj)
- {
+ if (argdata->is_same_trgobj) {
h5difftrace("argdata->is_same_trgobj\n");
is_hard_link = (object_type == H5TRAV_TYPE_DATASET ||
object_type == H5TRAV_TYPE_NAMED_DATATYPE ||
object_type == H5TRAV_TYPE_GROUP);
- if (options->follow_links || is_hard_link)
- {
+ if (opts->follow_links || is_hard_link) {
/* print information is only verbose option is used */
- if(options->m_verbose || options->m_report)
- {
- switch(object_type)
- {
+ if(opts->m_verbose || opts->m_report) {
+ switch(object_type) {
case H5TRAV_TYPE_DATASET:
- do_print_objname("dataset", path1, path2, options);
+ do_print_objname("dataset", path1, path2, opts);
break;
case H5TRAV_TYPE_NAMED_DATATYPE:
- do_print_objname("datatype", path1, path2, options);
+ do_print_objname("datatype", path1, path2, opts);
break;
case H5TRAV_TYPE_GROUP:
- do_print_objname("group", path1, path2, options);
+ do_print_objname("group", path1, path2, opts);
break;
case H5TRAV_TYPE_LINK:
- do_print_objname("link", path1, path2, options);
+ do_print_objname("link", path1, path2, opts);
break;
case H5TRAV_TYPE_UDLINK:
if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
- do_print_objname("external link", path1, path2, options);
+ do_print_objname("external link", path1, path2, opts);
else
- do_print_objname ("user defined link", path1, path2, options);
+ do_print_objname ("user defined link", path1, path2, opts);
break;
case H5TRAV_TYPE_UNKNOWN:
default:
parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n",
path1, path2, get_type(object_type) );
- options->not_cmp = 1;
+ opts->not_cmp = 1;
break;
} /* switch(type)*/
print_found(nfound);
- } /* if(options->m_verbose || options->m_report) */
+ } /* if(opts->m_verbose || opts->m_report) */
/* exact same, so comparison is done */
- goto out2;
+ HGOTO_DONE(0);
}
}
- switch(object_type)
- {
+ switch(object_type) {
/*----------------------------------------------------------------------
* H5TRAV_TYPE_DATASET
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_DATASET:
if((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed");
if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0)
- goto out;
- /* verbose (-v) and report (-r) mode */
- if(options->m_verbose || options->m_report)
- {
- do_print_objname("dataset", path1, path2, options);
- nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed");
+ /* verbose (-v) and report (-r) mode */
+ if(opts->m_verbose || opts->m_report) {
+ do_print_objname("dataset", path1, path2, opts);
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
print_found(nfound);
}
/* quiet mode (-q), just count differences */
- else if(options->m_quiet)
- {
- nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+ else if(opts->m_quiet) {
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
}
- /* the rest (-c, none, ...) */
- else
- {
- nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
+ /* the rest (-c, none, ...) */
+ else {
+ nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
/* print info if difference found */
- if (nfound)
- {
- do_print_objname("dataset", path1, path2, options);
+ if (nfound) {
+ do_print_objname("dataset", path1, path2, opts);
print_found(nfound);
}
}
-
+ h5diffdebug2("diff after dataset:%d\n", nfound);
/*---------------------------------------------------------
* compare attributes
@@ -1692,13 +1562,13 @@ hsize_t diff(hid_t file1_id,
*---------------------------------------------------------
*/
if(path1)
- nfound += diff_attr(dset1_id, dset2_id, path1, path2, options);
+ nfound += diff_attr(dset1_id, dset2_id, path1, path2, opts);
if(H5Dclose(dset1_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed");
if(H5Dclose(dset2_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed");
break;
/*----------------------------------------------------------------------
@@ -1707,21 +1577,21 @@ hsize_t diff(hid_t file1_id,
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
if((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed");
if((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed");
- if((ret = H5Tequal(type1_id, type2_id)) < 0)
- goto out;
+ if((status = H5Tequal(type1_id, type2_id)) < 0)
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tequal failed");
/* if H5Tequal is > 0 then the datatypes refer to the same datatype */
- nfound = (ret > 0) ? 0 : 1;
+ nfound = (status > 0) ? 0 : 1;
- if(print_objname(options,nfound))
- do_print_objname("datatype", path1, path2, options);
+ if(print_objname(opts, nfound))
+ do_print_objname("datatype", path1, path2, opts);
/* always print the number of differences found in verbose mode */
- if(options->m_verbose)
+ if(opts->m_verbose)
print_found(nfound);
/*-----------------------------------------------------------------
@@ -1731,12 +1601,12 @@ hsize_t diff(hid_t file1_id,
*-----------------------------------------------------------------
*/
if(path1)
- nfound += diff_attr(type1_id, type2_id, path1, path2, options);
+ nfound += diff_attr(type1_id, type2_id, path1, path2, opts);
if(H5Tclose(type1_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(type2_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed");
break;
/*----------------------------------------------------------------------
@@ -1744,17 +1614,17 @@ hsize_t diff(hid_t file1_id,
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_GROUP:
- if(print_objname(options, nfound))
- do_print_objname("group", path1, path2, options);
+ if(print_objname(opts, nfound))
+ do_print_objname("group", path1, path2, opts);
/* always print the number of differences found in verbose mode */
- if(options->m_verbose)
+ if(opts->m_verbose)
print_found(nfound);
if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
/*-----------------------------------------------------------------
* compare attributes
@@ -1763,12 +1633,12 @@ hsize_t diff(hid_t file1_id,
*-----------------------------------------------------------------
*/
if(path1)
- nfound += diff_attr(grp1_id, grp2_id, path1, path2, options);
+ nfound += diff_attr(grp1_id, grp2_id, path1, path2, opts);
if(H5Gclose(grp1_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
if(H5Gclose(grp2_id) < 0)
- goto out;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
break;
@@ -1778,19 +1648,19 @@ hsize_t diff(hid_t file1_id,
*/
case H5TRAV_TYPE_LINK:
{
- ret = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path);
+ status = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path);
- /* if the target link name is not same then the links are "different" */
- nfound = (ret != 0) ? 1 : 0;
+ /* if the target link name is not same then the links are "different" */
+ nfound = (status != 0) ? 1 : 0;
- if(print_objname(options, nfound))
- do_print_objname("link", path1, path2, options);
+ if(print_objname(opts, nfound))
+ do_print_objname("link", path1, path2, opts);
- /* always print the number of differences found in verbose mode */
- if(options->m_verbose)
- print_found(nfound);
+ /* always print the number of differences found in verbose mode */
+ if(opts->m_verbose)
+ print_found(nfound);
- }
+ }
break;
/*----------------------------------------------------------------------
@@ -1799,101 +1669,85 @@ hsize_t diff(hid_t file1_id,
*/
case H5TRAV_TYPE_UDLINK:
{
- /* Only external links will have a query function registered */
- if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
- {
- /* If the buffers are the same size, compare them */
- if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size)
- {
- ret = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size);
- }
- else
- ret = 1;
+ /* Only external links will have a query function registered */
+ if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) {
+ /* If the buffers are the same size, compare them */
+ if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size) {
+ status = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size);
+ }
+ else
+ status = 1;
- /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links
- * are "different" extlinkinfo#.path is combination string of
- * file_name and obj_name
- */
- nfound = (ret != 0) ? 1 : 0;
+ /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links
+ * are "different" extlinkinfo#.path is combination string of
+ * file_name and obj_name
+ */
+ nfound = (status != 0) ? 1 : 0;
- if(print_objname(options, nfound))
- do_print_objname("external link", path1, path2, options);
+ if(print_objname(opts, nfound))
+ do_print_objname("external link", path1, path2, opts);
- } /* end if */
- else
- {
- /* If one or both of these links isn't an external link, we can only
- * compare information from H5Lget_info since we don't have a query
- * function registered for them.
- *
- * If the link classes or the buffer length are not the
- * same, the links are "different"
- */
- if((linkinfo1.linfo.type != linkinfo2.linfo.type) ||
- (linkinfo1.linfo.u.val_size != linkinfo2.linfo.u.val_size))
- nfound = 1;
- else
- nfound = 0;
-
- if (print_objname (options, nfound))
- do_print_objname ("user defined link", path1, path2, options);
- } /* end else */
+ } /* end if */
+ else {
+ /* If one or both of these links isn't an external link, we can only
+ * compare information from H5Lget_info since we don't have a query
+ * function registered for them.
+ *
+ * If the link classes or the buffer length are not the
+ * same, the links are "different"
+ */
+ if((linkinfo1.linfo.type != linkinfo2.linfo.type) ||
+ (linkinfo1.linfo.u.val_size != linkinfo2.linfo.u.val_size))
+ nfound = 1;
+ else
+ nfound = 0;
- /* always print the number of differences found in verbose mode */
- if(options->m_verbose)
- print_found(nfound);
+ if (print_objname (opts, nfound))
+ do_print_objname ("user defined link", path1, path2, opts);
+ } /* end else */
+
+ /* always print the number of differences found in verbose mode */
+ if(opts->m_verbose)
+ print_found(nfound);
}
break;
case H5TRAV_TYPE_UNKNOWN:
default:
- if(options->m_verbose)
+ if(opts->m_verbose)
parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n",
path1, path2, get_type(object_type) );
- options->not_cmp = 1;
+ opts->not_cmp = 1;
break;
}
- /* free link info buffer */
- if (linkinfo1.trg_path)
- HDfree(linkinfo1.trg_path);
- if (linkinfo2.trg_path)
- HDfree(linkinfo2.trg_path);
-
- return nfound;
-
-out:
- options->err_stat = 1;
+done:
+ opts->err_stat = opts->err_stat | ret_value;
-out2:
/*-----------------------------------
* handle dangling link(s)
*/
/* both path1 and path2 are dangling links */
- if(is_dangle_link1 && is_dangle_link2)
- {
- if(print_objname(options, nfound))
- {
- do_print_objname("dangling link", path1, path2, options);
+ if(is_dangle_link1 && is_dangle_link2) {
+ if(print_objname(opts, nfound)) {
+ do_print_objname("dangling link", path1, path2, opts);
print_found(nfound);
}
}
/* path1 is dangling link */
- else if (is_dangle_link1)
- {
- if(options->m_verbose)
+ else if (is_dangle_link1) {
+ if(opts->m_verbose)
parallel_print("obj1 <%s> is a dangling link.\n", path1);
nfound++;
- if(print_objname(options, nfound))
+ if(print_objname(opts, nfound))
print_found(nfound);
}
/* path2 is dangling link */
- else if (is_dangle_link2)
- {
- if(options->m_verbose)
+ else if (is_dangle_link2) {
+ if(opts->m_verbose)
parallel_print("obj2 <%s> is a dangling link.\n", path2);
nfound++;
- if(print_objname(options, nfound))
+ if(print_objname(opts, nfound))
print_found(nfound);
}
@@ -1906,13 +1760,16 @@ out2:
/* close */
/* disable error reporting */
H5E_BEGIN_TRY {
+ H5Dclose(dset1_id);
+ H5Dclose(dset2_id);
H5Tclose(type1_id);
H5Tclose(type2_id);
H5Gclose(grp1_id);
- H5Tclose(grp2_id);
+ H5Gclose(grp2_id);
/* enable error reporting */
} H5E_END_TRY;
- h5difftrace("diff finish\n");
+
+ h5diffdebug3("diff finish:%d - errstat:%d\n", nfound, opts->err_stat);
return nfound;
}
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 0226e83..26bcd95 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -38,7 +38,7 @@
/*-------------------------------------------------------------------------
* This is used to pass multiple args into diff().
- * Passing this instead of several each arg provides smoother extensibility
+ * Passing this instead of several each arg provides smoother extensibility
* through its members along with MPI code for ph5diff
* as it doesn't require interface change.
*------------------------------------------------------------------------*/
@@ -95,13 +95,13 @@ H5TOOLS_DLL hsize_t h5diff(const char *fname1,
const char *fname2,
const char *objname1,
const char *objname2,
- diff_opt_t *options);
+ diff_opt_t *opts);
H5TOOLS_DLL hsize_t diff( hid_t file1_id,
const char *path1,
hid_t file2_id,
const char *path2,
- diff_opt_t *options,
+ diff_opt_t *opts,
diff_args_t *argdata);
#ifdef H5_HAVE_PARALLEL
@@ -125,18 +125,18 @@ hsize_t diff_dataset( hid_t file1_id,
hid_t file2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options);
+ diff_opt_t *opts);
hsize_t diff_datasetid( hid_t dset1_id,
hid_t dset2_id,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options);
+ diff_opt_t *opts);
hsize_t diff_match( hid_t file1_id, const char *grp1, trav_info_t *info1,
hid_t file2_id, const char *grp2, trav_info_t *info2,
- trav_table_t *table, diff_opt_t *options );
+ trav_table_t *table, diff_opt_t *opts );
hsize_t diff_array( void *_mem1,
void *_mem2,
@@ -144,7 +144,7 @@ hsize_t diff_array( void *_mem1,
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,
@@ -162,7 +162,7 @@ int diff_can_type( hid_t f_type1, /* file data type */
hsize_t *maxdim2,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options,
+ diff_opt_t *opts,
int is_compound);
@@ -170,7 +170,7 @@ hsize_t diff_attr(hid_t loc1_id,
hid_t loc2_id,
const char *path1,
const char *path2,
- diff_opt_t *options);
+ diff_opt_t *opts);
/*-------------------------------------------------------------------------
@@ -187,10 +187,10 @@ const char* get_class(H5T_class_t tclass);
const char* get_sign(H5T_sign_t sign);
void print_dimensions (int rank, hsize_t *dims);
herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
- hid_t *m_tid1, hid_t *m_tid2,
+ hid_t *m_tid1, hid_t *m_tid2,
size_t *m_size1, size_t *m_size2);
/* in h5diff.c */
-int print_objname(diff_opt_t *options, hsize_t nfound);
+int print_objname(diff_opt_t *opts, hsize_t nfound);
void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts);
void do_print_attrname (const char *attr, const char *path1, const char *path2);
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 09894e6..11f5e41 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, size_t 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);
@@ -155,17 +155,17 @@ static void print_char_pos(int *ph, int pp, hsize_t curr_pos, size_t 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,
@@ -176,50 +176,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);
/*-------------------------------------------------------------------------
@@ -256,11 +256,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
- *
*-------------------------------------------------------------------------
*/
@@ -271,7 +266,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,
@@ -290,7 +285,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);
@@ -329,36 +324,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;
/*-------------------------------------------------------------------------
@@ -376,16 +371,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;
}
@@ -397,10 +390,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
@@ -436,18 +425,17 @@ 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;
size_t u;
- hid_t memb_type;
size_t type_size;
H5T_sign_t type_sign;
H5T_class_t type_class;
@@ -458,14 +446,13 @@ static hsize_t diff_datum(
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 */
+ hsize_t ret_value = opts->err_stat;
double per;
hbool_t both_zero;
h5difftrace("diff_datum start\n");
+
type_size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@@ -478,14 +465,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;
/*-------------------------------------------------------------------------
@@ -494,15 +481,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;
@@ -532,6 +521,7 @@ static hsize_t diff_datum(
size1 = HDstrlen(s1);
else
size1 = 0;
+
/* Get pointer to second string */
s2 = *(char**) mem2;
if (s2)
@@ -547,14 +537,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;
}
@@ -562,6 +555,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;
@@ -573,8 +567,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);
+ 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++;
@@ -595,15 +589,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;
@@ -616,7 +610,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;
/*-------------------------------------------------------------------------
@@ -627,7 +621,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;
/*-------------------------------------------------------------------------
@@ -667,7 +661,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);
@@ -677,7 +671,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);
@@ -685,7 +679,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 */
@@ -699,8 +693,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);
@@ -714,7 +709,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);
}
@@ -728,7 +723,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) {
/*-------------------------------------------------------------------------
@@ -736,25 +732,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 = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0)
- ret = -1;
- if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, 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 = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed");
+ }
+ if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 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, opts);
- nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, options);
H5Oclose(obj1_id);
H5Oclose(obj2_id);
H5Sclose(region1_id);
@@ -770,41 +773,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 = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0)
- ret = -1;
- if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0)
- ret = -1;
- if (ret == -1) {
- options->err_stat = 1;
- return 0;
+ if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed");
+ }
+ if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 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);
@@ -818,18 +821,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;
/*-------------------------------------------------------------------------
@@ -845,13 +852,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));
@@ -860,19 +869,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);
@@ -881,19 +890,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);
@@ -902,7 +911,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));
@@ -918,14 +927,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));
@@ -934,19 +945,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);
@@ -955,19 +966,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);
@@ -976,7 +987,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));
@@ -992,14 +1003,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));
@@ -1008,19 +1021,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);
@@ -1029,19 +1042,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);
@@ -1050,7 +1063,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));
@@ -1066,14 +1079,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));
@@ -1082,19 +1097,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);
@@ -1103,19 +1118,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);
@@ -1124,7 +1139,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));
@@ -1140,14 +1155,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));
@@ -1156,19 +1173,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);
@@ -1177,19 +1194,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);
@@ -1198,7 +1215,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));
@@ -1214,14 +1231,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));
@@ -1230,19 +1249,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);
@@ -1251,19 +1270,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);
@@ -1272,7 +1291,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));
@@ -1288,14 +1307,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));
@@ -1304,19 +1325,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);
@@ -1325,19 +1346,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);
@@ -1346,7 +1367,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));
@@ -1362,14 +1383,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));
@@ -1378,19 +1401,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);
@@ -1399,19 +1422,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);
@@ -1420,7 +1443,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));
@@ -1445,31 +1468,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));
@@ -1479,7 +1503,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));
@@ -1491,12 +1515,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);
}
@@ -1506,15 +1530,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,
@@ -1525,7 +1549,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));
@@ -1537,12 +1561,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);
}
@@ -1552,15 +1576,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,
@@ -1571,7 +1595,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));
@@ -1583,8 +1607,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));
@@ -1603,30 +1627,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));
@@ -1636,24 +1661,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);
}
@@ -1663,15 +1688,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));
@@ -1681,7 +1706,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));
@@ -1693,12 +1718,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);
}
@@ -1708,16 +1733,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));
@@ -1727,7 +1752,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));
@@ -1739,8 +1764,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));
@@ -1761,7 +1786,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));
@@ -1772,20 +1799,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));
@@ -1795,7 +1822,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));
@@ -1807,12 +1834,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);
}
@@ -1822,15 +1849,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));
@@ -1840,7 +1867,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));
@@ -1852,30 +1879,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));
@@ -1885,7 +1912,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));
@@ -1897,8 +1924,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));
@@ -1911,7 +1938,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;
}
@@ -1922,7 +1953,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
- *
*-------------------------------------------------------------------------
*/
@@ -1942,7 +1972,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
- *
*-------------------------------------------------------------------------
*/
@@ -1965,7 +1994,6 @@ void print_region_block(int i, hsize_t *ptdata, int ndims) {
* Purpose: print points of a region reference
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
@@ -1986,18 +2014,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;
@@ -2012,18 +2040,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);
}
/*-------------------------------------------------------------------------
@@ -2032,57 +2059,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 */
}
/*-------------------------------------------------------------------------
@@ -2090,98 +2122,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, size_t 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);
@@ -2199,20 +2240,20 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t 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));
@@ -2220,9 +2261,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));
@@ -2231,10 +2272,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);
@@ -2243,10 +2284,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);
@@ -2255,7 +2296,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));
@@ -2269,14 +2310,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)
{
@@ -2296,7 +2337,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));
@@ -2305,15 +2346,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));
@@ -2323,7 +2364,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));
@@ -2333,7 +2374,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 */
}
@@ -2341,7 +2382,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));
@@ -2350,7 +2391,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);
}
@@ -2359,15 +2400,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,
@@ -2378,7 +2419,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));
@@ -2388,7 +2429,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 */
}
@@ -2396,7 +2437,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));
@@ -2405,7 +2446,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);
}
@@ -2415,15 +2456,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,
@@ -2435,7 +2476,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));
@@ -2445,7 +2486,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 */
}
@@ -2459,8 +2500,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));
@@ -2470,7 +2511,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 */
}
@@ -2482,23 +2523,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;
@@ -2509,7 +2549,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));
@@ -2518,15 +2558,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));
@@ -2536,7 +2576,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));
@@ -2546,7 +2586,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 */
}
@@ -2555,7 +2595,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));
@@ -2564,7 +2604,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);
}
@@ -2573,15 +2613,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,
@@ -2592,7 +2632,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));
@@ -2602,7 +2642,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 */
}
@@ -2610,7 +2650,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));
@@ -2620,7 +2660,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);
}
@@ -2630,15 +2670,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,
@@ -2649,7 +2689,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));
@@ -2658,7 +2698,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 */
}
@@ -2671,8 +2711,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));
@@ -2682,7 +2722,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 */
}
@@ -2694,10 +2734,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
@@ -2710,13 +2749,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;
@@ -2732,7 +2771,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));
@@ -2741,15 +2780,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));
@@ -2759,7 +2798,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));
@@ -2769,7 +2808,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 */
}
@@ -2778,7 +2817,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));
@@ -2787,7 +2826,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);
}
@@ -2796,15 +2835,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,
@@ -2815,7 +2854,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));
@@ -2824,7 +2863,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 */
}
@@ -2832,7 +2871,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));
@@ -2841,7 +2880,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);
}
@@ -2851,15 +2890,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));
@@ -2869,7 +2908,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));
@@ -2878,7 +2917,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 */
}
@@ -2891,8 +2930,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));
@@ -2901,7 +2940,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 */
}
@@ -2914,34 +2953,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));
@@ -2950,12 +2988,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));
@@ -2963,15 +3001,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);
@@ -2980,12 +3018,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));
@@ -2993,15 +3031,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);
@@ -3010,7 +3048,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;
}
}
@@ -3020,7 +3058,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));
@@ -3030,7 +3068,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 */
}
@@ -3042,33 +3080,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));
@@ -3077,12 +3114,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));
@@ -3090,15 +3127,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);
@@ -3107,12 +3144,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));
@@ -3120,15 +3157,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);
@@ -3137,7 +3174,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;
}
}
@@ -3147,7 +3184,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));
@@ -3157,7 +3194,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 */
}
@@ -3169,33 +3206,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));
@@ -3204,12 +3240,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));
@@ -3217,15 +3253,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);
@@ -3234,12 +3270,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));
@@ -3247,15 +3283,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);
@@ -3264,7 +3300,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;
}
}
@@ -3274,7 +3310,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));
@@ -3284,7 +3320,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 */
}
@@ -3296,34 +3332,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));
@@ -3332,12 +3367,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));
@@ -3345,15 +3380,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);
@@ -3362,12 +3397,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));
@@ -3375,15 +3410,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);
@@ -3392,7 +3427,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;
}
}
@@ -3402,7 +3437,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));
@@ -3412,7 +3447,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 */
}
@@ -3422,35 +3457,34 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
}
/*-------------------------------------------------------------------------
- * Function: diff_int
- *
- * Purpose: diff a H5T_NATIVE_INT type
+ * Function: diff_int
*
- * 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));
@@ -3459,12 +3493,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));
@@ -3472,15 +3506,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);
@@ -3489,12 +3523,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));
@@ -3502,15 +3536,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);
@@ -3519,7 +3553,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;
}
}
@@ -3529,7 +3563,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));
@@ -3539,7 +3573,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 */
@@ -3551,15 +3585,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 */
@@ -3571,13 +3604,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));
@@ -3586,12 +3619,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));
@@ -3599,15 +3632,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);
@@ -3616,12 +3649,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));
@@ -3629,16 +3662,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);
@@ -3647,7 +3680,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;
}
}
@@ -3657,7 +3690,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));
@@ -3667,7 +3700,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 */
}
@@ -3679,15 +3712,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 */
@@ -3699,14 +3731,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));
@@ -3715,13 +3747,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));
@@ -3729,15 +3761,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);
@@ -3746,12 +3778,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));
@@ -3759,15 +3791,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);
@@ -3776,7 +3808,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;
}
}
@@ -3786,7 +3818,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));
@@ -3796,7 +3828,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 */
}
@@ -3808,35 +3840,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));
@@ -3845,13 +3876,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));
@@ -3859,15 +3890,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);
@@ -3876,12 +3907,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));
@@ -3889,16 +3920,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);
@@ -3907,7 +3938,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;
}
}
@@ -3917,7 +3948,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));
@@ -3927,7 +3958,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 */
}
@@ -3939,33 +3970,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));
@@ -3974,12 +4004,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));
@@ -3987,15 +4017,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);
@@ -4004,12 +4034,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));
@@ -4017,16 +4047,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);
@@ -4035,7 +4065,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;
}
}
@@ -4045,7 +4075,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));
@@ -4055,7 +4085,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 */
}
@@ -4067,34 +4097,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));
@@ -4103,12 +4132,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));
@@ -4118,15 +4147,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);
@@ -4135,12 +4164,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));
@@ -4150,16 +4179,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);
@@ -4168,7 +4197,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;
}
}
@@ -4178,7 +4207,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));
@@ -4188,7 +4217,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 */
}
@@ -4201,69 +4230,56 @@ 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;
-
-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);
- return -1;
+ h5difftrace("ull2float finish\n");
+
+ 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
*-------------------------------------------------------------------------
@@ -4275,26 +4291,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;
@@ -4303,18 +4317,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
*-------------------------------------------------------------------------
@@ -4326,26 +4338,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;
@@ -4356,17 +4366,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
*-------------------------------------------------------------------------
@@ -4378,46 +4383,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) {
@@ -4445,9 +4439,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
@@ -4474,9 +4467,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") ||
@@ -4501,24 +4493,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);
@@ -4528,8 +4521,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");
}
@@ -4544,15 +4536,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 */
@@ -4576,23 +4568,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 */
int pp, /* print percentage */
hsize_t curr_pos, size_t u, 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 */
@@ -4616,20 +4607,20 @@ void print_char_pos(int *ph, /* print header */
}
}
- 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("\\\"");
@@ -4662,12 +4653,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)
@@ -4682,8 +4674,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;
@@ -4701,15 +4692,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)
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 9bebcbe..6019738 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -136,54 +136,55 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta
*
* Parameter:
* table_out [OUT] : return the list
- *
- * Programmer: Jonathan Kim
- *
- * Date: March 15, 2011
*------------------------------------------------------------------------*/
-static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *options)
+static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts)
{
- H5O_info_t oinfo1, oinfo2; /* Object info */
- hid_t attr1_id=-1; /* attr ID */
- hid_t attr2_id=-1; /* attr ID */
- size_t curr1 = 0;
- size_t curr2 = 0;
- unsigned infile[2];
- char name1[ATTR_NAME_MAX];
- char name2[ATTR_NAME_MAX];
- int cmp;
- unsigned i;
+ int ret_value = 0;
+ H5O_info_t oinfo1, oinfo2; /* Object info */
+ hid_t attr1_id = -1; /* attr ID */
+ hid_t attr2_id = -1; /* attr ID */
+ size_t curr1 = 0;
+ size_t curr2 = 0;
+ unsigned infile[2];
+ char name1[ATTR_NAME_MAX];
+ char name2[ATTR_NAME_MAX];
+ int cmp;
+ unsigned i;
table_attrs_t *table_lp = NULL;
h5difftrace("build_match_list_attrs start\n");
+
if(H5Oget_info(loc1_id, &oinfo1) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info first object failed");
if(H5Oget_info(loc2_id, &oinfo2) < 0)
- goto error;
-
- table_attrs_init( &table_lp );
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info second object failed");
- h5diffdebug3("build_match_list_attrs: %ld - %ld\n", curr1 < oinfo1.num_attrs, curr2 < oinfo2.num_attrs);
+ table_attrs_init(&table_lp);
+ if (table_lp == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Table allocation failed");
/*--------------------------------------------------
* build the list
*/
while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) {
+ h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", curr1, oinfo1.num_attrs);
+ h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", curr2, oinfo2.num_attrs);
+
/*------------------
* open attribute1 */
if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed");
/* get name */
if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed");
/*------------------
* open attribute2 */
if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed");
/* get name */
if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed");
/* criteria is string compare */
cmp = HDstrcmp(name1, name2);
@@ -221,13 +222,15 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
infile[0] = 1;
infile[1] = 0;
while(curr1 < oinfo1.num_attrs) {
+ h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", curr1, oinfo1.num_attrs);
+
/*------------------
* open attribute1 */
if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed");
/* get name */
if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed");
h5diffdebug2("build_match_list_attrs #1 name - %s\n", name1);
table_attr_mark_exist(infile, name1, table_lp);
@@ -243,13 +246,14 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
infile[0] = 0;
infile[1] = 1;
while(curr2 < oinfo2.num_attrs) {
+ h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", curr2, oinfo2.num_attrs);
/*------------------
* open attribute2 */
if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed");
/* get name */
if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
- goto error;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed");
h5diffdebug2("build_match_list_attrs #2 name - %s\n", name2);
table_attr_mark_exist(infile, name2, table_lp);
@@ -258,12 +262,13 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* close for next turn */
H5Aclose(attr2_id);
+ attr2_id = -1;
}
/*------------------------------------------------------
* print the list
*/
- if(options->m_verbose_level == 2) {
+ if(opts->m_verbose_level == 2) {
/* if '-v2' is detected */
parallel_print(" obj1 obj2\n");
parallel_print(" --------------------------------------\n");
@@ -275,44 +280,35 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
} /* end for */
}
- if(options->m_verbose_level >= 1)
+ if(opts->m_verbose_level >= 1)
parallel_print("Attributes status: %d common, %d only in obj1, %d only in obj2\n",
table_lp->nattrs - table_lp->nattrs_only1 - table_lp->nattrs_only2,
table_lp->nattrs_only1, table_lp->nattrs_only2);
+done:
*table_out = table_lp;
- h5difftrace("build_match_list_attrs end\n");
- return 0;
-
-error:
- if (0 < attr1_id)
+ /* disable error reporting */
+ H5E_BEGIN_TRY {
H5Aclose(attr1_id);
- if (0 < attr2_id)
H5Aclose(attr2_id);
+ } H5E_END_TRY;
+
+ h5diffdebug2("build_match_list_attrs end - errstat:%d\n", opts->err_stat);
- h5difftrace("build_match_list_attrs end with error\n");
- return -1;
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: diff_attr
*
- * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are
- * obtained either from
- * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
- * loc_id = H5Dopen2(fid, name);
- * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
- *
- * Return: number of differences found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November, 03, 2003
- *
- * Modifications:
- * March, 02, 2007: return the number of differences found
+ * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are
+ * obtained either from
+ * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Dopen2(fid, name);
+ * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
*
+ * Return: number of differences found
*-------------------------------------------------------------------------
*/
@@ -320,34 +316,35 @@ hsize_t diff_attr(hid_t loc1_id,
hid_t loc2_id,
const char *path1,
const char *path2,
- diff_opt_t *options)
+ diff_opt_t *opts)
{
- hid_t attr1_id=-1; /* attr ID */
- hid_t attr2_id=-1; /* attr ID */
- hid_t space1_id=-1; /* space ID */
- hid_t space2_id=-1; /* space ID */
- hid_t ftype1_id=-1; /* file data type ID */
- hid_t ftype2_id=-1; /* file data type ID */
- int vstrtype1=0; /* ftype1 is a variable string */
- int vstrtype2=0; /* ftype2 is a variable string */
- hid_t mtype1_id=-1; /* memory data type ID */
- hid_t mtype2_id=-1; /* memory data type ID */
- size_t msize1; /* memory size of memory type */
- size_t msize2; /* memory size of memory type */
- void *buf1=NULL; /* data buffer */
- void *buf2=NULL; /* data buffer */
- hbool_t buf1hasdata=FALSE; /* buffer has data */
- hbool_t buf2hasdata=FALSE; /* buffer has data */
- hsize_t nelmts1; /* number of elements in dataset */
- int rank1; /* rank of dataset */
- int rank2; /* rank of dataset */
- hsize_t dims1[H5S_MAX_RANK];/* dimensions of dataset */
- hsize_t dims2[H5S_MAX_RANK];/* dimensions of dataset */
- char *name1;
- char *name2;
+ int ret_value = opts->err_stat;
+ hid_t attr1_id = -1; /* attr ID */
+ hid_t attr2_id = -1; /* attr ID */
+ hid_t space1_id = -1; /* space ID */
+ hid_t space2_id = -1; /* space ID */
+ hid_t ftype1_id = -1; /* file data type ID */
+ hid_t ftype2_id = -1; /* file data type ID */
+ int vstrtype1 = 0; /* ftype1 is a variable string */
+ int vstrtype2 = 0; /* ftype2 is a variable string */
+ hid_t mtype1_id = -1; /* memory data type ID */
+ hid_t mtype2_id = -1; /* memory data type ID */
+ size_t msize1; /* memory size of memory type */
+ size_t msize2; /* memory size of memory type */
+ void *buf1 = NULL; /* data buffer */
+ void *buf2 = NULL; /* data buffer */
+ hbool_t buf1hasdata = FALSE; /* buffer has data */
+ hbool_t buf2hasdata = FALSE; /* buffer has data */
+ hsize_t nelmts1; /* number of elements in dataset */
+ int rank1; /* rank of dataset */
+ int rank2; /* rank of dataset */
+ hsize_t dims1[H5S_MAX_RANK]; /* dimensions of dataset */
+ hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */
+ char *name1 = NULL;
+ char *name2 = NULL;
char np1[512];
char np2[512];
- unsigned u; /* Local index variable */
+ unsigned u; /* Local index variable */
hsize_t nfound = 0;
hsize_t nfound_total = 0;
int j;
@@ -355,17 +352,21 @@ hsize_t diff_attr(hid_t loc1_id,
table_attrs_t *match_list_attrs = NULL;
h5difftrace("diff_attr start\n");
- if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, options) < 0)
- goto error;
+ if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) {
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "build_match_list_attrs failed");
+ }
+ h5diffdebug2("build_match_list_attrs - errstat:%d\n", opts->err_stat);
/* if detect any unique extra attr */
if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) {
h5difftrace("diff_attr attributes only in one file\n");
/* exit will be 1 */
- options->contents = 0;
+ opts->contents = 0;
}
+ h5diffdebug2("match_list_attrs info - errstat:%d\n", opts->err_stat);
for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) {
+ h5diffdebug3("match_list_attrs loop[%d] - errstat:%d\n", u, opts->err_stat);
if((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) {
name1 = name2 = match_list_attrs->attrs[u].name;
h5diffdebug2("diff_attr name - %s\n", name1);
@@ -373,59 +374,60 @@ hsize_t diff_attr(hid_t loc1_id,
/*--------------
* attribute 1 */
if((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen first attribute failed");
/*--------------
* attribute 2 */
if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen second attribute failed");
h5difftrace("diff_attr got attributes\n");
/* get the datatypes */
if((ftype1_id = H5Aget_type(attr1_id)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
vstrtype1 = H5Tis_variable_str(ftype1_id);
if((ftype2_id = H5Aget_type(attr2_id)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
vstrtype2 = H5Tis_variable_str(ftype2_id);
+
/* no compare if either one but not both are variable string type */
if (vstrtype1 != vstrtype2) {
- if((options->m_verbose || options->m_list_not_cmp))
+ if((opts->m_verbose || opts->m_list_not_cmp))
parallel_print("Not comparable: one of attribute <%s/%s> or <%s/%s> is of variable length type\n",
path1, name1, path2, name2);
- options->not_cmp = 1;
+ opts->not_cmp = 1;
if (H5Tclose(ftype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed");
if (H5Tclose(ftype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed");
if (H5Aclose(attr1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed");
if (H5Aclose(attr2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed");
continue;
}
if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed");
if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second attribute ftype failed");
if((msize1 = H5Tget_size(mtype1_id)) == 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size first attribute mtype failed");
if((msize2 = H5Tget_size(mtype2_id)) == 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size second attribute mtype failed");
/* get the dataspace */
if((space1_id = H5Aget_space(attr1_id)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space first attribute failed");
if((space2_id = H5Aget_space(attr2_id)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space second attribute failed");
/* get dimensions */
if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims first attribute failed");
if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims second attribute failed");
/*----------------------------------------------------------------------
* check for comparable TYPE and SPACE
@@ -435,23 +437,23 @@ hsize_t diff_attr(hid_t loc1_id,
/* pass dims1 and dims2 for maxdims as well since attribute's maxdims
* are always same */
if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2,
- dims1, dims2, name1, name2, options, 0) != 1) {
+ dims1, dims2, name1, name2, opts, 0) != 1) {
if(H5Tclose(ftype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed");
if(H5Tclose(ftype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed");
if(H5Sclose(space1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose first attribute failed");
if(H5Sclose(space2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose second attribute failed");
if(H5Aclose(attr1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed");
if(H5Aclose(attr2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed");
if(H5Tclose(mtype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed");
if(H5Tclose(mtype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed");
continue;
}
@@ -462,7 +464,7 @@ hsize_t diff_attr(hid_t loc1_id,
*/
if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id,
&mtype2_id, &msize1, &msize2))
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed");
/*---------------------------------------------------------------------
* read
@@ -476,18 +478,18 @@ hsize_t diff_attr(hid_t loc1_id,
buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2);
if(buf1 == NULL || buf2 == NULL) {
parallel_print("cannot read into memory\n");
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "buffer allocation failed");
}
if(H5Aread(attr1_id, mtype1_id, buf1) < 0) {
parallel_print("Failed reading attribute1 %s/%s\n", path1, name1);
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
}
else
buf1hasdata = TRUE;
if(H5Aread(attr2_id, mtype2_id, buf2) < 0) {
parallel_print("Failed reading attribute2 %s/%s\n", path2, name2);
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
}
else
buf2hasdata = TRUE;
@@ -503,22 +505,22 @@ hsize_t diff_attr(hid_t loc1_id,
/* always print name */
/* verbose (-v) and report (-r) mode */
- if(options->m_verbose || options->m_report) {
+ if(opts->m_verbose || opts->m_report) {
do_print_attrname("attribute", np1, np2);
nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, options, np1, np2, mtype1_id, attr1_id, attr2_id);
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
print_found(nfound);
}
/* quiet mode (-q), just count differences */
- else if(options->m_quiet) {
+ else if(opts->m_quiet) {
nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, options, np1, np2, mtype1_id, attr1_id, attr2_id);
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
}
/* the rest (-c, none, ...) */
else {
nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, options, np1, np2, mtype1_id, attr1_id, attr2_id);
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
/* print info if compatible and difference found */
if (nfound) {
@@ -545,32 +547,29 @@ hsize_t diff_attr(hid_t loc1_id,
buf2 = NULL;
if(H5Tclose(ftype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
if(H5Tclose(ftype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
if(H5Sclose(space1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
if(H5Sclose(space2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
if(H5Aclose(attr1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
if(H5Aclose(attr2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
if(H5Tclose(mtype1_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed");
if(H5Tclose(mtype2_id) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed");
nfound_total += nfound;
}
} /* u */
- table_attrs_free(match_list_attrs);
-
- h5difftrace("diff_attr end\n");
- return nfound_total;
+done:
+ opts->err_stat = opts->err_stat | ret_value;
-error:
H5E_BEGIN_TRY {
if(buf1) {
if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
@@ -595,8 +594,7 @@ error:
H5Aclose(attr2_id);
} H5E_END_TRY;
- options->err_stat = 1;
- h5difftrace("diff_attr end with error\n");
+ h5diffdebug2("diff_attr end - errstat:%d\n", opts->err_stat);
return nfound_total;
}
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 998a8ca..b03295b 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -1,15 +1,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-* Copyright by The HDF Group. *
-* Copyright by the Board of Trustees of the University of Illinois. *
-* All rights reserved. *
-* *
-* This file is part of HDF5. The full HDF5 copyright notice, including *
-* terms governing use, modification, and redistribution, is contained in *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "H5private.h"
#include "h5tools.h"
@@ -19,25 +19,22 @@
/*-------------------------------------------------------------------------
-* Function: diff_dataset
-*
-* Purpose: check for comparable datasets and read into a compatible
-* memory type
-*
-* Return: Number of differences found
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: May 9, 2003
-*
-*-------------------------------------------------------------------------
-*/
-hsize_t diff_dataset( hid_t file1_id,
- hid_t file2_id,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *options)
+ * Function: diff_dataset
+ *
+ * Purpose: check for comparable datasets and read into a compatible
+ * memory type
+ *
+ * Return: Number of differences found
+ *-------------------------------------------------------------------------
+ */
+hsize_t diff_dataset(hid_t file1_id,
+ hid_t file2_id,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t *opts)
{
+ int ret_value = opts->err_stat;
+ int status = -1;
hid_t did1 = -1;
hid_t did2 = -1;
hid_t dcpl1 = -1;
@@ -46,53 +43,45 @@ hsize_t diff_dataset( hid_t file1_id,
h5difftrace("diff_dataset start\n");
/*-------------------------------------------------------------------------
- * open the handles
- *-------------------------------------------------------------------------
- */
- /* disable error reporting */
- H5E_BEGIN_TRY
- {
- /* Open the datasets */
- if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) {
- parallel_print("Cannot open dataset <%s>\n", obj1_name);
- goto error;
- }
- if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) {
- parallel_print("Cannot open dataset <%s>\n", obj2_name);
- goto error;
- }
- /* enable error reporting */
- } H5E_END_TRY;
-
+ * open the handles
+ *-------------------------------------------------------------------------
+ */
+ /* Open the datasets */
+ if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) {
+ parallel_print("Cannot open dataset <%s>\n", obj1_name);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 first dataset failed");
+ }
+ if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) {
+ parallel_print("Cannot open dataset <%s>\n", obj2_name);
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 second dataset failed");
+ }
if((dcpl1 = H5Dget_create_plist(did1)) < 0)
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist first dataset failed");
if((dcpl2 = H5Dget_create_plist(did2)) < 0)
- goto error;
-
- /*-------------------------------------------------------------------------
- * check if the dataset creation property list has filters that
- * are not registered in the current configuration
- * 1) the external filters GZIP and SZIP might not be available
- * 2) the internal filters might be turned off
- *-------------------------------------------------------------------------
- */
- if ((h5tools_canreadf((options->m_verbose ? obj1_name : NULL), dcpl1) == 1) &&
- (h5tools_canreadf((options->m_verbose ? obj2_name : NULL), dcpl2) == 1))
- nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, options);
- else
- goto error;
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist second dataset failed");
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- goto done;
-
-error:
- options->err_stat = 1;
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if ((status = h5tools_canreadf((opts->m_verbose ? obj1_name : NULL), dcpl1) == 1) &&
+ (status = h5tools_canreadf((opts->m_verbose ? obj2_name : NULL), dcpl2) == 1))
+ nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, opts);
+ else if (status < 0) {
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "h5tools_canreadf failed");
+ }
+ else {
+ ret_value = 1;
+ opts->not_cmp = 1;
+ }
done:
+ opts->err_stat = opts->err_stat | ret_value;
+
/* disable error reporting */
H5E_BEGIN_TRY {
H5Pclose(dcpl1);
@@ -102,82 +91,75 @@ done:
/* enable error reporting */
} H5E_END_TRY;
- h5difftrace("diff_dataset end\n");
+ h5diffdebug3("diff_dataset finish:%d - errstat:%d\n", nfound, opts->err_stat);
return nfound;
}
/*-------------------------------------------------------------------------
-* Function: diff_datasetid
-*
-* Purpose: check for comparable datasets and read into a compatible
-* memory type
-*
-* Return: Number of differences found
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: May 9, 2003
-*
-* Modifications:
-*
-*
-* October 2006: Read by hyperslabs for big datasets.
-*
-* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
-* i.e., if the memory needed to read a dataset is greater than this limit,
-* then hyperslab I/O is done instead of one operation I/O
-* For each dataset, the memory needed is calculated according to
-*
-* memory needed = number of elements * size of each element
-*
-* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
-* are done
-*
-* H5Dread( input_dataset1 )
-* H5Dread( input_dataset2 )
-*
-* with all elements in the datasets selected. If the memory needed is greater than
-* H5TOOLS_MALLOCSIZE, then the following operations are done instead:
-*
-* a strip mine is defined for each dimension k (a strip mine is defined as a
-* hyperslab whose size is memory manageable) according to the formula
-*
-* (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type)
-*
-* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures
-* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip
-* mine size k is simply defined as its dimension k, but for larger datasets the
-* hyperslab size is still memory manageable.
-* a cycle is done until the number of elements in the dataset is reached. In each
-* iteration, two parameters are defined for the function H5Sselect_hyperslab,
-* the start and size of each hyperslab, according to
-*
-* (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k])
-*
-* where hyperslab_offset [k] is initially set to zero, and later incremented in
-* hyperslab_size[k] offsets. The reason for the operation
-*
-* dimension[k] - hyperslab_offset[k]
-*
-* in (2) is that, when using the strip mine size, it assures that the "remaining" part
-* of the dataset that does not fill an entire strip mine is processed.
-*
-*-------------------------------------------------------------------------
-*/
-hsize_t diff_datasetid( hid_t did1,
- hid_t did2,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *options)
+ * Function: diff_datasetid
+ *
+ * Purpose: check for comparable datasets and read into a compatible
+ * memory type
+ *
+ * Return: Number of differences found
+ *
+ * October 2006: Read by hyperslabs for big datasets.
+ *
+ * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
+ * i.e., if the memory needed to read a dataset is greater than this limit,
+ * then hyperslab I/O is done instead of one operation I/O
+ * For each dataset, the memory needed is calculated according to
+ *
+ * memory needed = number of elements * size of each element
+ *
+ * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
+ * are done
+ *
+ * H5Dread( input_dataset1 )
+ * H5Dread( input_dataset2 )
+ *
+ * with all elements in the datasets selected. If the memory needed is greater than
+ * H5TOOLS_MALLOCSIZE, then the following operations are done instead:
+ *
+ * a strip mine is defined for each dimension k (a strip mine is defined as a
+ * hyperslab whose size is memory manageable) according to the formula
+ *
+ * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type)
+ *
+ * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures
+ * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip
+ * mine size k is simply defined as its dimension k, but for larger datasets the
+ * hyperslab size is still memory manageable.
+ * a cycle is done until the number of elements in the dataset is reached. In each
+ * iteration, two parameters are defined for the function H5Sselect_hyperslab,
+ * the start and size of each hyperslab, according to
+ *
+ * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k])
+ *
+ * where hyperslab_offset [k] is initially set to zero, and later incremented in
+ * hyperslab_size[k] offsets. The reason for the operation
+ *
+ * dimension[k] - hyperslab_offset[k]
+ *
+ * in (2) is that, when using the strip mine size, it assures that the "remaining" part
+ * of the dataset that does not fill an entire strip mine is processed.
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t diff_datasetid(hid_t did1,
+ hid_t did2,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t *opts)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t sid1=-1;
- hid_t sid2=-1;
- hid_t f_tid1=-1;
- hid_t f_tid2=-1;
- hid_t dam_tid=-1; /* m_tid for diff_array function */
- hid_t m_tid1=-1;
- hid_t m_tid2=-1;
+ int ret_value = opts->err_stat;
+ hid_t sid1 = -1;
+ hid_t sid2 = -1;
+ hid_t f_tid1 = -1;
+ hid_t f_tid2 = -1;
+ hid_t dam_tid = -1; /* m_tid for diff_array function */
+ hid_t m_tid1 = -1;
+ hid_t m_tid2 = -1;
hid_t dcpl1 = -1;
hid_t dcpl2 = -1;
H5D_layout_t stl1 = -1;
@@ -197,42 +179,41 @@ hsize_t diff_datasetid( hid_t did1,
hsize_t dims2[H5S_MAX_RANK];
hsize_t maxdim1[H5S_MAX_RANK];
hsize_t maxdim2[H5S_MAX_RANK];
- const char *name1=NULL; /* relative names */
- const char *name2=NULL;
+ const char *name1 = NULL; /* relative names */
+ const char *name2 = NULL;
hsize_t storage_size1;
hsize_t storage_size2;
- hsize_t nfound=0; /* number of differences found */
- int can_compare=1; /* do diff or not */
- void *buf1=NULL;
- void *buf2=NULL;
- void *sm_buf1=NULL;
- void *sm_buf2=NULL;
- hid_t sm_space; /*stripmine data space */
- size_t need; /* bytes needed for malloc */
+ hsize_t nfound = 0; /* number of differences found */
+ int can_compare = 1; /* do diff or not */
+ void *buf1 = NULL;
+ void *buf2 = NULL;
+ void *sm_buf1 = NULL;
+ void *sm_buf2 = NULL;
+ hid_t sm_space; /*stripmine data space */
+ size_t need; /* bytes needed for malloc */
int i;
- unsigned int vl_data = 0; /*contains VL datatypes */
+ unsigned int vl_data = 0; /*contains VL datatypes */
- options->err_stat = 1;
h5difftrace("diff_datasetid start\n");
/* Get the dataspace handle */
if((sid1 = H5Dget_space(did1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed");
/* Get rank */
if((rank1 = H5Sget_simple_extent_ndims(sid1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
/* Get the dataspace handle */
if((sid2 = H5Dget_space(did2)) < 0 )
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed");
/* Get rank */
if((rank2 = H5Sget_simple_extent_ndims(sid2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
/* Get dimensions */
if(H5Sget_simple_extent_dims(sid1, dims1, maxdim1) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
/* Get dimensions */
if(H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0)
@@ -240,36 +221,36 @@ hsize_t diff_datasetid( hid_t did1,
h5diffdebug3("rank: %ld - %ld\n", rank1, rank2);
/*-------------------------------------------------------------------------
- * get the file data type
- *-------------------------------------------------------------------------
- */
+ * get the file data type
+ *-------------------------------------------------------------------------
+ */
/* Get the data type */
if((f_tid1 = H5Dget_type(did1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed");
/* Get the data type */
if((f_tid2 = H5Dget_type(did2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed");
/*-------------------------------------------------------------------------
- * get the storage layout type
- *-------------------------------------------------------------------------
- */
+ * get the storage layout type
+ *-------------------------------------------------------------------------
+ */
if((dcpl1 = H5Dget_create_plist(did1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((dcpl2 = H5Dget_create_plist(did2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((stl1 = H5Pget_layout(dcpl1)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed");
if((stl2 = H5Pget_layout(dcpl2)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed");
/*-------------------------------------------------------------------------
- * check for empty datasets
- *-------------------------------------------------------------------------
- */
+ * check for empty datasets
+ *-------------------------------------------------------------------------
+ */
h5difftrace("check for empty datasets\n");
storage_size1 = H5Dget_storage_size(did1);
@@ -278,71 +259,74 @@ hsize_t diff_datasetid( hid_t did1,
if(storage_size1 == 0 || storage_size2 == 0) {
if(stl1 == H5D_VIRTUAL || stl2 == H5D_VIRTUAL) {
- if((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
+ if((opts->m_verbose||opts->m_list_not_cmp) && obj1_name && obj2_name)
parallel_print("Warning: <%s> or <%s> is a virtual dataset\n", obj1_name, obj2_name);
}
else {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name)
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name)
parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name);
can_compare = 0;
- options->not_cmp = 1;
+ opts->not_cmp = 1;
}
}
/*-------------------------------------------------------------------------
- * check for comparable TYPE and SPACE
- *-------------------------------------------------------------------------
- */
+ * check for comparable TYPE and SPACE
+ *-------------------------------------------------------------------------
+ */
if (diff_can_type(f_tid1, f_tid2, rank1, rank2,
dims1, dims2, maxdim1, maxdim2,
obj1_name, obj2_name,
- options, 0) != 1)
+ opts, 0) != 1)
can_compare = 0;
+ h5diffdebug2("diff_can_type - errstat:%d\n", opts->err_stat);
/*-------------------------------------------------------------------------
- * memory type and sizes
- *-------------------------------------------------------------------------
- */
+ * memory type and sizes
+ *-------------------------------------------------------------------------
+ */
h5difftrace("check for memory type and sizes\n");
if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed");
if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed");
m_size1 = H5Tget_size(m_tid1);
m_size2 = H5Tget_size(m_tid2);
h5diffdebug3("type size: %ld - %ld\n", m_size1, m_size2);
/*-------------------------------------------------------------------------
- * check for different signed/unsigned types
- *-------------------------------------------------------------------------
- */
+ * check for different signed/unsigned types
+ *-------------------------------------------------------------------------
+ */
if(can_compare) {
h5difftrace("can_compare for sign\n");
sign1 = H5Tget_sign(m_tid1);
sign2 = H5Tget_sign(m_tid2);
if(sign1 != sign2) {
h5difftrace("sign1 != sign2\n");
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1));
parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
}
can_compare = 0;
- options->not_cmp = 1;
+ opts->not_cmp = 1;
}
}
/* Check if type is either VLEN-data or VLEN-string to reclaim any
- * VLEN memory buffer later */
+ * VLEN memory buffer later
+ */
if(TRUE == h5tools_detect_vlen(m_tid1))
vl_data = TRUE;
+ h5diffdebug2("h5tools_detect_vlen - errstat:%d\n", opts->err_stat);
/*------------------------------------------------------------------------
- * only attempt to compare if possible
- *-------------------------------------------------------------------------
- */
+ * only attempt to compare if possible
+ *-------------------------------------------------------------------------
+ */
if(can_compare) { /* it is possible to compare */
H5T_class_t tclass = H5Tget_class(f_tid1);
h5difftrace("can_compare attempt\n");
@@ -363,14 +347,14 @@ hsize_t diff_datasetid( hid_t did1,
if(tclass != H5T_ARRAY) {
/*-----------------------------------------------------------------
- * "upgrade" the smaller memory size
- *------------------------------------------------------------------
- */
+ * "upgrade" the smaller memory size
+ *------------------------------------------------------------------
+ */
h5difftrace("upgrade the smaller memory size?\n");
if (FAIL == match_up_memsize (f_tid1, f_tid2,
&m_tid1, &m_tid2,
&m_size1, &m_size2))
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "match_up_memsize failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed");
h5diffdebug3("m_size: %ld - %ld\n", m_size1, m_size2);
dadims = dims1;
dam_size = m_size1;
@@ -405,9 +389,9 @@ hsize_t diff_datasetid( hid_t did1,
/*----------------------------------------------------------------
- * read/compare
- *-----------------------------------------------------------------
- */
+ * read/compare
+ *-----------------------------------------------------------------
+ */
if(need < H5TOOLS_MALLOCSIZE) {
buf1 = HDmalloc(need);
buf2 = HDmalloc(need);
@@ -416,14 +400,14 @@ hsize_t diff_datasetid( hid_t did1,
if(buf1 != NULL && buf2 != NULL) {
h5difftrace("buf1 != NULL && buf2 != NULL\n");
if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
h5difftrace("H5Dread did2\n");
if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
/* array diff */
nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims,
- options, name1, name2, dam_tid, did1, did2);
+ opts, name1, name2, dam_tid, did1, did2);
h5diffdebug2("diff_array nfound:%d\n", nfound);
/* reclaim any VL memory, if necessary */
@@ -482,9 +466,9 @@ hsize_t diff_datasetid( hid_t did1,
* E.g., sm_space.
*/
if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed");
if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed");
sm_nelmts = sm_nbytes / p_type_nbytes;
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
@@ -501,24 +485,24 @@ hsize_t diff_datasetid( hid_t did1,
hs_nelmts *= hs_size[i];
} /* end for */
if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
} /* end if */
else
hs_nelmts = 1;
if(H5Dread(did1, m_tid1, sm_space, sid1, H5P_DEFAULT, sm_buf1) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
if(H5Dread(did2, m_tid2, sm_space, sid2, H5P_DEFAULT, sm_buf2) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
/* get array differences. in the case of hyperslab read, increment the number of differences
found in each hyperslab and pass the position at the beginning for printing */
nfound += diff_array(sm_buf1, sm_buf2, hs_nelmts, elmtno, rank1,
- dadims, options, name1, name2, dam_tid, did1, did2);
+ dadims, opts, name1, name2, dam_tid, did1, did2);
/* reclaim any VL memory, if necessary */
if(vl_data) {
@@ -553,11 +537,10 @@ hsize_t diff_datasetid( hid_t did1,
* close
*-------------------------------------------------------------------------
*/
- h5difftrace("reclaim any VL memory\n");
+ h5diffdebug2("reclaim any VL memory - errstat:%d\n", opts->err_stat);
done:
-
- options->err_stat = ret_value;
+ opts->err_stat = opts->err_stat | ret_value;
/* free */
if(buf1 != NULL) {
@@ -599,60 +582,55 @@ done:
H5Tclose(m_tid2);
/* enable error reporting */
} H5E_END_TRY;
- h5diffdebug3("diff_datasetid return:%d with nfound:%d\n", ret_value, nfound);
+ h5diffdebug3("diff_datasetid return:%d with nfound:%d\n", ret_value, nfound);
return nfound;
}
/*-------------------------------------------------------------------------
-* Function: diff_can_type
-*
-* Purpose: check for comparable TYPE and SPACE
-*
-* Return:
-* 1, can compare
-* 0, cannot compare
-* -1, error
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: November 3, 2003
-*
-*-------------------------------------------------------------------------
-*/
-
-int diff_can_type( hid_t f_tid1, /* file data type */
- hid_t f_tid2, /* file data type */
- int rank1,
- int rank2,
- hsize_t *dims1,
- hsize_t *dims2,
- hsize_t *maxdim1,
- hsize_t *maxdim2,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *options,
- int is_compound)
+ * Function: diff_can_type
+ *
+ * Purpose: check for comparable TYPE and SPACE
+ *
+ * Return:
+ * 1, can compare
+ * 0, cannot compare
+ * -1, error
+ *-------------------------------------------------------------------------
+ */
+
+int diff_can_type(hid_t f_tid1, /* file data type */
+ hid_t f_tid2, /* file data type */
+ int rank1,
+ int rank2,
+ hsize_t *dims1,
+ hsize_t *dims2,
+ hsize_t *maxdim1,
+ hsize_t *maxdim2,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t *opts,
+ int is_compound)
{
+ int ret_value = 1; /* can_compare value */
H5T_class_t tclass1;
H5T_class_t tclass2;
int maxdim_diff = 0; /* maximum dimensions are different */
int dim_diff = 0; /* current dimensions are different */
int i;
- int can_compare = 1; /* return value */
h5difftrace("diff_can_type start\n");
/*-------------------------------------------------------------------------
- * check for the same class
- *-------------------------------------------------------------------------
- */
+ * check for the same class
+ *-------------------------------------------------------------------------
+ */
if((tclass1 = H5Tget_class(f_tid1)) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_class first object failed");
if((tclass2 = H5Tget_class(f_tid2)) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_class second object failed");
if(tclass1 != tclass2) {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
if(is_compound) {
parallel_print("Not comparable: <%s> has a class %s and <%s> has a class %s\n",
obj1_name, get_class(tclass1),
@@ -664,24 +642,22 @@ int diff_can_type( hid_t f_tid1, /* file data type */
obj2_name, get_class(tclass2));
}
}
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
}
/*-------------------------------------------------------------------------
- * check for non supported classes
- *-------------------------------------------------------------------------
- */
+ * check for non supported classes
+ *-------------------------------------------------------------------------
+ */
switch (tclass1) {
case H5T_TIME:
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> and <%s> are of class %s\n",
obj1_name, obj2_name, get_class(tclass2));
} /* end if */
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
case H5T_INTEGER:
case H5T_FLOAT:
@@ -701,10 +677,10 @@ int diff_can_type( hid_t f_tid1, /* file data type */
} /* end switch */
/*-------------------------------------------------------------------------
- * check for equal file datatype; warning only
- *-------------------------------------------------------------------------
- */
- if((H5Tequal(f_tid1, f_tid2) == 0) && (options->m_verbose) && obj1_name && obj2_name) {
+ * check for equal file datatype; warning only
+ *-------------------------------------------------------------------------
+ */
+ if((H5Tequal(f_tid1, f_tid2) == 0) && (opts->m_verbose) && obj1_name && obj2_name) {
H5T_class_t cl = H5Tget_class(f_tid1);
parallel_print("Warning: different storage datatype\n");
@@ -719,11 +695,11 @@ int diff_can_type( hid_t f_tid1, /* file data type */
}
/*-------------------------------------------------------------------------
- * check for the same rank
- *-------------------------------------------------------------------------
- */
+ * check for the same rank
+ *-------------------------------------------------------------------------
+ */
if(rank1 != rank2) {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1);
print_dimensions(rank1, dims1);
parallel_print(", max dimensions ");
@@ -735,15 +711,14 @@ int diff_can_type( hid_t f_tid1, /* file data type */
print_dimensions(rank2, maxdim2);
parallel_print("\n");
}
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
}
/*-------------------------------------------------------------------------
- * check for different dimensions
- *-------------------------------------------------------------------------
- */
+ * check for different dimensions
+ *-------------------------------------------------------------------------
+ */
for(i = 0; i<rank1; i++) {
if(maxdim1 && maxdim2) {
if(maxdim1[i] != maxdim2[i])
@@ -754,11 +729,11 @@ int diff_can_type( hid_t f_tid1, /* file data type */
}
/*-------------------------------------------------------------------------
- * current dimensions
- *-------------------------------------------------------------------------
- */
+ * current dimensions
+ *-------------------------------------------------------------------------
+ */
if(dim_diff == 1) {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1);
print_dimensions(rank1, dims1);
if(maxdim1 && maxdim2) {
@@ -772,17 +747,16 @@ int diff_can_type( hid_t f_tid1, /* file data type */
parallel_print("\n");
}
}
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
}
/*-------------------------------------------------------------------------
- * maximum dimensions; just give a warning
- *-------------------------------------------------------------------------
- */
+ * maximum dimensions; just give a warning
+ *-------------------------------------------------------------------------
+ */
if(maxdim1 && maxdim2 && maxdim_diff == 1 && obj1_name) {
- if(options->m_verbose) {
+ if(opts->m_verbose) {
parallel_print( "Warning: different maximum dimensions\n");
parallel_print("<%s> has max dimensions ", obj1_name);
print_dimensions(rank1, maxdim1);
@@ -797,21 +771,20 @@ int diff_can_type( hid_t f_tid1, /* file data type */
int nmembs1;
int nmembs2;
int j;
- hid_t memb_type1;
- hid_t memb_type2;
+ hid_t memb_type1 = -1;
+ hid_t memb_type2 = -1;
nmembs1 = H5Tget_nmembers(f_tid1);
nmembs2 = H5Tget_nmembers(f_tid2);
if(nmembs1 != nmembs2) {
- if((options->m_verbose || options->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has %d members ", obj1_name, nmembs1);
parallel_print("<%s> has %d members ", obj2_name, nmembs2);
parallel_print("\n");
}
- can_compare = 0;
- options->not_cmp = 1;
- goto done;
+ opts->not_cmp = 1;
+ HGOTO_DONE(0);
}
for (j = 0; j < nmembs1; j++) {
@@ -820,30 +793,31 @@ int diff_can_type( hid_t f_tid1, /* file data type */
if (diff_can_type(memb_type1, memb_type2, rank1, rank2,
dims1, dims2, maxdim1, maxdim2, obj1_name, obj2_name,
- options, 1) != 1) {
- can_compare = 0;
- options->not_cmp = 1;
+ opts, 1) != 1) {
+ opts->not_cmp = 1;
H5Tclose(memb_type1);
H5Tclose(memb_type2);
- goto done;
+ HGOTO_DONE(0);
}
H5Tclose(memb_type1);
H5Tclose(memb_type2);
}
}
done:
- h5diffdebug2("diff_can_type end - %d\n", can_compare);
- return can_compare;
+ if (ret_value < 0)
+ opts->err_stat = 1;
+
+ h5diffdebug2("diff_can_type end - %d\n", ret_value);
+ return ret_value;
}
/*-------------------------------------------------------------------------
-* Function: print_sizes
-*
-* Purpose: Print datatype sizes
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: print_sizes
+ *
+ * Purpose: Print datatype sizes
+ *-------------------------------------------------------------------------
+ */
#if defined (H5DIFF_DEBUG)
void print_sizes( const char *obj1,
const char *obj2,
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index ad23ccf..d4fc3a2 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -24,8 +24,7 @@ int g_nTasks = 1;
/*-------------------------------------------------------------------------
* Function: print_dimensions
*
- * Purpose: print dimensions
- *
+ * Purpose: print dimensions
*-------------------------------------------------------------------------
*/
void
@@ -33,14 +32,14 @@ print_dimensions (int rank, hsize_t *dims)
{
int i;
- if( rank <= 0 )
+ if(rank <= 0)
parallel_print("H5S_SCALAR" );
else {
if (!dims)
parallel_print("dimension is NULL");
else {
parallel_print("[");
- for ( i = 0; i < rank-1; i++) {
+ for (i = 0; i < rank-1; i++) {
parallel_print(HSIZE_T_FORMAT, dims[i]);
parallel_print("x");
}
@@ -55,16 +54,11 @@ print_dimensions (int rank, hsize_t *dims)
/*-------------------------------------------------------------------------
* Function: print_type
*
- * Purpose: Print name of datatype
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Purpose: Print name of datatype
*
- * Date: May 9, 2003
- *
- * Comments: Adapted from h5dump for H5T_INTEGER and H5T_FLOAT classes only
+ * Return: void
*
+ * Comments: Adapted from h5dump for H5T_INTEGER and H5T_FLOAT classes only
*-------------------------------------------------------------------------
*/
void print_type(hid_t type)
@@ -188,12 +182,7 @@ void print_type(hid_t type)
/*-------------------------------------------------------------------------
* Function: diff_basename
*
- * Purpose: Returns a pointer to the last component absolute name
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
+ * Purpose: Returns a pointer to the last component absolute name
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE const char*
@@ -219,12 +208,7 @@ diff_basename(const char *name)
/*-------------------------------------------------------------------------
* Function: get_type
*
- * Purpose: Returns the type as a string
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
+ * Purpose: Returns the type as a string
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE H5_ATTR_CONST const char*
@@ -255,21 +239,13 @@ get_type(h5trav_type_t type)
/*-------------------------------------------------------------------------
* Function: get_sign
*
- * Purpose: Returns the sign as a string
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments:
- *
+ * Purpose: Returns the sign as a string
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE const char*
get_sign(H5T_sign_t sign)
{
- switch(sign)
- {
+ switch(sign) {
case H5T_SGN_NONE:
return "H5T_SGN_NONE";
@@ -291,12 +267,7 @@ get_sign(H5T_sign_t sign)
/*-------------------------------------------------------------------------
* Function: get_class
*
- * Purpose: Returns the class as a string
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
+ * Purpose: Returns the class as a string
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE const char*
@@ -346,8 +317,7 @@ get_class(H5T_class_t tclass)
/*-------------------------------------------------------------------------
* Function: print_found
*
- * Purpose: print number of differences found
- *
+ * Purpose: print number of differences found
*-------------------------------------------------------------------------
*/
void print_found(hsize_t nfound)
@@ -362,43 +332,37 @@ void print_found(hsize_t nfound)
/*-----------------------------------------------------------------
* Function: match_up_memsize
*
- * Purpose: match smaller memory size up to bigger memory size
+ * Purpose: match smaller memory size up to bigger memory size
*------------------------------------------------------------------
*/
herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
hid_t *m_tid1, hid_t *m_tid2,
size_t *m_size1, size_t *m_size2)
{
- herr_t ret = SUCCEED;
+ herr_t ret_value = SUCCEED;
if((*m_size1) != (*m_size2)) {
if((*m_size1) < (*m_size2)) {
- H5Tclose( *m_tid1 );
+ H5Tclose(*m_tid1);
- if(((*m_tid1) = H5Tget_native_type(f_tid2_id, H5T_DIR_DEFAULT)) < 0) {
- ret = FAIL;
- goto out;
- }
+ if(((*m_tid1) = H5Tget_native_type(f_tid2_id, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
- *m_size1 = H5Tget_size( *m_tid1 );
+ *m_size1 = H5Tget_size(*m_tid1);
} /* end if */
else {
H5Tclose(*m_tid2);
- if(((*m_tid2) = H5Tget_native_type(f_tid1_id, H5T_DIR_DEFAULT)) < 0) {
- ret = FAIL;
- goto out;
- }
+ if(((*m_tid2) = H5Tget_native_type(f_tid1_id, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
*m_size2 = H5Tget_size(*m_tid2);
} /* end else */
} /* end if */
- if((*m_size1) != (*m_size2)) {
- ret = FAIL;
- goto out;
- }
+ if((*m_size1) != (*m_size2))
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "native type sizes do not compare");
-out:
- return ret;
+done:
+ return ret_value;
}
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index fb79b77..f987296 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -642,8 +642,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
- {
+ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) {
HERROR(H5E_tools_g, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
HGOTO_DONE(dimension_break);
}
@@ -1910,9 +1909,8 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
obj = search_obj(h5dump_type_table, oinfo.addr);
if(obj) {
- if(!obj->recorded) {
+ if(!obj->recorded)
h5tools_str_append(buffer,"\"/#"H5_PRINTF_HADDR_FMT"\"", obj->objno);
- }
else
h5tools_str_append(buffer, "\"%s\"", obj->objname);
}
@@ -1929,121 +1927,86 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
switch (type_class) {
case H5T_INTEGER:
- if (H5Tequal(type, H5T_STD_I8BE) == TRUE) {
+ if (H5Tequal(type, H5T_STD_I8BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I8BE");
- }
- else if (H5Tequal(type, H5T_STD_I8LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I8LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I8LE");
- }
- else if (H5Tequal(type, H5T_STD_I16BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I16BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I16BE");
- }
- else if (H5Tequal(type, H5T_STD_I16LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I16LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I16LE");
- }
- else if (H5Tequal(type, H5T_STD_I32BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I32BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I32BE");
- }
- else if (H5Tequal(type, H5T_STD_I32LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I32LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I32LE");
- }
- else if (H5Tequal(type, H5T_STD_I64BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I64BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I64BE");
- }
- else if (H5Tequal(type, H5T_STD_I64LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_I64LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_I64LE");
- }
- else if (H5Tequal(type, H5T_STD_U8BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U8BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U8BE");
- }
- else if (H5Tequal(type, H5T_STD_U8LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U8LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U8LE");
- }
- else if (H5Tequal(type, H5T_STD_U16BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U16BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U16BE");
- }
- else if (H5Tequal(type, H5T_STD_U16LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U16LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U16LE");
- }
- else if (H5Tequal(type, H5T_STD_U32BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U32BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U32BE");
- }
- else if (H5Tequal(type, H5T_STD_U32LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U32LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U32LE");
- }
- else if (H5Tequal(type, H5T_STD_U64BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U64BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U64BE");
- }
- else if (H5Tequal(type, H5T_STD_U64LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_U64LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_U64LE");
- }
- else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_SCHAR");
- }
- else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_UCHAR");
- }
- else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_SHORT");
- }
- else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_USHORT");
- }
- else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_INT");
- }
- else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_UINT");
- }
- else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_LONG");
- }
- else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_ULONG");
- }
- else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_LLONG");
- }
- else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_ULLONG");
- }
else {
/* byte order */
if (H5Tget_size(type) > 1) {
order = H5Tget_order(type);
- if (H5T_ORDER_LE == order) {
+ if (H5T_ORDER_LE == order)
order_s = " little-endian";
- }
- else if (H5T_ORDER_BE == order) {
+ else if (H5T_ORDER_BE == order)
order_s = " big-endian";
- }
- else if (H5T_ORDER_VAX == order) {
+ else if (H5T_ORDER_VAX == order)
order_s = " mixed-endian";
- }
- else {
+ else
order_s = " unknown-byte-order";
- }
}
- else {
+ else
order_s = "";
- }
/* sign */
if ((sign = H5Tget_sign(type)) >= 0) {
- if (H5T_SGN_NONE == sign) {
+ if (H5T_SGN_NONE == sign)
sign_s = " unsigned";
- }
- else if (H5T_SGN_2 == sign) {
+ else if (H5T_SGN_2 == sign)
sign_s = "";
- }
- else {
+ else
sign_s = " unknown-sign";
- }
}
- else {
+ else
sign_s = " unknown-sign";
- }
/* print size, order, and sign */
h5tools_str_append(buffer, "%lu-bit%s%s integer",
@@ -2052,56 +2015,42 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
break;
case H5T_FLOAT:
- if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE) {
+ if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE)
h5tools_str_append(buffer, "H5T_IEEE_F32BE");
- }
- else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE) {
+ else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE)
h5tools_str_append(buffer, "H5T_IEEE_F32LE");
- }
- else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE) {
+ else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE)
h5tools_str_append(buffer, "H5T_IEEE_F64BE");
- }
- else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE) {
+ else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE)
h5tools_str_append(buffer, "H5T_IEEE_F64LE");
- }
- else if (H5Tequal(type, H5T_VAX_F32) == TRUE) {
+ else if (H5Tequal(type, H5T_VAX_F32) == TRUE)
h5tools_str_append(buffer, "H5T_VAX_F32");
- }
- else if (H5Tequal(type, H5T_VAX_F64) == TRUE) {
+ else if (H5Tequal(type, H5T_VAX_F64) == TRUE)
h5tools_str_append(buffer, "H5T_VAX_F64");
- }
- else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_FLOAT");
- }
- else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE");
#if H5_SIZEOF_LONG_DOUBLE !=0
- }
- else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) {
+ else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE)
h5tools_str_append(buffer, "H5T_NATIVE_LDOUBLE");
#endif
- }
else {
/* byte order */
if (H5Tget_size(type) > 1) {
order = H5Tget_order(type);
- if (H5T_ORDER_LE == order) {
+ if (H5T_ORDER_LE == order)
order_s = " little-endian";
- }
- else if (H5T_ORDER_BE == order) {
+ else if (H5T_ORDER_BE == order)
order_s = " big-endian";
- }
- else if (H5T_ORDER_VAX == order) {
+ else if (H5T_ORDER_VAX == order)
order_s = " mixed-endian";
- }
- else {
+ else
order_s = " unknown-byte-order";
- }
}
- else {
+ else
order_s = "";
- }
/* print size and byte order */
h5tools_str_append(buffer, "%lu-bit%s floating-point",
@@ -2308,33 +2257,24 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
break;
case H5T_BITFIELD:
- if (H5Tequal(type, H5T_STD_B8BE) == TRUE) {
+ if (H5Tequal(type, H5T_STD_B8BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B8BE");
- }
- else if (H5Tequal(type, H5T_STD_B8LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B8LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B8LE");
- }
- else if (H5Tequal(type, H5T_STD_B16BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B16BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B16BE");
- }
- else if (H5Tequal(type, H5T_STD_B16LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B16LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B16LE");
- }
- else if (H5Tequal(type, H5T_STD_B32BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B32BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B32BE");
- }
- else if (H5Tequal(type, H5T_STD_B32LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B32LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B32LE");
- }
- else if (H5Tequal(type, H5T_STD_B64BE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B64BE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B64BE");
- }
- else if (H5Tequal(type, H5T_STD_B64LE) == TRUE) {
+ else if (H5Tequal(type, H5T_STD_B64LE) == TRUE)
h5tools_str_append(buffer, "H5T_STD_B64LE");
- }
- else {
+ else
h5tools_str_append(buffer, "undefined bitfield");
- }
break;
case H5T_OPAQUE:
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index abd55db..db61d51 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -18,28 +18,32 @@
* print a warning message
*-------------------------------------------------------------------------
*/
-static void print_warning(const char *dname, const char *fname)
+static void print_filter_warning(const char *dname, const char *fname)
{
fprintf(stderr,
- "warning: dataset <%s> cannot be read, %s filter is not available\n",
+ "Warning: dataset <%s> cannot be read, %s filter is not available\n",
dname, fname);
}
/*-------------------------------------------------------------------------
* Function: h5tools_canreadf
*
- * Purpose: check if the dataset creation property list has filters that
- * are not registered in the current configuration
- * 1) the external filters GZIP and SZIP might not be available
- * 2) the internal filters might be turned off
+ * Purpose: check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
*
- * Return: 1, can read, 0, cannot, -1 error
+ * Return:
+ * 1 can read,
+ * 0 cannot,
+ * -1 error
*-------------------------------------------------------------------------
*/
-int h5tools_canreadf(const char* name, /* object name, serves also as boolean print */
+int
+h5tools_canreadf(const char* name, /* object name, serves also as boolean print */
hid_t dcpl_id) /* dataset creation property list */
{
- int ret_value = 1; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 1;
int nfilters; /* number of filters */
H5Z_filter_t filtn; /* filter identification number */
int i; /* index */
@@ -69,7 +73,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
}
else if (!udfilter_avail) {
if (name)
- print_warning(name, "user defined");
+ print_filter_warning(name, "user defined");
ret_value = 0;
}
break;
@@ -81,7 +85,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
case H5Z_FILTER_DEFLATE:
#ifndef H5_HAVE_FILTER_DEFLATE
if (name)
- print_warning(name,"deflate");
+ print_filter_warning(name,"deflate");
ret_value = 0;
#endif
break;
@@ -92,7 +96,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
case H5Z_FILTER_SZIP:
#ifndef H5_HAVE_FILTER_SZIP
if (name)
- print_warning(name,"SZIP");
+ print_filter_warning(name,"SZIP");
ret_value = 0;
#endif
break;
@@ -130,56 +134,58 @@ done:
/*-------------------------------------------------------------------------
* Function: h5tools_canwritef
*
- * Purpose: check if the filter is available and can write data.
- * At this time, all filters that are available can write data,
- * except SZIP, which may be configured decoder-only.
+ * Purpose: check if the filter is available and can write data.
*
- * Return: 1, can write, 0, cannot, -1 error
+ * Return: 1 can write,
+ * 0 cannot,
+ * -1 error
*-------------------------------------------------------------------------
*/
H5_ATTR_CONST int
-h5tools_can_encode(H5Z_filter_t filtn) {
+h5tools_can_encode(H5Z_filter_t filtn)
+{
+ int ret_value = 1;
+
switch (filtn) {
/* user defined filter */
default:
- return 0;
-
+ HGOTO_DONE(0)
case H5Z_FILTER_DEFLATE:
#ifndef H5_HAVE_FILTER_DEFLATE
- return 0;
+ HGOTO_DONE(0)
#endif
break;
case H5Z_FILTER_SZIP:
#ifndef H5_HAVE_FILTER_SZIP
- return 0;
+ HGOTO_DONE(0)
#else
- {
+ {
unsigned int filter_config_flags;
if (H5Zget_filter_info(filtn, &filter_config_flags) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Zget_filter_info failed");
if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
/* filter present but neither encode nor decode is supported (???) */
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "neither encode nor decode is supported");
}
else if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) {
/* decoder only: read but not write */
- return 0;
+ HGOTO_DONE(0)
}
else if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
/* encoder only: write but not read (???) */
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "encoder only: write but not read");
}
else if ((filter_config_flags
& (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED))
== (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
- return 1;
+ HGOTO_DONE(1)
}
- }
+ }
#endif
break;
@@ -196,6 +202,7 @@ h5tools_can_encode(H5Z_filter_t filtn) {
break;
}/*switch*/
- return 1;
+done:
+ return ret_value;
}
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
index ee58ccb..f63c228 100644
--- a/tools/lib/h5tools_type.c
+++ b/tools/lib/h5tools_type.c
@@ -21,12 +21,6 @@
*
* Return: Success: datatype ID
* Failure: FAIL
- *
- * Programmer: Pedro Vicente Nunes
- * Tuesday, July 18, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -43,40 +37,40 @@ h5tools_get_little_endian_type(hid_t tid)
switch(type_class) {
case H5T_INTEGER:
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8LE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16LE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32LE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64LE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8LE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16LE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32LE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64LE);
+ if (size == 1 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I8LE);
+ else if (size == 2 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I16LE);
+ else if (size == 4 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I32LE);
+ else if (size == 8 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I64LE);
+ else if (size == 1 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U8LE);
+ else if (size == 2 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U16LE);
+ else if (size == 4 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U32LE);
+ else if (size == 8 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U64LE);
break;
case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32LE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64LE);
+ if (size == 4)
+ p_type = H5Tcopy(H5T_IEEE_F32LE);
+ else if (size == 8)
+ p_type = H5Tcopy(H5T_IEEE_F64LE);
break;
case H5T_BITFIELD:
- if ( size == 1)
- p_type=H5Tcopy(H5T_STD_B8LE);
- else if ( size == 2)
- p_type=H5Tcopy(H5T_STD_B16LE);
- else if ( size == 4)
- p_type=H5Tcopy(H5T_STD_B32LE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_STD_B64LE);
+ if (size == 1)
+ p_type = H5Tcopy(H5T_STD_B8LE);
+ else if (size == 2)
+ p_type = H5Tcopy(H5T_STD_B16LE);
+ else if (size == 4)
+ p_type = H5Tcopy(H5T_STD_B32LE);
+ else if (size == 8)
+ p_type = H5Tcopy(H5T_STD_B64LE);
break;
case H5T_TIME:
@@ -107,18 +101,12 @@ h5tools_get_little_endian_type(hid_t tid)
*
* Return: Success: datatype ID
* Failure: FAIL
- *
- * Programmer: Pedro Vicente Nunes
- * Tuesday, July 18, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
h5tools_get_big_endian_type(hid_t tid)
{
- hid_t p_type=-1;
+ hid_t p_type = -1;
H5T_class_t type_class;
size_t size;
H5T_sign_t sign;
@@ -129,39 +117,39 @@ h5tools_get_big_endian_type(hid_t tid)
switch(type_class) {
case H5T_INTEGER:
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8BE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16BE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32BE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64BE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8BE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16BE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32BE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64BE);
+ if (size == 1 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I8BE);
+ else if (size == 2 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I16BE);
+ else if (size == 4 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I32BE);
+ else if (size == 8 && sign == H5T_SGN_2)
+ p_type = H5Tcopy(H5T_STD_I64BE);
+ else if (size == 1 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U8BE);
+ else if (size == 2 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U16BE);
+ else if (size == 4 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U32BE);
+ else if (size == 8 && sign == H5T_SGN_NONE)
+ p_type = H5Tcopy(H5T_STD_U64BE);
break;
case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32BE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64BE);
+ if (size == 4)
+ p_type = H5Tcopy(H5T_IEEE_F32BE);
+ else if (size == 8)
+ p_type = H5Tcopy(H5T_IEEE_F64BE);
break;
case H5T_BITFIELD:
- if ( size == 1)
- p_type=H5Tcopy(H5T_STD_B8BE);
- else if ( size == 2)
- p_type=H5Tcopy(H5T_STD_B16BE);
- else if ( size == 4)
- p_type=H5Tcopy(H5T_STD_B32BE);
- else if ( size == 8)
+ if (size == 1)
+ p_type = H5Tcopy(H5T_STD_B8BE);
+ else if (size == 2)
+ p_type = H5Tcopy(H5T_STD_B16BE);
+ else if (size == 4)
+ p_type = H5Tcopy(H5T_STD_B32BE);
+ else if (size == 8)
p_type=H5Tcopy(H5T_STD_B64BE);
break;
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 8c435b2..a081c7e 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -58,15 +58,11 @@ static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t
/*-------------------------------------------------------------------------
* Function: parallel_print
*
- * Purpose: wrapper for printf for use in parallel mode.
- *
- * Programmer: Leon Arber
- *
- * Date: December 1, 2004
- *
+ * Purpose: wrapper for printf for use in parallel mode.
*-------------------------------------------------------------------------
*/
-void parallel_print(const char* format, ...)
+void
+parallel_print(const char* format, ...)
{
int bytes_written;
va_list ap;
@@ -103,18 +99,12 @@ void parallel_print(const char* format, ...)
/*-------------------------------------------------------------------------
- * Function: error_msg
+ * Function: error_msg
*
- * Purpose: Print a nicely formatted error message to stderr flushing the
+ * Purpose: Print a nicely formatted error message to stderr flushing the
* stdout stream first.
*
- * Return: Nothing
- *
- * Programmer: Bill Wendling
- * Tuesday, 20. February 2001
- *
- * Modifications:
- *
+ * Return: Nothing
*-------------------------------------------------------------------------
*/
void
@@ -134,18 +124,12 @@ error_msg(const char *fmt, ...)
/*-------------------------------------------------------------------------
- * Function: warn_msg
+ * Function: warn_msg
*
- * Purpose: Print a nicely formatted warning message to stderr flushing
+ * Purpose: Print a nicely formatted warning message to stderr flushing
* the stdout stream first.
*
- * Return: Nothing
- *
- * Programmer: Bill Wendling
- * Tuesday, 20. February 2001
- *
- * Modifications:
- *
+ * Return: Nothing
*-------------------------------------------------------------------------
*/
void
@@ -163,14 +147,11 @@ warn_msg(const char *fmt, ...)
}
/*-------------------------------------------------------------------------
- * Function: help_ref_msg
- *
- * Purpose: Print a message to refer help page
+ * Function: help_ref_msg
*
- * Return: Nothing
- *
- * Modifications:
+ * Purpose: Print a message to refer help page
*
+ * Return: Nothing
*-------------------------------------------------------------------------
*/
void
@@ -182,24 +163,16 @@ help_ref_msg(FILE *output)
/*-------------------------------------------------------------------------
- * Function: get_option
+ * Function: get_option
*
- * Purpose: Determine the command-line options a user specified. We can
- * accept both short and long type command-lines.
+ * Purpose: Determine the command-line options a user specified. We can
+ * accept both short and long type command-lines.
*
* Return: Success: The short valued "name" of the command line
* parameter or EOF if there are no more
* parameters to process.
*
- * Failure: A question mark.
- *
- * Programmer: Bill Wendling
- * Friday, 5. January 2001
- *
- * Modifications: Pedro Vicente
- * October, 27 2008
- * Wilcard "*" argument type
- *
+ * Failure: A question mark.
*-------------------------------------------------------------------------
*/
int
@@ -351,16 +324,11 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
/*-------------------------------------------------------------------------
- * Function: indentation
- *
- * Purpose: Print spaces for indentation
- *
- * Return: void
- *
- * Programmer: Ruey-Hsia Li
+ * Function: indentation
*
- * Modifications:
+ * Purpose: Print spaces for indentation
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -378,17 +346,12 @@ indentation(unsigned x)
/*-------------------------------------------------------------------------
- * Function: print_version
- *
- * Purpose: Print the program name and the version information which is
- * defined the same as the HDF5 library version.
- *
- * Return: void
+ * Function: print_version
*
- * Programmer: unknown
- *
- * Modifications:
+ * Purpose: Print the program name and the version information which is
+ * defined the same as the HDF5 library version.
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -407,11 +370,6 @@ print_version(const char *progname)
* and committed types
*
* Return: void
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -434,11 +392,6 @@ init_table(table_t **tbl)
* and committed types
*
* Return: void
- *
- * Programmer: Paul Harten
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -462,11 +415,6 @@ free_table(table_t *table)
* Purpose: display the contents of tables for debugging purposes
*
* Return: void
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -488,11 +436,6 @@ dump_table(char* tablename, table_t *table)
* Purpose: display the contents of tables for debugging purposes
*
* Return: void
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -513,11 +456,6 @@ dump_tables(find_objs_t *info)
* Return: Success: an integer, the location of the object
*
* Failure: FAIL if object is not found
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE obj_t *
@@ -541,11 +479,6 @@ search_obj(table_t *table, haddr_t objno)
* Return: Success: SUCCEED
*
* Failure: FAIL
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -623,11 +556,6 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
* Return: Success: SUCCEED
*
* Failure: FAIL
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -657,11 +585,6 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
* realloc the table if necessary
*
* Return: void
- *
- * Programmer: Ruey-Hsia Li
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -695,11 +618,6 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
*
* Return: a stream description when succeeds.
* NULL if fails.
- *
- * Programmer: Albert Cheng, 2005/8/9
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
FILE *
@@ -723,70 +641,61 @@ tmpfile(void)
*
* Return:
* 2 : given pathname is object
- * 1 : Succed to get link info.
+ * 1 : Succeed to get link info.
* 0 : Detected as a dangling link
* -1 : H5 API failed.
*
* NOTE:
* link_info->trg_path must be freed out of this function
- *
- * Programmer: Jonathan Kim
- *
- * Date: Feb 8, 2010
*-------------------------------------------------------------------------*/
int
-H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info,
- hbool_t get_obj_type)
+H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type)
{
htri_t l_ret;
H5O_info_t trg_oinfo;
hid_t fapl = H5P_DEFAULT;
hid_t lapl = H5P_DEFAULT;
- int ret = -1; /* init to fail */
+ int ret_value = -1; /* init to fail */
/* init */
link_info->trg_type = H5O_TYPE_UNKNOWN;
/* if path is root, return group type */
- if(!HDstrcmp(linkpath,"/"))
- {
+ if(!HDstrcmp(linkpath,"/")) {
link_info->trg_type = H5O_TYPE_GROUP;
- ret = 2;
- goto out;
+ HGOTO_DONE(2);
}
/* check if link itself exist */
if(H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: link <%s> doesn't exist \n",linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* get info from link */
if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get link info from <%s>\n",linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* given path is hard link (object) */
- if(link_info->linfo.type == H5L_TYPE_HARD) {
- ret = 2;
- goto out;
- } /* end if */
+ if(link_info->linfo.type == H5L_TYPE_HARD)
+ HGOTO_DONE(2);
/* trg_path must be freed out of this function when finished using */
if((link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to allocate buffer for <%s>\n",linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* get link value */
if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get link value from <%s>\n",linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/*-----------------------------------------------------
@@ -795,13 +704,13 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
*/
if(link_info->linfo.type == H5L_TYPE_EXTERNAL) {
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto out;
+ HGOTO_DONE(FAIL);
if(H5Pset_fapl_sec2(fapl) < 0)
- goto out;
+ HGOTO_DONE(FAIL);
if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0)
- goto out;
+ HGOTO_DONE(FAIL);
if(H5Pset_elink_fapl(lapl, fapl) < 0)
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* Check for retrieving object info */
@@ -814,25 +723,24 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
/* detect dangling link */
if(l_ret == FALSE) {
- ret = 0;
- goto out;
- } /* end if */
- /* function failed */
- else if(l_ret < 0)
- goto out;
+ HGOTO_DONE(0);
+ }
+ else if(l_ret < 0) { /* function failed */
+ HGOTO_DONE(FAIL);
+ }
/* get target object info */
if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* check unknown type */
if(trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES) {
if(link_info->opt.msg_mode == 1)
parallel_print("Warning: target object of <%s> is unknown type\n", linkpath);
- goto out;
+ HGOTO_DONE(FAIL);
} /* end if */
/* set target obj type to return */
@@ -844,31 +752,34 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
link_info->trg_type = H5O_TYPE_UNKNOWN;
/* succeed */
- ret = 1;
+ ret_value = 1;
-out:
+done:
if(fapl != H5P_DEFAULT)
H5Pclose(fapl);
if(lapl != H5P_DEFAULT)
H5Pclose(lapl);
- return ret;
+ return ret_value;
} /* end H5tools_get_symlink_info() */
/*-------------------------------------------------------------------------
* Audience: Public
- * Chapter: H5Tools Library
+ *
* Purpose: Initialize the name and operation status of the H5 Tools library
+ *
* Description:
* These are utility functions to set/get the program name and operation status.
*-------------------------------------------------------------------------
*/
-void h5tools_setprogname(const char *Progname)
+void
+h5tools_setprogname(const char *Progname)
{
h5tools_progname = Progname;
}
-void h5tools_setstatus(int D_status)
+void
+h5tools_setstatus(int D_status)
{
h5tools_d_status = D_status;
}
@@ -892,25 +803,19 @@ h5tools_getstatus(void)
* This can be called from each tools main() as part of initial act.
* Note: this is more of debugging purpose for now.
*/
-int h5tools_getenv_update_hyperslab_bufsize(void)
+int
+h5tools_getenv_update_hyperslab_bufsize(void)
{
const char *env_str = NULL;
long hyperslab_bufsize_mb;
+ int ret_value = 1;
/* check if environment variable is set for the hyperslab buffer size */
- if (NULL != (env_str = HDgetenv ("H5TOOLS_BUFSIZE")))
- {
+ if (NULL != (env_str = HDgetenv ("H5TOOLS_BUFSIZE"))) {
errno = 0;
hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10);
if (errno != 0 || hyperslab_bufsize_mb <= 0)
- {
- /* TODO: later when pubilshed
- HDfprintf(rawerrorstream,"Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str);
- */
-
- goto error;
- }
-
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "hyperslab buffer size failed");
/* convert MB to byte */
H5TOOLS_BUFSIZE = (hsize_t)hyperslab_bufsize_mb * 1024 * 1024;
@@ -918,9 +823,7 @@ int h5tools_getenv_update_hyperslab_bufsize(void)
H5TOOLS_MALLOCSIZE = MAX(H5TOOLS_BUFSIZE, H5TOOLS_MALLOCSIZE);
}
- return (1);
-
-error:
- return (-1);
+done:
+ return ret_value;
}
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index ddc0109..b6d32f7 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -13,6 +13,7 @@
#include "h5trav.h"
+#include "h5tools.h"
#include "H5private.h"
/*-------------------------------------------------------------------------
@@ -81,10 +82,9 @@ static int trav_verbosity = 0;
/*-------------------------------------------------------------------------
* Function: h5trav_set_index
*
- * Purpose: Set indexing properties for the objects & links in the file
- *
- * Return: none
+ * Purpose: Set indexing properties for the objects & links in the file
*
+ * Return: none
*-------------------------------------------------------------------------
*/
void
@@ -97,10 +97,9 @@ h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order)
/*-------------------------------------------------------------------------
* Function: h5trav_set_verbose
*
- * Purpose: Set verbosity of file contents 1=>attributes
- *
- * Return: none
+ * Purpose: Set verbosity of file contents 1=>attributes
*
+ * Return: none
*-------------------------------------------------------------------------
*/
void
@@ -118,14 +117,9 @@ h5trav_set_verbose(int print_verbose)
/*-------------------------------------------------------------------------
* Function: trav_addr_add
*
- * Purpose: Add a hardlink address to visited data structure
- *
- * Return: void
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Add a hardlink address to visited data structure
*
+ * Return: void
*-------------------------------------------------------------------------
*/
static void
@@ -149,14 +143,9 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
/*-------------------------------------------------------------------------
* Function: trav_addr_visited
*
- * Purpose: Check if an address has already been visited
- *
- * Return: TRUE/FALSE
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Check if an address has already been visited
*
+ * Return: TRUE/FALSE
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE static const char *
@@ -178,12 +167,7 @@ trav_addr_visited(trav_addr_t *visited, haddr_t addr)
/*-------------------------------------------------------------------------
* Function: traverse_cb
*
- * Purpose: Iterator callback for traversing objects in file
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
- *
+ * Purpose: Iterator callback for traversing objects in file
*-------------------------------------------------------------------------
*/
static herr_t
@@ -258,26 +242,23 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
/*-------------------------------------------------------------------------
* Function: traverse
*
- * Purpose: Iterate over all the objects/links in a file. Conforms to the
- * "visitor" pattern.
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Iterate over all the objects/links in a file. Conforms to the
+ * "visitor" pattern.
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
- hbool_t recurse, const trav_visitor_t *visitor)
+ hbool_t recurse, const trav_visitor_t *visitor)
{
H5O_info_t oinfo; /* Object info for starting group */
+ int ret_value = SUCCEED;
/* Get info for starting object */
if(H5Oget_info_by_name(file_id, grp_name, &oinfo, H5P_DEFAULT) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info_by_name failed");
/* Visit the starting object */
if(visit_start && visitor->visit_obj)
@@ -306,12 +287,12 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
if(recurse) {
/* Visit all links in group, recursively */
if(H5Lvisit_by_name(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lvisit_by_name failed");
} /* end if */
else {
/* Iterate over links in group */
if(H5Literate_by_name(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Literate_by_name failed");
} /* end else */
/* Free visited addresses table */
@@ -325,21 +306,17 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
} /* end if */
} /* end if */
- return 0;
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: trav_info_add
*
- * Purpose: Add a link path & type to info struct
- *
- * Return: void
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Add a link path & type to info struct
*
+ * Return: void
*-------------------------------------------------------------------------
*/
void
@@ -347,18 +324,20 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
{
size_t idx; /* Index of address to use */
- /* Allocate space if necessary */
- if(info->nused == info->nalloc) {
- info->nalloc = MAX(1, info->nalloc * 2);;
- info->paths = (trav_path_t *)HDrealloc(info->paths, info->nalloc * sizeof(trav_path_t));
- } /* end if */
+ if (info) {
+ /* Allocate space if necessary */
+ if(info->nused == info->nalloc) {
+ info->nalloc = MAX(1, info->nalloc * 2);;
+ info->paths = (trav_path_t *)HDrealloc(info->paths, info->nalloc * sizeof(trav_path_t));
+ } /* end if */
- /* Append it */
- idx = info->nused++;
- info->paths[idx].path = HDstrdup(path);
- info->paths[idx].type = obj_type;
- info->paths[idx].fileno = 0;
- info->paths[idx].objno = HADDR_UNDEF;
+ /* Append it */
+ idx = info->nused++;
+ info->paths[idx].path = HDstrdup(path);
+ info->paths[idx].type = obj_type;
+ info->paths[idx].fileno = 0;
+ info->paths[idx].objno = HADDR_UNDEF;
+ }
} /* end trav_info_add() */
@@ -368,7 +347,6 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
* Purpose: Add a file addr & fileno to info struct
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
void
@@ -390,22 +368,19 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
/*-------------------------------------------------------------------------
* Function: trav_info_visit_obj
*
- * Purpose: Callback for visiting object, with 'info' structure
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Callback for visiting object, with 'info' structure
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
int
trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
- const char H5_ATTR_UNUSED *already_visited, void *udata)
+ const char H5_ATTR_UNUSED *already_visited, void *udata)
{
size_t idx;
trav_info_t *info_p;
+
/* Add the object to the 'info' struct */
/* (object types map directly to "traversal" types) */
trav_info_add((trav_info_t *)udata, path, (h5trav_type_t)oinfo->type);
@@ -423,14 +398,10 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
/*-------------------------------------------------------------------------
* Function: trav_info_visit_lnk
*
- * Purpose: Callback for visiting link, with 'info' structure
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Callback for visiting link, with 'info' structure
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
int
@@ -446,21 +417,18 @@ trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
/*-------------------------------------------------------------------------
* Function: h5trav_getinfo
*
- * Purpose: get an array of "trav_info_t" , containing the name and type of
- * objects in the file
- *
- * Return: number of object names in file
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 6, 2002
+ * Purpose: get an array of "trav_info_t" , containing the name and type of
+ * objects in the file
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
int
h5trav_getinfo(hid_t file_id, trav_info_t *info)
{
trav_visitor_t info_visitor; /* Visitor structure for trav_info_t's */
+ int ret_value = SUCCEED;
/* Init visitor structure */
info_visitor.visit_obj = trav_info_visit_obj;
@@ -469,25 +437,21 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info)
/* Traverse all objects in the file, visiting each object & link */
if(traverse(file_id, "/", TRUE, TRUE, &info_visitor) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed");
- return 0;
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: h5trav_getindex
*
- * Purpose: get index of OBJ in list
- *
- * Return: index, -1 if not found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
+ * Purpose: get index of OBJ in list
*
+ * Return: index on success,
+ * -1 if not found
*-------------------------------------------------------------------------
*/
-
H5_ATTR_PURE ssize_t
h5trav_getindex(const trav_info_t *info, const char *obj)
{
@@ -511,17 +475,11 @@ h5trav_getindex(const trav_info_t *info, const char *obj)
/*-------------------------------------------------------------------------
* Function: trav_info_init
*
- * Purpose: Initialize the info
- *
- * Return: void
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 6, 2007
+ * Purpose: Initialize the info
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
void
trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info)
{
@@ -545,11 +503,9 @@ trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info)
/*-------------------------------------------------------------------------
* Function: trav_info_free
*
- * Purpose: free info memory
- *
+ * Purpose: free info memory
*-------------------------------------------------------------------------
*/
-
void
trav_info_free(trav_info_t *info)
{
@@ -557,11 +513,9 @@ trav_info_free(trav_info_t *info)
if(info) {
/* Free visited symbolic links path and file (if alloc) */
- for(u=0; u < info->symlink_visited.nused; u++)
- {
+ for(u = 0; u < info->symlink_visited.nused; u++) {
if (info->symlink_visited.objs[u].file)
HDfree(info->symlink_visited.objs[u].file);
-
HDfree(info->symlink_visited.objs[u].path);
}
HDfree(info->symlink_visited.objs);
@@ -586,12 +540,8 @@ trav_info_free(trav_info_t *info)
*
* Purpose: Callback for visiting object, with 'table' sructure
*
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
- *
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
@@ -608,21 +558,17 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
/* Add alias for object to table */
trav_table_addlink(table, oinfo->addr, path);
- return(0);
+ return 0;
} /* end trav_table_visit_obj() */
/*-------------------------------------------------------------------------
* Function: trav_table_visit_lnk
*
- * Purpose: Callback for visiting link, with 'table' sructure
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 1, 2007
+ * Purpose: Callback for visiting link, with 'table' sructure
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
@@ -631,28 +577,24 @@ trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, v
/* Add the link to the 'table' struct */
trav_table_add((trav_table_t *)udata, path, NULL);
- return(0);
+ return 0;
} /* end trav_table_visit_lnk() */
/*-------------------------------------------------------------------------
* Function: h5trav_gettable
*
- * Purpose: get the trav_table_t struct
- *
- * Return: 0, -1 on error
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December 17, 2003
+ * Purpose: get the trav_table_t struct
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
-
int
h5trav_gettable(hid_t fid, trav_table_t *table)
{
trav_visitor_t table_visitor; /* Visitor structure for trav_table_t's */
+ int ret_value = SUCCEED;
/* Init visitor structure */
table_visitor.visit_obj = trav_table_visit_obj;
@@ -661,71 +603,63 @@ h5trav_gettable(hid_t fid, trav_table_t *table)
/* Traverse all objects in the file, visiting each object & link */
if(traverse(fid, "/", TRUE, TRUE, &table_visitor) < 0)
- return -1;
- return 0;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed");
+
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
* Function: h5trav_getindext
*
- * Purpose: get index of NAME in list
- *
- * Return: index, -1 if not found
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December 18, 2003
+ * Purpose: get index of NAME in list
*
+ * Return: index on success,
+ * -1 if not found
*-------------------------------------------------------------------------
*/
-
H5_ATTR_PURE int
h5trav_getindext(const char *name, const trav_table_t *table)
{
unsigned int i;
- for(i = 0; i < table->nobjs; i++) {
- /* Check for object name having full path (with leading '/') */
- if(HDstrcmp(name, table->objs[i].name) == 0)
- return((int)i);
-
- /* Check for object name without leading '/' */
- if(HDstrcmp(name, table->objs[i].name + 1) == 0)
- return((int)i);
+ if(table) {
+ for(i = 0; i < table->nobjs; i++) {
+ /* Check for object name having full path (with leading '/') */
+ if(HDstrcmp(name, table->objs[i].name) == 0)
+ return((int)i);
- /* search also in the list of links */
- if(table->objs[i].nlinks) {
- unsigned int j;
+ /* Check for object name without leading '/' */
+ if(HDstrcmp(name, table->objs[i].name + 1) == 0)
+ return((int)i);
- for ( j=0; j<table->objs[i].nlinks; j++) {
- /* Check for object name having full path (with leading '/') */
- if(HDstrcmp(name, table->objs[i].links[j].new_name) == 0)
- return((int)i);
+ /* search also in the list of links */
+ if(table->objs[i].nlinks) {
+ unsigned int j;
- /* Check for object name without leading '/' */
- if(HDstrcmp(name, table->objs[i].links[j].new_name + 1) == 0)
- return((int)i);
- } /* end for */
- } /* end if */
- } /* end for */
+ for ( j=0; j<table->objs[i].nlinks; j++) {
+ /* Check for object name having full path (with leading '/') */
+ if(HDstrcmp(name, table->objs[i].links[j].new_name) == 0)
+ return((int)i);
+ /* Check for object name without leading '/' */
+ if(HDstrcmp(name, table->objs[i].links[j].new_name + 1) == 0)
+ return((int)i);
+ } /* end for */
+ } /* end if */
+ } /* end for */
+ }
return -1;
}
/*-------------------------------------------------------------------------
* Function: trav_table_add
*
- * Purpose: Add OBJNO, NAME and TYPE of object to table
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 4, 2002
+ * Purpose: Add OBJNO, NAME and TYPE of object to table
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
static void
trav_table_add(trav_table_t *table,
const char *path,
@@ -733,20 +667,22 @@ trav_table_add(trav_table_t *table,
{
size_t new_obj;
- if(table->nobjs == table->size) {
- table->size = MAX(1, table->size * 2);
- table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
- } /* end if */
+ if(table) {
+ if(table->nobjs == table->size) {
+ table->size = MAX(1, table->size * 2);
+ table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
+ } /* end if */
- new_obj = table->nobjs++;
- table->objs[new_obj].objno = oinfo ? oinfo->addr : HADDR_UNDEF;
- table->objs[new_obj].flags[0] = table->objs[new_obj].flags[1] = 0;
- table->objs[new_obj].is_same_trgobj = 0;
- table->objs[new_obj].name = (char *)HDstrdup(path);
- table->objs[new_obj].type = oinfo ? (h5trav_type_t)oinfo->type : H5TRAV_TYPE_LINK;
- table->objs[new_obj].nlinks = 0;
- table->objs[new_obj].sizelinks = 0;
- table->objs[new_obj].links = NULL;
+ new_obj = table->nobjs++;
+ table->objs[new_obj].objno = oinfo ? oinfo->addr : HADDR_UNDEF;
+ table->objs[new_obj].flags[0] = table->objs[new_obj].flags[1] = 0;
+ table->objs[new_obj].is_same_trgobj = 0;
+ table->objs[new_obj].name = (char *)HDstrdup(path);
+ table->objs[new_obj].type = oinfo ? (h5trav_type_t)oinfo->type : H5TRAV_TYPE_LINK;
+ table->objs[new_obj].nlinks = 0;
+ table->objs[new_obj].sizelinks = 0;
+ table->objs[new_obj].links = NULL;
+ }
}
/*-------------------------------------------------------------------------
@@ -755,58 +691,47 @@ trav_table_add(trav_table_t *table,
* Purpose: Add a hardlink name to the object
*
* Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: December 17, 2003
- *
*-------------------------------------------------------------------------
*/
-
static void
trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
{
size_t i; /* Local index variable */
- for(i = 0; i < table->nobjs; i++) {
- if(table->objs[i].objno == objno) {
- size_t n;
+ if(table) {
+ for(i = 0; i < table->nobjs; i++) {
+ if(table->objs[i].objno == objno) {
+ size_t n;
- /* already inserted? */
- if(HDstrcmp(table->objs[i].name, path) == 0)
- return;
+ /* already inserted? */
+ if(HDstrcmp(table->objs[i].name, path) == 0)
+ return;
- /* allocate space if necessary */
- if(table->objs[i].nlinks == (unsigned)table->objs[i].sizelinks) {
- table->objs[i].sizelinks = MAX(1, table->objs[i].sizelinks * 2);
- table->objs[i].links = (trav_link_t *)HDrealloc(table->objs[i].links, table->objs[i].sizelinks * sizeof(trav_link_t));
- } /* end if */
+ /* allocate space if necessary */
+ if(table->objs[i].nlinks == (unsigned)table->objs[i].sizelinks) {
+ table->objs[i].sizelinks = MAX(1, table->objs[i].sizelinks * 2);
+ table->objs[i].links = (trav_link_t *)HDrealloc(table->objs[i].links, table->objs[i].sizelinks * sizeof(trav_link_t));
+ } /* end if */
- /* insert it */
- n = table->objs[i].nlinks++;
- table->objs[i].links[n].new_name = (char *)HDstrdup(path);
+ /* insert it */
+ n = table->objs[i].nlinks++;
+ table->objs[i].links[n].new_name = (char *)HDstrdup(path);
- return;
+ return;
+ } /* end for */
} /* end for */
- } /* end for */
+ }
}
-
/*-------------------------------------------------------------------------
* Function: trav_table_addflags
*
- * Purpose: Add FLAGS, NAME and TYPE of object to table
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 4, 2002
+ * Purpose: Add FLAGS, NAME and TYPE of object to table
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
void trav_table_addflags(unsigned *flags,
char *name,
h5trav_type_t type,
@@ -814,92 +739,83 @@ void trav_table_addflags(unsigned *flags,
{
size_t new_obj;
- if(table->nobjs == table->size) {
- table->size = MAX(1, table->size * 2);
- table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
- } /* end if */
+ if(table) {
+ if(table->nobjs == table->size) {
+ table->size = MAX(1, table->size * 2);
+ table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
+ } /* end if */
- new_obj = table->nobjs++;
- table->objs[new_obj].objno = 0;
- table->objs[new_obj].flags[0] = flags[0];
- table->objs[new_obj].flags[1] = flags[1];
- table->objs[new_obj].is_same_trgobj = 0;
- table->objs[new_obj].name = (char *)HDstrdup(name);
- table->objs[new_obj].type = type;
- table->objs[new_obj].nlinks = 0;
- table->objs[new_obj].sizelinks = 0;
- table->objs[new_obj].links = NULL;
+ new_obj = table->nobjs++;
+ table->objs[new_obj].objno = 0;
+ table->objs[new_obj].flags[0] = flags[0];
+ table->objs[new_obj].flags[1] = flags[1];
+ table->objs[new_obj].is_same_trgobj = 0;
+ table->objs[new_obj].name = (char *)HDstrdup(name);
+ table->objs[new_obj].type = type;
+ table->objs[new_obj].nlinks = 0;
+ table->objs[new_obj].sizelinks = 0;
+ table->objs[new_obj].links = NULL;
+ }
}
/*-------------------------------------------------------------------------
* Function: trav_table_init
*
- * Purpose: Initialize the table
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 4, 2002
+ * Purpose: Initialize the table
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
void trav_table_init(trav_table_t **tbl)
{
trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t));
-
- table->size = 0;
- table->nobjs = 0;
- table->objs = NULL;
-
+ if(table) {
+ table->size = 0;
+ table->nobjs = 0;
+ table->objs = NULL;
+ }
*tbl = table;
}
-
/*-------------------------------------------------------------------------
* Function: trav_table_free
*
- * Purpose: free table memory
- *
- * Return: void
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: November 4, 2002
+ * Purpose: free table memory
*
+ * Return: void
*-------------------------------------------------------------------------
*/
-
-void trav_table_free( trav_table_t *table )
+void trav_table_free(trav_table_t *table)
{
- if(table->objs) {
- unsigned int i;
+ if(table) {
+ if(table->objs) {
+ unsigned int i;
- for(i = 0; i < table->nobjs; i++) {
- HDfree(table->objs[i].name );
- if(table->objs[i].nlinks) {
- unsigned int j;
+ for(i = 0; i < table->nobjs; i++) {
+ HDfree(table->objs[i].name );
+ if(table->objs[i].nlinks) {
+ unsigned int j;
- for(j = 0; j < table->objs[i].nlinks; j++)
- HDfree(table->objs[i].links[j].new_name);
+ for(j = 0; j < table->objs[i].nlinks; j++)
+ HDfree(table->objs[i].links[j].new_name);
- HDfree(table->objs[i].links);
- } /* end if */
- } /* end for */
- HDfree(table->objs);
- } /* end if */
- HDfree(table);
+ HDfree(table->objs[i].links);
+ } /* end if */
+ } /* end for */
+ HDfree(table->objs);
+ } /* end if */
+ HDfree(table);
+ }
}
static herr_t
trav_attr(hid_t
#ifndef H5TRAV_PRINT_SPACE
-H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* H5TRAV_PRINT_SPACE */
-obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
+ obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
{
trav_path_op_data_t *op_data = (trav_path_op_data_t *)_op_data;
const char *buf = op_data->path;
@@ -938,7 +854,7 @@ obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_da
case H5S_SIMPLE:
/* simple dataspace */
printf(" {");
- for (i=0; i<ndims; i++) {
+ for (i = 0; i < ndims; i++) {
printf("%s" HSIZE_T_FORMAT, i?", ":"", size[i]);
}
printf("}\n");
@@ -968,19 +884,15 @@ obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_da
/*-------------------------------------------------------------------------
* Function: trav_print_visit_obj
*
- * Purpose: Callback for visiting object, when printing info
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 6, 2007
+ * Purpose: Callback for visiting object, when printing info
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
- const char *already_visited, void *udata)
+ const char *already_visited, void *udata)
{
trav_print_udata_t *print_udata = (trav_print_udata_t *)udata;
/* Print the name of the object */
@@ -1029,14 +941,10 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
/*-------------------------------------------------------------------------
* Function: trav_print_visit_lnk
*
- * Purpose: Callback for visiting link, when printing info
- *
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 6, 2007
+ * Purpose: Callback for visiting link, when printing info
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
static int
@@ -1062,7 +970,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
case H5L_TYPE_EXTERNAL:
if(linfo->u.val_size > 0) {
- char *targbuf;
+ char *targbuf = NULL;
const char *filename = NULL;
const char *objname = NULL;
@@ -1097,22 +1005,18 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
/*-------------------------------------------------------------------------
* Function: h5trav_print
*
- * Purpose: Print information about the objects & links in the file
- *
- * Return: 0, -1 on error
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: September 6, 2007
+ * Purpose: Print information about the objects & links in the file
*
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
-
int
h5trav_print(hid_t fid)
{
trav_print_udata_t print_udata; /* User data for traversal */
trav_visitor_t print_visitor; /* Visitor structure for printing objects */
+ int ret_value = SUCCEED;
/* Init user data for printing */
print_udata.fid = fid;
@@ -1124,9 +1028,10 @@ h5trav_print(hid_t fid)
/* Traverse all objects in the file, visiting each object & link */
if(traverse(fid, "/", TRUE, TRUE, &print_visitor) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed");
- return 0;
+done:
+ return ret_value;
}
@@ -1135,21 +1040,17 @@ h5trav_print(hid_t fid)
*
* Purpose: Generic traversal routine for visiting objects and links
*
- * Return: 0, -1 on error
- *
- * Programmer: Quincey Koziol, koziol@hdfgroup.org
- *
- * Date: November 6, 2007
- *
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
-
int
h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start,
hbool_t recurse, h5trav_obj_func_t visit_obj, h5trav_lnk_func_t visit_lnk,
void *udata)
{
trav_visitor_t visitor; /* Visitor structure for objects */
+ int ret_value = SUCCEED;
/* Init visitor structure */
visitor.visit_obj = visit_obj;
@@ -1158,9 +1059,10 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start,
/* Traverse all objects in the file, visiting each object & link */
if(traverse(fid, grp_name, visit_start, recurse, &visitor) < 0)
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed");
- return 0;
+done:
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -1168,19 +1070,15 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start,
*
* Purpose: Add an symbolic link to visited data structure
*
- * Return: 0 on success, -1 on failure
- *
- * Programmer: Neil Fortner, nfortne2@hdfgroup.org
- * Adapted from trav_addr_add in h5trav.c by Quincey Koziol
- *
- * Date: September 5, 2008
- *
+ * Return: 0 on success,
+ * -1 on failure
*-------------------------------------------------------------------------
*/
herr_t
symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
- size_t idx; /* Index of address to use */
+ herr_t ret_value = SUCCEED;
+ size_t idx; /* Index of address to use */
/* Allocate space if necessary */
if(visited->nused == visited->nalloc) {
@@ -1188,7 +1086,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
visited->nalloc = MAX(1, visited->nalloc * 2);
if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t))))
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure realloc failed");
visited->objs = (symlink_trav_path_t *)tmp_ptr;
} /* end if */
@@ -1202,7 +1100,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
if(type == H5L_TYPE_EXTERNAL) {
if(NULL == (visited->objs[idx].file = HDstrdup(file))) {
visited->nused--;
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure name allocation failed");
} /* end if */
} /* end if */
@@ -1210,25 +1108,20 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
visited->nused--;
if(visited->objs[idx].file)
HDfree (visited->objs[idx].file);
- return -1;
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure path allocation failed");
} /* end if */
- return 0;
+done:
+ return ret_value;
} /* end symlink_visit_add() */
/*-------------------------------------------------------------------------
* Function: symlink_is_visited
*
- * Purpose: Check if an symbolic link has already been visited
- *
- * Return: TRUE/FALSE
- *
- * Programmer: Neil Fortner, nfortne2@hdfgroup.org
- * Adapted from trav_addr_visited in h5trav.c by Quincey Koziol
- *
- * Date: September 5, 2008
+ * Purpose: Check if an symbolic link has already been visited
*
+ * Return: TRUE/FALSE
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE hbool_t
diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h
index 996a611..2189e31 100644
--- a/tools/lib/ph5diff.h
+++ b/tools/lib/ph5diff.h
@@ -32,7 +32,7 @@ struct diff_mpi_args
{
char name1[256];
char name2[256];
- diff_opt_t options;
+ diff_opt_t opts;
diff_args_t argdata; /* rest args */
};