diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2011-05-10 16:11:11 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2011-05-10 16:11:11 (GMT) |
commit | acf8608ce6e64ab46b7242889c359cf40f2f82e7 (patch) | |
tree | 0afef4957af90ec6227af1e1bf2717dce7660e8d /tools/lib | |
parent | 49d12a044ce33b9765e6b20c2e761cd9990e6e9b (diff) | |
download | hdf5-acf8608ce6e64ab46b7242889c359cf40f2f82e7.zip hdf5-acf8608ce6e64ab46b7242889c359cf40f2f82e7.tar.gz hdf5-acf8608ce6e64ab46b7242889c359cf40f2f82e7.tar.bz2 |
[svn-r20789] Merged 20724 and 20756 from the trunk to fix HDFFV-7527 concerning
invalid enum value comparisons.
Tested on: h5committest
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff_array.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index c4c8dbf..6c5744f 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -621,12 +621,43 @@ hsize_t diff_datum(void *_mem1, char enum_name1[1024]; char enum_name2[1024]; + herr_t err1; + herr_t err2; + /* disable error reporting */ H5E_BEGIN_TRY { - if ((H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1) >= 0) && - (H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2) >= 0)) + /* If the enum value cannot be converted to a string + * it is set to an error string for later output. + */ + err1 = H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1); + if(err1 < 0) + strcpy(enum_name1, "**INVALID VALUE**"); + + err2 = H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2); + if(err2 < 0) + strcpy(enum_name2, "**INVALID VALUE**"); + + if(err1 < 0 || err2 < 0) { + /* One or more bad enum values */ + + /* If the two values cannot be converted to a string + * (probably due to them being invalid enum values), + * don't attempt to convert them - just report errors. + */ + nfound += 1; + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(S_FORMAT,enum_name1,enum_name2); + } + } + else + { + /* Both enum values were valid */ + if (HDstrcmp(enum_name1,enum_name2)!=0) { nfound=1; |