Fix building on Windows (mostly).

This commit is contained in:
Peter Powell 2018-02-17 17:12:26 +00:00
parent 36e6dc7bc8
commit d2efdbf6bb
7 changed files with 11 additions and 26 deletions

2
.gitignore vendored
View File

@ -28,3 +28,5 @@
/src/modules/m_ssl_mbedtls.cpp
/src/modules/m_ssl_openssl.cpp
/win/Win32
/win/*.dir

View File

@ -1216,34 +1216,12 @@ 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>)

View File

@ -23,7 +23,7 @@
/** Shun class
*/
class CoreExport Shun : public XLine
class Shun : public XLine
{
public:
/** Create a Shun.

View File

@ -42,7 +42,7 @@ namespace SQL
enum ErrorCode
{
/** No error has occurred. */
NO_ERROR,
SUCCESS,
/** The database identifier is invalid. */
BAD_DBID,

View 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);

View 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)

View 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)