summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-05-15 17:33:58 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-05-15 17:33:58 (GMT)
commit56c3ec98207bb6c4b3e6a7b9523c2a1e849879c3 (patch)
tree6d76921d8b37e6286c1a8432588dc2336468a7d8 /tools/lib
parent7078993d63aab4e239e4ae9c970b4b19d38352fa (diff)
downloadhdf5-56c3ec98207bb6c4b3e6a7b9523c2a1e849879c3.zip
hdf5-56c3ec98207bb6c4b3e6a7b9523c2a1e849879c3.tar.gz
hdf5-56c3ec98207bb6c4b3e6a7b9523c2a1e849879c3.tar.bz2
HDFFV-10128 add test to check null term
Test is another dataset
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff_array.c87
1 files changed, 52 insertions, 35 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<size; u++)
- nfound+=character_compare(
- s1 + u,
- s2 + u, /* offset */
- i, /* index position */
- u, /* string character position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
+ if(HDmemcmp(s1, s2, size)==0) {
+ if(size1 != size2)
+ if(print_data(options))
+ for (u=size; u<sizex; u++)
+ character_compare(
+ s1 + u,
+ s2 + u, /* offset */
+ i, /* index position */
+ u, /* string character position */
+ rank,
+ dims,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ ph);
+ }
+ else
+ for (u=0; u<size; u++)
+ nfound+=character_compare(
+ s1 + u,
+ s2 + u, /* offset */
+ i, /* index position */
+ u, /* string character position */
+ rank,
+ dims,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ ph);
}
}