diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-09-25 14:33:30 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-09-25 14:33:30 (GMT) |
commit | be8049e9d36e6b29f414f806f3a279db4be09643 (patch) | |
tree | 6a96d0253942aef92bde67b3ac8b9d100f622f22 /tools | |
parent | 3e250193da27fc67f05200a9cbca73a31af00f76 (diff) | |
download | hdf5-be8049e9d36e6b29f414f806f3a279db4be09643.zip hdf5-be8049e9d36e6b29f414f806f3a279db4be09643.tar.gz hdf5-be8049e9d36e6b29f414f806f3a279db4be09643.tar.bz2 |
[svn-r12677] bug fix
the number of atribute differences was not added to the total sum of
differences
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/h5diff.c | 4 | ||||
-rw-r--r-- | tools/lib/h5diff.h | 13 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 59 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 2 | ||||
-rw-r--r-- | tools/testfiles/h5diff_70.txt | 2 |
5 files changed, 41 insertions, 39 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 24a273d..ef480d2 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -489,7 +489,7 @@ diff (hid_t file1_id, *------------------------------------------------------------------------- */ if (path1) - diff_attr(type1_id,type2_id,path1,path2,options); + nfound = diff_attr(type1_id,type2_id,path1,path2,options); if ( H5Tclose(type1_id)<0) goto out; @@ -522,7 +522,7 @@ diff (hid_t file1_id, *------------------------------------------------------------------------- */ if (path1) - diff_attr(grp1_id,grp2_id,path1,path2,options); + nfound = diff_attr(grp1_id,grp2_id,path1,path2,options); if ( H5Gclose(grp1_id)<0) goto out; diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 78e4949..570e4c8 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -161,12 +161,13 @@ int diff_can_type( hid_t f_type1, /* file data type */ diff_opt_t *options ); -int diff_attr(hid_t loc1_id, - hid_t loc2_id, - const char *path1, - const char *path2, - diff_opt_t *options - ); +hsize_t +diff_attr(hid_t loc1_id, + hid_t loc2_id, + const char *path1, + const char *path2, + diff_opt_t *options + ); /*------------------------------------------------------------------------- diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 95cde9c..222775e 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -27,8 +27,7 @@ * loc_id = H5Topen( fid, name); * * Return: - * 0 : no differences found - * 1 : differences found + * number of differences found * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -37,21 +36,22 @@ *------------------------------------------------------------------------- */ -int diff_attr(hid_t loc1_id, - hid_t loc2_id, - const char *path1, - const char *path2, - diff_opt_t *options - ) +hsize_t +diff_attr(hid_t loc1_id, + hid_t loc2_id, + const char *path1, + const char *path2, + diff_opt_t *options + ) { - 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 */ + hid_t attr1_id; /* attr ID */ + hid_t attr2_id; /* attr ID */ + hid_t space1_id; /* space ID */ + hid_t space2_id; /* space ID */ + hid_t ftype1_id; /* file data type ID */ + hid_t ftype2_id; /* file data type ID */ + hid_t mtype1_id; /* memory data type ID */ + hid_t mtype2_id; /* 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 */ @@ -66,8 +66,7 @@ int diff_attr(hid_t loc1_id, char np1[512]; char np2[512]; int n1, n2, i, j; - int ret=0; - hsize_t nfound; + hsize_t found, nfound=0; int cmp=1; if ((n1 = H5Aget_num_attrs(loc1_id))<0) @@ -76,7 +75,7 @@ int diff_attr(hid_t loc1_id, goto error; if (n1!=n2) - return 1; + return nfound; for ( i = 0; i < n1; i++) { @@ -109,7 +108,6 @@ int diff_attr(hid_t loc1_id, } H5Aclose(attr1_id); H5Aclose(attr2_id); - ret=1; continue; } @@ -207,7 +205,7 @@ int diff_attr(hid_t loc1_id, if (options->m_verbose) { printf( "Attribute: <%s> and <%s>\n",np1,np2); - nfound = diff_array(buf1, + found = diff_array(buf1, buf2, nelmts1, rank1, @@ -218,7 +216,8 @@ int diff_attr(hid_t loc1_id, mtype1_id, attr1_id, attr2_id); - print_found(nfound); + print_found(found); + nfound += found; } /* check first if we have differences */ @@ -228,7 +227,7 @@ int diff_attr(hid_t loc1_id, { /* shut up temporarily */ options->m_quiet=1; - nfound = diff_array(buf1, + found = diff_array(buf1, buf2, nelmts1, rank1, @@ -241,10 +240,10 @@ int diff_attr(hid_t loc1_id, attr2_id); /* print again */ options->m_quiet=0; - if (nfound) + if (found) { printf( "Attribute: <%s> and <%s>\n",np1,np2); - nfound = diff_array(buf1, + found = diff_array(buf1, buf2, nelmts1, rank1, @@ -255,13 +254,14 @@ int diff_attr(hid_t loc1_id, mtype1_id, attr1_id, attr2_id); - print_found(nfound); + print_found(found); + nfound += found; } /*if*/ } /*if*/ /* in quiet mode, just count differences */ else { - nfound = diff_array(buf1, + found = diff_array(buf1, buf2, nelmts1, rank1, @@ -272,6 +272,7 @@ int diff_attr(hid_t loc1_id, mtype1_id, attr1_id, attr2_id); + nfound += found; } /*else quiet */ } /*else verbose */ }/*cmp*/ @@ -297,7 +298,7 @@ int diff_attr(hid_t loc1_id, HDfree(buf2); } /* i */ - return ret; + return nfound; error: H5E_BEGIN_TRY { @@ -316,7 +317,7 @@ error: } H5E_END_TRY; options->err_stat=1; - return 0; + return nfound; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 9d65552..df2bc36 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -390,7 +390,7 @@ hsize_t diff_datasetid( hid_t dset1_id, */ if (obj1_name!=NULL) - diff_attr(dset1_id,dset2_id,obj1_name,obj2_name,options); + nfound += diff_attr(dset1_id,dset2_id,obj1_name,obj2_name,options); }/*cmp*/ diff --git a/tools/testfiles/h5diff_70.txt b/tools/testfiles/h5diff_70.txt index c883348..d02f77d 100644 --- a/tools/testfiles/h5diff_70.txt +++ b/tools/testfiles/h5diff_70.txt @@ -1139,7 +1139,7 @@ position float3D of </> float3D of </> difference [ 3 2 0 ] 23.000000 0.000000 23.000000 [ 3 2 1 ] 24.000000 0.000000 24.000000 24 differences found -0 differences found +912 differences found -------------------------------- Some objects are not comparable -------------------------------- |