diff options
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.c | 24 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 153 |
2 files changed, 86 insertions, 91 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index dc32b9e..38bbcf55 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1052,33 +1052,33 @@ hsize_t diff (hid_t file1_id, char *buf1 = NULL; char *buf2 = NULL; - if (H5Gget_objinfo (file1_id, path1, FALSE, &sb1) < 0) + if(H5Gget_objinfo(file1_id, path1, FALSE, &sb1) < 0) goto out; - if (H5Gget_objinfo (file1_id, path1, FALSE, &sb2) < 0) + if(H5Gget_objinfo(file1_id, path1, FALSE, &sb2) < 0) goto out; - buf1 = HDmalloc (sb1.linklen); - buf2 = HDmalloc (sb2.linklen); + buf1 = HDmalloc(sb1.linklen); + buf2 = HDmalloc(sb2.linklen); - if (H5Gget_linkval (file1_id, path1, sb1.linklen, buf1) < 0) + if(H5Lget_val(file1_id, path1, buf1, sb1.linklen, H5P_DEFAULT) < 0) goto out; - if (H5Gget_linkval (file2_id, path2, sb1.linklen, buf2) < 0) + if(H5Lget_val(file2_id, path2, buf2, sb2.linklen, H5P_DEFAULT) < 0) goto out; - ret = HDstrcmp (buf1, buf2); + ret = HDstrcmp(buf1, buf2); /* if "buf1" != "buf2" then the links are "different" */ nfound = (ret != 0) ? 1 : 0; - if (print_objname (options, nfound)) - do_print_objname ("link", path1, path2); + if(print_objname(options, nfound)) + do_print_objname("link", path1, path2); /* always print the number of differences found in verbose mode */ - if (options->m_verbose) + if(options->m_verbose) print_found(nfound); - HDfree (buf1); - HDfree (buf2); + HDfree(buf1); + HDfree(buf2); } break; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index c824b3d..7ba2cc3 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -611,85 +611,80 @@ static int traverse( hid_t loc_id, break; - /*------------------------------------------------------------------------- - * H5G_LINK - *------------------------------------------------------------------------- - */ - - case H5G_LINK: - { - /* increment */ - inserted_objs++; - - /* add object to table */ - trav_table_add(HADDR_UNDEF, path, H5G_LINK, table ); - - if (statbuf.linklen>0) - { - char *targbuf; - - targbuf = HDmalloc(statbuf.linklen); - assert(targbuf); - H5Gget_linkval(loc_id,path,statbuf.linklen,targbuf); - if (print) - printf(" %-10s %s -> %s\n", "link", path, targbuf); - free(targbuf); - } - else - { - if (print) - printf(" %-10s %s ->\n", "link", path); - } - } - - break; - - /*------------------------------------------------------------------------- - * H5G_UDLINK - *------------------------------------------------------------------------- - */ - - case H5G_UDLINK: - { - H5L_info_t linkbuf; - - /* increment */ - inserted_objs++; - - /* add object to table */ - trav_table_add(HADDR_UNDEF, path, H5G_UDLINK, table ); - - /* Get type of link */ - H5E_BEGIN_TRY { - /* get link class info */ - H5Lget_info( loc_id, path, &linkbuf, H5P_DEFAULT); - } H5E_END_TRY; - - if(linkbuf.type == H5L_TYPE_EXTERNAL) { - if(statbuf.linklen > 0) { - char *targbuf; - const char *filename; - const char *objname; - - targbuf = HDmalloc(statbuf.linklen); - assert(targbuf); - H5Gget_linkval(loc_id, path, statbuf.linklen, targbuf); - H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &objname); - if(print) - printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); - free(targbuf); - } /* end if */ - else { - if(print) - printf(" %-10s %s ->\n", "udlink", path); - } /* end else */ - } /* end if */ - else { /* Unknown user-defined type */ - if(print) - printf(" %-10s %s ->\n", "UD link type", path); - } /* end else */ - } - break; + /*------------------------------------------------------------------------- + * H5G_LINK + *------------------------------------------------------------------------- + */ + + case H5G_LINK: + /* increment */ + inserted_objs++; + + /* add object to table */ + trav_table_add(HADDR_UNDEF, path, H5G_LINK, table); + + if(statbuf.linklen > 0) { + char *targbuf; + + targbuf = HDmalloc(statbuf.linklen); + assert(targbuf); + H5Lget_val(loc_id, path, targbuf, statbuf.linklen, H5P_DEFAULT); + if(print) + printf(" %-10s %s -> %s\n", "link", path, targbuf); + free(targbuf); + } + else { + if(print) + printf(" %-10s %s ->\n", "link", path); + } + break; + + /*------------------------------------------------------------------------- + * H5G_UDLINK + *------------------------------------------------------------------------- + */ + + case H5G_UDLINK: + { + H5L_info_t linkbuf; + + /* increment */ + inserted_objs++; + + /* add object to table */ + trav_table_add(HADDR_UNDEF, path, H5G_UDLINK, table ); + + /* Get type of link */ + H5E_BEGIN_TRY { + /* get link class info */ + H5Lget_info( loc_id, path, &linkbuf, H5P_DEFAULT); + } H5E_END_TRY; + + if(linkbuf.type == H5L_TYPE_EXTERNAL) { + if(statbuf.linklen > 0) { + char *targbuf; + const char *filename; + const char *objname; + + targbuf = HDmalloc(statbuf.linklen); + assert(targbuf); + H5Lget_val(loc_id, path, targbuf, statbuf.linklen, H5P_DEFAULT); + H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &objname); + if(print) + printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); + free(targbuf); + } /* end if */ + else { + if(print) + printf(" %-10s %s ->\n", "udlink", path); + } /* end else */ + } /* end if */ + else { /* Unknown user-defined type */ + if(print) + printf(" %-10s %s ->\n", "UD link type", path); + } /* end else */ + } + break; default: |