Fix C function cast errors for clang19

Merged johan requested to merge fix/function_cast_clang19 into release/5.4

Merge request reports