1
0
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:
Sandu Liviu Catalin 2020-04-27 10:17:08 +03:00
parent 6accac3bb1
commit 1e82d7b747
7 changed files with 22 additions and 22 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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;

View File

@ -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)
{ {

View File

@ -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

View File

@ -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

View File

@ -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)