summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff_attr.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 3078369..6474082 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -326,6 +326,8 @@ hsize_t diff_attr(hid_t loc1_id,
hid_t space2_id=-1; /* space ID */
hid_t ftype1_id=-1; /* file data type ID */
hid_t ftype2_id=-1; /* file data type ID */
+ int vstrtype1=0; /* ftype1 is a variable string */
+ int vstrtype2=0; /* ftype2 is a variable string */
hid_t mtype1_id=-1; /* memory data type ID */
hid_t mtype2_id=-1; /* memory data type ID */
size_t msize1; /* memory size of memory type */
@@ -378,8 +380,19 @@ hsize_t diff_attr(hid_t loc1_id,
/* get the datatypes */
if((ftype1_id = H5Aget_type(attr1_id)) < 0)
goto error;
+ vstrtype1 = H5Tis_variable_str(ftype1_id);
if((ftype2_id = H5Aget_type(attr2_id)) < 0)
goto error;
+ vstrtype2 = H5Tis_variable_str(ftype2_id);
+ /* no compare if either one but not both are variable string type */
+ if (vstrtype1 != vstrtype2){
+ if ((options->m_verbose||options->m_list_not_cmp))
+ parallel_print("Not comparable: one of attribute <%s/%s> or <%s/%s> is of variable length type\n",
+ path1, name1, path2, name2);
+ options->not_cmp = 1;
+ return 0;
+ }
+
if((mtype1_id = h5tools_get_native_type(ftype1_id))<0)
goto error;
if((mtype2_id = h5tools_get_native_type(ftype2_id))<0)
@@ -451,16 +464,20 @@ hsize_t diff_attr(hid_t loc1_id,
buf1 = (void *)HDmalloc((size_t)(nelmts1 * msize1));
buf2 = (void *)HDmalloc((size_t)(nelmts1 * msize2));
- if(buf1 == NULL || buf2 == NULL) {
+ if(buf1 == NULL || buf2 == NULL){
parallel_print( "cannot read into memory\n" );
goto error;
}
- if(H5Aread(attr1_id,mtype1_id,buf1) < 0)
- goto error;
- buf1hasdata = 1;
- if(H5Aread(attr2_id,mtype2_id,buf2) < 0)
- goto error;
- buf2hasdata = 1;
+ if(H5Aread(attr1_id,mtype1_id,buf1) < 0){
+ parallel_print("Failed reading attribute1 %s/%s\n", path1, name1);
+ goto error;
+ }else
+ buf1hasdata = 1;
+ if(H5Aread(attr2_id,mtype2_id,buf2) < 0){
+ parallel_print("Failed reading attribute2 %s/%s\n", path2, name2);
+ goto error;
+ }else
+ buf2hasdata = 1;
/* format output string */
HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1);