diff options
author | Jonathan Kim <jkm@hdfgroup.org> | 2010-11-02 16:57:16 (GMT) |
---|---|---|
committer | Jonathan Kim <jkm@hdfgroup.org> | 2010-11-02 16:57:16 (GMT) |
commit | 13c16c89823a412f3d6504f249836c7ed73f5c81 (patch) | |
tree | 44ac93eb296b0602faf8492e89d3ab6e9102f6ca /tools/lib | |
parent | d3770ffaefbf34b502ca31fbbcd3ffab565c70b2 (diff) | |
download | hdf5-13c16c89823a412f3d6504f249836c7ed73f5c81.zip hdf5-13c16c89823a412f3d6504f249836c7ed73f5c81.tar.gz hdf5-13c16c89823a412f3d6504f249836c7ed73f5c81.tar.bz2 |
[svn-r19713] Purpose:
Fixed h5diff to handle variable-length strings in a compound dataset
correctly. Also variable-length string array in a compound dataset.
Bug #1989.
Description:
Garbage values were displayed when h5diff compared variable-length
strings (or string array) in a compound type dataset.
Merged from hdf5 trunk r19712.
Tested:
jam (linux32-LE), heiwa (linuxppc64-BE)
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff_array.c | 106 |
1 files changed, 76 insertions, 30 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index d3f3c6b..969aabd 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -447,21 +447,43 @@ hsize_t diff_datum(void *_mem1, { offset = H5Tget_member_offset(m_type, (unsigned)j); memb_type = H5Tget_member_type(m_type, (unsigned)j); - nfound+=diff_datum( - mem1+offset, - mem2+offset, - memb_type, - i, - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - container1_id, - container2_id, - ph); + /* if member type is vlen string */ + if(H5Tis_variable_str(memb_type)) + { + nfound+=diff_datum( + ((unsigned char**)mem1)[j], + ((unsigned char**)mem2)[j], + memb_type, + i, + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + container1_id, + container2_id, + ph); + } + else + { + nfound+=diff_datum( + mem1+offset, + mem2+offset, + memb_type, + i, + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + container1_id, + container2_id, + ph); + } H5Tclose(memb_type); } break; @@ -631,21 +653,45 @@ hsize_t diff_datum(void *_mem1, for (u = 0, nelmts = 1; u <ndims; u++) nelmts *= adims[u]; for (u = 0; u < nelmts; u++) - nfound+=diff_datum( - mem1 + u * size, - mem2 + u * size, /* offset */ - memb_type, - i, /* index position */ - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - container1_id, - container2_id, - ph); + { + /* if member type is vlen string */ + if(H5Tis_variable_str(memb_type)) + { + nfound+=diff_datum( + ((unsigned char**)mem1)[u], + ((unsigned char**)mem2)[u], + memb_type, + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + container1_id, + container2_id, + ph); + } + else + { + nfound+=diff_datum( + mem1 + u * size, + mem2 + u * size, /* offset */ + memb_type, + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + container1_id, + container2_id, + ph); + } + } H5Tclose(memb_type); } break; |