diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 7 | ||||
-rw-r--r-- | tools/h5repack/h5repack_refs.c | 7 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 26 |
3 files changed, 22 insertions, 18 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index dedca0a..5734285 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -901,10 +901,11 @@ int copy_attr(hid_t loc_in, int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ char name[255]; - int n, j; + H5O_info_t oinfo; /* Object info */ + int j; unsigned u; - if ((n = H5Aget_num_attrs(loc_in))<0) + if(H5Oget_info(loc_in, ".", &oinfo, H5P_DEFAULT) < 0) goto error; /*------------------------------------------------------------------------- @@ -912,7 +913,7 @@ int copy_attr(hid_t loc_in, *------------------------------------------------------------------------- */ - for ( u = 0; u < (unsigned)n; u++) + for ( u = 0; u < (unsigned)oinfo.num_attrs; u++) { buf=NULL; diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index f1738e8..8ec1cfd 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -418,13 +418,14 @@ static int copy_refs_attr(hid_t loc_in, int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ char name[255]; - int n, j; + H5O_info_t oinfo; /* Object info */ + int j; unsigned u; - if((n = H5Aget_num_attrs(loc_in)) < 0) + if(H5Oget_info(loc_in, ".", &oinfo, H5P_DEFAULT) < 0) goto error; - for(u = 0; u < (unsigned)n; u++) { + for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 89d18d3..26c93d3 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -65,30 +65,31 @@ hsize_t diff_attr(hid_t loc1_id, char name2[512]; char np1[512]; char np2[512]; - int n1, n2, i, j; - hsize_t nfound=0; - hsize_t nfound_total=0; + H5O_info_t oinfo1, oinfo2; /* Object info */ + unsigned u; /* Local index variable */ + hsize_t nfound = 0; + hsize_t nfound_total = 0; int cmp=1; - if ((n1 = H5Aget_num_attrs(loc1_id))<0) + if(H5Oget_info(loc1_id, ".", &oinfo1, H5P_DEFAULT) < 0) goto error; - if ((n2 = H5Aget_num_attrs(loc2_id))<0) + if(H5Oget_info(loc2_id, ".", &oinfo2, H5P_DEFAULT) < 0) goto error; - if (n1!=n2) + if(oinfo1.num_attrs != oinfo2.num_attrs) return 1; - for ( i = 0; i < n1; i++) + for(u = 0; u < (unsigned)oinfo1.num_attrs; u++) { /* reset buffers for every attribute, we might goto out and call free */ - buf1=NULL; - buf2=NULL; + buf1 = NULL; + buf2 = NULL; /* open attribute */ - if ((attr1_id = H5Aopen_idx(loc1_id, (unsigned)i))<0) + if((attr1_id = H5Aopen_idx(loc1_id, u)) < 0) goto error; /* get name */ - if (H5Aget_name( attr1_id, 255, name1 )<0) + if(H5Aget_name(attr1_id, 255, name1) < 0) goto error; /* use the name on the first file to open the second file */ @@ -148,6 +149,7 @@ hsize_t diff_attr(hid_t loc1_id, */ if (cmp) { + int j; /*------------------------------------------------------------------------- * read to memory @@ -287,7 +289,7 @@ hsize_t diff_attr(hid_t loc1_id, HDfree(buf2); nfound_total += nfound; - } /* i */ + } /* u */ return nfound_total; |