summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-08-10 01:32:07 -0400
committerAdam <Adam@anope.org>2011-08-10 01:32:07 -0400
commitded98ed3ded63aa37b7226cd7228b375df8b33e3 (patch)
tree83e728dddd3b886d198908979a72916727d71ad1
parent13bcc4ef14c0c61e8ed578ac9346291ae731b8df (diff)
Fixed windows build
-rw-r--r--include/access.h4
-rw-r--r--include/account.h4
-rw-r--r--include/modules.h2
-rw-r--r--include/opertype.h2
-rw-r--r--include/regchannel.h2
-rw-r--r--include/socketengine.h4
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/dns.cpp4
-rw-r--r--src/sockets.cpp6
-rw-r--r--src/win32/anope_windows.h10
-rw-r--r--src/win32/windows.cpp15
11 files changed, 37 insertions, 17 deletions
diff --git a/include/access.h b/include/access.h
index 01d0616d4..c1692960d 100644
--- a/include/access.h
+++ b/include/access.h
@@ -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;
diff --git a/include/account.h b/include/account.h
index 57e678138..2a812529b 100644
--- a/include/account.h
+++ b/include/account.h
@@ -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;
diff --git a/include/modules.h b/include/modules.h
index df4fd0323..2bf16477b 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -188,7 +188,7 @@ class Version
class CallBack;
class XLineManager;
-class CommandSource;
+struct CommandSource;
/** Every module in Anope is actually a class.
*/
diff --git a/include/opertype.h b/include/opertype.h
index 0c0d329c7..364343f25 100644
--- a/include/opertype.h
+++ b/include/opertype.h
@@ -12,7 +12,7 @@
class OperType;
-struct Oper
+struct CoreExport Oper
{
Anope::string name;
Anope::string password;
diff --git a/include/regchannel.h b/include/regchannel.h
index 7df852793..855c3891d 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -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;
diff --git a/include/socketengine.h b/include/socketengine.h
index 05859eedb..28d838888 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -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;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 47d2e8efb..a01b608a4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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
diff --git a/src/dns.cpp b/src/dns.cpp
index 0cfe047b0..7c5889477 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -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());
diff --git a/src/sockets.cpp b/src/sockets.cpp
index e95c9f7a9..b7f0a5f9a 100644
--- a/src/sockets.cpp
+++ b/src/sockets.cpp
@@ -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() : "");
}
diff --git a/src/win32/anope_windows.h b/src/win32/anope_windows.h
index 6d16e5554..4fe1b11e5 100644
--- a/src/win32/anope_windows.h
+++ b/src/win32/anope_windows.h
@@ -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
diff --git a/src/win32/windows.cpp b/src/win32/windows.cpp
index 265b5601b..60edaffbc 100644
--- a/src/win32/windows.cpp
+++ b/src/win32/windows.cpp
@@ -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