From 1af64a9bbb150b9daae3944d6aae86864c271103 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 2 Sep 2012 08:30:54 -0400 Subject: Fix Windows --- include/account.h | 14 +++++++------- include/anope.h | 14 +++++++++++++- include/bots.h | 10 +++++----- include/channels.h | 14 +++++++------- include/commands.h | 2 +- include/config.h | 2 +- include/defs.h | 4 ++-- include/extensible.h | 2 +- include/extern.h | 13 ------------- include/modules.h | 2 +- include/protocol.h | 12 ++++++------ include/regchannel.h | 11 ++++++----- include/serialize.h | 2 +- include/services.h | 21 +++++++++++++-------- include/sockets.h | 8 +++++--- include/uplink.h | 2 +- include/users.h | 19 ++++++++++--------- 17 files changed, 80 insertions(+), 72 deletions(-) (limited to 'include') diff --git a/include/account.h b/include/account.h index 756c97348..ff9c70727 100644 --- a/include/account.h +++ b/include/account.h @@ -23,8 +23,8 @@ typedef Anope::insensitive_map nickalias_map; typedef Anope::insensitive_map nickcore_map; -extern serialize_checker NickAliasList; -extern serialize_checker NickCoreList; +extern CoreExport serialize_checker NickAliasList; +extern CoreExport serialize_checker NickCoreList; /* NickServ nickname structures. */ @@ -309,11 +309,11 @@ class CoreExport NickCore : public Extensible, public Flags inline T anope_dynamic_static_cast(O ptr) #endif } +template inline T anope_dynamic_reinterpret_cast(O ptr) +{ +#ifdef DEBUG_BUILD + T ret = dynamic_cast(ptr); + if (ptr != NULL && ret == NULL) + throw CoreException(Anope::string("anope_dynamic_reinterpret_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail"); + return ret; +#else + return reinterpret_cast(ptr); +#endif +} + /*************************************************************************/ /** Class with the ability to keep flags on items, they should extend from this diff --git a/include/bots.h b/include/bots.h index 749e4c92d..521ab8c03 100644 --- a/include/bots.h +++ b/include/bots.h @@ -17,8 +17,8 @@ typedef Anope::insensitive_map botinfo_map; typedef Anope::map botinfouid_map; -extern serialize_checker BotListByNick; -extern serialize_checker BotListByUID; +extern CoreExport serialize_checker BotListByNick; +extern CoreExport serialize_checker BotListByUID; /** Flags settable on a bot */ @@ -132,9 +132,9 @@ class CoreExport BotInfo : public User, public Flags, public Se CommandInfo *GetCommand(const Anope::string &cname); }; -extern BotInfo *findbot(const Anope::string &nick); +extern CoreExport BotInfo *findbot(const Anope::string &nick); -extern void bot_raw_ban(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason); -extern void bot_raw_kick(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason); +extern CoreExport void bot_raw_ban(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason); +extern CoreExport void bot_raw_kick(User *requester, ChannelInfo *ci, const Anope::string &nick, const Anope::string &reason); #endif // BOTS_H diff --git a/include/channels.h b/include/channels.h index bcde363fc..dbc71129d 100644 --- a/include/channels.h +++ b/include/channels.h @@ -246,15 +246,15 @@ class CoreExport Channel : public virtual Base, public Extensible, public Flags< void Hold(); }; -extern Channel *findchan(const Anope::string &chan); +extern CoreExport Channel *findchan(const Anope::string &chan); -extern User *nc_on_chan(Channel *c, const NickCore *nc); +extern CoreExport User *nc_on_chan(Channel *c, const NickCore *nc); -extern void do_cmode(const Anope::string &source, const Anope::string &channel, const Anope::string &modes, const Anope::string &ts); -extern void do_join(const Anope::string &source, const Anope::string &channels, const Anope::string &ts); -extern void do_kick(const Anope::string &source, const Anope::string &channel, const Anope::string &users, const Anope::string &reason); -extern void do_part(const Anope::string &source, const Anope::string &channels, const Anope::string &reason); +extern CoreExport void do_cmode(const Anope::string &source, const Anope::string &channel, const Anope::string &modes, const Anope::string &ts); +extern CoreExport void do_join(const Anope::string &source, const Anope::string &channels, const Anope::string &ts); +extern CoreExport void do_kick(const Anope::string &source, const Anope::string &channel, const Anope::string &users, const Anope::string &reason); +extern CoreExport void do_part(const Anope::string &source, const Anope::string &channels, const Anope::string &reason); -extern void chan_set_correct_modes(const User *user, Channel *c, int give_modes); +extern CoreExport void chan_set_correct_modes(const User *user, Channel *c, int give_modes); #endif // CHANNELS_H diff --git a/include/commands.h b/include/commands.h index d644ea8cb..c3a412624 100644 --- a/include/commands.h +++ b/include/commands.h @@ -142,6 +142,6 @@ class CoreExport Command : public Service, public Flags virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand); }; -extern void RunCommand(CommandSource &source, const Anope::string &message); +extern CoreExport void RunCommand(CommandSource &source, const Anope::string &message); #endif // COMMANDS_H diff --git a/include/config.h b/include/config.h index 0ab3c287b..e37028bcf 100644 --- a/include/config.h +++ b/include/config.h @@ -805,6 +805,6 @@ class CoreExport ConfigReader }; extern ConfigurationFile services_conf; -extern ServerConfig *Config; +extern CoreExport ServerConfig *Config; #endif // CONFIG_H diff --git a/include/defs.h b/include/defs.h index db3c801ed..2df0a2c15 100644 --- a/include/defs.h +++ b/include/defs.h @@ -21,6 +21,7 @@ class ChannelInfo; class ChannelStatus; class ClientSocket; class Command; +class CommandSource; class ConnectionSocket; class DNSPacket; class dynamic_reference_base; @@ -42,13 +43,12 @@ class ServerConfig; class Socket; class Thread; class User; +class XLine; class XLineManager; struct BadWord; -struct CommandSource; struct DNSQuery; struct Exception; struct MemoInfo; struct ModeLock; struct Oper; -struct XLine; diff --git a/include/extensible.h b/include/extensible.h index 5d0cdafa5..162a2cf6f 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -95,7 +95,7 @@ class CoreExport Extensible { extensible_map::const_iterator it = this->extension_items.find(key); if (it != this->extension_items.end()) - return anope_dynamic_static_cast(it->second); + return anope_dynamic_reinterpret_cast(it->second); return NULL; } diff --git a/include/extern.h b/include/extern.h index 29f84c850..5eb7dcb58 100644 --- a/include/extern.h +++ b/include/extern.h @@ -23,19 +23,6 @@ E bool bad_password(User *u); E void common_unban(const ChannelInfo *ci, User *u, bool full = false); -/**** channels.c ****/ - -E Channel *findchan(const Anope::string &chan); - -E User *nc_on_chan(Channel *c, const NickCore *nc); - -E void do_cmode(const Anope::string &source, const Anope::string &channel, const Anope::string &modes, const Anope::string &ts); -E void do_join(const Anope::string &source, const Anope::string &channels, const Anope::string &ts); -E void do_kick(const Anope::string &source, const Anope::string &channel, const Anope::string &users, const Anope::string &reason); -E void do_part(const Anope::string &source, const Anope::string &channels, const Anope::string &reason); - -E void chan_set_correct_modes(const User *user, Channel *c, int give_modes); - /**** encrypt.c ****/ E void enc_encrypt(const Anope::string &src, Anope::string &dest); diff --git a/include/modules.h b/include/modules.h index ae7ab139a..939b98b34 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1111,7 +1111,7 @@ class CoreExport ModuleManager /** Class used for callbacks within modules */ -class CallBack : public Timer +class CoreExport CallBack : public Timer { private: Module *m; diff --git a/include/protocol.h b/include/protocol.h index b471ce23f..5fb9da403 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -144,12 +144,12 @@ class CoreExport IRCdMessage virtual bool OnError(const Anope::string &, const std::vector &); }; -extern IRCDVar *ircd; -extern IRCDProto *ircdproto; -extern IRCdMessage *ircdmessage; +extern CoreExport IRCDVar *ircd; +extern CoreExport IRCDProto *ircdproto; +extern CoreExport IRCdMessage *ircdmessage; -extern void pmodule_ircd_proto(IRCDProto *); -extern void pmodule_ircd_var(IRCDVar *ircdvar); -extern void pmodule_ircd_message(IRCdMessage *message); +extern CoreExport void pmodule_ircd_proto(IRCDProto *); +extern CoreExport void pmodule_ircd_var(IRCDVar *ircdvar); +extern CoreExport void pmodule_ircd_message(IRCdMessage *message); #endif // PROTOCOL_H diff --git a/include/regchannel.h b/include/regchannel.h index 255bcc200..9640a6735 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -16,10 +16,11 @@ #include "logger.h" #include "modules.h" #include "serialize.h" +#include "bots.h" typedef Anope::insensitive_map registered_channel_map; -extern serialize_checker RegisteredChannelList; +extern CoreExport serialize_checker RegisteredChannelList; /** Flags used for the ChannelInfo class */ @@ -441,9 +442,9 @@ class CoreExport ChannelInfo : public Extensible, public Flags #endif +#ifndef _WIN32 +#include +#endif + /* Pull in the various bits of STL */ #include #include @@ -45,14 +49,6 @@ #define _(x) x -#ifndef _WIN32 -# define DllExport -# define CoreExport -# define MARK_DEPRECATED __attribute((deprecated)) -#else -# include "anope_windows.h" -#endif - #ifdef __GXX_EXPERIMENTAL_CXX0X__ # define anope_override override # define anope_final final @@ -61,6 +57,15 @@ # define anope_final #endif +#ifndef _WIN32 +# define DllExport +# define CoreExport +# define MARK_DEPRECATED __attribute((deprecated)) +# define anope_close close +#else +# include "anope_windows.h" +#endif + /** * RFC: defination of a valid nick * nickname = ( letter / special ) *8( letter / digit / special / "-" ) diff --git a/include/sockets.h b/include/sockets.h index 8f863b59c..8b669bbde 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -12,9 +12,11 @@ #ifndef SOCKETS_H #define SOCKETS_H +#ifndef _WIN32 #include #include #include +#endif #include "anope.h" @@ -482,8 +484,8 @@ class CoreExport Pipe : public Socket virtual void OnNotify() = 0; }; -extern uint32_t TotalRead; -extern uint32_t TotalWritten; -extern SocketIO normalSocketIO; +extern CoreExport uint32_t TotalRead; +extern CoreExport uint32_t TotalWritten; +extern CoreExport SocketIO normalSocketIO; #endif // SOCKET_H diff --git a/include/uplink.h b/include/uplink.h index 70b20a28b..617a8aa1a 100644 --- a/include/uplink.h +++ b/include/uplink.h @@ -42,7 +42,7 @@ class UplinkSocket : public ConnectionSocket, public BufferedSocket } }; }; -extern UplinkSocket *UplinkSock; +extern CoreExport UplinkSocket *UplinkSock; #endif // UPLINK_H diff --git a/include/users.h b/include/users.h index d0b38025e..fab5fa868 100644 --- a/include/users.h +++ b/include/users.h @@ -13,6 +13,7 @@ #include "extensible.h" #include "serialize.h" #include "commands.h" +#include "account.h" extern CoreExport Anope::insensitive_map UserListByNick; extern CoreExport Anope::map UserListByUID; @@ -303,19 +304,19 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe void Kill(const Anope::string &source, const Anope::string &reason); }; -extern int32_t opcnt; -extern uint32_t maxusercnt, usercnt; -extern time_t maxusertime; +extern CoreExport int32_t opcnt; +extern CoreExport uint32_t maxusercnt, usercnt; +extern CoreExport time_t maxusertime; -extern User *finduser(const Anope::string &nick); +extern CoreExport User *finduser(const Anope::string &nick); -extern User *do_nick(const Anope::string &source, const Anope::string &nick, const Anope::string &username, const Anope::string &host, const Anope::string &server, const Anope::string &realname, time_t ts, const Anope::string &ip, const Anope::string &vhost, const Anope::string &uid, const Anope::string &modes); +extern CoreExport User *do_nick(const Anope::string &source, const Anope::string &nick, const Anope::string &username, const Anope::string &host, const Anope::string &server, const Anope::string &realname, time_t ts, const Anope::string &ip, const Anope::string &vhost, const Anope::string &uid, const Anope::string &modes); -extern void do_umode(const Anope::string &user, const Anope::string &modes); -extern void do_kill(User *user, const Anope::string &reason); +extern CoreExport void do_umode(const Anope::string &user, const Anope::string &modes); +extern CoreExport void do_kill(User *user, const Anope::string &reason); -extern bool matches_list(Channel *c, User *user, ChannelModeName mode); +extern CoreExport bool matches_list(Channel *c, User *user, ChannelModeName mode); -extern Anope::string create_mask(User *u); +extern CoreExport Anope::string create_mask(User *u); #endif // USERS_H -- cgit