From 5f376ccb3e8d242329a431b89bb4103500b1ad38 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 8 Mar 2021 09:26:58 -0500 Subject: Removed bad function pointer casts (#434) * Removed bad function pointer casts In one case fixed the actual function signature to be correct. * Reformat source with clang v10.0.1. Co-authored-by: Larry Knox --- c++/test/dsets.cpp | 14 +++++++------- c++/test/tfilter.cpp | 36 ++++++++++++++++++------------------ test/filter_plugin1_dsets.c | 16 ++++++++-------- test/filter_plugin2_dsets.c | 16 ++++++++-------- test/filter_plugin3_dsets.c | 16 ++++++++-------- test/filter_plugin4_groups.c | 16 ++++++++-------- tools/test/h5copy/dynlib_copy.c | 14 +++++++------- tools/test/h5diff/dynlib_diff.c | 14 +++++++------- tools/test/h5dump/dynlib_dump.c | 14 +++++++------- tools/test/h5dump/h5dumpgentest.c | 14 +++++++------- tools/test/h5ls/dynlib_ls.c | 14 +++++++------- tools/test/h5repack/dynlib_rpk.c | 14 +++++++------- tools/test/h5repack/dynlib_vrpk.c | 14 +++++++------- 13 files changed, 106 insertions(+), 106 deletions(-) diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 65949b6..03e4927 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -398,13 +398,13 @@ test_tconv(H5File &file) /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version number */ - H5Z_FILTER_BOGUS, /* Filter id number */ - 1, 1, /* Encode and decode enabled */ - "bogus", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)filter_bogus, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version number */ + H5Z_FILTER_BOGUS, /* Filter id number */ + 1, 1, /* Encode and decode enabled */ + "bogus", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus, /* The actual filter function */ }}; /*------------------------------------------------------------------------- diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 1ded033..2df88b2 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -49,20 +49,18 @@ static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl, /* Temporary filter IDs used for testing */ const int H5Z_FILTER_BOGUS = 305; -#if 0 // H5_ATTR_UNUSED variables caused warning, so duplicated below with NULL instead -static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); -#endif -static size_t filter_bogus(size_t nbytes); +static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf); + /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "bogus", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)filter_bogus, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus, /* The actual filter function */ }}; /*------------------------------------------------------------------------- @@ -79,13 +77,15 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ *------------------------------------------------------------------------- */ static size_t -#if 0 // H5_ATTR_UNUSED variables caused warning, so duplicated below with NULL instead -filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, - const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, - size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) -#endif -filter_bogus(size_t nbytes) +filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) { + (void)flags; + (void)cd_nelmts; + (void)cd_values; + (void)buf_size; + (void)buf; + return nbytes; } diff --git a/test/filter_plugin1_dsets.c b/test/filter_plugin1_dsets.c index 7f9a664..5d6c1ef 100644 --- a/test/filter_plugin1_dsets.c +++ b/test/filter_plugin1_dsets.c @@ -26,14 +26,14 @@ static size_t add_sub_value(unsigned int flags, size_t cd_nelmts, const unsigned /* Filter class struct */ const H5Z_class2_t FILTER_INFO[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - FILTER1_ID, /* Filter ID number */ - 1, /* Encoding enabled */ - 1, /* Decoding enabled */ - "test filter plugin 1", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)add_sub_value, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER1_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 1", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + add_sub_value, /* The actual filter function */ }}; H5PL_type_t diff --git a/test/filter_plugin2_dsets.c b/test/filter_plugin2_dsets.c index 4a881aa..d2011d4 100644 --- a/test/filter_plugin2_dsets.c +++ b/test/filter_plugin2_dsets.c @@ -27,14 +27,14 @@ static size_t mult_div_value(unsigned int flags, size_t cd_nelmts, const unsigne /* Filter class struct */ const H5Z_class2_t FILTER_INFO[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - FILTER2_ID, /* Filter ID number */ - 1, /* Encoding enabled */ - 1, /* Decoding enabled */ - "test filter plugin 2", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)mult_div_value, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER2_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + mult_div_value, /* The actual filter function */ }}; H5PL_type_t diff --git a/test/filter_plugin3_dsets.c b/test/filter_plugin3_dsets.c index 5d8d57f..618ce06 100644 --- a/test/filter_plugin3_dsets.c +++ b/test/filter_plugin3_dsets.c @@ -30,14 +30,14 @@ static size_t add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, const uns /* Filter class struct */ const H5Z_class2_t FILTER_INFO[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - FILTER3_ID, /* Filter ID number */ - 1, /* Encoding enabled */ - 1, /* Decoding enabled */ - "test filter plugin 3", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)add_sub_value_hdf5, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER3_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 3", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + add_sub_value_hdf5, /* The actual filter function */ }}; H5PL_type_t diff --git a/test/filter_plugin4_groups.c b/test/filter_plugin4_groups.c index c948491..630dcd6 100644 --- a/test/filter_plugin4_groups.c +++ b/test/filter_plugin4_groups.c @@ -29,14 +29,14 @@ static size_t append_to_group_name(unsigned int flags, size_t cd_nelmts, const u /* Filter class struct */ const H5Z_class2_t FILTER_INFO[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - FILTER4_ID, /* Filter ID number */ - 1, /* Encoding enabled */ - 1, /* Decoding enabled */ - "test filter plugin 4", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)append_to_group_name, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER4_ID, /* Filter ID number */ + 1, /* Encoding enabled */ + 1, /* Decoding enabled */ + "test filter plugin 4", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + append_to_group_name, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c index 56be5a6..b954a22 100644 --- a/tools/test/h5copy/dynlib_copy.c +++ b/tools/test/h5copy/dynlib_copy.c @@ -25,13 +25,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index cebe53c..433522d 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -25,13 +25,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index cebe53c..433522d 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -25,13 +25,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 903fdf6..5178f25 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -154,13 +154,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; /* A UD link traversal function. Shouldn't actually be called. */ diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index cebe53c..433522d 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -25,13 +25,13 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIBUD, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlibud", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIBUD, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlibud", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlibud, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5repack/dynlib_rpk.c b/tools/test/h5repack/dynlib_rpk.c index e64e67b..b228344 100644 --- a/tools/test/h5repack/dynlib_rpk.c +++ b/tools/test/h5repack/dynlib_rpk.c @@ -27,13 +27,13 @@ static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const uns /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIB1[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB1, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlib1", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIB1, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlib1", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlib1, /* The actual filter function */ }}; H5PL_type_t diff --git a/tools/test/h5repack/dynlib_vrpk.c b/tools/test/h5repack/dynlib_vrpk.c index 2db97da..5eac4f2 100644 --- a/tools/test/h5repack/dynlib_vrpk.c +++ b/tools/test/h5repack/dynlib_vrpk.c @@ -27,13 +27,13 @@ static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, const uns /* This message derives from H5Z */ const H5Z_class2_t H5Z_DYNLIB4[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DYNLIB4, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dynlib4", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIB4, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlib4", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + H5Z_filter_dynlib4, /* The actual filter function */ }}; H5PL_type_t -- cgit v0.12