From 4f0b92bdd5d35395b3ee0d90a84133032b85e8ff Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 16 May 2017 09:28:49 -0500 Subject: HDFFV-10128 Fixed string length with no null fixed --- tools/lib/h5diff_array.c | 9 +++++++-- tools/test/h5diff/CMakeTests.cmake | 2 +- tools/test/h5diff/testfiles/h5diff_tmp1.txt | 14 +------------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 0a9d18a..499d5eb 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -665,6 +665,7 @@ static hsize_t diff_datum(void *_mem1, size_t size1; size_t size2; size_t sizex; + size_t size_mtype = H5Tget_size(m_type); H5T_str_t pad = H5Tget_strpad(m_type); /* if variable length string */ @@ -682,17 +683,21 @@ static hsize_t diff_datum(void *_mem1, /* Get pointer to first string */ s1 = (char*) mem1; size1 = HDstrlen(s1); + if (size1 > size_mtype) + size1 = size_mtype; /* Get pointer to second string */ s2 = (char*) mem2; size2 = HDstrlen(s2); + if (size2 > size_mtype) + size2 = size_mtype; } else { /* Get pointer to first string */ s1 = (char *)mem1; - size1 = H5Tget_size(m_type); + size1 = size_mtype; /* Get pointer to second string */ s2 = (char *)mem2; - size2 = H5Tget_size(m_type); + size2 = size_mtype; } /* diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 5759c2b..f6cd2dd 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -1130,7 +1130,7 @@ ADD_H5_TEST (h5diff_631 0 -v --use-system-epsilon ${FILE1} ${FILE1} g1/fp18 g1/f # ############################################################################## ADD_H5_TEST (h5diff_70 1 -v ${FILE5} ${FILE6}) # temporary test to verify HDF5-8625 -ADD_H5_TEST (h5diff_tmp1 1 tmptest2.he5 tmptest.he5) +ADD_H5_TEST (h5diff_tmp1 0 tmptest2.he5 tmptest.he5) # temporary test to verify HDF5-8639 ADD_H5_TEST (h5diff_tmp2 1 tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.reference.h5) diff --git a/tools/test/h5diff/testfiles/h5diff_tmp1.txt b/tools/test/h5diff/testfiles/h5diff_tmp1.txt index e2bb247..40e3fb6 100644 --- a/tools/test/h5diff/testfiles/h5diff_tmp1.txt +++ b/tools/test/h5diff/testfiles/h5diff_tmp1.txt @@ -1,17 +1,5 @@ -attribute: > 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: 1 +EXIT CODE: 0 -- cgit v0.12