diff options
author | worktycho <work.tycho@gmail.com> | 2016-01-07 02:31:27 +0100 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2016-01-07 02:31:27 +0100 |
commit | 5593db13eb84b756d10a7e5054c74c88d78ff85b (patch) | |
tree | 58db7ffefac6b6878f9ebc37ff7d754f56cceabd /src | |
parent | Merge pull request #2844 from mathias-github/silktouch (diff) | |
parent | Fixed Clang warnings. (diff) | |
download | cuberite-5593db13eb84b756d10a7e5054c74c88d78ff85b.tar cuberite-5593db13eb84b756d10a7e5054c74c88d78ff85b.tar.gz cuberite-5593db13eb84b756d10a7e5054c74c88d78ff85b.tar.bz2 cuberite-5593db13eb84b756d10a7e5054c74c88d78ff85b.tar.lz cuberite-5593db13eb84b756d10a7e5054c74c88d78ff85b.tar.xz cuberite-5593db13eb84b756d10a7e5054c74c88d78ff85b.tar.zst cuberite-5593db13eb84b756d10a7e5054c74c88d78ff85b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ChunkMap.cpp | 18 | ||||
-rw-r--r-- | src/Entities/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 10 | ||||
-rw-r--r-- | src/Protocol/Protocol18x.cpp | 4 | ||||
-rw-r--r-- | src/Root.cpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 39 |
6 files changed, 49 insertions, 33 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index edf42abe7..cbbf910fb 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1896,10 +1896,10 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_ public cEntityCallback { public: - cTNTDamageCallback(cBoundingBox & a_bbTNT, Vector3d a_ExplosionPos, int a_ExplosionSize) : - m_bbTNT(a_bbTNT), - m_ExplosionPos(a_ExplosionPos), - m_ExplosionSize(a_ExplosionSize) + cTNTDamageCallback(cBoundingBox & a_CBBBTNT, Vector3d a_CBExplosionPos, int a_CBExplosionSize) : + m_bbTNT(a_CBBBTNT), + m_ExplosionPos(a_CBExplosionPos), + m_ExplosionSize(a_CBExplosionSize) { } @@ -2364,10 +2364,10 @@ bool cChunkMap::GenerateChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * class cPrepareLoadCallback: public cChunkCoordCallback { public: - cPrepareLoadCallback(cWorld & a_World, cChunkMap & a_ChunkMap, cChunkCoordCallback * a_Callback): - m_World(a_World), - m_ChunkMap(a_ChunkMap), - m_Callback(a_Callback) + cPrepareLoadCallback(cWorld & a_CBWorld, cChunkMap & a_CBChunkMap, cChunkCoordCallback * a_CBCallback): + m_World(a_CBWorld), + m_ChunkMap(a_CBChunkMap), + m_Callback(a_CBCallback) { } @@ -2385,7 +2385,7 @@ bool cChunkMap::GenerateChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * } // The chunk failed to load, generate it: - cCSLock Lock(m_ChunkMap.m_CSLayers); + cCSLock CBLock(m_ChunkMap.m_CSLayers); cChunkPtr CBChunk = m_ChunkMap.GetChunkNoLoad(a_CBChunkX, a_CBChunkZ); if (CBChunk == nullptr) diff --git a/src/Entities/CMakeLists.txt b/src/Entities/CMakeLists.txt index 71964e90d..0416d5338 100644 --- a/src/Entities/CMakeLists.txt +++ b/src/Entities/CMakeLists.txt @@ -61,10 +61,7 @@ SET (HDRS WitherSkullEntity.h) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set_source_files_properties(Entity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=global-constructors -Wno-error=switch-enum ") - set_source_files_properties(EntityEffect.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum ") - set_source_files_properties(Floater.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion ") - set_source_files_properties(Player.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=switch-enum -Wno-error=conversion ") + set_source_files_properties(Entity.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors") endif() if(NOT MSVC) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index bede603e2..80f07cb65 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -908,7 +908,15 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI) case dtEnderPearl: DamageText = "misused an ender pearl"; break; case dtAdmin: DamageText = "was administrator'd"; break; case dtExplosion: DamageText = "blew up"; break; - default: DamageText = "died, somehow; we've no idea how though"; break; + case dtAttack: DamageText = "was attacked by thin air"; break; + #ifndef __clang__ + default: + { + ASSERT(!"Unknown damage type"); + DamageText = "died, somehow; we've no idea how though"; + break; + } + #endif // __clang__ } AString DeathMessage = Printf("%s %s", GetName().c_str(), DamageText.c_str()); PluginManager->CallHookKilled(*this, a_TDI, DeathMessage); diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index ad2964bed..9b716ff92 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -1916,7 +1916,7 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size) bb.ReadAll(Packet); Packet.resize(Packet.size() - 1); // Drop the final NUL pushed there for over-read detection AString Out; - CreateHexDump(Out, Packet.data(), (int)Packet.size(), 24); + CreateHexDump(Out, Packet.data(), Packet.size(), 24); LOGD("Packet contents:\n%s", Out.c_str()); #endif // _DEBUG @@ -2145,7 +2145,7 @@ void cProtocol180::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffe // Decrypt EncNonce using privkey cRsaPrivateKey & rsaDecryptor = cRoot::Get()->GetServer()->GetPrivateKey(); - Int32 DecryptedNonce[MAX_ENC_LEN / sizeof(Int32)]; + UInt32 DecryptedNonce[MAX_ENC_LEN / sizeof(Int32)]; int res = rsaDecryptor.Decrypt(reinterpret_cast<const Byte *>(EncNonce.data()), EncNonce.size(), reinterpret_cast<Byte *>(DecryptedNonce), sizeof(DecryptedNonce)); if (res != 4) { diff --git a/src/Root.cpp b/src/Root.cpp index 99dabc099..9226efb27 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -706,10 +706,10 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac } public: - cCallback (const AString & a_PlayerName) : + cCallback (const AString & a_CBPlayerName) : m_BestRating(0), - m_NameLength(a_PlayerName.length()), - m_PlayerName(a_PlayerName), + m_NameLength(a_CBPlayerName.length()), + m_PlayerName(a_CBPlayerName), m_BestMatch(), m_NumMatches(0) {} diff --git a/src/main.cpp b/src/main.cpp index aa21d8a31..06f979097 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,6 +20,15 @@ + +// Forward declarations to satisfy Clang's -Wmissing-variable-declarations: +extern bool g_ShouldLogCommIn; +extern bool g_ShouldLogCommOut; + + + + + /** If something has told the server to stop; checked periodically in cRoot */ bool cRoot::m_TerminateEventRaised = false; @@ -67,7 +76,8 @@ Synchronize this with Server.cpp to enable the "dumpmem" console command. */ -void NonCtrlHandler(int a_Signal) +#ifndef _DEBUG +static void NonCtrlHandler(int a_Signal) { LOGD("Terminate event raised from std::signal"); cRoot::Get()->QueueExecuteConsoleCommand("stop"); @@ -110,6 +120,7 @@ void NonCtrlHandler(int a_Signal) default: break; } } +#endif // _DEBUG @@ -129,11 +140,11 @@ typedef BOOL (WINAPI *pMiniDumpWriteDump)( PMINIDUMP_CALLBACK_INFORMATION CallbackParam ); -pMiniDumpWriteDump g_WriteMiniDump; // The function in dbghlp DLL that creates dump files +static pMiniDumpWriteDump g_WriteMiniDump; // The function in dbghlp DLL that creates dump files -wchar_t g_DumpFileName[MAX_PATH]; // Filename of the dump file; hes to be created before the dump handler kicks in -char g_ExceptionStack[128 * 1024]; // Substitute stack, just in case the handler kicks in because of "insufficient stack space" -MINIDUMP_TYPE g_DumpFlags = MiniDumpNormal; // By default dump only the stack and some helpers +static wchar_t g_DumpFileName[MAX_PATH]; // Filename of the dump file; hes to be created before the dump handler kicks in +static char g_ExceptionStack[128 * 1024]; // Substitute stack, just in case the handler kicks in because of "insufficient stack space" +static MINIDUMP_TYPE g_DumpFlags = MiniDumpNormal; // By default dump only the stack and some helpers @@ -142,7 +153,7 @@ MINIDUMP_TYPE g_DumpFlags = MiniDumpNormal; // By default dump only the stack a /** This function gets called just before the "program executed an illegal instruction and will be terminated" or similar. Its purpose is to create the crashdump using the dbghlp DLLs */ -LONG WINAPI LastChanceExceptionFilter(__in struct _EXCEPTION_POINTERS * a_ExceptionInfo) +static LONG WINAPI LastChanceExceptionFilter(__in struct _EXCEPTION_POINTERS * a_ExceptionInfo) { char * newStack = &g_ExceptionStack[sizeof(g_ExceptionStack) - 1]; char * oldStack; @@ -185,7 +196,7 @@ LONG WINAPI LastChanceExceptionFilter(__in struct _EXCEPTION_POINTERS * a_Except #ifdef _WIN32 // Handle CTRL events in windows, including console window close -BOOL CtrlHandler(DWORD fdwCtrlType) +static BOOL CtrlHandler(DWORD fdwCtrlType) { cRoot::Get()->QueueExecuteConsoleCommand("stop"); LOGD("Terminate event raised from the Windows CtrlHandler"); @@ -204,7 +215,7 @@ BOOL CtrlHandler(DWORD fdwCtrlType) //////////////////////////////////////////////////////////////////////////////// // UniversalMain - Main startup logic for both standard running and as a service -void UniversalMain(std::unique_ptr<cSettingsRepositoryInterface> a_OverridesRepo) +static void UniversalMain(std::unique_ptr<cSettingsRepositoryInterface> a_OverridesRepo) { // Initialize logging subsystem: cLogger::InitiateMultithreading(); @@ -242,7 +253,7 @@ void UniversalMain(std::unique_ptr<cSettingsRepositoryInterface> a_OverridesRepo //////////////////////////////////////////////////////////////////////////////// // serviceWorkerThread: Keep the service alive -DWORD WINAPI serviceWorkerThread(LPVOID lpParam) +static DWORD WINAPI serviceWorkerThread(LPVOID lpParam) { UNREFERENCED_PARAMETER(lpParam); @@ -262,7 +273,7 @@ DWORD WINAPI serviceWorkerThread(LPVOID lpParam) //////////////////////////////////////////////////////////////////////////////// // serviceSetState: Set the internal status of the service -void serviceSetState(DWORD acceptedControls, DWORD newState, DWORD exitCode) +static void serviceSetState(DWORD acceptedControls, DWORD newState, DWORD exitCode) { SERVICE_STATUS serviceStatus = {}; serviceStatus.dwCheckPoint = 0; @@ -285,7 +296,7 @@ void serviceSetState(DWORD acceptedControls, DWORD newState, DWORD exitCode) //////////////////////////////////////////////////////////////////////////////// // serviceCtrlHandler: Handle stop events from the Service Control Manager -void WINAPI serviceCtrlHandler(DWORD CtrlCode) +static void WINAPI serviceCtrlHandler(DWORD CtrlCode) { switch (CtrlCode) { @@ -308,7 +319,7 @@ void WINAPI serviceCtrlHandler(DWORD CtrlCode) //////////////////////////////////////////////////////////////////////////////// // serviceMain: Startup logic for running as a service -void WINAPI serviceMain(DWORD argc, TCHAR *argv[]) +static void WINAPI serviceMain(DWORD argc, TCHAR *argv[]) { wchar_t applicationFilename[MAX_PATH]; wchar_t applicationDirectory[MAX_PATH]; @@ -353,7 +364,7 @@ void WINAPI serviceMain(DWORD argc, TCHAR *argv[]) -std::unique_ptr<cMemorySettingsRepository> ParseArguments(int argc, char **argv) +static std::unique_ptr<cMemorySettingsRepository> ParseArguments(int argc, char ** argv) { try { @@ -434,7 +445,7 @@ std::unique_ptr<cMemorySettingsRepository> ParseArguments(int argc, char **argv) //////////////////////////////////////////////////////////////////////////////// // main: -int main(int argc, char **argv) +int main(int argc, char ** argv) { #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) InitLeakFinder(); |