Skip to content

Commit

Permalink
Removed bad function pointer casts (#434)
Browse files Browse the repository at this point in the history
* 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 <lrknox@hdfgroup.org>
  • Loading branch information
seanm and lrknox authored Mar 8, 2021
1 parent 150fb83 commit 5f376cc
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 106 deletions.
14 changes: 7 additions & 7 deletions c++/test/dsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}};

/*-------------------------------------------------------------------------
Expand Down
36 changes: 18 additions & 18 deletions c++/test/tfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}};

/*-------------------------------------------------------------------------
Expand All @@ -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;
}

Expand Down
16 changes: 8 additions & 8 deletions test/filter_plugin1_dsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions test/filter_plugin2_dsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions test/filter_plugin3_dsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions test/filter_plugin4_groups.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tools/test/h5copy/dynlib_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tools/test/h5diff/dynlib_diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tools/test/h5dump/dynlib_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tools/test/h5dump/h5dumpgentest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
14 changes: 7 additions & 7 deletions tools/test/h5ls/dynlib_ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tools/test/h5repack/dynlib_rpk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tools/test/h5repack/dynlib_vrpk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f376cc

Please sign in to comment.