From 61d964625ebb39af5326bc11dc52790ab39c8202 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Fri, 31 Oct 2003 16:18:09 -0500 Subject: [svn-r7804] Purpose: h5diff new feature Description: added diff for the class ENUM Solution: Platforms tested: linux solaris 2.7 IRIX Misc. update: --- tools/h5diff/test_h5diff.c | 2 +- tools/lib/h5diff_array.c | 80 ++++++++++++++++++++++++++++++++++++++++------ tools/lib/h5diff_dset.c | 34 ++++++++++++-------- 3 files changed, 92 insertions(+), 24 deletions(-) diff --git a/tools/h5diff/test_h5diff.c b/tools/h5diff/test_h5diff.c index 783eb42..7247fcd 100644 --- a/tools/h5diff/test_h5diff.c +++ b/tools/h5diff/test_h5diff.c @@ -74,7 +74,7 @@ int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, /* Write the buf */ if ( buf ) - assert(H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)>=0); + H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf); /* Close */ status = H5Dclose(dataset_id); diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index e65ae83..0a2eb41 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -175,21 +175,20 @@ int diff_array_mem( void *_mem1, { char fmt_llong[255], fmt_ullong[255]; char fmt_llongp[255], fmt_ullongp[255]; - size_t type_size; - static int ph=1; /* print header */ - int nfound=0; /* differences found */ + hsize_t dims[H5S_MAX_RANK]; unsigned char *mem1 = (unsigned char*)_mem1; unsigned char *mem2 = (unsigned char*)_mem2; unsigned u; hid_t memb_type; + size_t type_size; size_t offset; int nmembs; int j; - hsize_t dims[H5S_MAX_RANK]; hsize_t nelmts; hsize_t ndims; size_t size; - + static int ph=1; /* print header */ + int nfound=0; /* differences found */ /* Build default formats for long long types */ sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", @@ -271,13 +270,35 @@ int diff_array_mem( void *_mem1, break; /*------------------------------------------------------------------------- - * H5T_BITFIELD, H5T_OPAQUE, H5T_ENUM + * H5T_BITFIELD *------------------------------------------------------------------------- */ case H5T_BITFIELD: + { + /* byte-by-byte comparison */ + for (u=0; u= 0) && + (H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2) >= 0)) + { + if (HDstrcmp(enum_name1,enum_name2)!=0) + nfound=1; + } + else + { + for (u=0; u\n", obj1_name ); - goto out; + gout=1; } if ( (dset2_id = H5Dopen(file2_id,obj2_name)) < 0 ) { printf("Cannot open dataset <%s>\n", obj2_name ); - goto out; + gout=1; } /* enable error reporting */ } H5E_END_TRY; + if (gout) + goto out; /* Get the dataspace handle */ if ( (space1_id = H5Dget_space(dset1_id)) < 0 ) @@ -373,13 +375,13 @@ int diff_dataset( hid_t file1_id, { if ( m_size1 < m_size2 ) { - assert( (H5Tclose(m_type1)) >=0); + H5Tclose(m_type1); m_type1 = H5Tget_native_type( f_type2 , H5T_DIR_DEFAULT); m_size1 = H5Tget_size( m_type1 ); } else { - assert( (H5Tclose(m_type2)) >=0); + H5Tclose(m_type2); m_type2 = H5Tget_native_type( f_type1 , H5T_DIR_DEFAULT); m_size2 = H5Tget_size( m_type2 ); } @@ -434,15 +436,19 @@ out: if ( buf1) HDfree(buf1); if ( buf2) HDfree(buf2); - /* Close */ - if ( dset1_id!=-1 ) assert( (H5Dclose(dset1_id)) >=0); - if ( dset2_id!=-1 ) assert( (H5Dclose(dset2_id)) >=0); - if ( space1_id!=-1 ) assert( (H5Sclose(space1_id)) >=0); - if ( space2_id!=-1 ) assert( (H5Sclose(space2_id)) >=0); - if ( f_type1!=-1 ) assert( (H5Tclose(f_type1)) >=0); - if ( f_type2!=-1 ) assert( (H5Tclose(f_type2)) >=0); - if ( m_type1!=-1 ) assert( (H5Tclose(m_type1)) >=0); - if ( m_type2!=-1 ) assert( (H5Tclose(m_type2)) >=0); + /* close */ + /* disable error reporting */ + H5E_BEGIN_TRY { + H5Dclose(dset1_id); + H5Dclose(dset2_id); + H5Sclose(space1_id); + H5Sclose(space2_id); + H5Tclose(f_type1); + H5Tclose(f_type2); + H5Tclose(m_type1); + H5Tclose(m_type2); + /* enable error reporting */ + } H5E_END_TRY; return nfound; -- cgit v0.12