diff options
author | Adam <Adam@anope.org> | 2010-10-11 18:47:54 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-10-11 18:47:54 -0400 |
commit | d7aa5f6a3a69c69b5ab3d2ddcdfd2f819e840703 (patch) | |
tree | 2236bbe0a4a984e4cabb8d8b1547a7f84dcd3018 | |
parent | 717c123441bb47a4fab859e8fb3ec8c6ac5b7223 (diff) |
Fixed Windows build
-rw-r--r-- | include/anope.h | 4 | ||||
-rw-r--r-- | include/config.h | 7 | ||||
-rw-r--r-- | include/dns.h | 4 | ||||
-rw-r--r-- | include/modules.h | 9 | ||||
-rw-r--r-- | include/services.h | 1 | ||||
-rw-r--r-- | include/users.h | 2 | ||||
-rw-r--r-- | modules/core/ms_set.cpp | 2 | ||||
-rw-r--r-- | modules/extra/db_mysql.cpp | 6 | ||||
-rw-r--r-- | src/base.cpp | 3 | ||||
-rw-r--r-- | src/dns.cpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 8 | ||||
-rw-r--r-- | src/misc.cpp | 2 | ||||
-rw-r--r-- | src/modules.cpp | 7 |
13 files changed, 34 insertions, 27 deletions
diff --git a/include/anope.h b/include/anope.h index fe46dc0ed..64efacc82 100644 --- a/include/anope.h +++ b/include/anope.h @@ -16,7 +16,7 @@ #include <set> #include "hashcomp.h" -struct Message; +class Message; namespace Anope { @@ -291,7 +291,7 @@ namespace Anope /** The current system time, which is pretty close to being accurate. * Use this unless you need very specific time checks */ - extern time_t CurTime; + extern CoreExport time_t CurTime; extern CoreExport string Version(); diff --git a/include/config.h b/include/config.h index 839af5db8..ff6608b1e 100644 --- a/include/config.h +++ b/include/config.h @@ -387,12 +387,11 @@ struct MultiConfig MultiNotify finish_function; }; -/** This class holds the bulk of the runtime configuration for the ircd. +/** This class holds the bulk of the runtime configuration for Anope. * It allows for reading new config values, accessing configuration files, - * and storage of the configuration data needed to run the ircd, such as - * the servername, connect classes, /ADMIN data, MOTDs and filenames etc. + * and storage of the configuration data needed to run Anope. */ -class ServerConfig +class CoreExport ServerConfig { private: /** Check that there is only one of each configuration item diff --git a/include/dns.h b/include/dns.h index 44e8d515b..cbadc3916 100644 --- a/include/dns.h +++ b/include/dns.h @@ -44,7 +44,7 @@ enum DNSError DNS_ERROR_NOT_IMPLEMENTED, DNS_ERROR_REFUSED, DNS_ERROR_NO_RECORDS, - DNS_ERROR_INVALID_TYPE + DNS_ERROR_INVALIDTYPE }; class DNSRequestTimeout; // Forward declarations @@ -53,7 +53,7 @@ class Module; /** The request */ -class DNSRequest +class CoreExport DNSRequest { /* Timeout timer for this request */ DNSRequestTimeout *timeout; diff --git a/include/modules.h b/include/modules.h index 4377975b1..e47b5612b 100644 --- a/include/modules.h +++ b/include/modules.h @@ -27,7 +27,7 @@ # define dlsym(file, symbol) (HMODULE)GetProcAddress(file, symbol) # define dlclose(file) FreeLibrary(file) ? 0 : 1 # define ano_modclearerr() SetLastError(0) -# define ano_moderr() LastError().c_str() +# define ano_moderr() Anope::LastError().c_str() #else typedef void * ano_module_t; @@ -123,11 +123,9 @@ else \ # ifndef RTLD_LOCAL # define RTLD_LOCAL 0 # endif -#else - const char *ano_moderr(); #endif -struct Message; +class Message; extern CoreExport Module *FindModule(const Anope::string &name); int protocol_module_init(); @@ -1265,8 +1263,9 @@ class service_reference : public dynamic_reference<T> } }; -struct Message +class CoreExport Message { +public: Anope::string name; bool (*func)(const Anope::string &source, const std::vector<Anope::string> ¶ms); diff --git a/include/services.h b/include/services.h index 4a02cadb9..55993cd1f 100644 --- a/include/services.h +++ b/include/services.h @@ -78,7 +78,6 @@ # define inet_pton inet_pton_ # define inet_ntop inet_ntop_ # define MARK_DEPRECATED -# define EINPROGRESS WSAEWOULDBLOCK extern CoreExport int inet_pton(int af, const char *src, void *dst); extern CoreExport const char *inet_ntop(int af, const void *src, char *dst, size_t size); diff --git a/include/users.h b/include/users.h index 5abf6bbca..889eca357 100644 --- a/include/users.h +++ b/include/users.h @@ -17,7 +17,7 @@ typedef unordered_map_namespace::unordered_map<Anope::string, User *, Anope::has extern CoreExport user_map UserListByNick; extern CoreExport user_uid_map UserListByUID; -class ChannelStatus : public Flags<ChannelModeName, CMODE_END * 2> +class CoreExport ChannelStatus : public Flags<ChannelModeName, CMODE_END * 2> { public: Anope::string BuildCharPrefixList() const; diff --git a/modules/core/ms_set.cpp b/modules/core/ms_set.cpp index 492111389..302cf120b 100644 --- a/modules/core/ms_set.cpp +++ b/modules/core/ms_set.cpp @@ -163,7 +163,7 @@ class CommandMSSet : public Command limit = p1.is_pos_number_only() ? convertTo<int32>(p1) : -1; /* The first character is a digit, but we could still go negative * from overflow... watch out! */ - if (limit < 0 || (Config->MSMaxMemos > 0 && convertTo<unsigned>(limit) > Config->MSMaxMemos)) + if (limit < 0 || (Config->MSMaxMemos > 0 && static_cast<unsigned>(limit) > Config->MSMaxMemos)) { if (!chan.empty()) u->SendMessage(MemoServ, MEMO_SET_LIMIT_TOO_HIGH, chan.c_str(), Config->MSMaxMemos); diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp index 92f0d1528..f50d2630e 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/extra/db_mysql.cpp @@ -333,7 +333,7 @@ class DBMySQL : public Module { private: CommandSQLSync commandsqlsync; - MySQLInterface interface; + MySQLInterface sqlinterface; service_reference<SQLProvider> SQL; public: @@ -350,7 +350,7 @@ class DBMySQL : public Module ircdproto->SendGlobops(OperServ, "Found SQL again, going out of readonly mode..."); } - SQL->Run(&interface, query); + SQL->Run(&sqlinterface, query); } else { @@ -368,7 +368,7 @@ class DBMySQL : public Module return SQL ? SQL->Escape(query) : query; } - DBMySQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), interface(this), SQL("mysql/main") + DBMySQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), sqlinterface(this), SQL("mysql/main") { me = this; diff --git a/src/base.cpp b/src/base.cpp index 0aec072a1..6977f81c5 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -1,5 +1,4 @@ -#include "services.h" -#include "modules.h" +#include "anope.h" Base::Base() { diff --git a/src/dns.cpp b/src/dns.cpp index c4cfbda51..ffd34e669 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -4,7 +4,7 @@ DNSManager *DNSEngine = NULL; static inline unsigned short GetRandomID() { - return random(); + return rand(); } DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache, Module *c) : creator(c), address(addr), QT(qt) @@ -226,7 +226,7 @@ DNSSocket::~DNSSocket() int DNSSocket::SendTo(const unsigned char *buf, size_t len) const { - return sendto(this->GetFD(), buf, len, 0, &this->conaddr.sa, this->conaddr.size()); + return sendto(this->GetFD(), reinterpret_cast<const char *>(buf), len, 0, &this->conaddr.sa, this->conaddr.size()); } int DNSSocket::RecvFrom(char *buf, size_t len, sockaddrs &addrs) const @@ -443,7 +443,7 @@ bool DNSSocket::ProcessRead() } default: delete rr; - request->OnError(DNS_ERROR_INVALID_TYPE, "Invalid query type"); + request->OnError(DNS_ERROR_INVALIDTYPE, "Invalid query type"); rr = NULL; } diff --git a/src/main.cpp b/src/main.cpp index fb3b59d1e..2cacfd8f2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -242,7 +242,11 @@ static void services_shutdown() void sighandler(int signum) { if (quitmsg.empty()) +#ifndef _WIN32 quitmsg = Anope::string("Services terminating via signal ") + strsignal(signum) + " (" + stringify(signum) + ")"; +#else + quitmsg = Anope::string("Services terminating via signal ") + stringify(signum); +#endif bool fatal = false; if (started) @@ -276,7 +280,11 @@ void sighandler(int signum) signal(SIGHUP, SIG_IGN); #endif +#ifndef _WIN32 Log() << "Received " << strsignal(signum) << " signal (" << signum << "), exiting."; +#else + Log() << "Received signal " << signum << ", exiting."; +#endif if (Config->GlobalOnCycle) oper_global("", "%s", Config->GlobalOnCycleMessage.c_str()); diff --git a/src/misc.cpp b/src/misc.cpp index 54e8bec78..9e1599bf8 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -1286,7 +1286,7 @@ const Anope::string Anope::LastError() char errbuf[513]; DWORD err = GetLastError(); if (!err) - return NULL; + return ""; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, errbuf, 512, NULL); return errbuf; #endif diff --git a/src/modules.cpp b/src/modules.cpp index 0f6771c3a..a76f2c5da 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -11,7 +11,10 @@ #include "modules.h" #include "version.h" -#include <libintl.h> + +#if GETTEXT_FOUND +# include <libintl.h> +#endif message_map MessageMap; std::list<Module *> Modules; @@ -261,7 +264,7 @@ void ModuleRunTimeDirCleanUp() { Anope::string filebuf = dirbuf + "/" + FileData.cFileName; if (!DeleteFile(filebuf.c_str())) - Log(LOG_DEBUG) << "Error deleting file " << filebuf << " - GetLastError() reports " << LastError(); + Log(LOG_DEBUG) << "Error deleting file " << filebuf << " - GetLastError() reports " << Anope::LastError(); } if (!FindNextFile(hList, &FileData)) { |