Skip to content

Commit

Permalink
LocalSocket on Windows available on recent compilers without explicit…
Browse files Browse the repository at this point in the history
… option
  • Loading branch information
aslze committed Feb 2, 2025
1 parent 12008db commit 797367f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
struct IUnknown; // Workaround for "combaseapi.h(229): error C2187: syntax error: 'identifier' was unexpected here" with /permissive-
#include <winsock2.h>
#include <ws2tcpip.h>

#ifdef __has_include
#if __has_include(<afunix.h>) && !defined(ASL_SOCKET_LOCAL)
#define ASL_SOCKET_LOCAL
#endif
#endif
#ifdef ASL_SOCKET_LOCAL
#include <afunix.h>
#endif
Expand Down Expand Up @@ -415,7 +421,7 @@ Socket_::Socket_(int fd)

Socket_::~Socket_()
{
close();
Socket_::close();
}

bool Socket_::init(bool force)
Expand Down
6 changes: 3 additions & 3 deletions src/TlsSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
//#define TLS_DEBUG 3

#ifdef _WIN32
#include <windows.h>
#include <winsock2.h>
#include <windows.h> // NOLINT
#include <winsock2.h> // NOLINT
#else
#include <stdlib.h>
#include <unistd.h>
Expand Down Expand Up @@ -214,7 +214,7 @@ TlsSocket_::TlsSocket_()

TlsSocket_::~TlsSocket_()
{
close();
TlsSocket_::close();
mbedtls_net_free(&_core->net);
mbedtls_x509_crt_free(&_core->cacert);
mbedtls_ssl_free(&_core->ssl);
Expand Down
2 changes: 1 addition & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void Random::seed(ULong s)
_state[i] = s ^ (s << (i + 2));

for (int i = 0; i < 6; i++)
unsigned x = get();
get();
}

void Random::init(bool fast)
Expand Down

0 comments on commit 797367f

Please sign in to comment.