mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-31 09:57:14 +01:00
Use updated win32 identification.
This commit is contained in:
parent
6accac3bb1
commit
1e82d7b747
6
module/Vendor/SimpleSocket/ActiveSocket.cpp
vendored
6
module/Vendor/SimpleSocket/ActiveSocket.cpp
vendored
@ -64,7 +64,7 @@ bool CActiveSocket::ConnectTCP(const char *pAddr, uint16 nPort)
|
|||||||
|
|
||||||
if ((m_pHE = GETHOSTBYNAME(pAddr)) == NULL)
|
if ((m_pHE = GETHOSTBYNAME(pAddr)) == NULL)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
TranslateSocketError();
|
TranslateSocketError();
|
||||||
#else
|
#else
|
||||||
if (h_errno == HOST_NOT_FOUND)
|
if (h_errno == HOST_NOT_FOUND)
|
||||||
@ -144,7 +144,7 @@ bool CActiveSocket::ConnectUDP(const char *pAddr, uint16 nPort)
|
|||||||
|
|
||||||
if ((m_pHE = GETHOSTBYNAME(pAddr)) == NULL)
|
if ((m_pHE = GETHOSTBYNAME(pAddr)) == NULL)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
TranslateSocketError();
|
TranslateSocketError();
|
||||||
#else
|
#else
|
||||||
if (h_errno == HOST_NOT_FOUND)
|
if (h_errno == HOST_NOT_FOUND)
|
||||||
@ -202,7 +202,7 @@ bool CActiveSocket::ConnectRAW(const char *pAddr, uint16 nPort)
|
|||||||
|
|
||||||
if ((m_pHE = GETHOSTBYNAME(pAddr)) == NULL)
|
if ((m_pHE = GETHOSTBYNAME(pAddr)) == NULL)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
TranslateSocketError();
|
TranslateSocketError();
|
||||||
#else
|
#else
|
||||||
if (h_errno == HOST_NOT_FOUND)
|
if (h_errno == HOST_NOT_FOUND)
|
||||||
|
2
module/Vendor/SimpleSocket/CMakeLists.txt
vendored
2
module/Vendor/SimpleSocket/CMakeLists.txt
vendored
@ -15,6 +15,6 @@ target_compile_definitions(SimpleSocket PRIVATE _WIN32_WINNT=0x0601)
|
|||||||
if(UNIX)
|
if(UNIX)
|
||||||
target_compile_definitions(SimpleSocket PRIVATE _LINUX=1)
|
target_compile_definitions(SimpleSocket PRIVATE _LINUX=1)
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
target_compile_definitions(SimpleSocket PRIVATE WIN32=1 _WIN32=1)
|
target_compile_definitions(SimpleSocket PRIVATE _WIN32=1)
|
||||||
target_link_libraries(SimpleSocket PUBLIC Ws2_32)
|
target_link_libraries(SimpleSocket PUBLIC Ws2_32)
|
||||||
endif()
|
endif()
|
||||||
|
4
module/Vendor/SimpleSocket/PassiveSocket.cpp
vendored
4
module/Vendor/SimpleSocket/PassiveSocket.cpp
vendored
@ -51,7 +51,7 @@ CPassiveSocket::CPassiveSocket(CSocketType nType) : CSimpleSocket(nType)
|
|||||||
bool CPassiveSocket::BindMulticast(const char *pInterface, const char *pGroup, uint16 nPort)
|
bool CPassiveSocket::BindMulticast(const char *pInterface, const char *pGroup, uint16 nPort)
|
||||||
{
|
{
|
||||||
bool bRetVal = false;
|
bool bRetVal = false;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
ULONG inAddr;
|
ULONG inAddr;
|
||||||
#else
|
#else
|
||||||
in_addr_t inAddr;
|
in_addr_t inAddr;
|
||||||
@ -130,7 +130,7 @@ bool CPassiveSocket::BindMulticast(const char *pInterface, const char *pGroup, u
|
|||||||
bool CPassiveSocket::Listen(const char *pAddr, uint16 nPort, int32 nConnectionBacklog)
|
bool CPassiveSocket::Listen(const char *pAddr, uint16 nPort, int32 nConnectionBacklog)
|
||||||
{
|
{
|
||||||
bool bRetVal = false;
|
bool bRetVal = false;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
ULONG inAddr;
|
ULONG inAddr;
|
||||||
#else
|
#else
|
||||||
in_addr_t inAddr;
|
in_addr_t inAddr;
|
||||||
|
8
module/Vendor/SimpleSocket/SimpleSocket.cpp
vendored
8
module/Vendor/SimpleSocket/SimpleSocket.cpp
vendored
@ -137,7 +137,7 @@ bool CSimpleSocket::Initialize()
|
|||||||
{
|
{
|
||||||
errno = CSimpleSocket::SocketSuccess;
|
errno = CSimpleSocket::SocketSuccess;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// Data structure containing general Windows Sockets Info
|
// Data structure containing general Windows Sockets Info
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -831,7 +831,7 @@ bool CSimpleSocket::SetNonblocking(void)
|
|||||||
{
|
{
|
||||||
int32 nCurFlags;
|
int32 nCurFlags;
|
||||||
|
|
||||||
#if WIN32
|
#if _WIN32
|
||||||
nCurFlags = 1;
|
nCurFlags = 1;
|
||||||
|
|
||||||
if (ioctlsocket(m_socket, FIONBIO, (ULONG *)&nCurFlags) != 0)
|
if (ioctlsocket(m_socket, FIONBIO, (ULONG *)&nCurFlags) != 0)
|
||||||
@ -870,7 +870,7 @@ bool CSimpleSocket::SetBlocking(void)
|
|||||||
{
|
{
|
||||||
int32 nCurFlags;
|
int32 nCurFlags;
|
||||||
|
|
||||||
#if WIN32
|
#if _WIN32
|
||||||
nCurFlags = 0;
|
nCurFlags = 0;
|
||||||
|
|
||||||
if (ioctlsocket(m_socket, FIONBIO, (ULONG *)&nCurFlags) != 0)
|
if (ioctlsocket(m_socket, FIONBIO, (ULONG *)&nCurFlags) != 0)
|
||||||
@ -1010,7 +1010,7 @@ void CSimpleSocket::TranslateSocketError(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
int32 nError = WSAGetLastError();
|
int32 nError = WSAGetLastError();
|
||||||
switch (nError)
|
switch (nError)
|
||||||
{
|
{
|
||||||
|
18
module/Vendor/SimpleSocket/include/Host.h
vendored
18
module/Vendor/SimpleSocket/include/Host.h
vendored
@ -71,7 +71,7 @@ extern "C"
|
|||||||
typedef int SOCKET;
|
typedef int SOCKET;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
struct iovec {
|
struct iovec {
|
||||||
void *iov_base;
|
void *iov_base;
|
||||||
size_t iov_len;
|
size_t iov_len;
|
||||||
@ -85,11 +85,11 @@ extern "C"
|
|||||||
typedef int int32;
|
typedef int int32;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
typedef unsigned long long int uint64;
|
typedef unsigned long long int uint64;
|
||||||
typedef long long int int64;
|
typedef long long int int64;
|
||||||
#elif (__WORDSIZE == 32)
|
#elif (__WORDSIZE == 32)
|
||||||
@ -102,7 +102,7 @@ extern "C"
|
|||||||
typedef long int int64;
|
typedef long int int64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#ifndef UINT8_MAX
|
#ifndef UINT8_MAX
|
||||||
#define UINT8_MAX (UCHAR_MAX)
|
#define UINT8_MAX (UCHAR_MAX)
|
||||||
@ -123,7 +123,7 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#define ssize_t size_t
|
#define ssize_t size_t
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ extern "C"
|
|||||||
/* Socket Macros */
|
/* Socket Macros */
|
||||||
/* */
|
/* */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#define SHUT_RD 0
|
#define SHUT_RD 0
|
||||||
#define SHUT_WR 1
|
#define SHUT_WR 1
|
||||||
#define SHUT_RDWR 2
|
#define SHUT_RDWR 2
|
||||||
@ -226,19 +226,19 @@ extern "C"
|
|||||||
/* Misc Macros */
|
/* Misc Macros */
|
||||||
/* */
|
/* */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#define GET_CLOCK_COUNT(x) QueryPerformanceCounter((LARGE_INTEGER *)x)
|
#define GET_CLOCK_COUNT(x) QueryPerformanceCounter((LARGE_INTEGER *)x)
|
||||||
#else
|
#else
|
||||||
#define GET_CLOCK_COUNT(x) gettimeofday(x, NULL)
|
#define GET_CLOCK_COUNT(x) gettimeofday(x, NULL)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#define STRTOULL(x) _atoi64(x)
|
#define STRTOULL(x) _atoi64(x)
|
||||||
#else
|
#else
|
||||||
#define STRTOULL(x) strtoull(x, NULL, 10)
|
#define STRTOULL(x) strtoull(x, NULL, 10)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#define SNPRINTF _snprintf
|
#define SNPRINTF _snprintf
|
||||||
#define PRINTF printf
|
#define PRINTF printf
|
||||||
#define VPRINTF vprintf
|
#define VPRINTF vprintf
|
||||||
|
@ -570,7 +570,7 @@ protected:
|
|||||||
struct sockaddr_in m_stMulticastGroup; /// multicast group to bind to
|
struct sockaddr_in m_stMulticastGroup; /// multicast group to bind to
|
||||||
struct linger m_stLinger; /// linger flag
|
struct linger m_stLinger; /// linger flag
|
||||||
CStatTimer m_timer; /// internal statistics.
|
CStatTimer m_timer; /// internal statistics.
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
WSADATA m_hWSAData; /// Windows
|
WSADATA m_hWSAData; /// Windows
|
||||||
#endif
|
#endif
|
||||||
fd_set m_writeFds; /// write file descriptor set
|
fd_set m_writeFds; /// write file descriptor set
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if WIN32
|
#if _WIN32
|
||||||
#include <Winsock2.h>
|
#include <Winsock2.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#define GET_CLOCK_COUNT(x) QueryPerformanceCounter((LARGE_INTEGER *)x)
|
#define GET_CLOCK_COUNT(x) QueryPerformanceCounter((LARGE_INTEGER *)x)
|
||||||
#else
|
#else
|
||||||
#define GET_CLOCK_COUNT(x) gettimeofday(x, NULL)
|
#define GET_CLOCK_COUNT(x) gettimeofday(x, NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user