Skip to content

Commit 759ec7d

Browse files
committed
win32: cast GetProcAddress 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 3cd123e commit 759ec7d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/win32/thread.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ int git_threads_init(void)
4242
HMODULE hModule = GetModuleHandleW(L"kernel32");
4343

4444
if (hModule) {
45-
win32_srwlock_initialize = (win32_srwlock_fn)
45+
win32_srwlock_initialize = (win32_srwlock_fn)(void *)
4646
GetProcAddress(hModule, "InitializeSRWLock");
47-
win32_srwlock_acquire_shared = (win32_srwlock_fn)
47+
win32_srwlock_acquire_shared = (win32_srwlock_fn)(void *)
4848
GetProcAddress(hModule, "AcquireSRWLockShared");
49-
win32_srwlock_release_shared = (win32_srwlock_fn)
49+
win32_srwlock_release_shared = (win32_srwlock_fn)(void *)
5050
GetProcAddress(hModule, "ReleaseSRWLockShared");
51-
win32_srwlock_acquire_exclusive = (win32_srwlock_fn)
51+
win32_srwlock_acquire_exclusive = (win32_srwlock_fn)(void *)
5252
GetProcAddress(hModule, "AcquireSRWLockExclusive");
53-
win32_srwlock_release_exclusive = (win32_srwlock_fn)
53+
win32_srwlock_release_exclusive = (win32_srwlock_fn)(void *)
5454
GetProcAddress(hModule, "ReleaseSRWLockExclusive");
5555
}
5656

0 commit comments

Comments
 (0)