diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2022-07-18 13:20:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-18 13:20:45 (GMT) |
commit | daf9562f7768660a86ef933ab41a7b67342ad377 (patch) | |
tree | 3b39523e0d14eb6456358679f2129db9b86b12c5 | |
parent | 2c966f1e55da4223c0a1fa08733400851e27bd70 (diff) | |
download | hdf5-daf9562f7768660a86ef933ab41a7b67342ad377.zip hdf5-daf9562f7768660a86ef933ab41a7b67342ad377.tar.gz hdf5-daf9562f7768660a86ef933ab41a7b67342ad377.tar.bz2 |
1.10 eliminate unnecessary errors in the error stack (#1881)
* Eliminate unnecessary error output
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
-rw-r--r-- | tools/lib/h5tools_str.c | 32 | ||||
-rw-r--r-- | tools/lib/h5tools_str.h | 3 |
2 files changed, 19 insertions, 16 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 8a592f7..0a44fc3 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1074,7 +1074,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* if (H5Tequal(type, H5T_STD_REF_DSETREG)) */ H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_DSETREG"); h5tools_str_append(str, H5_TOOLS_DATASET); - h5tools_str_sprint_reference(str, container, vp); + h5tools_str_sprint_reference(str, container, H5R_DATASET_REGION, vp); } else if (nsize == H5R_OBJ_REF_BUF_SIZE) { /* if (H5Tequal(type, H5T_STD_REF_OBJ)) */ @@ -1115,7 +1115,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr); - h5tools_str_sprint_reference(str, container, vp); + h5tools_str_sprint_reference(str, container, H5R_OBJECT, vp); } /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */ } break; @@ -1265,7 +1265,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai *------------------------------------------------------------------------- */ void -h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp) +h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, H5R_type_t ref_type, void *vp) { hid_t obj = H5I_INVALID_HID; hid_t region = H5I_INVALID_HID; @@ -1275,18 +1275,20 @@ h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp) H5TOOLS_START_DEBUG(" "); h5tools_str_append(str, " \""); - obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, vp); - if (obj >= 0) { - region = H5Rget_region(container, H5R_DATASET_REGION, vp); - if (region >= 0) { - H5Rget_name(obj, H5R_DATASET_REGION, vp, (char *)ref_name, 1024); - h5tools_str_append(str, "%s", ref_name); - - H5Sclose(region); - } /* end if (region >= 0) */ - H5Dclose(obj); - } /* end if (obj >= 0) */ - else { + if (ref_type == H5R_DATASET_REGION) { + obj = H5Rdereference2(container, H5P_DEFAULT, ref_type, vp); + if (obj >= 0) { + region = H5Rget_region(container, ref_type, vp); + if (region >= 0) { + H5Rget_name(obj, ref_type, vp, (char *)ref_name, 1024); + h5tools_str_append(str, "%s", ref_name); + + H5Sclose(region); + } /* end if (region >= 0) */ + H5Dclose(obj); + } /* end if (obj >= 0) */ + } + else if (ref_type == H5R_OBJECT) { /* Print name */ path = lookup_ref_path(*(haddr_t *)vp); if (path) { diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index ad43590..025022f 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -41,7 +41,8 @@ H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5t h5tools_context_t *ctx); H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *); H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *); -H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp); +H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, H5R_type_t ref_type, + void *vp); H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, hid_t type, void *vp, h5tools_context_t *ctx); H5TOOLS_DLL char *h5tools_str_replace(const char *string, const char *substr, const char *replacement); |