diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-12-28 08:16:44 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-12-31 00:02:06 (GMT) |
commit | 1795aa660afe47adb28436b24eac64fa77f183fd (patch) | |
tree | 17cad54bdc89f8f095b72e0ff73ce9168215c0ee /tools/lib/h5diff_attr.c | |
parent | 2cbf31cb3ad8032fb1915c783dc52a2050aaf7da (diff) | |
download | hdf5-1795aa660afe47adb28436b24eac64fa77f183fd.zip hdf5-1795aa660afe47adb28436b24eac64fa77f183fd.tar.gz hdf5-1795aa660afe47adb28436b24eac64fa77f183fd.tar.bz2 |
Clean up tools warnings introduced by H5TOOLS_ERR_INIT macro
Diffstat (limited to 'tools/lib/h5diff_attr.c')
-rw-r--r-- | tools/lib/h5diff_attr.c | 107 |
1 files changed, 51 insertions, 56 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 6b1857f..c93293b 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -139,20 +139,20 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta *------------------------------------------------------------------------*/ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts) { - H5TOOLS_ERR_INIT(herr_t, 0) - H5O_info_t oinfo1, oinfo2; /* Object info */ - hid_t attr1_id = H5I_INVALID_HID; /* attr ID */ - hid_t attr2_id = H5I_INVALID_HID; /* attr ID */ - size_t curr1 = 0; - size_t curr2 = 0; - unsigned infile[2]; - char name1[ATTR_NAME_MAX]; - char name2[ATTR_NAME_MAX]; - int cmp; - unsigned i; table_attrs_t *table_lp = NULL; + H5O_info_t oinfo1, oinfo2; /* Object info */ + hid_t attr1_id = H5I_INVALID_HID; /* attr ID */ + hid_t attr2_id = H5I_INVALID_HID; /* attr ID */ + size_t curr1 = 0; + size_t curr2 = 0; + unsigned infile[2]; + char name1[ATTR_NAME_MAX]; + char name2[ATTR_NAME_MAX]; + int cmp; + unsigned i; + herr_t ret_value = SUCCEED; + - H5TOOLS_PUSH_STACK(); H5TOOLS_DEBUG("build_match_list_attrs start - errstat:%d", opts->err_stat); if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) { @@ -302,7 +302,6 @@ done: H5TOOLS_DEBUG("build_match_list_attrs end - errstat:%d", opts->err_stat); H5TOOLS_ENDDEBUG("exit"); - H5TOOLS_POP_STACK(); return ret_value; } @@ -318,7 +317,6 @@ done: hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2, const char *path1, const char *path2, diff_opt_t *opts) { - H5TOOLS_ERR_INIT(int, opts->err_stat) hid_t space1_id = H5I_INVALID_HID; /* space ID */ hid_t space2_id = H5I_INVALID_HID; /* space ID */ hid_t ftype1_id = H5I_INVALID_HID; /* file data type ID */ @@ -327,8 +325,8 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const hid_t mtype2_id = H5I_INVALID_HID; /* memory data type ID */ size_t msize1; /* memory size of memory type */ size_t msize2; /* memory size of memory type */ - void *buf1 = NULL; /* data buffer */ - void *buf2 = NULL; /* data buffer */ + void *buf1 = NULL; /* data buffer */ + void *buf2 = NULL; /* data buffer */ hbool_t buf1hasdata = FALSE; /* buffer has data */ hbool_t buf2hasdata = FALSE; /* buffer has data */ hsize_t nelmts1; /* number of elements in dataset */ @@ -340,49 +338,49 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char np2[512]; unsigned u; /* Local index variable */ hsize_t nfound = 0; - int j; + int j; + diff_err_t ret_value = opts->err_stat; - H5TOOLS_PUSH_STACK(); H5TOOLS_DEBUG("diff_attr_data start - errstat:%d", opts->err_stat); /* get the datatypes */ if((ftype1_id = H5Aget_type(attr1_id)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); if((ftype2_id = H5Aget_type(attr2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); if (H5Tget_class(ftype1_id) == H5T_REFERENCE) { if((mtype1_id = H5Tcopy(H5T_STD_REF)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Tcopy(H5T_STD_REF) first attribute ftype failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) first attribute ftype failed"); } else { if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Tget_native_type first attribute ftype failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type first attribute ftype failed"); } if (H5Tget_class(ftype2_id) == H5T_REFERENCE) { if((mtype2_id = H5Tcopy(H5T_STD_REF)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Tcopy(H5T_STD_REF) second attribute ftype failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) second attribute ftype failed"); } else { if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Tget_native_type second attribute ftype failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type second attribute ftype failed"); } if((msize1 = H5Tget_size(mtype1_id)) == 0) - H5TOOLS_GOTO_ERROR(1, "H5Tget_size first attribute mtype failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_size first attribute mtype failed"); if((msize2 = H5Tget_size(mtype2_id)) == 0) - H5TOOLS_GOTO_ERROR(1, "H5Tget_size second attribute mtype failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_size second attribute mtype failed"); /* get the dataspace */ if((space1_id = H5Aget_space(attr1_id)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_space first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_space first attribute failed"); if((space2_id = H5Aget_space(attr2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_space second attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_space second attribute failed"); /* get dimensions */ if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Sget_simple_extent_dims first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims first attribute failed"); if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Sget_simple_extent_dims second attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims second attribute failed"); /*---------------------------------------------------------------------- * check for comparable TYPE and SPACE @@ -398,7 +396,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const *------------------------------------------------------------------ */ if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2)) - H5TOOLS_GOTO_ERROR(1, "match_up_memsize failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed"); H5TOOLS_DEBUG("diff_attr_data read"); /*--------------------------------------------------------------------- @@ -413,18 +411,18 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2); if(buf1 == NULL || buf2 == NULL) { parallel_print("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR(1, "buffer allocation failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "buffer allocation failed"); } if(H5Aread(attr1_id, mtype1_id, buf1) < 0) { parallel_print("Failed reading attribute1 %s\n", name1); - H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); } else buf1hasdata = TRUE; if(H5Aread(attr2_id, mtype2_id, buf2) < 0) { parallel_print("Failed reading attribute2 %s\n", name2); - H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); } else buf2hasdata = TRUE; @@ -485,17 +483,17 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const buf2 = NULL; if(H5Tclose(ftype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); if(H5Tclose(ftype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); if(H5Sclose(space1_id) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); if(H5Sclose(space2_id) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); if(H5Tclose(mtype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Tclose first attribute mtype failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose first attribute mtype failed"); if(H5Tclose(mtype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Tclose second attribute mtype failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose second attribute mtype failed"); done: opts->err_stat = opts->err_stat | ret_value; @@ -523,7 +521,6 @@ done: H5TOOLS_DEBUG("diff_attr_data end - errstat:%d", opts->err_stat); H5TOOLS_ENDDEBUG("exit"); - H5TOOLS_POP_STACK(); return nfound; } @@ -542,21 +539,20 @@ done: hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *path2, diff_opt_t *opts) { - H5TOOLS_ERR_INIT(int, opts->err_stat) - hid_t attr1_id = H5I_INVALID_HID; /* attr ID */ - hid_t attr2_id = H5I_INVALID_HID; /* attr ID */ - char *name1 = NULL; - char *name2 = NULL; - unsigned u; /* Local index variable */ - hsize_t nfound = 0; - hsize_t nfound_total = 0; table_attrs_t *match_list_attrs = NULL; + hid_t attr1_id = H5I_INVALID_HID; /* attr ID */ + hid_t attr2_id = H5I_INVALID_HID; /* attr ID */ + char *name1 = NULL; + char *name2 = NULL; + unsigned u; /* Local index variable */ + hsize_t nfound = 0; + hsize_t nfound_total = 0; + diff_err_t ret_value = opts->err_stat; - H5TOOLS_PUSH_STACK(); H5TOOLS_DEBUG("diff_attr start - errstat:%d", opts->err_stat); if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) { - H5TOOLS_GOTO_ERROR(1, "build_match_list_attrs failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "build_match_list_attrs failed"); } H5TOOLS_DEBUG("build_match_list_attrs - errstat:%d", opts->err_stat); @@ -577,19 +573,19 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p /*-------------- * attribute 1 */ if((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aopen first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aopen first attribute failed"); /*-------------- * attribute 2 */ if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aopen second attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aopen second attribute failed"); H5TOOLS_DEBUG("diff_attr got attributes"); nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, opts); if(H5Aclose(attr1_id) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); if(H5Aclose(attr2_id) < 0) - H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); nfound_total += nfound; } @@ -607,7 +603,6 @@ done: H5TOOLS_DEBUG("diff_attr end - errstat:%d", opts->err_stat); H5TOOLS_ENDDEBUG("exit"); - H5TOOLS_POP_STACK(); return nfound_total; } |