Fixed windows build not compiling

This commit is contained in:
Anonymous275
2021-02-21 22:00:50 +02:00
committed by Anonymous275
parent f13523fbe5
commit 218504e674
9 changed files with 32 additions and 9 deletions

View File

@@ -178,11 +178,11 @@ void SafeExecution(TLuaEngine& Engine, TLuaFile* lua, const std::string& FuncNam
if (lua_isfunction(luaState, -1)) {
char* Origin = ThreadOrigin(lua);
#ifdef WIN32
__try {
//__try {
int R = lua_pcall(luaState, 0, 0, 0);
CheckLua(luaState, R);
} __except (Handle(GetExceptionInformation(), Origin)) {
}
/*} __except (Handle(GetExceptionInformation(), Origin)) {
}*/
#else // unix
int R = lua_pcall(luaState, 0, 0, 0);
CheckLua(luaState, R);

View File

@@ -2,6 +2,7 @@
#include "CustomAssert.h"
#include "TTCPServer.h"
#include <any>
#include <array>
#include <cstring>
#include <utility>
@@ -119,7 +120,7 @@ void TUDPServer::UDPSend(TClient& Client, std::string Data) const {
return;
}
sockaddr_in Addr = Client.GetUDPAddr();
socklen_t AddrSize = sizeof(Client.GetUDPAddr());
auto AddrSize = sizeof(Client.GetUDPAddr());
if (Data.length() > 400) {
std::string CMP(Comp(Data));
Data = "ABG:" + CMP;
@@ -159,7 +160,12 @@ void TUDPServer::UDPSend(TClient& Client, std::string Data) const {
std::string TUDPServer::UDPRcvFromClient(sockaddr_in& client) const {
size_t clientLength = sizeof(client);
std::array<char, 1024> Ret {};
#ifdef WIN32
int64_t Rcv = recvfrom(mUDPSock, Ret.data(), Ret.size(), 0, (sockaddr*)&client, (int*)&clientLength);
#else // unix
int64_t Rcv = recvfrom(mUDPSock, Ret.data(), Ret.size(), 0, (sockaddr*)&client, (socklen_t*)&clientLength);
#endif // WIN32
if (Rcv == -1) {
#ifdef WIN32
error(("(UDP) Error receiving from Client! Code : ") + std::to_string(WSAGetLastError()));

View File

@@ -8,9 +8,9 @@
#include "TUDPServer.h"
#include <iostream>
#include <thread>
#include <TTCPServer.h>
#ifdef __unix
#include <TTCPServer.h>
#include <csignal>
void UnixSignalHandler(int sig) {