summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-11-08 17:29:16 -0500
committerAdam <Adam@anope.org>2011-11-08 17:29:16 -0500
commitb5ff856f47d8e54d12c568462a06351633c29610 (patch)
treea4e2f96c59ee49aa5e6cacdfd30db6155151ad36
parent97b9055f92f21cd91af44a3d5dacce0024536cff (diff)
Windows
-rw-r--r--CMakeLists.txt2
-rw-r--r--docs/WIN32.txt24
-rw-r--r--include/access.h13
-rw-r--r--include/account.h4
-rw-r--r--include/anope.h6
-rw-r--r--include/bots.h2
-rw-r--r--include/dns.h10
-rw-r--r--include/extensible.h2
-rw-r--r--include/hashcomp.h33
-rw-r--r--include/modules.h23
-rw-r--r--include/oper.h4
-rw-r--r--include/regchannel.h18
-rw-r--r--include/serialize.h149
-rw-r--r--include/services.h55
-rw-r--r--include/sockets.h6
-rw-r--r--include/threadengine.h17
-rw-r--r--modules/commands/bs_kick.cpp2
-rw-r--r--modules/commands/cs_access.cpp43
-rw-r--r--modules/commands/cs_entrymsg.cpp9
-rw-r--r--modules/commands/cs_flags.cpp41
-rw-r--r--modules/commands/cs_seen.cpp11
-rw-r--r--modules/commands/cs_set_misc.cpp9
-rw-r--r--modules/commands/cs_suspend.cpp11
-rw-r--r--modules/commands/cs_xop.cpp39
-rw-r--r--modules/commands/hs_request.cpp9
-rw-r--r--modules/commands/ns_ajoin.cpp9
-rw-r--r--modules/commands/ns_set_misc.cpp9
-rw-r--r--modules/commands/ns_suspend.cpp11
-rw-r--r--modules/commands/os_forbid.cpp6
-rw-r--r--modules/commands/os_forbid.h10
-rw-r--r--modules/commands/os_ignore.cpp5
-rw-r--r--modules/commands/os_ignore.h7
-rw-r--r--modules/commands/os_news.cpp6
-rw-r--r--modules/commands/os_news.h7
-rw-r--r--modules/commands/os_oper.cpp9
-rw-r--r--modules/commands/os_session.cpp5
-rw-r--r--modules/commands/os_session.h10
-rw-r--r--modules/database/db_flatfile.cpp57
-rw-r--r--modules/database/db_plain.cpp4
-rw-r--r--modules/database/db_sql.cpp42
-rw-r--r--modules/database/db_sql_live_read.cpp110
-rw-r--r--modules/database/db_sql_live_write.cpp2
-rw-r--r--modules/extra/m_mysql.cpp6
-rw-r--r--modules/extra/m_proxyscan.cpp4
-rw-r--r--modules/extra/m_sqlite.cpp6
-rw-r--r--modules/extra/sql.h2
-rw-r--r--modules/pseudoclients/operserv.cpp2
-rw-r--r--src/CMakeLists.txt26
-rw-r--r--src/access.cpp36
-rw-r--r--src/base.cpp19
-rw-r--r--src/bots.cpp8
-rw-r--r--src/encrypt.cpp2
-rw-r--r--src/hashcomp.cpp4
-rw-r--r--src/init.cpp8
-rw-r--r--src/logger.cpp2
-rw-r--r--src/main.cpp16
-rw-r--r--src/memoserv.cpp6
-rw-r--r--src/misc.cpp29
-rw-r--r--src/modulemanager.cpp63
-rw-r--r--src/nickalias.cpp6
-rw-r--r--src/nickcore.cpp4
-rw-r--r--src/operserv.cpp14
-rw-r--r--src/regchannel.cpp42
-rw-r--r--src/socketengines/pipeengine_pipe.cpp8
-rw-r--r--src/socketengines/pipeengine_win32.cpp53
-rw-r--r--src/socketengines/socketengine_select.cpp7
-rw-r--r--src/sockets.cpp22
-rw-r--r--src/threadengine.cpp121
-rw-r--r--src/threadengines/threadengine_pthread.cpp122
-rw-r--r--src/threadengines/threadengine_win32.cpp108
-rw-r--r--src/win32/anope_windows.h146
-rw-r--r--src/win32/dir/dir.cpp47
-rw-r--r--src/win32/dir/dir.h26
-rw-r--r--src/win32/dl/dl.cpp30
-rw-r--r--src/win32/dl/dl.h13
-rw-r--r--src/win32/pipe/pipe.cpp61
-rw-r--r--src/win32/pipe/pipe.h8
-rw-r--r--src/win32/pthread/pthread.cpp117
-rw-r--r--src/win32/pthread/pthread.h34
-rw-r--r--src/win32/sigaction/sigaction.cpp60
-rw-r--r--src/win32/sigaction/sigaction.h56
-rw-r--r--src/win32/socket.cpp152
-rw-r--r--src/win32/socket.h32
-rw-r--r--src/win32/vsvars32.bat66
-rw-r--r--src/win32/windows.cpp104
85 files changed, 1274 insertions, 1275 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 774f8c2e7..770a7d1ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -238,7 +238,7 @@ if(MSVC)
string(REPLACE "/GX " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "/W3 " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# Set the compile flags to have warnings on the max setting (but disable a few annoying ones), exception handling turned on, the proper defines
- set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4251 /wd4706 /wd4800 /wd4996 /EHs")
+ set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4251 /wd4706 /wd4800 /wd4996 /wd4250 /EHs")
add_definitions(-DMSVCPP -D_CRT_SECURE_NO_WARNINGS)
# Otherwise, we're not using Visual Studio
else(MSVC)
diff --git a/docs/WIN32.txt b/docs/WIN32.txt
index 54a95b230..17b4e38ab 100644
--- a/docs/WIN32.txt
+++ b/docs/WIN32.txt
@@ -26,36 +26,16 @@ Anope for Windows
(NOTE: When installing, tell CMake to add itself to the PATH.)
If you have Visual C++ 10 (2010) skip ahead to step 2, else you
- need to download the following free components from Microsoft. Once
+ need to download the following free component from Microsoft. Once
downloaded, install these packages.
* Microsoft Visual C++ 2010 Express Edition:
http://www.microsoft.com/express/vc/
- or
-
- then download and install:
-
- * Microsoft Windows 2008 SDK:
- http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en
-
- (NOTE: Although they say for Windows Server 2003 or 2008, they do infact work on all supported
- versions of Windows. When installing the 2003 SDK, you should select the Custom option, and only select
- to have the Microsoft Windows Core SDK installed. When installing the 2008 SDK, you should select the
- Custom option, and only select to have the Developer Tools installed, but also expand that and deselect
- the Visual C++ Compilers as well as the Mobile Tools. Doing this will decrease the install time as well
- as the space used by the SDK.)
-
2) Unpack the Anope tarball with your favorite uncompression program
(WinZip or WinRAR, etc).
- 3) (Note before this step: If you fall under one of the situations at the end of Step 1 where it says that the
- SDK will not work out of the box, do not bring up the Visual C++ Command Prompt by using the link in
- the Windows Start Menu. Instead, edit vsvars32.bat in the directory where you unpacked the source code
- in step 2, so the first line that says "@SET VSINSTALLDIR=<whatever>" has the directory where you installed
- Visual C++ Express to, if different from the default. Save the file and then run it instead.)
-
- Bring up the Visual C++ Command Prompt; This will launch a
+ 3) Bring up the Visual C++ Command Prompt; This will launch a
DOS Command Prompt like window, which will set the environment
properties needed to make Anope.
diff --git a/include/access.h b/include/access.h
index d86539d8f..1e5f6a496 100644
--- a/include/access.h
+++ b/include/access.h
@@ -1,7 +1,7 @@
#ifndef ACCESS_H
#define ACCESS_H
-struct Privilege
+struct CoreExport Privilege
{
Anope::string name;
Anope::string desc;
@@ -10,7 +10,7 @@ struct Privilege
bool operator==(const Privilege &other);
};
-class PrivilegeManager
+class CoreExport PrivilegeManager
{
static std::vector<Privilege> privs;
public:
@@ -31,7 +31,7 @@ class CoreExport AccessProvider : public Service<AccessProvider>
virtual ChanAccess *Create() = 0;
};
-class CoreExport ChanAccess
+class CoreExport ChanAccess : public Serializable
{
public:
AccessProvider *provider;
@@ -41,11 +41,12 @@ class CoreExport ChanAccess
time_t last_seen;
time_t created;
- virtual Anope::string serialize_name() = 0;
- virtual SerializableBase::serialized_data serialize() = 0;
-
ChanAccess(AccessProvider *p);
virtual ~ChanAccess();
+
+ serialized_data serialize();
+ static void unserialize(serialized_data &);
+
virtual bool Matches(User *u, NickCore *nc) = 0;
virtual bool HasPriv(const Anope::string &name) = 0;
virtual Anope::string Serialize() = 0;
diff --git a/include/account.h b/include/account.h
index 395d883dc..2d12c99cb 100644
--- a/include/account.h
+++ b/include/account.h
@@ -93,7 +93,7 @@ const Anope::string NickCoreFlagStrings[] = {
"MEMO_MAIL", "HIDE_STATUS", "SUSPENDED", "AUTOOP", "FORBIDDEN", "UNCONFIRMED", ""
};
-class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_END>, public Serializable<NickAlias>
+class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_END>, public Serializable
{
public:
/** Default constructor
@@ -132,7 +132,7 @@ class CoreExport NickAlias : public Extensible, public Flags<NickNameFlag, NS_EN
void OnCancel(User *u);
};
-class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END>, public Serializable<NickCore>
+class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END>, public Serializable
{
public:
/** Default constructor
diff --git a/include/anope.h b/include/anope.h
index 60eb59775..837f0c82e 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -21,7 +21,7 @@ class Message;
namespace Anope
{
template<typename T> class map : public std::map<string, T> { };
- template<typename T> class insensitive_map : public std::map<string, T, std::less<ci::string> > { };
+ template<typename T> class insensitive_map : public std::map<string, T, ci::less> { };
/**
* A wrapper string class around all the other string classes, this class will
@@ -265,7 +265,7 @@ namespace Anope
{
Anope::string new_string = *this;
for (size_type i = 0; i < new_string.length(); ++i)
- new_string[i] = tolower(new_string[i]);
+ new_string[i] = static_cast<char>(tolower(new_string[i]));
return new_string;
}
@@ -276,7 +276,7 @@ namespace Anope
{
Anope::string new_string = *this;
for (size_type i = 0; i < new_string.length(); ++i)
- new_string[i] = toupper(new_string[i]);
+ new_string[i] = static_cast<char>(toupper(new_string[i]));
return new_string;
}
diff --git a/include/bots.h b/include/bots.h
index 64d185840..00c0c87a1 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -32,7 +32,7 @@ enum BotFlag
static const Anope::string BotFlagString[] = { "BEGIN", "CORE", "PRIVATE", "CONF", "" };
-class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>, public Serializable<BotInfo>
+class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>, public Serializable
{
public:
uint32_t chancount;
diff --git a/include/dns.h b/include/dns.h
index d72cc08de..23e779b67 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -52,7 +52,7 @@ class Module;
struct DNSQuery;
class DNSPacket;
-struct Question
+struct CoreExport Question
{
Anope::string name;
QueryType type;
@@ -62,7 +62,7 @@ struct Question
Question(const Anope::string &, QueryType, unsigned short = 1);
};
-struct ResourceRecord : public Question
+struct CoreExport ResourceRecord : public Question
{
unsigned int ttl;
Anope::string rdata;
@@ -72,7 +72,7 @@ struct ResourceRecord : public Question
ResourceRecord(const Question &);
};
-struct DNSQuery
+struct CoreExport DNSQuery
{
std::vector<Question> questions;
std::vector<ResourceRecord> answers, authorities, additional;
@@ -134,11 +134,11 @@ class DNSPacket : public DNSQuery
unsigned short Pack(unsigned char *output, unsigned short output_size);
};
-/** DNS manager, manages the connection and all requests
+/** DNS manager, manages all requests
*/
class CoreExport DNSManager : public Timer, public Socket
{
- typedef std::multimap<Anope::string, ResourceRecord, std::less<ci::string> > cache_map;
+ typedef std::multimap<Anope::string, ResourceRecord, ci::less> cache_map;
cache_map cache;
sockaddrs addrs;
public:
diff --git a/include/extensible.h b/include/extensible.h
index c5de2dae4..c4dd3a0f3 100644
--- a/include/extensible.h
+++ b/include/extensible.h
@@ -10,7 +10,7 @@
#include "anope.h"
#include "hashcomp.h"
-class ExtensibleItem
+class CoreExport ExtensibleItem
{
public:
ExtensibleItem();
diff --git a/include/hashcomp.h b/include/hashcomp.h
index d78b01857..a4a86889f 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -139,6 +139,16 @@ namespace irc
/** This typedef declares irc::string based upon irc_char_traits.
*/
typedef std::basic_string<char, irc_char_traits, std::allocator<char> > string;
+
+ struct CoreExport less
+ {
+ /** Compare two Anope::strings as irc::strings and find which one is less
+ * @param s1 The first string
+ * @param s2 The second string
+ * @return true if s1 < s2, else false
+ */
+ bool operator()(const Anope::string &s1, const Anope::string &s2) const;
+ };
}
/** The ci namespace contains a number of helper classes.
@@ -193,16 +203,9 @@ namespace ci
/** This typedef declares ci::string based upon ci_char_traits.
*/
typedef std::basic_string<char, ci_char_traits, std::allocator<char> > string;
-}
-namespace std
-{
- /** An overload for std::less<ci::string> that uses Anope::string, passed for the third template argument
- * to std::map and std::multimap
- */
- template<> struct CoreExport less<ci::string>
+ struct CoreExport less
{
- public:
/** Compare two Anope::strings as ci::strings and find which one is less
* @param s1 The first string
* @param s2 The second string
@@ -210,20 +213,6 @@ namespace std
*/
bool operator()(const Anope::string &s1, const Anope::string &s2) const;
};
-
- /** An overload for std;:less<irc::string> that uses Anope::string, passed for the third tempalte argument
- * to std::map and std::multimap
- */
- template<> struct CoreExport less<irc::string>
- {
- public:
- /** Compare two Anope::strings as irc::strings and find which one is less
- * @param s1 The first string
- * @param s2 The second string
- * @return true if s1 < s2, else false
- */
- bool operator()(const Anope::string &s1, const Anope::string &s2) const;
- };
}
/* Define operators for + and == with irc::string to std::string for easy assignment
diff --git a/include/modules.h b/include/modules.h
index 695917dbf..d3a43cd8a 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -18,27 +18,6 @@
#include "timers.h"
#include "hashcomp.h"
-/* Cross OS compatibility macros */
-#ifdef _WIN32
- typedef HMODULE ano_module_t;
-
-# define dlopen(file, unused) LoadLibrary(file)
-# define dlsym(file, symbol) (HMODULE)GetProcAddress(file, symbol)
-# define dlclose(file) FreeLibrary(file) ? 0 : 1
-# define ano_modclearerr() SetLastError(0)
-# define ano_moderr() (Anope::LastError().empty() ? NULL : Anope::LastError().c_str())
-#else
- typedef void * ano_module_t;
-
-/* We call dlerror() here because it clears the module error after being
- * called. This previously read 'errno = 0', but that didn't work on
- * all POSIX-compliant architectures. This way the error is guaranteed
- * to be cleared, POSIX-wise. -GD
- */
-# define ano_modclearerr() dlerror()
-# define ano_moderr() dlerror()
-#endif
-
/** Possible return types from events.
*/
enum EventReturn
@@ -215,7 +194,7 @@ class CoreExport Module : public Extensible
/** Handle for this module, obtained from dlopen()
*/
- ano_module_t handle;
+ void *handle;
/** Time this module was created
*/
diff --git a/include/oper.h b/include/oper.h
index 1537681a1..62f783282 100644
--- a/include/oper.h
+++ b/include/oper.h
@@ -11,7 +11,7 @@
class XLineManager;
-class CoreExport XLine : public Serializable<XLine>
+class CoreExport XLine : public Serializable
{
protected:
XLine();
@@ -42,7 +42,7 @@ class CoreExport XLineManager : public Service<XLineManager>
char type;
/* List of XLines in this XLineManager */
std::vector<XLine *> XLines;
- static std::map<Anope::string, XLine *, std::less<ci::string> > XLinesByUID;
+ static std::map<Anope::string, XLine *, ci::less> XLinesByUID;
public:
/* List of XLine managers we check users against in XLineManager::CheckAll */
static std::list<XLineManager *> XLineManagers;
diff --git a/include/regchannel.h b/include/regchannel.h
index e22d64e5f..3f6c29581 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -75,12 +75,13 @@ enum BadWordType
};
/* Structure used to contain bad words. */
-struct BadWord : Serializable<BadWord>
+struct CoreExport BadWord : Serializable
{
ChannelInfo *ci;
Anope::string word;
BadWordType type;
+ BadWord();
serialized_data serialize();
static void unserialize(serialized_data &);
};
@@ -96,10 +97,10 @@ enum AutoKickFlag
const Anope::string AutoKickFlagString[] = { "AK_ISNICK", "" };
/* AutoKick data. */
-class AutoKick : public Flags<AutoKickFlag>, public Serializable<AutoKick>
+class CoreExport AutoKick : public Flags<AutoKickFlag>, public Serializable
{
public:
- AutoKick() : Flags<AutoKickFlag>(AutoKickFlagString) { }
+ AutoKick();
ChannelInfo *ci;
/* Only one of these can be in use */
Anope::string mask;
@@ -114,9 +115,9 @@ class AutoKick : public Flags<AutoKickFlag>, public Serializable<AutoKick>
static void unserialize(serialized_data &);
};
-struct ModeLock : Serializable<ModeLock>
+struct CoreExport ModeLock : Serializable
{