Commit 8a58347a authored by Peter Eisentraut's avatar Peter Eisentraut

Fix -Wcast-function-type warnings on Windows/MinGW

After de8feb1f, some warnings remained
that were only visible when using GCC on Windows.  Fix those as well.

Note that the ecpg test source files don't use the full pg_config.h,
so we can't use pg_funcptr_t there but have to do it the long way.
parent 19ae53c9
...@@ -1521,7 +1521,7 @@ pg_SSPI_recvauth(Port *port) ...@@ -1521,7 +1521,7 @@ pg_SSPI_recvauth(Port *port)
(errmsg("could not load library \"%s\": error code %lu", (errmsg("could not load library \"%s\": error code %lu",
"SECUR32.DLL", GetLastError()))); "SECUR32.DLL", GetLastError())));
_QuerySecurityContextToken = (QUERY_SECURITY_CONTEXT_TOKEN_FN) _QuerySecurityContextToken = (QUERY_SECURITY_CONTEXT_TOKEN_FN) (pg_funcptr_t)
GetProcAddress(secur32, "QuerySecurityContextToken"); GetProcAddress(secur32, "QuerySecurityContextToken");
if (_QuerySecurityContextToken == NULL) if (_QuerySecurityContextToken == NULL)
{ {
...@@ -2522,7 +2522,7 @@ InitializeLDAPConnection(Port *port, LDAP **ldap) ...@@ -2522,7 +2522,7 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
ldap_unbind(*ldap); ldap_unbind(*ldap);
return STATUS_ERROR; return STATUS_ERROR;
} }
_ldap_start_tls_sA = (__ldap_start_tls_sA) GetProcAddress(ldaphandle, "ldap_start_tls_sA"); _ldap_start_tls_sA = (__ldap_start_tls_sA) (pg_funcptr_t) GetProcAddress(ldaphandle, "ldap_start_tls_sA");
if (_ldap_start_tls_sA == NULL) if (_ldap_start_tls_sA == NULL)
{ {
ereport(LOG, ereport(LOG,
......
...@@ -122,7 +122,7 @@ crashDumpHandler(struct _EXCEPTION_POINTERS *pExceptionInfo) ...@@ -122,7 +122,7 @@ crashDumpHandler(struct _EXCEPTION_POINTERS *pExceptionInfo)
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
} }
pDump = (MINIDUMPWRITEDUMP) GetProcAddress(hDll, "MiniDumpWriteDump"); pDump = (MINIDUMPWRITEDUMP) (pg_funcptr_t) GetProcAddress(hDll, "MiniDumpWriteDump");
if (pDump == NULL) if (pDump == NULL)
{ {
......
...@@ -1778,7 +1778,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser ...@@ -1778,7 +1778,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
Advapi32Handle = LoadLibrary("ADVAPI32.DLL"); Advapi32Handle = LoadLibrary("ADVAPI32.DLL");
if (Advapi32Handle != NULL) if (Advapi32Handle != NULL)
{ {
_CreateRestrictedToken = (__CreateRestrictedToken) GetProcAddress(Advapi32Handle, "CreateRestrictedToken"); _CreateRestrictedToken = (__CreateRestrictedToken) (pg_funcptr_t) GetProcAddress(Advapi32Handle, "CreateRestrictedToken");
} }
if (_CreateRestrictedToken == NULL) if (_CreateRestrictedToken == NULL)
...@@ -1852,11 +1852,11 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser ...@@ -1852,11 +1852,11 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
Kernel32Handle = LoadLibrary("KERNEL32.DLL"); Kernel32Handle = LoadLibrary("KERNEL32.DLL");
if (Kernel32Handle != NULL) if (Kernel32Handle != NULL)
{ {
_IsProcessInJob = (__IsProcessInJob) GetProcAddress(Kernel32Handle, "IsProcessInJob"); _IsProcessInJob = (__IsProcessInJob) (pg_funcptr_t) GetProcAddress(Kernel32Handle, "IsProcessInJob");
_CreateJobObject = (__CreateJobObject) GetProcAddress(Kernel32Handle, "CreateJobObjectA"); _CreateJobObject = (__CreateJobObject) (pg_funcptr_t) GetProcAddress(Kernel32Handle, "CreateJobObjectA");
_SetInformationJobObject = (__SetInformationJobObject) GetProcAddress(Kernel32Handle, "SetInformationJobObject"); _SetInformationJobObject = (__SetInformationJobObject) (pg_funcptr_t) GetProcAddress(Kernel32Handle, "SetInformationJobObject");
_AssignProcessToJobObject = (__AssignProcessToJobObject) GetProcAddress(Kernel32Handle, "AssignProcessToJobObject"); _AssignProcessToJobObject = (__AssignProcessToJobObject) (pg_funcptr_t) GetProcAddress(Kernel32Handle, "AssignProcessToJobObject");
_QueryInformationJobObject = (__QueryInformationJobObject) GetProcAddress(Kernel32Handle, "QueryInformationJobObject"); _QueryInformationJobObject = (__QueryInformationJobObject) (pg_funcptr_t) GetProcAddress(Kernel32Handle, "QueryInformationJobObject");
} }
/* Verify that we found all functions */ /* Verify that we found all functions */
......
...@@ -66,7 +66,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo) ...@@ -66,7 +66,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo)
return 0; return 0;
} }
_CreateRestrictedToken = (__CreateRestrictedToken) GetProcAddress(Advapi32Handle, "CreateRestrictedToken"); _CreateRestrictedToken = (__CreateRestrictedToken) (pg_funcptr_t) GetProcAddress(Advapi32Handle, "CreateRestrictedToken");
if (_CreateRestrictedToken == NULL) if (_CreateRestrictedToken == NULL)
{ {
......
...@@ -99,7 +99,7 @@ int main() ...@@ -99,7 +99,7 @@ int main()
#ifndef WIN32 #ifndef WIN32
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1)); pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
#else #else
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)test_thread, (void *) (n + 1), 0, NULL); threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) (void (*) (void)) test_thread, (void *) (n + 1), 0, NULL);
#endif #endif
} }
......
...@@ -99,7 +99,7 @@ int main() ...@@ -99,7 +99,7 @@ int main()
#ifndef WIN32 #ifndef WIN32
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1)); pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
#else #else
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) test_thread, (void *) (n+1), 0, NULL); threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) (void (*) (void)) test_thread, (void *) (n+1), 0, NULL);
#endif #endif
} }
......
...@@ -68,7 +68,7 @@ int main() ...@@ -68,7 +68,7 @@ int main()
#ifndef WIN32 #ifndef WIN32
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1)); pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
#else #else
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)test_thread, (void *) (n + 1), 0, NULL); threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) (void (*) (void)) test_thread, (void *) (n + 1), 0, NULL);
#endif #endif
} }
......
...@@ -68,7 +68,7 @@ int main() ...@@ -68,7 +68,7 @@ int main()
#ifndef WIN32 #ifndef WIN32
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1)); pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
#else #else
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) test_thread, (void *) (n+1), 0, NULL); threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) (void (*) (void)) test_thread, (void *) (n+1), 0, NULL);
#endif #endif
} }
......
...@@ -79,12 +79,12 @@ haveNativeWindowsIPv6routines(void) ...@@ -79,12 +79,12 @@ haveNativeWindowsIPv6routines(void)
{ {
/* We found a dll, so now get the addresses of the routines */ /* We found a dll, so now get the addresses of the routines */
getaddrinfo_ptr = (getaddrinfo_ptr_t) GetProcAddress(hLibrary, getaddrinfo_ptr = (getaddrinfo_ptr_t) (pg_funcptr_t) GetProcAddress(hLibrary,
"getaddrinfo"); "getaddrinfo");
freeaddrinfo_ptr = (freeaddrinfo_ptr_t) GetProcAddress(hLibrary, freeaddrinfo_ptr = (freeaddrinfo_ptr_t) (pg_funcptr_t) GetProcAddress(hLibrary,
"freeaddrinfo"); "freeaddrinfo");
getnameinfo_ptr = (getnameinfo_ptr_t) GetProcAddress(hLibrary, getnameinfo_ptr = (getnameinfo_ptr_t) (pg_funcptr_t) GetProcAddress(hLibrary,
"getnameinfo"); "getnameinfo");
/* /*
* If any one of the routines is missing, let's play it safe and * If any one of the routines is missing, let's play it safe and
......
...@@ -95,7 +95,7 @@ pgwin32_putenv(const char *envval) ...@@ -95,7 +95,7 @@ pgwin32_putenv(const char *envval)
{ {
PUTENVPROC putenvFunc; PUTENVPROC putenvFunc;
putenvFunc = (PUTENVPROC) GetProcAddress(hmodule, "_putenv"); putenvFunc = (PUTENVPROC) (pg_funcptr_t) GetProcAddress(hmodule, "_putenv");
if (putenvFunc) if (putenvFunc)
putenvFunc(envval); putenvFunc(envval);
FreeLibrary(hmodule); FreeLibrary(hmodule);
......
...@@ -227,7 +227,7 @@ _pgstat64(const char *name, struct stat *buf) ...@@ -227,7 +227,7 @@ _pgstat64(const char *name, struct stat *buf)
return -1; return -1;
} }
_NtQueryInformationFile = (PFN_NTQUERYINFORMATIONFILE) _NtQueryInformationFile = (PFN_NTQUERYINFORMATIONFILE) (pg_funcptr_t)
GetProcAddress(ntdll, "NtQueryInformationFile"); GetProcAddress(ntdll, "NtQueryInformationFile");
if (_NtQueryInformationFile == NULL) if (_NtQueryInformationFile == NULL)
{ {
......
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