1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 07:26:37 +02:00

Fixed Windows build

This commit is contained in:
Adam
2010-10-11 18:47:54 -04:00
parent 717c123441
commit d7aa5f6a3a
13 changed files with 34 additions and 27 deletions
+2 -2
View File
@@ -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();
+3 -4
View File
@@ -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
+2 -2
View File
@@ -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;
+4 -5
View File
@@ -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> &params);
-1
View File
@@ -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);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
+3 -3
View File
@@ -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;
+1 -2
View File
@@ -1,5 +1,4 @@
#include "services.h"
#include "modules.h"
#include "anope.h"
Base::Base()
{
+3 -3
View File
@@ -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;
}
+8
View File
@@ -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());
+1 -1
View File
@@ -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
+5 -2
View File
@@ -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))
{