crt: Use (void*) casts to silence warnings about function pointer casts
Modern GCC and Clang warn for these casts, with warnings like these:
../secapi/_chsize_s.c:20:6: warning: cast from 'FARPROC' (aka 'long long (*)()') to 'errno_t ((*))(int, long long) __attribute__((cdecl))' (aka 'int (*)(int, lo
ng long)') converts to incompatible function type [-Wcast-function-type-mismatch]
20 | f = (errno_t __cdecl (*)(int, long long))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | GetProcAddress (__mingw_get_msvcrt_handle (), "_chsize_s");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
By casting to (void*) instead, we can let the compiler do the second
cast to the target function type implicitly, and also silencing these
warnings.
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/secapi/memcpy_s.c b/mingw-w64-crt/secapi/memcpy_s.c
index 013eff0..a206de3 100644
--- a/mingw-w64-crt/secapi/memcpy_s.c
+++ b/mingw-w64-crt/secapi/memcpy_s.c
@@ -16,7 +16,7 @@
if (f == _stub)
{
- f = (errno_t __cdecl (*)(void *, size_t, const void *, size_t))
+ f = (void*)
GetProcAddress (__mingw_get_msvcrt_handle (), "memcpy_s");
if (!f)
f = _int_memcpy_s;