diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2022-07-26 21:49:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 21:49:46 (GMT) |
commit | f0690f13fb914ff39a32d88801eabcef759a0163 (patch) | |
tree | d0c1f7577a41dd9f276d31402954458f95cf85ec /tools/lib/h5tools_str.c | |
parent | d0739f13c131fd8d85c4b3247c26ca2bca515ece (diff) | |
download | hdf5-f0690f13fb914ff39a32d88801eabcef759a0163.zip hdf5-f0690f13fb914ff39a32d88801eabcef759a0163.tar.gz hdf5-f0690f13fb914ff39a32d88801eabcef759a0163.tar.bz2 |
eliminate unnecessary errors in the error stack (#1937)
Diffstat (limited to 'tools/lib/h5tools_str.c')
-rw-r--r-- | tools/lib/h5tools_str.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 626adfa..daeeb95 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1182,7 +1182,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* if(nsize == H5R_DSET_REG_REF_BUF_SIZE) */ H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_DSETREG"); h5tools_str_append(str, H5_TOOLS_DATASET); - h5tools_str_sprint_old_reference(str, container, vp); + h5tools_str_sprint_old_reference(str, container, H5R_DATASET_REGION, vp); } else if (H5Tequal(type, H5T_STD_REF_OBJ)) { /* if (nsize == H5R_OBJ_REF_BUF_SIZE) */ @@ -1231,7 +1231,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai obj_tok_str = NULL; } - h5tools_str_sprint_old_reference(str, container, vp); + h5tools_str_sprint_old_reference(str, container, H5R_OBJECT, vp); } /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */ } break; @@ -1382,7 +1382,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai *------------------------------------------------------------------------- */ void -h5tools_str_sprint_old_reference(h5tools_str_t *str, hid_t container, void *vp) +h5tools_str_sprint_old_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; @@ -1391,21 +1391,23 @@ h5tools_str_sprint_old_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); + 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 { - obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp); + H5Sclose(region); + } /* end if (region >= 0) */ + H5Dclose(obj); + } /* end if (obj >= 0) */ + } + else if (ref_type == H5R_OBJECT) { + obj = H5Rdereference2(container, H5P_DEFAULT, ref_type, vp); if (obj >= 0) { - H5Rget_name(obj, H5R_OBJECT, vp, (char *)ref_name, 1024); + H5Rget_name(obj, ref_type, vp, (char *)ref_name, 1024); h5tools_str_append(str, "%s", ref_name); H5Dclose(obj); } |