]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix building on Windows (mostly).
authorPeter Powell <petpow@saberuk.com>
Sat, 17 Feb 2018 17:12:26 +0000 (17:12 +0000)
committerPeter Powell <petpow@saberuk.com>
Sat, 17 Feb 2018 17:12:26 +0000 (17:12 +0000)
.gitignore
include/modules.h
include/modules/shun.h
include/modules/sql.h
src/modules/extra/m_mysql.cpp
src/socketengine.cpp
win/CMakeLists.txt

index e9d91b29bee6a7d3224c55b714c7b74f85b3752f..2790ac8c2c14d27b04a85446116168b4cce32577 100644 (file)
@@ -28,3 +28,5 @@
 /src/modules/m_ssl_mbedtls.cpp
 /src/modules/m_ssl_openssl.cpp
 
+/win/Win32
+/win/*.dir
index c6b10cad9eff8b0c7e2da9233a2910e849a64efe..a5e5461493e040b6c605189603584510f3adb772 100644 (file)
@@ -1216,35 +1216,13 @@ struct AllModuleList {
  * and functions needed to make a module loadable by the OS.
  * It defines the class factory and external init_module function.
  */
-#ifdef _WIN32
-
 #define MODULE_INIT(y) \
        extern "C" DllExport Module * MODULE_INIT_SYM() \
        { \
                return new y; \
        } \
-       BOOLEAN WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) \
-       { \
-               switch ( nReason ) \
-               { \
-                       case DLL_PROCESS_ATTACH: \
-                       case DLL_PROCESS_DETACH: \
-                               break; \
-               } \
-               return TRUE; \
-       } \
        extern "C" DllExport const char inspircd_src_version[] = INSPIRCD_VERSION;
 
-#else
-
-#define MODULE_INIT(y) \
-       extern "C" DllExport Module * MODULE_INIT_SYM() \
-       { \
-               return new y; \
-       } \
-       extern "C" DllExport const char inspircd_src_version[] = INSPIRCD_VERSION;
-#endif
-
 #define COMMAND_INIT(c) MODULE_INIT(CommandModule<c>)
 
 #endif
index f2bc4eea5ba27300d4e2804bf35c6f34a458f3e5..9ce547e2d6fe36a5502f1e543d45f2902f1718a9 100644 (file)
@@ -23,7 +23,7 @@
 
 /** Shun class
  */
-class CoreExport Shun : public XLine
+class Shun : public XLine
 {
   public:
        /** Create a Shun.
index 01adbb42e587e1d540f4c6309c28a002d46aa6ab..14cd60a5625012bb87c714a69d5a0c57292eef11 100644 (file)
@@ -42,7 +42,7 @@ namespace SQL
        enum ErrorCode
        {
                /** No error has occurred. */
-               NO_ERROR,
+               SUCCESS,
 
                /** The database identifier is invalid. */
                BAD_DBID,
index a16a293d75da88d9e3a357b71ddc58a9c4ceb5cd..4ee6de527232de3c1cdee21c333596f43f54b9df 100644 (file)
@@ -145,7 +145,7 @@ class MySQLresult : public SQL::Result
        std::vector<std::string> colnames;
        std::vector<SQL::Row> fieldlists;
 
-       MySQLresult(MYSQL_RES* res, int affected_rows) : err(SQL::NO_ERROR), currentrow(0), rows(0)
+       MySQLresult(MYSQL_RES* res, int affected_rows) : err(SQL::SUCCESS), currentrow(0), rows(0)
        {
                if (affected_rows >= 1)
                {
@@ -541,7 +541,7 @@ void DispatcherThread::OnNotify()
        for(ResultQueue::iterator i = Parent->rq.begin(); i != Parent->rq.end(); i++)
        {
                MySQLresult* res = i->r;
-               if (res->err.code == SQL::NO_ERROR)
+               if (res->err.code == SQL::SUCCESS)
                        i->q->OnResult(*res);
                else
                        i->q->OnError(res->err);
index 10a0e51a2387398076f2a7199bfa21ebfb17de5e..df6ff5a0206d0471b41d962ffe115a9add91ab1f 100644 (file)
@@ -71,6 +71,9 @@ void SocketEngine::InitError()
 
 void SocketEngine::LookupMaxFds()
 {
+#if defined _WIN32
+       MaxSetSize = FD_SETSIZE;
+#else
        struct rlimit limits;
        if (!getrlimit(RLIMIT_NOFILE, &limits))
                MaxSetSize = limits.rlim_cur;
@@ -82,6 +85,7 @@ void SocketEngine::LookupMaxFds()
 #endif
        if (!setrlimit(RLIMIT_NOFILE, &limits))
                MaxSetSize = limits.rlim_cur;
+#endif
 }
 
 void SocketEngine::ChangeEventMask(EventHandler* eh, int change)
index e8ff42d1ee54b1740163b613da4da065caf50167..96e558c8b63b57365ba893b4b0c5fb06fd6ae4a1 100644 (file)
@@ -23,6 +23,7 @@ file(STRINGS "${INSPIRCD_BASE}/src/version.sh" VERSIONSH)
 string(REGEX REPLACE ".*InspIRCd-([0-9]*).*" "\\1" VERSION_MAJOR "${VERSIONSH}")
 string(REGEX REPLACE ".*InspIRCd-[0-9]*\\.([0-9]*).*" "\\1" VERSION_MINOR "${VERSIONSH}")
 string(REGEX REPLACE ".*InspIRCd-[0-9]*\\.[0-9]*\\.([0-9]*).*" "\\1" VERSION_PATCH "${VERSIONSH}")
+string(REGEX REPLACE ".*InspIRCd-([^\"]+).*" "\\1" VERSION_FULL "${VERSIONSH}")
 
 if(MSVC)
        # Without /SAFESEH:NO old libraries compiled with VS 2010 or older won't link correctly to VS2012 (eg, extra module libs)