HDFFV-10128 add test to check null term

Test is another dataset
This commit is contained in:
Allen Byrne
2017-05-15 12:33:58 -05:00
parent 7078993d63
commit 56c3ec9820
6 changed files with 94 additions and 37 deletions

View File

@@ -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);
}
}