From 56c3ec98207bb6c4b3e6a7b9523c2a1e849879c3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 15 May 2017 12:33:58 -0500 Subject: HDFFV-10128 add test to check null term Test is another dataset --- tools/lib/h5diff_array.c | 87 ++++++++++++++++----------- tools/test/h5diff/CMakeTests.cmake | 2 +- tools/test/h5diff/h5diffgentest.c | 28 +++++++++ tools/test/h5diff/testfiles/diff_strings1.h5 | Bin 4464 -> 4640 bytes tools/test/h5diff/testfiles/diff_strings2.h5 | Bin 4464 -> 4640 bytes tools/test/h5diff/testfiles/h5diff_tmp1.txt | 14 ++++- 6 files changed, 94 insertions(+), 37 deletions(-) diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index bb2cd8a..0a9d18a 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -658,16 +658,17 @@ static hsize_t diff_datum(void *_mem1, case H5T_STRING: h5difftrace("diff_datum H5T_STRING\n"); { - char *s; - char *s1; - char *s2; - size_t size1; - size_t size2; - H5T_str_t pad = H5Tget_strpad(m_type); - + char *s = NULL; + char *sx = NULL; + char *s1 = NULL; + char *s2 = NULL; + size_t size1; + size_t size2; + size_t sizex; + H5T_str_t pad = H5Tget_strpad(m_type); + /* if variable length string */ - if(H5Tis_variable_str(m_type)) - { + if(H5Tis_variable_str(m_type)) { h5difftrace("diff_datum H5T_STRING variable\n"); /* Get pointer to first string */ s1 = *(char**) mem1; @@ -685,8 +686,7 @@ static hsize_t diff_datum(void *_mem1, s2 = (char*) mem2; size2 = HDstrlen(s2); } - else - { + else { /* Get pointer to first string */ s1 = (char *)mem1; size1 = H5Tget_size(m_type); @@ -703,42 +703,59 @@ static hsize_t diff_datum(void *_mem1, */ h5diffdebug2("diff_datum string size:%d\n",size1); h5diffdebug2("diff_datum string size:%d\n",size2); - if(size1 != size2) - { + if(size1 != size2) { h5difftrace("diff_datum string sizes\n"); nfound++; } - if(size1 < size2) - { + if(size1 < size2) { size = size1; s = s1; + sizex = size2; + sx = s2; } - else - { + else { size = size2; s = s2; + sizex = size1; + sx = s1; } /* check for NULL pointer for string */ - if(s!=NULL) - { + if(s!=NULL) { /* try fast compare first */ - if (HDmemcmp(s1, s2, size)==0) - break; - for (u=0; u> and > +3 differences found +attribute: > and > +1 differences found +attribute: > and > +1 differences found +attribute: > and > +1 differences found +attribute: > and > +1 differences found +attribute: > and > +1 differences found -------------------------------- Some objects are not comparable -------------------------------- Use -c for a list of objects. -EXIT CODE: 0 +EXIT CODE: 1 -- cgit v0.12