diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-07-21 17:50:11 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-07-21 17:50:11 (GMT) |
commit | 7dc938f649657f0b6b7f269374526365f8d87e14 (patch) | |
tree | d990647d58b719c6a49737ded36e9a4241e53863 /tools/lib | |
parent | c157f8636889acb3fef0769512091f1d2749bdae (diff) | |
download | hdf5-7dc938f649657f0b6b7f269374526365f8d87e14.zip hdf5-7dc938f649657f0b6b7f269374526365f8d87e14.tar.gz hdf5-7dc938f649657f0b6b7f269374526365f8d87e14.tar.bz2 |
[svn-r8911] Purpose:
bug fixes
Description:
the return error code for a function was not initialized.
in HP-UX it happened that this variable was initialized to -1
causing the function to return with an error condtion
solution : initialized the variable to 0
the name of the dataset was printed after the differences in verbose mode
and report when differences were found
solution : check first if differences were found and then
print the name of dataset and differences
in verbose mode always print the name first
Solution:
Platforms tested:
linux
HP-UX
solaris
AIX
Misc. update:
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.c | 34 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 9 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 73 |
3 files changed, 99 insertions, 17 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 818bc40..f5ba995 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -432,9 +432,39 @@ hsize_t diff( hid_t file1_id, *------------------------------------------------------------------------- */ case H5G_DATASET: - nfound=diff_dataset(file1_id,file2_id,path1,path2,options); - if (print_objname(options,nfound)) + + /* always print name */ + if (options->m_verbose) + { + if (print_objname(options,1)) printf( "Dataset: <%s> and <%s>\n",path1,path2); + nfound=diff_dataset(file1_id,file2_id,path1,path2,options); + + } + /* check first if we have differences */ + else + { + if (options->m_quiet==0) + { + /* shut up temporarily */ + options->m_quiet=1; + nfound=diff_dataset(file1_id,file2_id,path1,path2,options); + /* print again */ + options->m_quiet=0; + if (nfound) + { + if (print_objname(options,nfound)) + printf( "Dataset: <%s> and <%s>\n",path1,path2); + nfound=diff_dataset(file1_id,file2_id,path1,path2,options); + } /*if*/ + } /*if*/ + /* in quiet mode, just count differences */ + else + { + nfound=diff_dataset(file1_id,file2_id,path1,path2,options); + } + }/*else*/ + break; /*------------------------------------------------------------------------- diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 51d87d0..73a1fbf 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -24,12 +24,13 @@ static hbool_t is_zero(const void *_mem, size_t size); /*------------------------------------------------------------------------- * Function: print_data * - * Purpose: print data only in report or verbose modes + * Purpose: print data only in report or verbose modes, + * and do not print in quiet mode *------------------------------------------------------------------------- */ static int print_data(diff_opt_t *options) -{ - return (options->m_report || options->m_verbose==1)?1:0; +{ + return ( (options->m_report || options->m_verbose) && !options->m_quiet)?1:0; } /*------------------------------------------------------------------------- @@ -208,7 +209,7 @@ hsize_t diff_datum(void *_mem1, H5G_stat_t sb1; H5G_stat_t sb2; hsize_t nfound=0; /* differences found */ - int ret; + int ret=0; /* check return error */ /* Build default formats for long long types */ sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index bf3a874..6aedaf5 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -189,7 +189,12 @@ int diff_attr(hid_t loc1_id, */ sprintf(name1,"%s of <%s>",name1,path1); sprintf(name2,"%s of <%s>",name2,path2); - nfound = diff_array(buf1, + + /* always print name */ + if (options->m_verbose) + { + printf( "Attribute: <%s> and <%s>\n",name1,name2); + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -200,18 +205,64 @@ int diff_attr(hid_t loc1_id, mtype1_id, attr1_id, attr2_id); - - }/*cmp*/ - -/*------------------------------------------------------------------------- - * print how many differences were found - *------------------------------------------------------------------------- - */ - if (print_objname(options,nfound)) - { - printf( "Attribute: <%s> and <%s>\n",name1,name2); print_found(nfound); + } + /* check first if we have differences */ + else + { + if (options->m_quiet==0) + { + /* shut up temporarily */ + options->m_quiet=1; + nfound = diff_array(buf1, + buf2, + nelmts1, + rank1, + dims1, + options, + name1, + name2, + mtype1_id, + attr1_id, + attr2_id); + /* print again */ + options->m_quiet=0; + if (nfound) + { + printf( "Attribute: <%s> and <%s>\n",name1,name2); + nfound = diff_array(buf1, + buf2, + nelmts1, + rank1, + dims1, + options, + name1, + name2, + mtype1_id, + attr1_id, + attr2_id); + print_found(nfound); + } /*if*/ + } /*if*/ + /* in quiet mode, just count differences */ + else + { + nfound = diff_array(buf1, + buf2, + nelmts1, + rank1, + dims1, + options, + name1, + name2, + mtype1_id, + attr1_id, + attr2_id); + } /*else quiet */ + } /*else verbose */ + }/*cmp*/ + /*------------------------------------------------------------------------- |