clang on windows support

This commit is contained in:
wuggy 2026-09-10 08:32:59 -07:00
commit 1d44f05fba
22 changed files with 208 additions and 65 deletions

View file

@ -321,8 +321,8 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
} else {
#if defined(_WIN64)
if (fd->secret->overlappedActive) {
PRInt32 rvSent;
if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == FALSE) {
DWORD rvSent;
if (GetOverlappedResult((HANDLE)osfd, &fd->secret->ol, &rvSent, FALSE) == FALSE) {
err = WSAGetLastError();
PR_LOG(_pr_io_lm, PR_LOG_MIN,
("SocketConnectContinue GetOverlappedResult failed %d\n", err));
@ -353,8 +353,8 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
* To get result we need to use GetOverlappedResult. */
if (fd->secret->overlappedActive) {
PR_ASSERT(fd->secret->nonblocking);
PRInt32 rvSent;
if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) {
DWORD rvSent;
if (GetOverlappedResult((HANDLE)osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) {
fd->secret->overlappedActive = PR_FALSE;
PR_LOG(_pr_io_lm, PR_LOG_MIN,
("SocketConnectContinue GetOverlappedResult succeeded\n"));

View file

@ -769,10 +769,13 @@ PRStatus _PR_WaitWindowsProcess(PRProcess *process,
return PR_FAILURE;
}
PR_ASSERT(dwRetVal == WAIT_OBJECT_0);
if (exitCode != NULL &&
GetExitCodeProcess(process->md.handle, exitCode) == FALSE) {
PR_SetError(PR_UNKNOWN_ERROR, GetLastError());
return PR_FAILURE;
if (exitCode != NULL) {
DWORD dwExitCode;
if (GetExitCodeProcess(process->md.handle, &dwExitCode) == FALSE) {
PR_SetError(PR_UNKNOWN_ERROR, GetLastError());
return PR_FAILURE;
}
*exitCode = (PRInt32)dwExitCode;
}
CloseHandle(process->md.handle);
PR_DELETE(process);

View file

@ -266,7 +266,7 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, int mode)
PRInt32
_PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len)
{
PRUint32 bytes;
DWORD bytes;
int rv, err;
rv = ReadFile((HANDLE)fd->secret->md.osfd,
@ -295,7 +295,7 @@ PRInt32
_PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len)
{
PROsfd f = fd->secret->md.osfd;
PRInt32 bytes;
DWORD bytes;
int rv;
rv = WriteFile((HANDLE)f,

View file

@ -7,6 +7,8 @@
*
*/
/* Include Winsock 2 before primpl.h brings in windows.h and Winsock 1. */
#include <winsock2.h>
#include "primpl.h"
#if defined(_WIN64)
@ -117,7 +119,7 @@ _MD_CloseSocket(PROsfd osfd)
PRInt32
_MD_SocketAvailable(PRFileDesc *fd)
{
PRInt32 result;
u_long result;
if (ioctlsocket(fd->secret->md.osfd, FIONREAD, &result) < 0) {
PR_SetError(PR_BAD_DESCRIPTOR_ERROR, WSAGetLastError());
@ -363,7 +365,7 @@ static PRStatus PR_CALLBACK _pr_set_connectex(void)
{
_pr_win_connectex = NULL;
SOCKET sock;
PRInt32 dwBytes;
DWORD dwBytes;
int rc;
/* Dummy socket needed for WSAIoctl */
@ -445,7 +447,7 @@ _PR_MD_TCPSENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
memset(&fd->secret->ol, 0, sizeof(fd->secret->ol));
/* ConnectEx return TRUE on a success and FALSE on an error. */
if (_pr_win_connectex( (SOCKET)osfd, (struct sockaddr *) addr,
addrlen, buf, amount,
addrlen, (PVOID)buf, amount,
&rvSent, &fd->secret->ol) == TRUE) {
/* When ConnectEx is used, all previously set socket options and
* property are not enabled and to enable them
@ -494,7 +496,7 @@ _PR_MD_TCPSENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
if ( rv < 0 ) {
return -1;
}
rv = GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE);
rv = GetOverlappedResult((HANDLE)osfd, &fd->secret->ol, &rvSent, FALSE);
if ( rv == TRUE ) {
return rvSent;
} else {