summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-12-19 22:29:35 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-12-19 22:29:43 (GMT)
commit628c63f12598b65727e828090f38f038e2597400 (patch)
tree3dc3fbc36fdfedc48cb8edba778cd3597620e777 /tools/lib
parent63fdb7868593639dd7e06dcff85980ed4b29a8c1 (diff)
downloadhdf5-628c63f12598b65727e828090f38f038e2597400.zip
hdf5-628c63f12598b65727e828090f38f038e2597400.tar.gz
hdf5-628c63f12598b65727e828090f38f038e2597400.tar.bz2
HDFFV-10980 - h5diff uses new ref APIs
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/CMakeLists.txt2
-rw-r--r--tools/lib/h5diff.c134
-rw-r--r--tools/lib/h5diff.h9
-rw-r--r--tools/lib/h5diff_array.c400
-rw-r--r--tools/lib/h5diff_attr.c469
-rw-r--r--tools/lib/h5diff_dset.c122
-rw-r--r--tools/lib/h5diff_util.c5
-rw-r--r--tools/lib/h5tools.c22
-rw-r--r--tools/lib/h5tools_dump.c22
-rw-r--r--tools/lib/h5tools_error.h6
-rw-r--r--tools/lib/h5tools_filters.c4
-rw-r--r--tools/lib/h5tools_utils.c4
-rw-r--r--tools/lib/h5trav.c46
13 files changed, 820 insertions, 425 deletions
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index f46eb23..2acfab0 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -39,6 +39,7 @@ if (NOT ONLY_SHARED_LIBS)
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
#target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5_TOOLS_DEBUG)
+ #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG)
TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC)
target_link_libraries (${HDF5_TOOLS_LIB_TARGET}
PUBLIC ${HDF5_LIB_TARGET}
@@ -59,6 +60,7 @@ if (BUILD_SHARED_LIBS)
target_compile_definitions(${HDF5_TOOLS_LIBSH_TARGET}
PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
#PRIVATE H5_TOOLS_DEBUG
+ #PRIVATE H5DIFF_DEBUG
)
TARGET_C_PROPERTIES (${HDF5_TOOLS_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET}
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index b22af18..74bc2f9 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -262,6 +262,7 @@ 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)
{
+ H5TOOLS_ERR_INIT(int, 0)
size_t curr1 = 0;
size_t curr2 = 0;
unsigned infile[2];
@@ -274,9 +275,9 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
int cmp;
trav_table_t *table = NULL;
size_t idx;
- int ret_value = 0;
- h5difftrace("build_match_list start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list start - errstat:%d", opts->err_stat);
/* init */
trav_table_init(&table);
if (table == NULL) {
@@ -372,7 +373,11 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
done:
*table_out = table;
- h5difftrace("build_match_list finish\n");
+
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
+
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list finish");
}
@@ -399,7 +404,7 @@ trav_grp_objs(const char *path, const H5O_info_t *oinfo,
static herr_t
trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
{
- herr_t ret_value = 0;
+ H5TOOLS_ERR_INIT(herr_t, 0)
trav_info_t *tinfo = (trav_info_t *)udata;
diff_opt_t *opts = (diff_opt_t *)tinfo->opts;
h5tool_link_info_t lnk_info;
@@ -409,6 +414,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
/* init linkinfo struct */
HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t));
+ H5TOOLS_PUSH_STACK();
if (!opts->follow_links) {
trav_info_visit_lnk(path, linfo, tinfo);
HGOTO_DONE(0);
@@ -489,6 +495,8 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
done:
if (lnk_info.trg_path)
HDfree(lnk_info.trg_path);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -509,7 +517,7 @@ h5diff(const char *fname1,
const char *objname2,
diff_opt_t *opts)
{
- int ret_value = 0;
+ H5TOOLS_ERR_INIT(int, 0)
hid_t file1_id = -1;
hid_t file2_id = -1;
char filenames[2][MAX_FILENAME];
@@ -541,7 +549,8 @@ h5diff(const char *fname1,
/* list for common objects */
trav_table_t *match_list = NULL;
- h5difftrace("h5diff start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff start");
/* init filenames */
HDmemset(filenames, 0, MAX_FILENAME * 2);
/* init link info struct */
@@ -566,13 +575,14 @@ h5diff(const char *fname1,
parallel_print("h5diff: <%s>: unable to open file\n", fname1);
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname1);
} /* end if */
-
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "file1_id = %s", fname1);
/* 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);
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname2);
} /* end if */
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "file2_id = %s", fname2);
/*-------------------------------------------------------------------------
* Initialize the info structs
@@ -581,7 +591,7 @@ h5diff(const char *fname1,
trav_info_init(fname1, file1_id, &info1_obj);
trav_info_init(fname2, file2_id, &info2_obj);
- h5difftrace("trav_info_init initialized\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "trav_info_init initialized");
/* if any object is specified */
if (objname1) {
/* make the given object1 fullpath, start with "/" */
@@ -622,7 +632,7 @@ h5diff(const char *fname1,
/*----------------------------------------------------------
* check if obj1 is root, group, single object or symlink
*/
- h5difftrace("h5diff check if obj1 is root, group, single object or symlink\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check if obj1=%s is root, group, single object or symlink", obj1fullname);
if(!HDstrcmp(obj1fullname, "/")) {
obj1type = H5TRAV_TYPE_GROUP;
}
@@ -672,7 +682,7 @@ h5diff(const char *fname1,
/*----------------------------------------------------------
* check if obj2 is root, group, single object or symlink
*/
- h5difftrace("h5diff check if obj2 is root, group, single object or symlink\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check if obj2=%s is root, group, single object or symlink", obj2fullname);
if(!HDstrcmp(obj2fullname, "/")) {
obj2type = H5TRAV_TYPE_GROUP;
}
@@ -721,7 +731,7 @@ h5diff(const char *fname1,
}
/* if no object specified */
else {
- h5difftrace("h5diff no object specified\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff no object specified");
/* set root group */
obj1fullname = (char*)HDstrdup("/");
obj1type = H5TRAV_TYPE_GROUP;
@@ -729,7 +739,7 @@ h5diff(const char *fname1,
obj2type = H5TRAV_TYPE_GROUP;
}
- h5diffdebug2("get any symbolic links info - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "get any symbolic links info - errstat:%d", 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);
@@ -745,10 +755,10 @@ h5diff(const char *fname1,
/*-------------------------------
* check symbolic link (object1)
*/
- h5difftrace("h5diff check symbolic link (object1)\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check symbolic link (object1)");
/* dangling link */
if (l_ret1 == 0) {
- h5difftrace("h5diff ... dangling link\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... dangling link");
if (opts->no_dangle_links) {
/* treat dangling link as error */
if(opts->m_verbose)
@@ -771,25 +781,25 @@ h5diff(const char *fname1,
}
else if(l_ret1 != 2) { /* symbolic link */
obj1type = (h5trav_type_t)trg_linfo1.trg_type;
- h5difftrace("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD");
if (info1_lp != NULL) {
size_t idx = info1_lp->nused - 1;
- h5difftrace("h5diff ... ... ... info1_obj not null\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... ... ... info1_obj not null");
info1_lp->paths[idx].type = (h5trav_type_t)trg_linfo1.trg_type;
info1_lp->paths[idx].objno = trg_linfo1.objno;
info1_lp->paths[idx].fileno = trg_linfo1.fileno;
}
- h5difftrace("h5diff check symbolic link (object1) finished\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check symbolic link (object1) finished");
}
/*-------------------------------
* check symbolic link (object2)
*/
- h5difftrace("h5diff check symbolic link (object2)\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check symbolic link (object2)");
/* dangling link */
if (l_ret2 == 0) {
- h5difftrace("h5diff ... dangling link\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... dangling link");
if (opts->no_dangle_links) {
/* treat dangling link as error */
if(opts->m_verbose)
@@ -815,12 +825,12 @@ h5diff(const char *fname1,
if (info2_lp != NULL) {
size_t idx = info2_lp->nused - 1;
- h5difftrace("h5diff ... ... ... info2_obj not null\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... ... ... info2_obj not null");
info2_lp->paths[idx].type = (h5trav_type_t)trg_linfo2.trg_type;
info2_lp->paths[idx].objno = trg_linfo2.objno;
info2_lp->paths[idx].fileno = trg_linfo2.fileno;
}
- h5difftrace("h5diff check symbolic link (object1) finished\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check symbolic link (object1) finished");
}
} /* end of if follow symlinks */
@@ -832,7 +842,7 @@ h5diff(const char *fname1,
*/
if(!(opts->m_verbose || opts->m_report)) {
- h5difftrace("h5diff NOT (opts->m_verbose || opts->m_report)\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff NOT (opts->m_verbose || opts->m_report)");
/* if no danglink links */
if (l_ret1 > 0 && l_ret2 > 0)
if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname) != 0)
@@ -841,7 +851,7 @@ h5diff(const char *fname1,
both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP);
if (both_objs_grp) {
- h5difftrace("h5diff both_objs_grp TRUE\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff both_objs_grp TRUE");
/*
* traverse group1
*/
@@ -870,7 +880,7 @@ h5diff(const char *fname1,
} /* end if */
info2_lp = info2_grp;
}
- h5diffdebug2("groups traversed - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "groups traversed - errstat:%d", opts->err_stat);
#ifdef H5_HAVE_PARALLEL
if(g_Parallel) {
@@ -890,8 +900,10 @@ h5diff(const char *fname1,
} /* end if */
#endif
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list next - errstat:%d", opts->err_stat);
/* process the objects */
build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, &match_list, opts);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list finished - errstat:%d", opts->err_stat);
if (both_objs_grp) {
/*------------------------------------------------------
* print the list
@@ -915,6 +927,7 @@ h5diff(const char *fname1,
parallel_print ("\n");
} /* end if */
}
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match next - errstat:%d", opts->err_stat);
nfound = diff_match(file1_id, obj1fullname, info1_lp,
file2_id, obj2fullname, info2_lp,
match_list, opts);
@@ -957,8 +970,10 @@ done:
H5Fclose(file2_id);
} H5E_END_TRY;
- h5difftrace("h5diff finish\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff finish - errstat:%d", opts->err_stat);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return nfound;
}
@@ -985,9 +1000,9 @@ 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 *opts)
{
+ H5TOOLS_ERR_INIT(int, opts->err_stat)
hsize_t nfound = 0;
unsigned i;
- int ret_value = opts->err_stat;
const char *grp1_path = "";
const char *grp2_path = "";
char *obj1_fullpath = NULL;
@@ -996,7 +1011,8 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
size_t idx1 = 0;
size_t idx2 = 0;
- h5difftrace("diff_match start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match start - errstat:%d", opts->err_stat);
/*
* if not root, prepare object name to be pre-appended to group path to
* make full path
@@ -1049,7 +1065,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
#endif
for(i = 0; i < table->nobjs; i++) {
- h5diffdebug3("diff for common objects[%d] - errstat:%d\n", i, opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff for common objects[%d] - errstat:%d", i, opts->err_stat);
if(table->objs[i].flags[0] && table->objs[i].flags[1]) {
/* make full path for obj1 */
#ifdef H5_HAVE_ASPRINTF
@@ -1066,7 +1082,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
HDstrcat(obj1_fullpath, table->objs[i].name);
}
#endif /* H5_HAVE_ASPRINTF */
- h5diffdebug2("diff_match path1 - %s\n", obj1_fullpath);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match path1 - %s", obj1_fullpath);
/* make full path for obj2 */
#ifdef H5_HAVE_ASPRINTF
@@ -1083,7 +1099,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
HDstrcat(obj2_fullpath, table->objs[i].name);
}
#endif /* H5_HAVE_ASPRINTF */
- h5diffdebug2("diff_match path2 - %s\n", obj2_fullpath);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match path2 - %s", 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))
@@ -1099,6 +1115,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
opts->cmn_objs = 1;
if(!g_Parallel) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff paths - errstat:%d", opts->err_stat);
nfound += diff(file1_id, obj1_fullpath,
file2_id, obj2_fullpath,
opts, &argdata);
@@ -1107,7 +1124,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
else {
int workerFound = 0;
- h5difftrace("Beginning of big else block\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Beginning of big else block");
/* We're in parallel mode */
/* Since the data type of diff value is hsize_t which can
* be arbitary large such that there is no MPI type that
@@ -1261,7 +1278,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
HDfree(obj2_fullpath);
} /* end if */
} /* end for */
- h5diffdebug2("done with for loop - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "done with for loop - errstat:%d", opts->err_stat);
#ifdef H5_HAVE_PARALLEL
if(g_Parallel) {
@@ -1338,7 +1355,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* Print any final data waiting in our queue */
print_incoming_data();
} /* end if */
- h5difftrace("done with if block\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "done with if block");
HDfree(workerTasks);
}
@@ -1349,8 +1366,11 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* free table */
if (table)
trav_table_free(table);
- h5diffdebug2("diff_match finish:%d\n", nfound);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match finish diffs=%d - errstat:%d", nfound, opts->err_stat);
+
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return nfound;
}
@@ -1376,14 +1396,14 @@ diff(hid_t file1_id,
diff_opt_t * opts,
diff_args_t *argdata)
{
- int ret_value = opts->err_stat;
+ H5TOOLS_ERR_INIT(int, 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;
+ hid_t dset1_id = H5I_INVALID_HID;
+ hid_t dset2_id = H5I_INVALID_HID;
+ hid_t type1_id = H5I_INVALID_HID;
+ hid_t type2_id = H5I_INVALID_HID;
+ hid_t grp1_id = H5I_INVALID_HID;
+ hid_t grp2_id = H5I_INVALID_HID;
hbool_t is_dangle_link1 = FALSE;
hbool_t is_dangle_link2 = FALSE;
hbool_t is_hard_link = FALSE;
@@ -1394,7 +1414,8 @@ diff(hid_t file1_id,
h5tool_link_info_t linkinfo1;
h5tool_link_info_t linkinfo2;
- h5difftrace("diff start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff start - errstat:%d", opts->err_stat);
/*init link info struct */
HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t));
@@ -1414,6 +1435,7 @@ diff(hid_t file1_id,
* check dangling links for path1 and path2
*/
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff links");
/* target object1 - get type and name */
if ((status = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, opts->follow_links)) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed");
@@ -1462,6 +1484,7 @@ diff(hid_t file1_id,
}
/* if objects are not the same type */
if (argdata->type[0] != argdata->type[1]) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff objects are not the same");
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]),
@@ -1485,7 +1508,7 @@ diff(hid_t file1_id,
* Perform this to match the outputs as bypassing.
*/
if (argdata->is_same_trgobj) {
- h5difftrace("argdata->is_same_trgobj\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "argdata->is_same_trgobj");
is_hard_link = (object_type == H5TRAV_TYPE_DATASET ||
object_type == H5TRAV_TYPE_NAMED_DATATYPE ||
object_type == H5TRAV_TYPE_GROUP);
@@ -1533,6 +1556,7 @@ diff(hid_t file1_id,
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_DATASET:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff object type H5TRAV_TYPE_DATASET - errstat:%d", opts->err_stat);
if((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed");
if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0)
@@ -1540,6 +1564,7 @@ diff(hid_t file1_id,
/* verbose (-v) and report (-r) mode */
if(opts->m_verbose || opts->m_report) {
do_print_objname("dataset", path1, path2, opts);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_dataset 1:%s 2:%s ", path1, path2);
nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
print_found(nfound);
}
@@ -1556,7 +1581,7 @@ diff(hid_t file1_id,
print_found(nfound);
}
}
- h5diffdebug2("diff after dataset:%d\n", nfound);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff after dataset:%d - errstat:%d", nfound, opts->err_stat);
/*---------------------------------------------------------
* compare attributes
@@ -1564,9 +1589,10 @@ diff(hid_t file1_id,
* referenced object
*---------------------------------------------------------
*/
- if(path1)
+ if(path1) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_attr 1:%s 2:%s ", path1, path2);
nfound += diff_attr(dset1_id, dset2_id, path1, path2, opts);
-
+ }
if(H5Dclose(dset1_id) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed");
@@ -1579,6 +1605,7 @@ diff(hid_t file1_id,
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5TRAV_TYPE_NAMED_DATATYPE 1:%s 2:%s ", path1, path2);
if((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed");
if((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 0)
@@ -1603,8 +1630,10 @@ diff(hid_t file1_id,
* referenced object
*-----------------------------------------------------------------
*/
- if(path1)
+ if(path1) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_attr 1:%s 2:%s ", path1, path2);
nfound += diff_attr(type1_id, type2_id, path1, path2, opts);
+ }
if(H5Tclose(type1_id) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed");
@@ -1617,6 +1646,7 @@ diff(hid_t file1_id,
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_GROUP:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5TRAV_TYPE_GROUP 1:%s 2:%s ", path1, path2);
if(print_objname(opts, nfound))
do_print_objname("group", path1, path2, opts);
@@ -1635,8 +1665,10 @@ diff(hid_t file1_id,
* referenced object
*-----------------------------------------------------------------
*/
- if(path1)
+ if(path1) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_attr 1:%s 2:%s ", path1, path2);
nfound += diff_attr(grp1_id, grp2_id, path1, path2, opts);
+ }
if(H5Gclose(grp1_id) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
@@ -1651,6 +1683,7 @@ diff(hid_t file1_id,
*/
case H5TRAV_TYPE_LINK:
{
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5TRAV_TYPE_LINK 1:%s 2:%s ", path1, path2);
status = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path);
/* if the target link name is not same then the links are "different" */
@@ -1672,6 +1705,7 @@ diff(hid_t file1_id,
*/
case H5TRAV_TYPE_UDLINK:
{
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5TRAV_TYPE_UDLINK 1:%s 2:%s ", path1, path2);
/* 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 */
@@ -1772,8 +1806,10 @@ done:
/* enable error reporting */
} H5E_END_TRY;
- h5diffdebug3("diff finish:%d - errstat:%d\n", nfound, opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff finish:%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return nfound;
}
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 26bcd95..0931c1a 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -71,7 +71,7 @@ typedef struct {
hsize_t count; /* count value */
hbool_t follow_links; /* follow symbolic links */
int no_dangle_links; /* return error when find dangling link */
- int err_stat; /* an error ocurred (1, error, 0, no error) */
+ int err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */
int cmn_objs; /* do we have common objects */
int not_cmp; /* are the objects comparable */
int contents; /* equal contents */
@@ -165,6 +165,13 @@ int diff_can_type( hid_t f_type1, /* file data type */
diff_opt_t *opts,
int is_compound);
+hsize_t diff_attr_data(hid_t attr1_id,
+ hid_t attr2_id,
+ const char *attr1_name,
+ const char *attr2_name,
+ const char *path1,
+ const char *path2,
+ diff_opt_t *opts);
hsize_t diff_attr(hid_t loc1_id,
hid_t loc2_id,
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index c83b88d..637cfa8 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -17,6 +17,8 @@
#include "h5diff.h"
#include "ph5diff.h"
+#define ATTR_NAME_MAX 255
+
/*-------------------------------------------------------------------------
* printf formatting
*-------------------------------------------------------------------------
@@ -273,6 +275,7 @@ hsize_t diff_array(
hid_t container1_id,
hid_t container2_id) /* dataset where the reference came from*/
{
+ H5TOOLS_ERR_INIT(int, 0)
hsize_t nfound = 0; /* number of differences found */
size_t size; /* size of datum */
unsigned char *mem1 = (unsigned char*) _mem1;
@@ -285,7 +288,8 @@ hsize_t diff_array(
mcomp_t members;
H5T_class_t type_class;
- h5diffdebug2("diff_array start - errstat:%d\n", opts->err_stat);
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_array start - errstat:%d", opts->err_stat);
/* get the size. */
size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@@ -310,6 +314,7 @@ hsize_t diff_array(
pos[j] = 0;
}
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_array type_class:%d", type_class);
switch (type_class) {
case H5T_NO_CLASS:
case H5T_TIME:
@@ -370,6 +375,7 @@ hsize_t diff_array(
case H5T_REFERENCE:
HDmemset(&members, 0, sizeof(mcomp_t));
get_member_types(m_type, &members);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_datum nelmts:%d - errstat:%d", nelmts, opts->err_stat);
for (i = 0; i < nelmts; i++) {
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);
@@ -378,8 +384,10 @@ hsize_t diff_array(
} /* i */
close_member_types(&members);
} /* switch */
- h5diffdebug3("diff_array finish:%d - errstat:%d\n", nfound, opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_array finish:%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit: %d", nfound);
+ H5TOOLS_POP_STACK();
return nfound;
}
@@ -433,6 +441,7 @@ static hsize_t diff_datum(
int *ph, /*print header */
mcomp_t *members) /*compound members */
{
+ H5TOOLS_ERR_INIT(hsize_t, opts->err_stat)
unsigned char *mem1 = (unsigned char*) _mem1;
unsigned char *mem2 = (unsigned char*) _mem2;
size_t u;
@@ -447,11 +456,11 @@ static hsize_t diff_datum(
hbool_t iszero1;
hbool_t iszero2;
hsize_t nfound = 0; /* differences found */
- hsize_t ret_value = opts->err_stat;
double per;
hbool_t both_zero;
- h5difftrace("diff_datum start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum start - errstat:%d", opts->err_stat);
type_size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@@ -480,7 +489,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_COMPOUND:
- h5difftrace("diff_datum H5T_COMPOUND\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_COMPOUND");
{
hid_t memb_type = -1;
nmembs = members->n;
@@ -500,7 +509,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_STRING:
- h5difftrace("diff_datum H5T_STRING\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_STRING");
{
char *s = NULL;
char *sx = NULL;
@@ -514,7 +523,7 @@ static hsize_t diff_datum(
/* if variable length string */
if (H5Tis_variable_str(m_type)) {
- h5difftrace("diff_datum H5T_STRING variable\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_STRING variable");
/* Get pointer to first string */
s1 = *(char **)((void *)mem1);
if (s1)
@@ -530,7 +539,7 @@ static hsize_t diff_datum(
size2 = 0;
}
else if (H5T_STR_NULLTERM == pad) {
- h5difftrace("diff_datum H5T_STRING null term\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_STRING null term");
/* Get pointer to first string */
s1 = (char*) mem1;
if (s1)
@@ -567,10 +576,10 @@ 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);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum string size:%d", size1);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum string size:%d", size2);
if (size1 != size2) {
- h5difftrace("diff_datum string sizes\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum string sizes difference");
nfound++;
}
if (size1 < size2) {
@@ -607,7 +616,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_BITFIELD:
- h5difftrace("diff_datum H5T_BITFIELD\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_BITFIELD");
/* byte-by-byte comparison */
for (u = 0; u < type_size; u++)
nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph);
@@ -618,7 +627,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_OPAQUE:
- h5difftrace("diff_datum H5T_OPAQUE\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_OPAQUE");
/* byte-by-byte comparison */
for (u = 0; u < type_size; u++)
nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph);
@@ -634,7 +643,7 @@ static hsize_t diff_datum(
* compared, we convert both bit patterns to their corresponding
* enumeration constant and do a string comparison
*/
- h5difftrace("diff_datum H5T_ENUM\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_ENUM");
{
char enum_name1[1024];
char enum_name2[1024];
@@ -693,6 +702,7 @@ static hsize_t diff_datum(
*/
case H5T_ARRAY:
{
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_ARRAY");
hid_t memb_type = -1;
hsize_t adims[H5S_MAX_RANK];
int ndims;
@@ -720,6 +730,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_REFERENCE:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_REFERENCE");
iszero1 = all_zero(_mem1, H5Tget_size(m_type));
iszero2 = all_zero(_mem2, H5Tget_size(m_type));
if (iszero1 != iszero2) {
@@ -727,23 +738,285 @@ static hsize_t diff_datum(
HGOTO_DONE (opts->err_stat);
}
else if (!iszero1 && !iszero2) {
- /*-------------------------------------------------------------------------
- * H5T_STD_REF_DSETREG
- * Dataset region reference
- *-------------------------------------------------------------------------
- */
hid_t obj1_id = -1;
hid_t obj2_id = -1;
+ /*-------------------------------------------------------------------------
+ * H5T_STD_REF
+ * Reference
+ *-------------------------------------------------------------------------
+ */
if (H5Tequal(m_type, H5T_STD_REF)) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_REFERENCE - H5T_STD_REF");
/* if (type_size == H5R_STD_REF_SIZE) */
- H5TOOLS_INFO(H5E_tools_min_info_id_g, "NEW reference type");
+ hid_t region1_id = -1;
+ hid_t region2_id = -1;
+ H5R_ref_t *ref1_buf = (const H5R_ref_t *)_mem1;
+ H5R_ref_t *ref2_buf = (const H5R_ref_t *)_mem2;
+ H5O_type_t obj1_type; /* Object type */
+ H5O_type_t obj2_type; /* Object type */
+ H5R_type_t ref_type; /* Reference type */
+
+ ref_type = H5Rget_type(ref1_buf);
+ switch (ref_type) {
+ case H5R_OBJECT1:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT1");
+ if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type3 object 1 failed");
+ }
+ if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type3 object 2 failed");
+ }
+
+ /* check object type */
+ 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 = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_object object 1 failed");
+ }
+ if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_object object 2 failed");
+ }
+
+ switch (obj1_type) {
+ case H5O_TYPE_DATASET:
+ nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
+ break;
+
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_NAMED_DATATYPE:
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ if (opts->m_verbose)
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
+ opts->not_cmp = 1;
+ break;
+ } /* end switch */
+ if(obj1_id >= 0)
+ if(H5Oclose(obj1_id) < 0)
+ H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT1 failed");
+ if(obj2_id >= 0)
+ if(H5Oclose(obj2_id) < 0)
+ H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT1 failed");
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT1 failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT1 failed");
+ break;
+ case H5R_DATASET_REGION1:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION1");
+ if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts);
+ if(H5Sclose(region2_id) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION1 failed");
+ }
+ if(H5Sclose(region1_id) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION1 failed");
+ }
+ if(H5Oclose(obj2_id) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_DATASET_REGION1 failed");
+ }
+ else {
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed");
+ }
+ if(H5Oclose(obj1_id) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_DATASET_REGION1 failed");
+ }
+ else {
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed");
+ }
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION1 failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION1 failed");
+ break;
+ case H5R_OBJECT2:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2");
+ if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type3 object 1 failed");
+ }
+ if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type3 object 2 failed");
+ }
+
+ /* check object type */
+ 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 = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_object object 1 failed");
+ }
+ if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ opts->err_stat = 1;
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_object object 2 failed");
+ }
+
+ switch (obj1_type) {
+ case H5O_TYPE_DATASET:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2 : DATASET");
+ nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
+ break;
+
+ case H5O_TYPE_GROUP:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2 : GROUP");
+ if (opts->m_verbose)
+ parallel_print("Warning: Comparison not possible of group object types referenced: <%s> and <%s>\n", obj1, obj2);
+ opts->not_cmp = 1;
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2 : NAMED");
+ if (opts->m_verbose)
+ parallel_print("Warning: Comparison not possible of named datatypes object types referenced: <%s> and <%s>\n", obj1, obj2);
+ opts->not_cmp = 1;
+ break;
+
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ if (opts->m_verbose)
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
+ opts->not_cmp = 1;
+ break;
+ } /* end switch */
+ if(obj1_id >= 0)
+ if(H5Oclose(obj1_id) < 0)
+ H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT2 failed");
+ if(obj2_id >= 0)
+ if(H5Oclose(obj2_id) < 0)
+ H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT2 failed");
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT2 failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT2 failed");
+ break;
+ case H5R_DATASET_REGION2:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION2");
+
+ /* if (obj_id < 0) - could mean that no reference was written do not throw failure */
+ obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT);
+ obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT);
+ if((obj1_id < 0) || (obj1_id < 0))
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g,
+ "H5Ropen_object H5R_DATASET_REGION2 failed");
+ else {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "open_region - H5R_DATASET_REGION2");
+ if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (h5tools_is_zero(ref1_buf, H5Tget_size(H5T_STD_REF))) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_DATASET_REGION2");
+ }
+ else {
+ if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (h5tools_is_zero(ref2_buf, H5Tget_size(H5T_STD_REF))) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_DATASET_REGION2");
+ }
+ else {
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts);
+ }
+ if(H5Sclose(region2_id) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION2 failed");
+ }
+ else
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed");
+ } /* end else to if (h5tools_is_zero(... */
+ if(H5Sclose(region1_id) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION2 failed");
+ }
+ else
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed");
+ if (obj1_id >= 0)
+ if(H5Dclose(obj1_id) < 0)
+ H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION2 failed");
+ if (obj2_id >= 0)
+ if(H5Dclose(obj2_id) < 0)
+ H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION2 failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION2 failed");
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION2 failed");
+ }
+ break;
+ case H5R_ATTR:
+ {
+ char name1[ATTR_NAME_MAX];
+ char name2[ATTR_NAME_MAX];
+
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_ATTR");
+ if((obj1_id = H5Ropen_attr(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ parallel_print("Warning: Cannot open referenced attribute: attribute 1\n");
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_attr object 1 failed");
+ }
+ if((obj2_id = H5Ropen_attr(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ parallel_print("Warning: Cannot open referenced attribute: attribute 2\n");
+ H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_attr object 2 failed");
+ }
+
+ if((obj1_id < 0) || (obj1_id < 0))
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g,
+ "H5Ropen_attr H5R_ATTR failed");
+ else {
+ /* get name */
+ if(H5Aget_name(obj1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed");
+ /* get name */
+ if(H5Aget_name(obj2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed");
+
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5R_ATTR diff_attr_data - name1=%s, name2=%s", name1, name2);
+ nfound = diff_attr_data(obj1_id, obj2_id, name1, name2, NULL, NULL, opts);
+ }
+
+ if(obj1_id >= 0)
+ if(H5Aclose(obj1_id) < 0)
+ H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose H5R_ATTR failed");
+ if(obj2_id >= 0)
+ if(H5Aclose(obj2_id) < 0)
+ H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose H5R_ATTR failed");
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_ATTR failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_ATTR failed");
+ }
+ break;
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ break;
+ } /* end switch */
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, opts->err_stat);
}
+ /*-------------------------------------------------------------------------
+ * H5T_STD_REF_DSETREG
+ * Dataset region reference
+ *-------------------------------------------------------------------------
+ */
else if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) {
/* if (type_size == H5R_DSET_REG_REF_BUF_SIZE) */
hid_t region1_id = -1;
hid_t region2_id = -1;
+ H5TOOLS_INFO(H5E_tools_min_info_id_g, "H5T_STD_REF_DSETREG reference type");
+
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");
@@ -779,6 +1052,8 @@ static hsize_t diff_datum(
H5O_type_t obj1_type;
H5O_type_t obj2_type;
+ H5TOOLS_INFO(H5E_tools_min_info_id_g, "H5T_STD_REF_OBJ reference type");
+
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");
@@ -809,9 +1084,7 @@ static hsize_t diff_datum(
nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
else {
if (opts->m_verbose)
- parallel_print(
- "Warning: Comparison not possible of object types referenced: <%s> and <%s>\n",
- obj1, obj2);
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
opts->not_cmp = 1;
}
@@ -819,6 +1092,7 @@ static hsize_t diff_datum(
H5Oclose(obj2_id);
}/*object reference*/
}/*is zero*/
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_REFERENCE complete");
break;
/*-------------------------------------------------------------------------
@@ -829,6 +1103,7 @@ static hsize_t diff_datum(
{
hid_t memb_type = -1;
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_VLEN");
/* get the VL sequences's base datatype for each element */
memb_type = H5Tget_super(m_type);
size = H5Tget_size(memb_type);
@@ -849,6 +1124,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_INTEGER:
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_INTEGER");
type_sign = H5Tget_sign(m_type);
/*-------------------------------------------------------------------------
* H5T_NATIVE_SCHAR
@@ -1467,6 +1743,7 @@ static hsize_t diff_datum(
* H5T_NATIVE_FLOAT
*-------------------------------------------------------------------------
*/
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_FLOAT");
if (type_size == 4) {
float temp1_float;
float temp2_float;
@@ -1947,8 +2224,10 @@ static hsize_t diff_datum(
done:
opts->err_stat = opts->err_stat | ret_value;
- h5diffdebug3("diff_datum finish:%d - errstat:%d\n", nfound, opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum finish:%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return nfound;
}
@@ -2025,7 +2304,7 @@ void print_points(int i, hsize_t *ptdata, int ndims) {
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;
+ H5TOOLS_ERR_INIT(hsize_t, 0)
hssize_t nblocks1, npoints1;
hssize_t nblocks2, npoints2;
hsize_t alloc_size;
@@ -2037,6 +2316,9 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
hsize_t nfound_b = 0; /* block differences found */
hsize_t nfound_p = 0; /* point differences found */
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_region start");
+
ndims1 = H5Sget_simple_extent_ndims(region1_id);
ndims2 = H5Sget_simple_extent_ndims(region2_id);
@@ -2052,6 +2334,8 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
npoints1 = H5Sget_select_elem_npoints(region1_id);
npoints2 = H5Sget_select_elem_npoints(region2_id);
} H5E_END_TRY;
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_region blocks: 1=%ld-2=%ld", nblocks1, nblocks2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_region points: 1=%ld-2=%ld", npoints1, npoints2);
if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) {
opts->not_cmp = 1;
@@ -2063,6 +2347,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
*-------------------------------------------------------------------------
*/
if (nblocks1 > 0) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "region compare blocks");
HDassert(ndims1 > 0);
alloc_size = (hsize_t) nblocks1 * (unsigned) ndims1 * 2 * sizeof(ptdata1[0]);
HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
@@ -2127,6 +2412,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
*-------------------------------------------------------------------------
*/
if (npoints1 > 0) {
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "region compare points");
alloc_size = (hsize_t) npoints1 * (unsigned) ndims1 * sizeof(ptdata1[0]);
HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/
@@ -2191,6 +2477,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
parallel_print(")");
}
+ parallel_print("\n");
#endif
HDfree(ptdata1);
@@ -2203,6 +2490,8 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
ret_value = nfound_p + nfound_b;
done:
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit with diffs:%d", ret_value);
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -2218,13 +2507,15 @@ done:
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 *opts, const char *obj1, const char *obj2, int *ph)
{
+ H5TOOLS_ERR_INIT(int, 0)
hsize_t nfound = 0; /* differences found */
char temp1_uchar;
char temp2_uchar;
+ H5TOOLS_PUSH_STACK();
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);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "character_compare start %d=%d",temp1_uchar,temp2_uchar);
if (temp1_uchar != temp2_uchar) {
if (print_data(opts)) {
@@ -2237,8 +2528,10 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
}
nfound++;
}
- h5difftrace("character_compare finish\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "character_compare finish");
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit: %d", nfound);
+ H5TOOLS_POP_STACK();
return nfound;
}
@@ -2263,7 +2556,6 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- h5difftrace("character_compare_opt start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
@@ -2307,7 +2599,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
- } h5difftrace("character_compare_opt finish\n");
+ }
return nfound;
}
@@ -2335,8 +2627,6 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- h5difftrace("diff_float start\n");
-
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
@@ -2520,7 +2810,6 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_float finish\n");
return nfound;
}
@@ -2548,7 +2837,6 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- h5difftrace("diff_double start\n");
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
@@ -2731,7 +3019,6 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_double finish\n");
return nfound;
}
@@ -2769,8 +3056,6 @@ static hsize_t diff_ldouble(unsigned char *mem1,
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- h5difftrace("diff_ldouble start\n");
-
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
@@ -2949,7 +3234,6 @@ static hsize_t diff_ldouble(unsigned char *mem1,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_ldouble finish\n");
return nfound;
}
@@ -2976,7 +3260,6 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_schar start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3077,7 +3360,6 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_schar finish\n");
return nfound;
}
@@ -3102,7 +3384,6 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_uchar start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3203,7 +3484,6 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_uchar finish\n");
return nfound;
}
@@ -3228,7 +3508,6 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_short start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3329,7 +3608,6 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_short finish\n");
return nfound;
}
@@ -3355,7 +3633,6 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_ushort start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3456,7 +3733,6 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_ushort finish\n");
return nfound;
}
@@ -3481,7 +3757,6 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_int start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3583,7 +3858,6 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
} /* nelmts */
}
- h5difftrace("diff_int finish\n");
return nfound;
}
@@ -3607,7 +3881,6 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_uint start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3709,7 +3982,6 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_uint finish\n");
return nfound;
}
@@ -3734,7 +4006,6 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_long start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3837,7 +4108,6 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_long finish\n");
return nfound;
}
@@ -3862,8 +4132,6 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_ulong start\n");
-
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3967,7 +4235,6 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_ulong finish\n");
return nfound;
}
@@ -3992,7 +4259,6 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_llong start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -4094,7 +4360,6 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_llong finish\n");
return nfound;
}
@@ -4120,7 +4385,6 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_ullong start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -4226,7 +4490,6 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_ullong finish\n");
return nfound;
}
@@ -4240,13 +4503,14 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
static
int ull2float(unsigned long long ull_value, float *f_value)
{
- int ret_value = SUCCEED;
+ H5TOOLS_ERR_INIT(int, SUCCEED)
hid_t dxpl_id = -1;
unsigned char *buf = NULL;
size_t src_size;
size_t dst_size;
- h5difftrace("ull2float start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ull2float start");
if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
@@ -4271,8 +4535,10 @@ done:
if (buf)
HDfree(buf);
- h5difftrace("ull2float finish\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ull2float finish");
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -4283,7 +4549,6 @@ done:
*-------------------------------------------------------------------------
*/
static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
- h5difftrace("equal_double start\n");
if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
@@ -4314,8 +4579,6 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
if (ABS((value-expected)) < DBL_EPSILON)
return TRUE;
- h5difftrace("equal_double finish\n");
-
return FALSE;
}
@@ -4330,7 +4593,6 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
static
hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
{
- h5difftrace("equal_ldouble start\n");
if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
@@ -4361,8 +4623,6 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
if (ABS((value-expected)) < DBL_EPSILON)
return TRUE;
- h5difftrace("equal_ldouble finish\n");
-
return FALSE;
}
@@ -4375,7 +4635,6 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
*-------------------------------------------------------------------------
*/
static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
- h5difftrace("equal_float start\n");
if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
@@ -4406,8 +4665,6 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
if (ABS( (value-expected) ) < FLT_EPSILON)
return TRUE;
- h5difftrace("equal_float finish\n");
-
return FALSE;
}
@@ -4423,7 +4680,6 @@ static hbool_t my_isnan(dtype_t type, void *val) {
hbool_t retval = FALSE;
char s[256];
- h5difftrace("my_isnan start\n");
if (FLT_FLOAT == type) {
float x;
@@ -4483,8 +4739,6 @@ static hbool_t my_isnan(dtype_t type, void *val) {
}
}
- h5difftrace("my_isnan finish\n");
-
return retval;
}
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index cd906af..bd66567 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -139,10 +139,10 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta
*------------------------------------------------------------------------*/
static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts)
{
- int ret_value = 0;
+ H5TOOLS_ERR_INIT(herr_t, 0)
H5O_info_t oinfo1, oinfo2; /* Object info */
- hid_t attr1_id = -1; /* attr ID */
- hid_t attr2_id = -1; /* attr ID */
+ hid_t attr1_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr2_id = H5I_INVALID_HID; /* attr ID */
size_t curr1 = 0;
size_t curr2 = 0;
unsigned infile[2];
@@ -152,12 +152,17 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
unsigned i;
table_attrs_t *table_lp = NULL;
- h5difftrace("build_match_list_attrs start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs start - errstat:%d", opts->err_stat);
- if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0)
+ if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) {
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info first object failed");
- if(H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0)
+ }
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Oget_info2 loc1id=%d", oinfo1.num_attrs);
+ if(H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) {
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info second object failed");
+ }
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Oget_info2 loc2id=%d", oinfo2.num_attrs);
table_attrs_init(&table_lp);
if (table_lp == NULL)
@@ -167,8 +172,8 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
* 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);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs);
/*------------------
* open attribute1 */
@@ -222,7 +227,7 @@ 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);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs);
/*------------------
* open attribute1 */
@@ -231,7 +236,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* get name */
if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed");
- h5diffdebug2("build_match_list_attrs #1 name - %s\n", name1);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs #1 name - %s", name1);
table_attr_mark_exist(infile, name1, table_lp);
table_lp->nattrs_only1++;
@@ -246,7 +251,7 @@ 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);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 2: %ld - %ld", 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)
@@ -254,7 +259,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* get name */
if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed");
- h5diffdebug2("build_match_list_attrs #2 name - %s\n", name2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs #2 name - %s", name2);
table_attr_mark_exist(infile, name2, table_lp);
table_lp->nattrs_only2++;
@@ -294,39 +299,32 @@ done:
H5Aclose(attr2_id);
} H5E_END_TRY;
- h5diffdebug2("build_match_list_attrs end - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs end - errstat:%d", opts->err_stat);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: diff_attr
+ * Function: diff_attr_data
*
- * 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);
+ * Purpose: compare attribute data located in attr1_id and attr2_id, which are
+ * obtained from open attributes
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-hsize_t diff_attr(hid_t loc1_id,
- hid_t loc2_id,
- const char *path1,
- const char *path2,
- diff_opt_t *opts)
+hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2, const char *path1, const char *path2, diff_opt_t *opts)
{
- 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 */
- hid_t mtype1_id = -1; /* memory data type ID */
- hid_t mtype2_id = -1; /* memory data type ID */
+ H5TOOLS_ERR_INIT(int, opts->err_stat)
+ hid_t space1_id = H5I_INVALID_HID; /* space ID */
+ hid_t space2_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype1_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t ftype2_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype1_id = H5I_INVALID_HID; /* memory data type ID */
+ hid_t mtype2_id = H5I_INVALID_HID; /* 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 */
@@ -338,36 +336,243 @@ hsize_t diff_attr(hid_t loc1_id,
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 */
hsize_t nfound = 0;
- hsize_t nfound_total = 0;
int j;
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data start - errstat:%d", opts->err_stat);
+
+ /* get the datatypes */
+ if((ftype1_id = H5Aget_type(attr1_id)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
+ if((ftype2_id = H5Aget_type(attr2_id)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
+
+ if (H5Tget_class(ftype1_id) == H5T_REFERENCE) {
+ if((mtype1_id = H5Tcopy(H5T_STD_REF)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) first attribute ftype failed");
+ }
+ else {
+ if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed");
+ }
+ if (H5Tget_class(ftype2_id) == H5T_REFERENCE) {
+ if((mtype2_id = H5Tcopy(H5T_STD_REF)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) second attribute ftype failed");
+ }
+ else {
+ if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second attribute ftype failed");
+ }
+ if((msize1 = H5Tget_size(mtype1_id)) == 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size first attribute mtype failed");
+ if((msize2 = H5Tget_size(mtype2_id)) == 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size second attribute mtype failed");
+
+ /* get the dataspace */
+ if((space1_id = H5Aget_space(attr1_id)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space first attribute failed");
+ if((space2_id = H5Aget_space(attr2_id)) < 0)
+ H5TOOLS_GOTO_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)
+ H5TOOLS_GOTO_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)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims second attribute failed");
+
+ /*----------------------------------------------------------------------
+ * check for comparable TYPE and SPACE
+ *----------------------------------------------------------------------
+ */
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data check for comparable TYPE and SPACE");
+
+ /* 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, opts, 0) == 1) {
+ /*-----------------------------------------------------------------
+ * "upgrade" the smaller memory size
+ *------------------------------------------------------------------
+ */
+ if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2))
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed");
+
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data read");
+ /*---------------------------------------------------------------------
+ * read
+ *----------------------------------------------------------------------
+ */
+ nelmts1 = 1;
+ for(j = 0; j < rank1; j++)
+ nelmts1 *= dims1[j];
+
+ buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1);
+ buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2);
+ if(buf1 == NULL || buf2 == NULL) {
+ parallel_print("cannot read into memory\n");
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "buffer allocation failed");
+ }
+ if(H5Aread(attr1_id, mtype1_id, buf1) < 0) {
+ parallel_print("Failed reading attribute1 %s\n", name1);
+ H5TOOLS_GOTO_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\n", name2);
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
+ }
+ else
+ buf2hasdata = TRUE;
+
+ /* format output string */
+ HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1);
+ HDsnprintf(np2, sizeof(np1), "%s of <%s>", name2, path2);
+
+ /*---------------------------------------------------------------------
+ * array compare
+ *----------------------------------------------------------------------
+ */
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data array compare %s - %s", name1, name1);
+
+ /* always print name */
+ /* verbose (-v) and report (-r) mode */
+ if(opts->m_verbose || opts->m_report) {
+ do_print_attrname("attribute", np1, np2);
+
+ nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
+ print_found(nfound);
+ }
+ /* quiet mode (-q), just count differences */
+ else if(opts->m_quiet) {
+ nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
+ 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, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
+
+ /* print info if compatible and difference found */
+ if (nfound) {
+ do_print_attrname("attribute", np1, np2);
+ print_found(nfound);
+ } /* end if */
+ } /* end else */
+ }
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat);
+
+ /*----------------------------------------------------------------------
+ * close
+ *----------------------------------------------------------------------
+ */
+
+ /* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any
+ * VLEN memory first */
+ if(TRUE == h5tools_detect_vlen(mtype1_id))
+ H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
+ HDfree(buf1);
+ buf1 = NULL;
+
+ if(TRUE == h5tools_detect_vlen(mtype2_id))
+ H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
+ HDfree(buf2);
+ buf2 = NULL;
+
+ if(H5Tclose(ftype1_id) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
+ if(H5Tclose(ftype2_id) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
+ if(H5Sclose(space1_id) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
+ if(H5Sclose(space2_id) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
+ if(H5Tclose(mtype1_id) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed");
+ if(H5Tclose(mtype2_id) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed");
+
+done:
+ opts->err_stat = opts->err_stat | ret_value;
+
+ H5E_BEGIN_TRY {
+ if(buf1) {
+ if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
+ H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
+ HDfree(buf1);
+ } /* end if */
+ if(buf2) {
+ if(buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id))
+ H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
+ HDfree(buf2);
+ } /* end if */
+
+ H5Tclose(ftype1_id);
+ H5Tclose(ftype2_id);
+ H5Tclose(mtype1_id);
+ H5Tclose(mtype2_id);
+ H5Sclose(space1_id);
+ H5Sclose(space2_id);
+ } H5E_END_TRY;
+
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data end - errstat:%d", opts->err_stat);
+
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
+ return nfound;
+}
+
+/*-------------------------------------------------------------------------
+ * 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
+ *-------------------------------------------------------------------------
+ */
+
+hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *path2, diff_opt_t *opts)
+{
+ H5TOOLS_ERR_INIT(int, opts->err_stat)
+ hid_t attr1_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr2_id = H5I_INVALID_HID; /* attr ID */
+ char *name1 = NULL;
+ char *name2 = NULL;
+ unsigned u; /* Local index variable */
+ hsize_t nfound = 0;
+ hsize_t nfound_total = 0;
+
+ H5TOOLS_PUSH_STACK();
table_attrs_t *match_list_attrs = NULL;
- h5difftrace("diff_attr start\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr start - errstat:%d", opts->err_stat);
if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) {
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "build_match_list_attrs failed");
}
- h5diffdebug2("build_match_list_attrs - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs - errstat:%d", 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");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr attributes only in one file");
/* exit will be 1 */
opts->contents = 0;
}
- h5diffdebug2("match_list_attrs info - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g,"match_list_attrs info - errstat:%d", 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);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "match_list_attrs loop[%d] - errstat:%d", 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);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr name - %s", name1);
/*--------------
* attribute 1 */
@@ -379,167 +584,12 @@ hsize_t diff_attr(hid_t loc1_id,
if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_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)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
- if((ftype2_id = H5Aget_type(attr2_id)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
-
- if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0)
- H5TOOLS_GOTO_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)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second attribute ftype failed");
- if((msize1 = H5Tget_size(mtype1_id)) == 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size first attribute mtype failed");
- if((msize2 = H5Tget_size(mtype2_id)) == 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size second attribute mtype failed");
-
- /* get the dataspace */
- if((space1_id = H5Aget_space(attr1_id)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space first attribute failed");
- if((space2_id = H5Aget_space(attr2_id)) < 0)
- H5TOOLS_GOTO_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)
- H5TOOLS_GOTO_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)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims second attribute failed");
-
- /*----------------------------------------------------------------------
- * check for comparable TYPE and SPACE
- *----------------------------------------------------------------------
- */
-
- /* 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, opts, 0) != 1) {
- if(H5Tclose(ftype1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed");
- if(H5Tclose(ftype2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed");
- if(H5Sclose(space1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose first attribute failed");
- if(H5Sclose(space2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose second attribute failed");
- if(H5Aclose(attr1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed");
- if(H5Aclose(attr2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed");
- if(H5Tclose(mtype1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed");
- if(H5Tclose(mtype2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed");
-
- continue;
- }
-
- /*-----------------------------------------------------------------
- * "upgrade" the smaller memory size
- *------------------------------------------------------------------
- */
- if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id,
- &mtype2_id, &msize1, &msize2))
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed");
-
- /*---------------------------------------------------------------------
- * read
- *----------------------------------------------------------------------
- */
- nelmts1 = 1;
- for(j = 0; j < rank1; j++)
- nelmts1 *= dims1[j];
-
- buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1);
- buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2);
- if(buf1 == NULL || buf2 == NULL) {
- parallel_print("cannot read into memory\n");
- H5TOOLS_GOTO_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);
- H5TOOLS_GOTO_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);
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
- }
- else
- buf2hasdata = TRUE;
-
- /* format output string */
- HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1);
- HDsnprintf(np2, sizeof(np1), "%s of <%s>", name2, path2);
-
- /*---------------------------------------------------------------------
- * array compare
- *----------------------------------------------------------------------
- */
-
- /* always print name */
- /* verbose (-v) and report (-r) mode */
- if(opts->m_verbose || opts->m_report) {
- do_print_attrname("attribute", np1, np2);
-
- nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
- print_found(nfound);
- }
- /* quiet mode (-q), just count differences */
- else if(opts->m_quiet) {
- nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- 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, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
-
- /* print info if compatible and difference found */
- if (nfound) {
- do_print_attrname("attribute", np1, np2);
- print_found(nfound);
- } /* end if */
- } /* end else */
-
- /*----------------------------------------------------------------------
- * close
- *----------------------------------------------------------------------
- */
-
- /* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any
- * VLEN memory first */
- if(TRUE == h5tools_detect_vlen(mtype1_id))
- H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
- HDfree(buf1);
- buf1 = NULL;
-
- if(TRUE == h5tools_detect_vlen(mtype2_id))
- H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
- HDfree(buf2);
- buf2 = NULL;
-
- if(H5Tclose(ftype1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
- if(H5Tclose(ftype2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
- if(H5Sclose(space1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
- if(H5Sclose(space2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr got attributes");
+ nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, opts);
if(H5Aclose(attr1_id) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
if(H5Aclose(attr2_id) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
- if(H5Tclose(mtype1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed");
- if(H5Tclose(mtype2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed");
nfound_total += nfound;
}
@@ -549,30 +599,15 @@ done:
opts->err_stat = opts->err_stat | ret_value;
H5E_BEGIN_TRY {
- if(buf1) {
- if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
- H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
- HDfree(buf1);
- } /* end if */
- if(buf2) {
- if(buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id))
- H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
- HDfree(buf2);
- } /* end if */
-
table_attrs_free(match_list_attrs);
- H5Tclose(ftype1_id);
- H5Tclose(ftype2_id);
- H5Tclose(mtype1_id);
- H5Tclose(mtype2_id);
- H5Sclose(space1_id);
- H5Sclose(space2_id);
H5Aclose(attr1_id);
H5Aclose(attr2_id);
} H5E_END_TRY;
- h5diffdebug2("diff_attr end - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr end - errstat:%d", opts->err_stat);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return nfound_total;
}
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 56c4f0b..5fb0ebf 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -33,7 +33,7 @@ hsize_t diff_dataset(hid_t file1_id,
const char *obj2_name,
diff_opt_t *opts)
{
- int ret_value = opts->err_stat;
+ H5TOOLS_ERR_INIT(int, opts->err_stat)
int status = -1;
hid_t did1 = -1;
hid_t did2 = -1;
@@ -41,7 +41,8 @@ hsize_t diff_dataset(hid_t file1_id,
hid_t dcpl2 = -1;
hsize_t nfound = 0;
- h5difftrace("diff_dataset start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_dataset start - errstat:%d", opts->err_stat);
/*-------------------------------------------------------------------------
* open the handles
*-------------------------------------------------------------------------
@@ -68,6 +69,7 @@ hsize_t diff_dataset(hid_t file1_id,
* 2) the internal filters might be turned off
*-------------------------------------------------------------------------
*/
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_dataset h5tools_canreadf then diff_datasetid");
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);
@@ -91,7 +93,9 @@ done:
/* enable error reporting */
} H5E_END_TRY;
- h5diffdebug3("diff_dataset finish:%d - errstat:%d\n", nfound, opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_dataset finish:%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return nfound;
}
@@ -152,16 +156,16 @@ hsize_t diff_datasetid(hid_t did1,
const char *obj2_name,
diff_opt_t *opts)
{
- 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;
+ H5TOOLS_ERR_INIT(int, opts->err_stat)
+ hid_t sid1 = H5I_INVALID_HID;
+ hid_t sid2 = H5I_INVALID_HID;
+ hid_t f_tid1 = H5I_INVALID_HID;
+ hid_t f_tid2 = H5I_INVALID_HID;
+ hid_t dam_tid = H5I_INVALID_HID; /* m_tid for diff_array function */
+ hid_t m_tid1 = H5I_INVALID_HID;
+ hid_t m_tid2 = H5I_INVALID_HID;
+ hid_t dcpl1 = H5I_INVALID_HID;
+ hid_t dcpl2 = H5I_INVALID_HID;
H5D_layout_t stl1 = -1;
H5D_layout_t stl2 = -1;
size_t dam_size; /* m_size for diff_array function */
@@ -189,13 +193,14 @@ hsize_t diff_datasetid(hid_t did1,
void *buf2 = NULL;
void *sm_buf1 = NULL;
void *sm_buf2 = NULL;
- hid_t sm_space = -1; /*stripmine data space */
+ hid_t sm_space = H5I_INVALID_HID; /*stripmine data space */
size_t need; /* bytes needed for malloc */
int i;
unsigned int vl_data1 = 0; /*contains VL datatypes */
unsigned int vl_data2 = 0; /*contains VL datatypes */
- h5difftrace("diff_datasetid start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datasetid start - errstat:%d", opts->err_stat);
/* Get the dataspace handle */
if((sid1 = H5Dget_space(did1)) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed");
@@ -219,7 +224,7 @@ hsize_t diff_datasetid(hid_t did1,
/* Get dimensions */
if(H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0)
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
- h5diffdebug3("rank: %ld - %ld\n", rank1, rank2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "rank: %ld - %ld", rank1, rank2);
/*-------------------------------------------------------------------------
* get the file data type
@@ -252,11 +257,11 @@ hsize_t diff_datasetid(hid_t did1,
* check for empty datasets
*-------------------------------------------------------------------------
*/
- h5difftrace("check for empty datasets\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "check for empty datasets");
storage_size1 = H5Dget_storage_size(did1);
storage_size2 = H5Dget_storage_size(did2);
- h5diffdebug3("storage size: %ld - %ld\n", storage_size1, storage_size2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "storage size: %ld - %ld", storage_size1, storage_size2);
if(storage_size1 == 0 || storage_size2 == 0) {
if(stl1 == H5D_VIRTUAL || stl2 == H5D_VIRTUAL) {
@@ -280,33 +285,45 @@ hsize_t diff_datasetid(hid_t did1,
obj1_name, obj2_name,
opts, 0) != 1)
can_compare = 0;
- h5diffdebug2("diff_can_type - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type - errstat:%d", opts->err_stat);
/*-------------------------------------------------------------------------
* memory type and sizes
*-------------------------------------------------------------------------
*/
- h5difftrace("check for memory type and sizes\n");
- if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "check for memory type and sizes");
+ if (H5Tget_class(f_tid1) == H5T_REFERENCE) {
+ if((m_tid1 = H5Tcopy(H5T_STD_REF)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) first ftype failed");
+ }
+ else {
+ if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first ftype failed");
+ }
- if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed");
+ if (H5Tget_class(f_tid2) == H5T_REFERENCE) {
+ if((m_tid2 = H5Tcopy(H5T_STD_REF)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) second ftype failed");
+ }
+ else {
+ if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second ftype failed");
+ }
m_size1 = H5Tget_size(m_tid1);
m_size2 = H5Tget_size(m_tid2);
- h5diffdebug3("type size: %ld - %ld\n", m_size1, m_size2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "type size: %ld - %ld", m_size1, m_size2);
/*-------------------------------------------------------------------------
* check for different signed/unsigned types
*-------------------------------------------------------------------------
*/
if(can_compare) {
- h5difftrace("can_compare for sign\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "can_compare for sign");
sign1 = H5Tget_sign(m_tid1);
sign2 = H5Tget_sign(m_tid2);
if(sign1 != sign2) {
- h5difftrace("sign1 != sign2\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sign1 != sign2");
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));
@@ -315,6 +332,7 @@ hsize_t diff_datasetid(hid_t did1,
can_compare = 0;
opts->not_cmp = 1;
}
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "can_compare for sign - can_compare=%d opts->not_cmp=%d", can_compare, opts->not_cmp);
}
/* Check if type is either VLEN-data or VLEN-string to reclaim any
@@ -324,7 +342,7 @@ hsize_t diff_datasetid(hid_t did1,
vl_data1 = TRUE;
if(TRUE == h5tools_detect_vlen(m_tid2))
vl_data2 = TRUE;
- h5diffdebug2("h5tools_detect_vlen - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5tools_detect_vlen %d:%d - errstat:%d", vl_data1, vl_data2, opts->err_stat);
/*------------------------------------------------------------------------
* only attempt to compare if possible
@@ -332,7 +350,7 @@ hsize_t diff_datasetid(hid_t did1,
*/
if(can_compare) { /* it is possible to compare */
H5T_class_t tclass = H5Tget_class(f_tid1);
- h5difftrace("can_compare attempt\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "can_compare attempt");
/*-----------------------------------------------------------------
* get number of elements
@@ -346,19 +364,19 @@ hsize_t diff_datasetid(hid_t did1,
for(i = 0; i < rank2; i++)
nelmts2 *= dims2[i];
- h5diffdebug3("nelmts: %ld - %ld\n", nelmts1, nelmts2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "nelmts: %ld - %ld", nelmts1, nelmts2);
if(tclass != H5T_ARRAY) {
/*-----------------------------------------------------------------
* "upgrade" the smaller memory size
*------------------------------------------------------------------
*/
- h5difftrace("upgrade the smaller memory size?\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NOT H5T_ARRAY, upgrade the smaller memory size?");
if (FAIL == match_up_memsize (f_tid1, f_tid2,
&m_tid1, &m_tid2,
&m_size1, &m_size2))
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed");
- h5diffdebug3("m_size: %ld - %ld\n", m_size1, m_size2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "m_size: %ld - %ld", m_size1, m_size2);
dadims = dims1;
dam_size = m_size1;
dam_tid = m_tid1;
@@ -366,7 +384,7 @@ hsize_t diff_datasetid(hid_t did1,
need = (size_t)(nelmts1 * m_size1); /* bytes needed */
}
else {
- h5diffdebug3("Array dims: %d - %d\n", dims1[0], dims2[0]);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Array dims: %d - %d", dims1[0], dims2[0]);
/* Compare the smallest array, but create the largest buffer */
if(m_size1 <= m_size2) {
dadims = dims1;
@@ -388,9 +406,10 @@ hsize_t diff_datasetid(hid_t did1,
name1 = diff_basename(obj1_name);
if(obj2_name)
name2 = diff_basename(obj2_name);
- h5diffdebug3("obj_names: %s - %s\n", name1, name2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "obj_names: %s - %s", name1, name2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "read/compare");
/*----------------------------------------------------------------
* read/compare
*-----------------------------------------------------------------
@@ -401,23 +420,24 @@ hsize_t diff_datasetid(hid_t did1,
} /* end if */
if(buf1 != NULL && buf2 != NULL) {
- h5difftrace("buf1 != NULL && buf2 != NULL\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "buf1 != NULL && buf2 != NULL");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Dread did1");
if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
- h5difftrace("H5Dread did2\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Dread did2");
if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0)
H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed");
/* array diff */
nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims,
opts, name1, name2, dam_tid, did1, did2);
- h5diffdebug2("diff_array nfound:%d\n", nfound);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_array nfound:%d - errstat:%d", nfound, opts->err_stat);
/* reclaim any VL memory, if necessary */
- h5diffdebug2("check vl_data1:%d\n", vl_data1);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "check vl_data1:%d", vl_data1);
if(vl_data1)
H5Treclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
- h5diffdebug2("check vl_data2:%d\n", vl_data2);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "check vl_data2:%d", vl_data2);
if(vl_data2)
H5Treclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
if(buf1 != NULL) {
@@ -459,7 +479,7 @@ hsize_t diff_datasetid(hid_t did1,
size = 1;
sm_size[i - 1] = MIN(dadims[i - 1], size);
sm_nbytes *= sm_size[i - 1];
- h5diffdebug2("sm_nbytes: %ld\n", sm_nbytes);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sm_nbytes: %ld", sm_nbytes);
} /* end for */
/* malloc return code should be verified.
@@ -534,6 +554,7 @@ hsize_t diff_datasetid(hid_t did1,
H5Sclose(sm_space);
} /* hyperslab read */
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "can_compare complete");
} /*can_compare*/
@@ -541,7 +562,7 @@ hsize_t diff_datasetid(hid_t did1,
* close
*-------------------------------------------------------------------------
*/
- h5diffdebug2("reclaim any VL memory - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reclaim any VL memory - errstat:%d", opts->err_stat);
done:
opts->err_stat = opts->err_stat | ret_value;
@@ -588,7 +609,9 @@ done:
/* enable error reporting */
} H5E_END_TRY;
- h5diffdebug3("diff_datasetid return:%d with nfound:%d\n", ret_value, nfound);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datasetid return:%d with nfound:%d", ret_value, nfound);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return nfound;
}
@@ -617,14 +640,15 @@ int diff_can_type(hid_t f_tid1, /* file data type */
diff_opt_t *opts,
int is_compound)
{
- int ret_value = 1; /* can_compare value */
+ H5TOOLS_ERR_INIT(int, 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;
- h5difftrace("diff_can_type start\n");
+ H5TOOLS_PUSH_STACK();
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type start");
/*-------------------------------------------------------------------------
* check for the same class
*-------------------------------------------------------------------------
@@ -677,7 +701,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */
case H5T_NO_CLASS:
case H5T_NCLASSES:
default:
- h5diffdebug2("diff_can_type class - %s\n", get_class(tclass1));
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type class - %s", get_class(tclass1));
break;
} /* end switch */
@@ -775,7 +799,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */
if(tclass1 == H5T_STRING) {
htri_t vstrtype1 = -1;
htri_t vstrtype2 = -1;
- h5difftrace("diff_can_type end - H5T_STRING\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type end - H5T_STRING");
vstrtype1 = H5Tis_variable_str(f_tid1);
vstrtype2 = H5Tis_variable_str(f_tid2);
@@ -796,7 +820,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */
int j;
hid_t memb_type1 = -1;
hid_t memb_type2 = -1;
- h5difftrace("diff_can_type end - H5T_COMPOUND\n");
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type end - H5T_COMPOUND");
nmembs1 = H5Tget_nmembers(f_tid1);
nmembs2 = H5Tget_nmembers(f_tid2);
@@ -831,7 +855,9 @@ done:
if (ret_value < 0)
opts->err_stat = 1;
- h5diffdebug2("diff_can_type end - %d\n", ret_value);
+ H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type end - %d", ret_value);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 6b5ca2f..b54ffe1 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -339,8 +339,9 @@ 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_value = SUCCEED;
+ H5TOOLS_ERR_INIT(herr_t, SUCCEED)
+ H5TOOLS_PUSH_STACK();
if((*m_size1) != (*m_size2)) {
if((*m_size1) < (*m_size2)) {
H5Tclose(*m_tid1);
@@ -363,6 +364,8 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "native type sizes do not compare");
done:
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 727e493..f70ecd2 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -436,8 +436,8 @@ h5tools_set_error_file(const char *fname, int is_bin)
static hid_t
h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
{
+ H5TOOLS_ERR_INIT(int, SUCCEED)
hid_t new_fapl = -1; /* Copy of file access property list passed in, or new property list */
- int ret_value = SUCCEED;
/* Make a copy of the FAPL, for the file open call to use, eventually */
if (fapl == H5P_DEFAULT) {
@@ -1534,6 +1534,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
hsize_t blkndx;
hid_t sid1 = -1;
+ H5TOOLS_PUSH_STACK();
/* Get the dataspace of the dataset */
if((sid1 = H5Dget_space(region_id)) < 0)
H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
@@ -1600,6 +1601,8 @@ CATCH
if(H5Sclose(sid1) < 0)
H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -1627,6 +1630,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
hid_t dtype = -1;
hid_t type_id = -1;
+ H5TOOLS_PUSH_STACK();
if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
nblocks = (hsize_t)snblocks;
@@ -1650,7 +1654,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
render_bin_output_region_data_blocks(region_id, stream, container, ndims, type_id, nblocks, ptdata);
- done:
+done:
HDfree(ptdata);
if(type_id > 0 && H5Tclose(type_id) < 0)
@@ -1661,7 +1665,9 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
H5_LEAVE(TRUE)
- CATCH
+CATCH
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -1693,6 +1699,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
hid_t mem_space = -1;
void *region_buf = NULL;
+ H5TOOLS_PUSH_STACK();
if((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
@@ -1715,13 +1722,15 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
if(render_bin_output(stream, container, type_id, (char*)region_buf, npoints) < 0)
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "render_bin_output of data points failed");
- done:
+done:
HDfree(region_buf);
HDfree(dims1);
if(H5Sclose(mem_space) < 0)
H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -1747,6 +1756,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
hid_t dtype = -1;
hid_t type_id = -1;
+ H5TOOLS_PUSH_STACK();
if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
npoints = (hsize_t)snpoints;
@@ -1764,7 +1774,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
render_bin_output_region_data_points(region_space, region_id, stream, container, ndims, type_id, npoints);
- done:
+done:
if(type_id > 0 && H5Tclose(type_id) < 0)
H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
@@ -1773,6 +1783,8 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
H5_LEAVE(ret_value)
CATCH
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 8b08d7f..55d3a6b 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -628,7 +628,7 @@ h5tools_print_region_data_blocks(hid_t region_id,
} /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
- done:
+done:
HDfree(start);
HDfree(count);
HDfree(region_buf);
@@ -1280,6 +1280,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
/* VL data special information */
unsigned int vl_data = 0; /* contains VL datatypes */
+ H5TOOLS_PUSH_STACK();
if ((size_t) ctx->ndims > NELMTS(sm_size))
H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed");
@@ -1400,6 +1401,8 @@ CATCH
if(sm_buf)
HDfree(sm_buf);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -1585,6 +1588,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
size_t i; /* counters */
hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/
+ H5TOOLS_PUSH_STACK();
if((f_space = H5Dget_space(dset)) < 0)
H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
@@ -1610,6 +1614,8 @@ CATCH
if(f_space >= 0 && H5Sclose(f_space) < 0)
H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -1979,6 +1985,8 @@ done:
if (f_space > 0)
H5Sclose(f_space);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -2002,6 +2010,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c
hid_t f_type = H5I_INVALID_HID;
h5tool_format_t info_dflt;
+ H5TOOLS_PUSH_STACK();
/* Use default values */
if (!stream)
stream = rawoutstream;
@@ -2047,6 +2056,8 @@ done:
if (f_space > 0)
H5Sclose(f_space);
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -2088,6 +2099,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
const char *sign_s = NULL; /* sign scheme string */
const char *order_s = NULL; /* byte order string */
+ H5TOOLS_PUSH_STACK();
if((type_class = H5Tget_class(type)) < 0)
H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed");
if (object_search && H5Tcommitted(type) > 0) {
@@ -2633,6 +2645,8 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
}
CATCH
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -2657,6 +2671,7 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
H5S_class_t space_type = -1;
int i;
+ H5TOOLS_PUSH_STACK();
if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0)
H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
@@ -2708,6 +2723,8 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
} /* end switch */
CATCH
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
@@ -2741,6 +2758,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
size_t ncols = 80; /*available output width */
hsize_t curr_pos = 0; /* total data element position */
+ H5TOOLS_PUSH_STACK();
if (info->line_ncols > 0)
ncols = info->line_ncols;
@@ -2852,6 +2870,8 @@ CATCH
if(0 == nmembs)
h5tools_str_append(buffer, "\n<empty>");
+ H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
+ H5TOOLS_POP_STACK();
return ret_value;
}
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index 2c5e6c9..6e20b7c 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -112,7 +112,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
* H5TOOLS_INFO macro, used to facilitate error reporting . The arguments are the minor error number, and a description of the error.
*/
#define H5TOOLS_INFO(min_id, ...) { \
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \
+ H5Epush2(estack_id, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \
}
/*
@@ -120,7 +120,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
* error number, the minor error number, and a description of the error.
*/
#define H5TOOLS_ERROR(maj_id, min_id, ...) { \
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \
+ H5Epush2(estack_id, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \
ret_value = FAIL; \
}
@@ -152,7 +152,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
* to the `catch_except' label, if we're not already past it.
*/
#define H5TOOLS_THROW(fail_value, min_id, ...) { \
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \
+ H5Epush2(estack_id, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \
H5_LEAVE(fail_value) \
}
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index aafc7ba..acaf24a 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -43,7 +43,7 @@ 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;
+ H5TOOLS_ERR_INIT(int, 1)
int nfilters; /* number of filters */
H5Z_filter_t filtn; /* filter identification number */
int i; /* index */
@@ -144,7 +144,7 @@ done:
H5_ATTR_CONST int
h5tools_can_encode(H5Z_filter_t filtn)
{
- int ret_value = 1;
+ H5TOOLS_ERR_INIT(int, 1)
switch (filtn) {
/* user defined filter */
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 7b47f4d..96f1e04 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -788,7 +788,7 @@ herr_t
init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
table_t **dset_table, table_t **type_table)
{
- herr_t ret_value = SUCCEED;
+ H5TOOLS_ERR_INIT(herr_t, SUCCEED)
/* Initialize the tables */
init_table(group_table);
@@ -1047,9 +1047,9 @@ h5tools_getstatus(void)
int
h5tools_getenv_update_hyperslab_bufsize(void)
{
+ H5TOOLS_ERR_INIT(int, 1)
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"))) {
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 4f4f42a..ab1635c 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -114,7 +114,7 @@ h5trav_set_verbose(int print_verbose)
*-------------------------------------------------------------------------
*/
-
+
/*-------------------------------------------------------------------------
* Function: trav_addr_add
*
@@ -140,7 +140,7 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
visited->objs[idx].path = HDstrdup(path);
} /* end trav_addr_add() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_addr_visited
*
@@ -164,7 +164,7 @@ trav_addr_visited(trav_addr_t *visited, haddr_t addr)
return(NULL);
} /* end trav_addr_visited() */
-
+
/*-------------------------------------------------------------------------
* Function: traverse_cb
*
@@ -239,7 +239,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
return(H5_ITER_CONT);
} /* end traverse_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: traverse
*
@@ -254,8 +254,8 @@ static int
traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
hbool_t recurse, const trav_visitor_t *visitor, unsigned fields)
{
+ H5TOOLS_ERR_INIT(int, SUCCEED)
H5O_info_t oinfo; /* Object info for starting group */
- int ret_value = SUCCEED;
/* Get info for starting object */
if(H5Oget_info_by_name2(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0)
@@ -312,7 +312,7 @@ done:
return ret_value;
}
-
+
/*-------------------------------------------------------------------------
* Function: trav_info_add
*
@@ -366,7 +366,7 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
info->paths[idx].fileno = oinfo.fileno;
} /* end trav_fileinfo_add() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_info_visit_obj
*
@@ -396,7 +396,7 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
return(0);
} /* end trav_info_visit_obj() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_info_visit_lnk
*
@@ -415,7 +415,7 @@ trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
return(0);
} /* end trav_info_visit_lnk() */
-
+
/*-------------------------------------------------------------------------
* Function: h5trav_getinfo
*
@@ -429,8 +429,8 @@ trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
int
h5trav_getinfo(hid_t file_id, trav_info_t *info)
{
+ H5TOOLS_ERR_INIT(int, SUCCEED)
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;
@@ -501,7 +501,7 @@ trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info)
*_info = info;
} /* end trav_info_init() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_info_free
*
@@ -536,7 +536,7 @@ trav_info_free(trav_info_t *info)
*-------------------------------------------------------------------------
*/
-
+
/*-------------------------------------------------------------------------
* Function: trav_table_visit_obj
*
@@ -563,7 +563,7 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
return 0;
} /* end trav_table_visit_obj() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_table_visit_lnk
*
@@ -582,7 +582,7 @@ trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, v
return 0;
} /* end trav_table_visit_lnk() */
-
+
/*-------------------------------------------------------------------------
* Function: h5trav_gettable
*
@@ -595,8 +595,8 @@ trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, v
int
h5trav_gettable(hid_t fid, trav_table_t *table)
{
+ H5TOOLS_ERR_INIT(int, SUCCEED)
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;
@@ -882,7 +882,7 @@ trav_attr(hid_t
return(0);
}
-
+
/*-------------------------------------------------------------------------
* Function: trav_print_visit_obj
*
@@ -940,7 +940,7 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
return(0);
} /* end trav_print_visit_obj() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_print_visit_lnk
*
@@ -1004,7 +1004,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
return(0);
} /* end trav_print_visit_lnk() */
-
+
/*-------------------------------------------------------------------------
* Function: h5trav_print
*
@@ -1017,9 +1017,9 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
int
h5trav_print(hid_t fid)
{
+ H5TOOLS_ERR_INIT(int, SUCCEED)
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;
@@ -1037,7 +1037,7 @@ done:
return ret_value;
}
-
+
/*-------------------------------------------------------------------------
* Function: h5trav_visit
*
@@ -1052,8 +1052,8 @@ 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, unsigned fields)
{
+ H5TOOLS_ERR_INIT(int, SUCCEED)
trav_visitor_t visitor; /* Visitor structure for objects */
- int ret_value = SUCCEED;
/* Init visitor structure */
visitor.visit_obj = visit_obj;
@@ -1080,7 +1080,7 @@ done:
herr_t
symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
- herr_t ret_value = SUCCEED;
+ H5TOOLS_ERR_INIT(herr_t, SUCCEED)
size_t idx; /* Index of address to use */
/* Allocate space if necessary */
@@ -1118,7 +1118,7 @@ done:
return ret_value;
} /* end symlink_visit_add() */
-
+
/*-------------------------------------------------------------------------
* Function: symlink_is_visited
*