summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-05-12 19:40:39 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-05-12 19:40:39 (GMT)
commit7078993d63aab4e239e4ae9c970b4b19d38352fa (patch)
treee9b33540e5817fda6ebd2478d45f8dd364da3721 /tools
parent5e60a0e10e167f9caa8de84100f22f47658f2cf2 (diff)
downloadhdf5-7078993d63aab4e239e4ae9c970b4b19d38352fa.zip
hdf5-7078993d63aab4e239e4ae9c970b4b19d38352fa.tar.gz
hdf5-7078993d63aab4e239e4ae9c970b4b19d38352fa.tar.bz2
HDFFV-10128 Fix null term strings
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff_array.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 49f41dc..bb2cd8a 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -623,6 +623,7 @@ static hsize_t diff_datum(void *_mem1,
*-------------------------------------------------------------------------
*/
case H5T_COMPOUND:
+ h5difftrace("diff_datum H5T_COMPOUND\n");
nmembs = members->n;
@@ -655,18 +656,19 @@ static hsize_t diff_datum(void *_mem1,
*-------------------------------------------------------------------------
*/
case H5T_STRING:
-
+ h5difftrace("diff_datum H5T_STRING\n");
{
- H5T_str_t pad;
char *s;
char *s1;
char *s2;
size_t size1;
size_t size2;
-
+ H5T_str_t pad = H5Tget_strpad(m_type);
+
/* if variable length string */
if(H5Tis_variable_str(m_type))
{
+ h5difftrace("diff_datum H5T_STRING variable\n");
/* Get pointer to first string */
s1 = *(char**) mem1;
size1 = HDstrlen(s1);
@@ -674,6 +676,15 @@ static hsize_t diff_datum(void *_mem1,
s2 = *(char**) mem2;
size2 = HDstrlen(s2);
}
+ else if (H5T_STR_NULLTERM == pad) {
+ h5difftrace("diff_datum H5T_STRING null term\n");
+ /* Get pointer to first string */
+ s1 = (char*) mem1;
+ size1 = HDstrlen(s1);
+ /* Get pointer to second string */
+ s2 = (char*) mem2;
+ size2 = HDstrlen(s2);
+ }
else
{
/* Get pointer to first string */
@@ -714,9 +725,6 @@ static hsize_t diff_datum(void *_mem1,
/* try fast compare first */
if (HDmemcmp(s1, s2, size)==0)
break;
-
- pad = H5Tget_strpad(m_type);
-
for (u=0; u<size; u++)
nfound+=character_compare(
s1 + u,
@@ -741,6 +749,7 @@ static hsize_t diff_datum(void *_mem1,
*-------------------------------------------------------------------------
*/
case H5T_BITFIELD:
+ h5difftrace("diff_datum H5T_BITFIELD\n");
/* byte-by-byte comparison */
for (u=0; u<type_size; u++)
@@ -764,7 +773,7 @@ static hsize_t diff_datum(void *_mem1,
*-------------------------------------------------------------------------
*/
case H5T_OPAQUE:
-
+ h5difftrace("diff_datum H5T_OPAQUE\n");
/* byte-by-byte comparison */
for (u=0; u<type_size; u++)
nfound+=character_compare_opt(
@@ -788,6 +797,7 @@ static hsize_t diff_datum(void *_mem1,
*-------------------------------------------------------------------------
*/
case H5T_ENUM:
+ h5difftrace("diff_datum H5T_ENUM\n");
/* For enumeration types we compare the names instead of the
integer values. For each pair of elements being