Skip to content

Commit c512d58

Browse files
committed
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.
1 parent 38e6b28 commit c512d58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/core/link.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void do_symlink(const char *old, const char *new, int is_dir)
5454
create_symlink_func pCreateSymbolicLink;
5555

5656
cl_assert(module = GetModuleHandle("kernel32"));
57-
cl_assert(pCreateSymbolicLink = (create_symlink_func)GetProcAddress(module, "CreateSymbolicLinkA"));
57+
cl_assert(pCreateSymbolicLink = (create_symlink_func)(void *)GetProcAddress(module, "CreateSymbolicLinkA"));
5858

5959
cl_win32_pass(pCreateSymbolicLink(new, old, is_dir));
6060
#endif
@@ -70,7 +70,7 @@ static void do_hardlink(const char *old, const char *new)
7070
create_hardlink_func pCreateHardLink;
7171

7272
cl_assert(module = GetModuleHandle("kernel32"));
73-
cl_assert(pCreateHardLink = (create_hardlink_func)GetProcAddress(module, "CreateHardLinkA"));
73+
cl_assert(pCreateHardLink = (create_hardlink_func)(void *)GetProcAddress(module, "CreateHardLinkA"));
7474

7575
cl_win32_pass(pCreateHardLink(new, old, 0));
7676
#endif

0 commit comments

Comments
 (0)