diff options
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 22 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 18 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 8 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 2 |
5 files changed, 46 insertions, 9 deletions
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 21420ce..7f7b451 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_TOOLS_LIB) #----------------------------------------------------------------------------- +# Apply Definitions to compiler in this directory and below +#----------------------------------------------------------------------------- +ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS}) + +#----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index f2eb3ab..2b4fa29 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1547,6 +1547,8 @@ hsize_t diff(hid_t file1_id, diff_opt_t * options, diff_args_t *argdata) { + hid_t dset1_id = (-1); + hid_t dset2_id = (-1); hid_t type1_id = (-1); hid_t type2_id = (-1); hid_t grp1_id = (-1); @@ -1714,6 +1716,10 @@ hsize_t diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_DATASET: + if((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0) + goto out; + if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0) + goto out; /* verbose (-v) and report (-r) mode */ if(options->m_verbose || options->m_report) { @@ -1737,6 +1743,22 @@ hsize_t diff(hid_t file1_id, print_found(nfound); } } + + + /*--------------------------------------------------------- + * compare attributes + * if condition refers to cases when the dataset is a + * referenced object + *--------------------------------------------------------- + */ + if(path1) + nfound += diff_attr(dset1_id, dset2_id, path1, path2, options); + + + if(H5Dclose(dset1_id) < 0) + goto out; + if(H5Dclose(dset2_id) < 0) + goto out; break; /*---------------------------------------------------------------------- diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 144159a..130a0d8 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -207,6 +207,12 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t table_lp->nattrs_only2++; curr2++; } + + /* close for next turn */ + H5Aclose(attr1_id); + attr1_id = -1; + H5Aclose(attr2_id); + attr2_id = -1; } /* end while */ /* list1 did not end */ @@ -225,6 +231,10 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t table_attr_mark_exist(infile, name1, table_lp); table_lp->nattrs_only1++; curr1++; + + /* close for next turn */ + H5Aclose(attr1_id); + attr1_id = -1; } /* list2 did not end */ @@ -243,6 +253,9 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t table_attr_mark_exist(infile, name2, table_lp); table_lp->nattrs_only2++; curr2++; + + /* close for next turn */ + H5Aclose(attr2_id); } /*------------------------------------------------------ @@ -272,6 +285,11 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t return 0; error: + if (0 < attr1_id) + H5Aclose(attr1_id); + if (0 < attr2_id) + H5Aclose(attr2_id); + return -1; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index f9c7d1c..f6e6329 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -507,14 +507,6 @@ hsize_t diff_datasetid( hid_t did1, } /* hyperslab read */ } /*can_compare*/ - /*------------------------------------------------------------------------- - * compare attributes - * the if condition refers to cases when the dataset is a referenced object - *------------------------------------------------------------------------- - */ - h5difftrace("compare attributes?\n"); - if(obj1_name) - nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); /*------------------------------------------------------------------------- * close diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 3e3a4cf..4fbd84f 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -435,7 +435,7 @@ typedef struct h5tool_format_t { * indentlevel: a string that shows how far to indent if extra spacing * is needed. dumper uses it. */ - int line_ncols; /*columns of output */ + unsigned line_ncols; /*columns of output */ size_t line_per_line; /*max elements per line */ const char *line_pre; /*prefix at front of each line */ const char *line_1st; /*alternate pre. on first line */ |