diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/actions.cpp | 1 | ||||
-rw-r--r-- | src/botserv.cpp | 1 | ||||
-rw-r--r-- | src/chanserv.cpp | 1 | ||||
-rw-r--r-- | src/dns.cpp | 2 | ||||
-rw-r--r-- | src/encrypt.cpp | 1 | ||||
-rw-r--r-- | src/init.cpp | 3 | ||||
-rw-r--r-- | src/logger.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 5 | ||||
-rw-r--r-- | src/misc.cpp | 2 | ||||
-rw-r--r-- | src/modulemanager.cpp | 5 | ||||
-rw-r--r-- | src/operserv.cpp | 6 | ||||
-rw-r--r-- | src/socketengines/pipeengine_pipe.cpp | 5 | ||||
-rw-r--r-- | src/sockets.cpp | 5 | ||||
-rw-r--r-- | src/threadengine.cpp | 2 | ||||
-rw-r--r-- | src/win32/anope_windows.h | 16 | ||||
-rw-r--r-- | src/win32/dl/dl.cpp | 1 | ||||
-rw-r--r-- | src/win32/pipe/pipe.cpp | 21 | ||||
-rw-r--r-- | src/win32/socket.h | 1 | ||||
-rw-r--r-- | src/win32/windows.cpp | 6 |
19 files changed, 59 insertions, 27 deletions
diff --git a/src/actions.cpp b/src/actions.cpp index 657973e3c..512a0fa52 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -14,6 +14,7 @@ #include "config.h" #include "regchannel.h" #include "channels.h" +#include "extern.h" /*************************************************************************/ diff --git a/src/botserv.cpp b/src/botserv.cpp index 4ec6465a1..5718be81a 100644 --- a/src/botserv.cpp +++ b/src/botserv.cpp @@ -20,6 +20,7 @@ #include "extern.h" #include "access.h" #include "channels.h" +#include "account.h" BotInfo* findbot(const Anope::string &nick) { diff --git a/src/chanserv.cpp b/src/chanserv.cpp index 67b77a432..4456ce37c 100644 --- a/src/chanserv.cpp +++ b/src/chanserv.cpp @@ -17,6 +17,7 @@ #include "users.h" #include "channels.h" #include "access.h" +#include "account.h" ChannelInfo* cs_findchan(const Anope::string &chan) { diff --git a/src/dns.cpp b/src/dns.cpp index 25c82e24f..f21453ddd 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -15,9 +15,11 @@ #include "sockets.h" #include "socketengine.h" +#ifndef _WIN32 #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> +#endif DNSManager *DNSEngine = NULL; diff --git a/src/encrypt.cpp b/src/encrypt.cpp index af6a54ba8..154f600bf 100644 --- a/src/encrypt.cpp +++ b/src/encrypt.cpp @@ -11,6 +11,7 @@ #include "services.h" #include "modules.h" +#include "extern.h" /******************************************************************************/ diff --git a/src/init.cpp b/src/init.cpp index 45262c1dd..b1001904c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -20,11 +20,12 @@ #include "socketengine.h" #include "servers.h" +#ifndef _WIN32 #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> -#include <unistd.h> #include <grp.h> +#endif Anope::string conf_dir = "conf", db_dir = "data", modules_dir = "lib", locale_dir = "locale", log_dir = "logs"; diff --git a/src/logger.cpp b/src/logger.cpp index 0624509d2..f14664cdb 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -22,8 +22,10 @@ #include "uplink.h" #include "protocol.h" +#ifndef _WIN32 #include <sys/time.h> #include <unistd.h> +#endif static Anope::string GetTimeStamp() { diff --git a/src/main.cpp b/src/main.cpp index e3fcb8bb2..cdddc3163 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,8 +35,11 @@ #include "signals.h" #include "socketengine.h" -#include <unistd.h> +#ifndef _WIN32 #include <limits.h> +#else +#include <process.h> +#endif /******** Global variables! ********/ diff --git a/src/misc.cpp b/src/misc.cpp index ee091c249..1245656f0 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -760,7 +760,7 @@ void Anope::Unhex(const Anope::string &src, Anope::string &dest) Anope::string rv; for (size_t i = 0; i + 1 < len; i += 2) { - char h = std::tolower(src[i]), l = std::tolower(src[i + 1]); + char h = std::tolower(src[i], Anope::casemap), l = std::tolower(src[i + 1], Anope::casemap); unsigned char byte = (h >= 'a' ? h - 'a' + 10 : h - '0') << 4; byte += (l >= 'a' ? l - 'a' + 10 : l - '0'); rv += byte; diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 57b8f850e..5e3f7b6f2 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -12,11 +12,12 @@ #include "users.h" #include <sys/types.h> +#include <sys/stat.h> +#ifndef _WIN32 #include <dirent.h> #include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> #include <dlfcn.h> +#endif std::vector<Module *> ModuleManager::EventHandlers[I_END]; diff --git a/src/operserv.cpp b/src/operserv.cpp index bbdeffdc8..de49c55b9 100644 --- a/src/operserv.cpp +++ b/src/operserv.cpp @@ -253,7 +253,7 @@ Anope::string XLineManager::GenerateUID() { char c; do - c = (random() % 75) + 48; + c = (rand() % 75) + 48; while (!isupper(c) && !isdigit(c)); id += c; } @@ -431,9 +431,9 @@ bool XLineManager::CanAdd(CommandSource &source, const Anope::string &mask, time */ XLine* XLineManager::HasEntry(const Anope::string &mask) { - std::map<Anope::string, XLine *, ci::less>::iterator it = XLinesByUID->find(mask); + std::multimap<Anope::string, XLine *, ci::less>::iterator it = XLinesByUID->find(mask); if (it != XLinesByUID->end()) - for (std::map<Anope::string, XLine *, ci::less>::iterator it2 = XLinesByUID->upper_bound(mask); it != it2; ++it) + for (std::multimap<Anope::string, XLine *, ci::less>::iterator it2 = XLinesByUID->upper_bound(mask); it != it2; ++it) if (it->second->manager == NULL || it->second->manager == this) { it->second->QueueUpdate(); diff --git a/src/socketengines/pipeengine_pipe.cpp b/src/socketengines/pipeengine_pipe.cpp index 985c1cf95..dbded29b4 100644 --- a/src/socketengines/pipeengine_pipe.cpp +++ b/src/socketengines/pipeengine_pipe.cpp @@ -13,8 +13,9 @@ #include "sockets.h" #include "socketengine.h" -#include <unistd.h> +#ifndef _WIN32 #include <fcntl.h> +#endif Pipe::Pipe() : Socket(-1), WritePipe(-1) { @@ -37,7 +38,7 @@ Pipe::Pipe() : Socket(-1), WritePipe(-1) Pipe::~Pipe() { if (this->WritePipe >= 0) - close(this->WritePipe); + anope_close(this->WritePipe); } bool Pipe::ProcessRead() diff --git a/src/sockets.cpp b/src/sockets.cpp index ebaf8f5a3..3d2df8dc9 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -14,10 +14,11 @@ #include "socketengine.h" #include "logger.h" +#ifndef _WIN32 #include <arpa/inet.h> #include <errno.h> -#include <unistd.h> #include <fcntl.h> +#endif std::map<int, Socket *> SocketEngine::Sockets; @@ -421,7 +422,7 @@ Socket::Socket(int sock, bool ipv6, int type) : Flags<SocketFlag>(SocketFlagStri Socket::~Socket() { SocketEngine::DelSocket(this); - close(this->Sock); + anope_close(this->Sock); this->IO->Destroy(); } diff --git a/src/threadengine.cpp b/src/threadengine.cpp index d45686586..c3ecdd1b5 100644 --- a/src/threadengine.cpp +++ b/src/threadengine.cpp @@ -13,7 +13,9 @@ #include "threadengine.h" #include "anope.h" +#ifndef _WIN32 #include <pthread.h> +#endif static inline pthread_attr_t *get_engine_attr() { diff --git a/src/win32/anope_windows.h b/src/win32/anope_windows.h index e5c4d3b11..635dfb8e8 100644 --- a/src/win32/anope_windows.h +++ b/src/win32/anope_windows.h @@ -1,4 +1,4 @@ - /* POSIX emulation layer for Windows. +/* POSIX emulation layer for Windows. * * Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org> * Copyright (C) 2008-2012 Anope Team <info@anope.org> @@ -9,9 +9,11 @@ * Based on the original code of Services by Andy Church. */ - #ifndef WINDOWS_H - #define WINDOWS_H - #ifdef _WIN32 +#ifndef WINDOWS_H +#define WINDOWS_H +#ifdef _WIN32 + +#define NOMINMAX #include <winsock2.h> #include <ws2tcpip.h> @@ -40,6 +42,8 @@ /* VS2008 hates having this define before its own */ #define vsnprintf _vsnprintf +#define anope_close windows_close + #define stat _stat #define S_ISREG(x) ((x) & _S_IFREG) @@ -48,6 +52,8 @@ #endif #define EINPROGRESS WSAEWOULDBLOCK +#include "extensible.h" + #include "socket.h" #include "dir/dir.h" #include "dl/dl.h" @@ -71,5 +77,7 @@ extern int unsetenv(const char *name); extern int mkstemp(char *input); extern void getcwd(char *buf, size_t sz); +template struct ExtensibleItemClass<Anope::string>; + #endif // _WIN32 #endif // WINDOWS_H diff --git a/src/win32/dl/dl.cpp b/src/win32/dl/dl.cpp index 93e2939d0..a6cbe48ce 100644 --- a/src/win32/dl/dl.cpp +++ b/src/win32/dl/dl.cpp @@ -6,6 +6,7 @@ */ #include "services.h" +#include "anope.h" void *dlopen(const char *filename, int) { diff --git a/src/win32/pipe/pipe.cpp b/src/win32/pipe/pipe.cpp index 36e6ef5ec..6c4a9a3f1 100644 --- a/src/win32/pipe/pipe.cpp +++ b/src/win32/pipe/pipe.cpp @@ -6,6 +6,7 @@ */ #include "services.h" +#include "sockets.h" int pipe(int fds[2]) { @@ -14,22 +15,22 @@ int pipe(int fds[2]) int cfd = socket(AF_INET, SOCK_STREAM, 0), lfd = socket(AF_INET, SOCK_STREAM, 0); if (cfd == -1 || lfd == -1) { - close(cfd); - close(lfd); + anope_close(cfd); + anope_close(lfd); return -1; } if (bind(lfd, &localhost.sa, localhost.size()) == -1) { - close(cfd); - close(lfd); + anope_close(cfd); + anope_close(lfd); return -1; } if (listen(lfd, 1) == -1) { - close(cfd); - close(lfd); + anope_close(cfd); + anope_close(lfd); return -1; } @@ -39,16 +40,16 @@ int pipe(int fds[2]) if (connect(cfd, &lfd_addr.sa, lfd_addr.size())) { - close(cfd); - close(lfd); + anope_close(cfd); + anope_close(lfd); return -1; } int afd = accept(lfd, NULL, NULL); - close(lfd); + anope_close(lfd); if (afd == -1) { - close(cfd); + anope_close(cfd); return -1; } diff --git a/src/win32/socket.h b/src/win32/socket.h index 50262a708..4c1f182eb 100644 --- a/src/win32/socket.h +++ b/src/win32/socket.h @@ -25,7 +25,6 @@ extern CoreExport const char *windows_inet_ntop(int af, const void *src, char *d extern CoreExport int fcntl(int fd, int cmd, int arg); #ifndef WIN32_NO_OVERRIDE -# define close windows_close # define accept windows_accept # define inet_pton windows_inet_pton # define inet_ntop windows_inet_ntop diff --git a/src/win32/windows.cpp b/src/win32/windows.cpp index 1e621945e..785a38969 100644 --- a/src/win32/windows.cpp +++ b/src/win32/windows.cpp @@ -11,6 +11,12 @@ #ifdef _WIN32 #include "services.h" +#include "anope.h" + +#include <io.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <fcntl.h> static struct WindowsLanguage { |