From 67154217a2be5f66eeaeedd10bcc24d26ce473c2 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 25 May 2013 14:59:41 +0000 Subject: Added base Code::Blocks project (WIP, still doesn't compile) and fixed some source errors with MinGW. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1510 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- VC2008/CryptoPP.cbp | 311 ++++++++++++++++++++++ VC2008/JsonCpp.cbp | 81 ++++++ VC2008/Lua.cbp | 184 +++++++++++++ VC2008/MCServer.cbp | 611 ++++++++++++++++++++++++++++++++++++++++++++ VC2008/Squirrel3.cbp | 109 ++++++++ VC2008/ToLua.cbp | 102 ++++++++ VC2008/WebServer.cbp | 77 ++++++ VC2008/expat.cbp | 77 ++++++ VC2008/resource.h | Bin 904 -> 0 bytes VC2008/resource_MCServer.h | 5 + VC2008/zlib.cbp | 121 +++++++++ source/Log.cpp | 6 +- source/OSSupport/Socket.cpp | 37 ++- source/main.cpp | 8 +- 14 files changed, 1711 insertions(+), 18 deletions(-) create mode 100644 VC2008/CryptoPP.cbp create mode 100644 VC2008/JsonCpp.cbp create mode 100644 VC2008/Lua.cbp create mode 100644 VC2008/MCServer.cbp create mode 100644 VC2008/Squirrel3.cbp create mode 100644 VC2008/ToLua.cbp create mode 100644 VC2008/WebServer.cbp create mode 100644 VC2008/expat.cbp delete mode 100644 VC2008/resource.h create mode 100644 VC2008/resource_MCServer.h create mode 100644 VC2008/zlib.cbp diff --git a/VC2008/CryptoPP.cbp b/VC2008/CryptoPP.cbp new file mode 100644 index 000000000..f9f10e7a7 --- /dev/null +++ b/VC2008/CryptoPP.cbp @@ -0,0 +1,311 @@ + + + + + + diff --git a/VC2008/JsonCpp.cbp b/VC2008/JsonCpp.cbp new file mode 100644 index 000000000..35aa6ea81 --- /dev/null +++ b/VC2008/JsonCpp.cbp @@ -0,0 +1,81 @@ + + + + + + diff --git a/VC2008/Lua.cbp b/VC2008/Lua.cbp new file mode 100644 index 000000000..208bf42f4 --- /dev/null +++ b/VC2008/Lua.cbp @@ -0,0 +1,184 @@ + + + + + + diff --git a/VC2008/MCServer.cbp b/VC2008/MCServer.cbp new file mode 100644 index 000000000..9bc715f8c --- /dev/null +++ b/VC2008/MCServer.cbp @@ -0,0 +1,611 @@ + + + + + + diff --git a/VC2008/Squirrel3.cbp b/VC2008/Squirrel3.cbp new file mode 100644 index 000000000..fd145c420 --- /dev/null +++ b/VC2008/Squirrel3.cbp @@ -0,0 +1,109 @@ + + + + + + diff --git a/VC2008/ToLua.cbp b/VC2008/ToLua.cbp new file mode 100644 index 000000000..f22bfda4a --- /dev/null +++ b/VC2008/ToLua.cbp @@ -0,0 +1,102 @@ + + + + + + diff --git a/VC2008/WebServer.cbp b/VC2008/WebServer.cbp new file mode 100644 index 000000000..41fb405c2 --- /dev/null +++ b/VC2008/WebServer.cbp @@ -0,0 +1,77 @@ + + + + + + diff --git a/VC2008/expat.cbp b/VC2008/expat.cbp new file mode 100644 index 000000000..6cd3f6234 --- /dev/null +++ b/VC2008/expat.cbp @@ -0,0 +1,77 @@ + + + + + + diff --git a/VC2008/resource.h b/VC2008/resource.h deleted file mode 100644 index 02b28b22f..000000000 Binary files a/VC2008/resource.h and /dev/null differ diff --git a/VC2008/resource_MCServer.h b/VC2008/resource_MCServer.h new file mode 100644 index 000000000..2b306eb98 --- /dev/null +++ b/VC2008/resource_MCServer.h @@ -0,0 +1,5 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDI_ICON1 101 diff --git a/VC2008/zlib.cbp b/VC2008/zlib.cbp new file mode 100644 index 000000000..2b7d759da --- /dev/null +++ b/VC2008/zlib.cbp @@ -0,0 +1,121 @@ + + + + + + diff --git a/source/Log.cpp b/source/Log.cpp index ed1a9beb8..5f78bba1b 100644 --- a/source/Log.cpp +++ b/source/Log.cpp @@ -70,7 +70,7 @@ void cLog::CloseLog() void cLog::OpenLog( const char* a_FileName ) { if(m_File) fclose (m_File); - #ifdef _WIN32 + #ifdef _MSC_VER fopen_s( &m_File, a_FileName, "a+" ); #else m_File = fopen(a_FileName, "a+" ); @@ -83,7 +83,7 @@ void cLog::OpenLog( const char* a_FileName ) void cLog::ClearLog() { - #ifdef _WIN32 + #ifdef _MSC_VER if( fopen_s( &m_File, "log.txt", "w" ) == 0) fclose (m_File); #else @@ -107,7 +107,7 @@ void cLog::Log(const char * a_Format, va_list argList) time ( &rawtime ); struct tm* timeinfo; -#ifdef _WIN32 +#ifdef _MSC_VER struct tm timeinforeal; timeinfo = &timeinforeal; localtime_s(timeinfo, &rawtime ); diff --git a/source/OSSupport/Socket.cpp b/source/OSSupport/Socket.cpp index b4ac62993..48bfc6cfd 100644 --- a/source/OSSupport/Socket.cpp +++ b/source/OSSupport/Socket.cpp @@ -294,17 +294,32 @@ cSocket cSocket::AcceptIPv6(void) if (SClient.IsValid()) { #if defined(_WIN32) - // Windows XP doesn't have inet_ntop, so we need to improvise: - Printf(SClient.m_IPString, "%x:%x:%x:%x:%x:%x:%x:%x", - from.sin6_addr.u.Word[0], - from.sin6_addr.u.Word[1], - from.sin6_addr.u.Word[2], - from.sin6_addr.u.Word[3], - from.sin6_addr.u.Word[4], - from.sin6_addr.u.Word[5], - from.sin6_addr.u.Word[6], - from.sin6_addr.u.Word[7] - ); + // Windows XP doesn't have inet_ntop, so we need to improvise. And MSVC has different headers than GCC + #ifdef _MSC_VER + // MSVC version + Printf(SClient.m_IPString, "%x:%x:%x:%x:%x:%x:%x:%x", + from.sin6_addr.u.Word[0], + from.sin6_addr.u.Word[1], + from.sin6_addr.u.Word[2], + from.sin6_addr.u.Word[3], + from.sin6_addr.u.Word[4], + from.sin6_addr.u.Word[5], + from.sin6_addr.u.Word[6], + from.sin6_addr.u.Word[7] + ); + #else // _MSC_VER + // MinGW + Printf(SClient.m_IPString, "%x:%x:%x:%x:%x:%x:%x:%x", + from.sin6_addr.s6_addr16[0], + from.sin6_addr.s6_addr16[1], + from.sin6_addr.s6_addr16[2], + from.sin6_addr.s6_addr16[3], + from.sin6_addr.s6_addr16[4], + from.sin6_addr.s6_addr16[5], + from.sin6_addr.s6_addr16[6], + from.sin6_addr.s6_addr16[7] + ); + #endif // else _MSC_VER #else char buffer[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &(from.sin6_addr), buffer, sizeof(buffer)); diff --git a/source/main.cpp b/source/main.cpp index 71110c265..baf41a845 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -11,9 +11,9 @@ #include "squirrelbindings/SquirrelBindings.h" #endif -#ifdef _WIN32 +#ifdef _MSC_VER #include -#endif // _WIN32 +#endif // _MSC_VER @@ -51,7 +51,7 @@ void ShowCrashReport(int) -#if defined(_WIN32) && !defined(_WIN64) +#if defined(_WIN32) && !defined(_WIN64) && defined(_MSC_VER) /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Windows 32-bit stuff: when the server crashes, create a "dump file" containing the callstack of each thread and some variables; let the user send us that crash file for analysis @@ -128,7 +128,7 @@ int main( int argc, char **argv ) #endif // Magic code to produce dump-files on Windows if the server crashes: - #if defined(_WIN32) && !defined(_WIN64) + #if defined(_WIN32) && !defined(_WIN64) && defined(_MSC_VER) HINSTANCE hDbgHelp = LoadLibrary("DBGHELP.DLL"); g_WriteMiniDump = (pMiniDumpWriteDump)GetProcAddress(hDbgHelp, "MiniDumpWriteDump"); if (g_WriteMiniDump != NULL) -- cgit v1.2.3