summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5diff.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2011-03-22 15:47:07 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2011-03-22 15:47:07 (GMT)
commit4147de8d02fdfb651e860df999f87263d72be573 (patch)
tree0c12e5c4d19e03085adffaf51ac0fd7f1d67154e /tools/lib/h5diff.c
parentf92d2371ffce9ec664833187cadb0223fa1dc1c2 (diff)
downloadhdf5-4147de8d02fdfb651e860df999f87263d72be573.zip
hdf5-4147de8d02fdfb651e860df999f87263d72be573.tar.gz
hdf5-4147de8d02fdfb651e860df999f87263d72be573.tar.bz2
[svn-r20294] Purpose:
Fixed CHICAGO: Bug 2121 - h5diff - incorrect and lack of output for the different set of attributes (different number and names) Description: Previously h5diff compared attributes correctly only when two objects have the same number of attributes and attribute names are identical. This fix covers all other cases. Also didn't display useful information about attribute difference. This fixes both issues. Tested: jam (linux32-LE), amani (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE)
Diffstat (limited to 'tools/lib/h5diff.c')
-rw-r--r--tools/lib/h5diff.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index a616dba..a4d8469 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -47,8 +47,7 @@
* 2) when diff was found (normal mode)
*-------------------------------------------------------------------------
*/
-int
-print_objname (diff_opt_t * options, hsize_t nfound)
+int print_objname (diff_opt_t * options, hsize_t nfound)
{
return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0;
}
@@ -60,13 +59,31 @@ print_objname (diff_opt_t * options, hsize_t nfound)
*
*-------------------------------------------------------------------------
*/
-void
-do_print_objname (const char *OBJ, const char *path1, const char *path2)
+void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts)
{
+ /* if verbose level is higher than 0, put space line before
+ * displaying any object or symbolic links. This improves
+ * readability of the output.
+ */
+ if (opts->m_verbose_level >= 1)
+ parallel_print("\n");
parallel_print("%-7s: <%s> and <%s>\n", OBJ, path1, path2);
}
/*-------------------------------------------------------------------------
+ * Function: do_print_attrname
+ *
+ * Purpose: print attribute name
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+do_print_attrname (const char *attr, const char *path1, const char *path2)
+{
+ parallel_print("%-7s: <%s> and <%s>\n", attr, path1, path2);
+}
+
+/*-------------------------------------------------------------------------
* Function: print_warn
*
* Purpose: check print warning condition.
@@ -1689,7 +1706,7 @@ out:
{
if(print_objname(options, nfound))
{
- do_print_objname("dangling link", obj1name, obj2name);
+ do_print_objname("dangling link", obj1name, obj2name, options);
print_found(nfound);
}
}
@@ -1828,7 +1845,7 @@ hsize_t diff(hid_t file1_id,
/* verbose (-v) and report (-r) mode */
if(options->m_verbose || options->m_report)
{
- do_print_objname("dataset", path1, path2);
+ do_print_objname("dataset", path1, path2, options);
nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
print_found(nfound);
}
@@ -1844,7 +1861,7 @@ hsize_t diff(hid_t file1_id,
/* print info if compatible and difference found */
if (!options->not_cmp && nfound)
{
- do_print_objname("dataset", path1, path2);
+ do_print_objname("dataset", path1, path2, options);
print_found(nfound);
}
}
@@ -1867,7 +1884,7 @@ hsize_t diff(hid_t file1_id,
nfound = (ret > 0) ? 0 : 1;
if(print_objname(options,nfound))
- do_print_objname("datatype", path1, path2);
+ do_print_objname("datatype", path1, path2, options);
/* always print the number of differences found in verbose mode */
if(options->m_verbose)
@@ -1894,7 +1911,7 @@ hsize_t diff(hid_t file1_id,
*/
case H5TRAV_TYPE_GROUP:
if(print_objname(options, nfound))
- do_print_objname("group", path1, path2);
+ do_print_objname("group", path1, path2, options);
/* always print the number of differences found in verbose mode */
if(options->m_verbose)
@@ -1933,7 +1950,7 @@ hsize_t diff(hid_t file1_id,
nfound = (ret != 0) ? 1 : 0;
if(print_objname(options, nfound))
- do_print_objname("link", path1, path2);
+ do_print_objname("link", path1, path2, options);
if (options->follow_links)
{
@@ -1985,7 +2002,7 @@ hsize_t diff(hid_t file1_id,
nfound = (ret != 0) ? 1 : 0;
if(print_objname(options, nfound))
- do_print_objname("external link", path1, path2);
+ do_print_objname("external link", path1, path2, options);
if (options->follow_links)
{
@@ -2021,7 +2038,7 @@ hsize_t diff(hid_t file1_id,
nfound = 0;
if (print_objname (options, nfound))
- do_print_objname ("user defined link", path1, path2);
+ do_print_objname ("user defined link", path1, path2, options);
} /* end else */
/* always print the number of differences found in verbose mode */
@@ -2058,7 +2075,7 @@ out2:
{
if(print_objname(options, nfound))
{
- do_print_objname("dangling link", path1, path2);
+ do_print_objname("dangling link", path1, path2, options);
print_found(nfound);
}
}