From: Peter Powell Date: Sat, 17 Feb 2018 17:12:26 +0000 (+0000) Subject: Fix building on Windows (mostly). X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=d2efdbf6bb91229d043303b1694fefae79ea6fe7;p=user%2Fhenk%2Fcode%2Finspircd.git Fix building on Windows (mostly). --- diff --git a/.gitignore b/.gitignore index e9d91b29b..2790ac8c2 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ /src/modules/m_ssl_mbedtls.cpp /src/modules/m_ssl_openssl.cpp +/win/Win32 +/win/*.dir diff --git a/include/modules.h b/include/modules.h index c6b10cad9..a5e546149 100644 --- a/include/modules.h +++ b/include/modules.h @@ -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) #endif diff --git a/include/modules/shun.h b/include/modules/shun.h index f2bc4eea5..9ce547e2d 100644 --- a/include/modules/shun.h +++ b/include/modules/shun.h @@ -23,7 +23,7 @@ /** Shun class */ -class CoreExport Shun : public XLine +class Shun : public XLine { public: /** Create a Shun. diff --git a/include/modules/sql.h b/include/modules/sql.h index 01adbb42e..14cd60a56 100644 --- a/include/modules/sql.h +++ b/include/modules/sql.h @@ -42,7 +42,7 @@ namespace SQL enum ErrorCode { /** No error has occurred. */ - NO_ERROR, + SUCCESS, /** The database identifier is invalid. */ BAD_DBID, diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index a16a293d7..4ee6de527 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -145,7 +145,7 @@ class MySQLresult : public SQL::Result std::vector colnames; std::vector 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); diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 10a0e51a2..df6ff5a02 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -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) diff --git a/win/CMakeLists.txt b/win/CMakeLists.txt index e8ff42d1e..96e558c8b 100644 --- a/win/CMakeLists.txt +++ b/win/CMakeLists.txt @@ -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)