Commit c512d58f by Edward Thomson

win32: cast WinAPI to void * before casting

GetProcAddress is prototyped to return a `FARPROC`, which is meant to be
a generic function pointer.  It's literally `int (FAR WINAPI * FARPROC)()`
which gcc complains if you attempt to cast to a `void (*)(GIT_SRWLOCK *)`.
Cast to a `void *` before casting to avoid warnings about the arguments.
parent 38e6b287
...@@ -54,7 +54,7 @@ static void do_symlink(const char *old, const char *new, int is_dir) ...@@ -54,7 +54,7 @@ static void do_symlink(const char *old, const char *new, int is_dir)
create_symlink_func pCreateSymbolicLink; create_symlink_func pCreateSymbolicLink;
cl_assert(module = GetModuleHandle("kernel32")); cl_assert(module = GetModuleHandle("kernel32"));
cl_assert(pCreateSymbolicLink = (create_symlink_func)GetProcAddress(module, "CreateSymbolicLinkA")); cl_assert(pCreateSymbolicLink = (create_symlink_func)(void *)GetProcAddress(module, "CreateSymbolicLinkA"));
cl_win32_pass(pCreateSymbolicLink(new, old, is_dir)); cl_win32_pass(pCreateSymbolicLink(new, old, is_dir));
#endif #endif
...@@ -70,7 +70,7 @@ static void do_hardlink(const char *old, const char *new) ...@@ -70,7 +70,7 @@ static void do_hardlink(const char *old, const char *new)
create_hardlink_func pCreateHardLink; create_hardlink_func pCreateHardLink;
cl_assert(module = GetModuleHandle("kernel32")); cl_assert(module = GetModuleHandle("kernel32"));
cl_assert(pCreateHardLink = (create_hardlink_func)GetProcAddress(module, "CreateHardLinkA")); cl_assert(pCreateHardLink = (create_hardlink_func)(void *)GetProcAddress(module, "CreateHardLinkA"));
cl_win32_pass(pCreateHardLink(new, old, 0)); cl_win32_pass(pCreateHardLink(new, old, 0));
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment