1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 19:14:47 +02:00

Fixed windows build

This commit is contained in:
Adam
2011-08-10 01:32:07 -04:00
parent 13bcc4ef14
commit ded98ed3de
11 changed files with 37 additions and 17 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ enum ChannelAccess
class ChanAccess;
class AccessProvider : public Service
class CoreExport AccessProvider : public Service
{
public:
AccessProvider(Module *o, const Anope::string &n);
@@ -75,7 +75,7 @@ class CoreExport ChanAccess
bool operator<=(ChanAccess &other);
};
class AccessGroup : public std::vector<ChanAccess *>
class CoreExport AccessGroup : public std::vector<ChanAccess *>
{
public:
ChannelInfo *ci;
+2 -2
View File
@@ -249,7 +249,7 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END
/** Timer for colliding nicks to force people off of nicknames
*/
class NickServCollide : public Timer
class CoreExport NickServCollide : public Timer
{
dynamic_reference<User> u;
Anope::string nick;
@@ -273,7 +273,7 @@ class NickServCollide : public Timer
/** Timers for releasing nicks to be available for use
*/
class NickServRelease : public User, public Timer
class CoreExport NickServRelease : public User, public Timer
{
Anope::string nick;
+1 -1
View File
@@ -188,7 +188,7 @@ class Version
class CallBack;
class XLineManager;
class CommandSource;
struct CommandSource;
/** Every module in Anope is actually a class.
*/
+1 -1
View File
@@ -12,7 +12,7 @@
class OperType;
struct Oper
struct CoreExport Oper
{
Anope::string name;
Anope::string password;
+1 -1
View File
@@ -357,7 +357,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** A timer used to keep the BotServ bot/ChanServ in the channel
* after kicking the last user in a channel
*/
class ChanServTimer : public Timer
class CoreExport ChanServTimer : public Timer
{
private:
dynamic_reference<Channel> c;
-4
View File
@@ -14,10 +14,6 @@
class CoreExport SocketEngine
{
#ifdef _WIN32
/* Windows crap */
static WSADATA wsa;
#endif
public:
/* Map of sockets */
static std::map<int, Socket *> Sockets;
+1
View File
@@ -4,6 +4,7 @@ file(GLOB SRC_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
# If using Windows, add the windows.cpp, the win32 threading engine, and the socket engine to the list
if(WIN32)
append_to_list(SRC_SRCS win32/windows.cpp)
append_to_list(SRC_SRCS win32/sigaction/sigaction.cpp)
append_to_list(SRC_SRCS threadengines/threadengine_win32.cpp)
append_to_list(SRC_SRCS socketengines/pipeengine_win32.cpp)
# If not using Windows, add the pthread threading engine to the list
+2 -2
View File
@@ -255,7 +255,7 @@ bool DNSManager::ProcessRead()
unsigned char packet_buffer[524];
sockaddrs from_server;
socklen_t x = sizeof(from_server);
int length = recvfrom(this->GetFD(), &packet_buffer, sizeof(packet_buffer), 0, &from_server.sa, &x);
int length = recvfrom(this->GetFD(), reinterpret_cast<char *>(&packet_buffer), sizeof(packet_buffer), 0, &from_server.sa, &x);
if (length < 12)
return true;
@@ -497,7 +497,7 @@ bool DNSManager::ProcessWrite()
unsigned char buffer[524];
r->FillBuffer(buffer);
sendto(this->GetFD(), buffer, r->payload_count + 12, 0, &this->addrs.sa, this->addrs.size());
sendto(this->GetFD(), reinterpret_cast<char *>(buffer), r->payload_count + 12, 0, &this->addrs.sa, this->addrs.size());
delete r;
DNSEngine->packets.erase(DNSEngine->packets.begin());
+3 -3
View File
@@ -666,7 +666,7 @@ bool ConnectionSocket::ProcessRead()
{
int optval = 0;
socklen_t optlen = sizeof(optval);
if (!getsockopt(this->GetFD(), SOL_SOCKET, SO_ERROR, &optval, &optlen) && !optval)
if (!getsockopt(this->GetFD(), SOL_SOCKET, SO_ERROR, reinterpret_cast<char *>(&optval), &optlen) && !optval)
{
this->connected = true;
this->OnConnect();
@@ -694,7 +694,7 @@ bool ConnectionSocket::ProcessWrite()
{
int optval = 0;
socklen_t optlen = sizeof(optval);
if (!getsockopt(this->GetFD(), SOL_SOCKET, SO_ERROR, &optval, &optlen) && !optval)
if (!getsockopt(this->GetFD(), SOL_SOCKET, SO_ERROR, reinterpret_cast<char *>(&optval), &optlen) && !optval)
{
this->connected = true;
this->OnConnect();
@@ -720,7 +720,7 @@ void ConnectionSocket::ProcessError()
{
int optval = 0;
socklen_t optlen = sizeof(optval);
getsockopt(this->GetFD(), SOL_SOCKET, SO_ERROR, &optval, &optlen);
getsockopt(this->GetFD(), SOL_SOCKET, SO_ERROR, reinterpret_cast<char *>(&optval), &optlen);
errno = optval;
this->OnError(optval ? Anope::LastError() : "");
}
+10
View File
@@ -41,6 +41,15 @@
#define snprintf _snprintf
/* VS2008 hates having this define before its own */
#define vsnprintf _vsnprintf
#define stat _stat
#define S_ISREG(x) ((x) & _S_IFREG)
#include "sigaction/sigaction.h"
namespace Anope
{
class string;
}
extern CoreExport void OnStartup();
extern CoreExport void OnShutdown();
@@ -50,6 +59,7 @@ extern CoreExport const char *inet_ntop(int af, const void *src, char *dst, size
extern CoreExport int gettimeofday(timeval *tv, void *);
extern CoreExport Anope::string GetWindowsVersion();
extern CoreExport bool SupportedWindowsVersion();
extern int mkstemp(char *input);
#endif // _WIN32
#endif // WINDOWS_H
+14 -1
View File
@@ -34,7 +34,7 @@ WindowsLanguage WindowsLanguages[] = {
{NULL, 0}
};
WSADATA SocketEngine::wsa;
WSADATA wsa;
void OnStartup()
{
@@ -302,4 +302,17 @@ bool SupportedWindowsVersion()
return false;
}
int mkstemp(char *input)
{
input = _mktemp(input);
if (input == NULL)
{
errno = EEXIST;
return -1;
}
int fd = open(input, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
return fd;
}
#endif