From e61810e1bf67dc43861d4741b16e65b30fe8d23c Mon Sep 17 00:00:00 2001 From: Tycho Date: Fri, 14 Mar 2014 06:52:49 -0700 Subject: Removed invalid block face handling code The code for handling invalid block faces is removed by gcc and clang as it is undefined behavior for a enum to contain a value that is not part of the enum. Since the only way that the line can be executed is through undefined behavior clang and gcc remove it so the function fits in the caches better. --- src/Defines.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/Defines.h b/src/Defines.h index 3b7654265..2e412209d 100644 --- a/src/Defines.h +++ b/src/Defines.h @@ -290,7 +290,6 @@ inline AString BlockFaceToString(eBlockFace a_BlockFace) case BLOCK_FACE_ZP: return "BLOCK_FACE_ZP"; case BLOCK_FACE_NONE: return "BLOCK_FACE_NONE"; } - return Printf("Unknown BLOCK_FACE: %d", a_BlockFace); } -- cgit v1.2.3 From 58fa8b40bf5700327d99d96d656994dab619b670 Mon Sep 17 00:00:00 2001 From: Tycho Date: Fri, 14 Mar 2014 07:02:57 -0700 Subject: Removed missiterperatable malfunctioning error handling code --- src/Scoreboard.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/Scoreboard.cpp b/src/Scoreboard.cpp index 8088e624b..cfeb1d619 100644 --- a/src/Scoreboard.cpp +++ b/src/Scoreboard.cpp @@ -30,8 +30,6 @@ AString cObjective::TypeToString(eType a_Type) case otStatBlockMine: return "stat.mineBlock"; case otStatEntityKill: return "stat.killEntity"; case otStatEntityKilledBy: return "stat.entityKilledBy"; - - default: return ""; } } -- cgit v1.2.3 From b829c9b14e95f37a3a5ba70fc42cb8cfe9066522 Mon Sep 17 00:00:00 2001 From: Tycho Date: Fri, 14 Mar 2014 07:12:00 -0700 Subject: Fixed a few unneeded breaks --- src/Map.cpp | 4 +++- src/StringUtils.cpp | 1 - src/main.cpp | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Map.cpp b/src/Map.cpp index 2d8f57168..79370b097 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -243,7 +243,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) { for (unsigned int Z = m_RelZ; Z < m_RelZ + PixelWidth; ++Z) { - unsigned int WaterDepth = 0; + // unsigned int WaterDepth = 0; BLOCKTYPE TargetBlock = E_BLOCK_AIR; NIBBLETYPE TargetMeta = 0; @@ -261,12 +261,14 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) continue; } // TODO 2014-02-22 xdot: Check if block is liquid + /* else if (false) { --Height; ++WaterDepth; continue; } + */ break; } diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index 3f9275798..ad622d707 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -454,7 +454,6 @@ AString & UTF8ToRawBEUTF16(const char * a_UTF8, size_t a_UTF8Length, AString & a if (!isLegalUTF8(source, extraBytesToRead + 1)) { return a_UTF16; - break; } // The cases all fall through. See "Note A" below. diff --git a/src/main.cpp b/src/main.cpp index 2ae8a413b..68eea7f4d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -72,7 +72,6 @@ void NonCtrlHandler(int a_Signal) LOGERROR(" D: | MCServer has encountered an error and needs to close"); LOGERROR("Details | SIGABRT: Server self-terminated due to an internal fault"); exit(EXIT_FAILURE); - break; } case SIGINT: case SIGTERM: -- cgit v1.2.3 From 2e9fe777e425e65d733110247e73c1d9fb25ab1c Mon Sep 17 00:00:00 2001 From: Tycho Date: Sat, 15 Mar 2014 06:45:26 -0700 Subject: Patched tolua to emit range checks for enums --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0f8700692..6d3f6ddc6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,7 @@ if (NOT MSVC) #lib dependecies are not included set(BINDING_DEPENDECIES + tolua ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/virtual_method_hooks.lua ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/AllToLua.pkg Bindings/LuaFunctions.h -- cgit v1.2.3 From 04f1d58561c13ead8927ab0cd216f200892af086 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sat, 15 Mar 2014 07:08:09 -0700 Subject: Fixed unessicary return --- src/DeadlockDetect.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/DeadlockDetect.cpp b/src/DeadlockDetect.cpp index c42d09b89..4dc7bfde6 100644 --- a/src/DeadlockDetect.cpp +++ b/src/DeadlockDetect.cpp @@ -121,7 +121,6 @@ void cDeadlockDetect::CheckWorldAge(const AString & a_WorldName, Int64 a_Age) if (itr->second.m_NumCyclesSame > (1000 * m_IntervalSec) / CYCLE_MILLISECONDS) { DeadlockDetected(); - return; } } else -- cgit v1.2.3 From 363c92ed534d5cffe164079359b62a0768bc0f80 Mon Sep 17 00:00:00 2001 From: Tycho Date: Wed, 19 Mar 2014 12:06:12 -0700 Subject: Added unreachable lines backit prtected by preprocessor guards --- src/Defines.h | 4 ++++ src/Scoreboard.cpp | 6 ++++++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/Defines.h b/src/Defines.h index 7f7a2eeb1..1a8b3fa4a 100644 --- a/src/Defines.h +++ b/src/Defines.h @@ -290,6 +290,10 @@ inline AString BlockFaceToString(eBlockFace a_BlockFace) case BLOCK_FACE_ZP: return "BLOCK_FACE_ZP"; case BLOCK_FACE_NONE: return "BLOCK_FACE_NONE"; } + // clang optimisises this line away then warns that it has done so. + #if !defined(__clang__) + return Printf("Unknown BLOCK_FACE: %d", a_BlockFace); + #endif } diff --git a/src/Scoreboard.cpp b/src/Scoreboard.cpp index cfeb1d619..4c89ce265 100644 --- a/src/Scoreboard.cpp +++ b/src/Scoreboard.cpp @@ -30,7 +30,13 @@ AString cObjective::TypeToString(eType a_Type) case otStatBlockMine: return "stat.mineBlock"; case otStatEntityKill: return "stat.killEntity"; case otStatEntityKilledBy: return "stat.entityKilledBy"; + + // clang optimisises this line away then warns that it has done so. + #if !defined(__clang__) + default: return ""; + #endif } + } -- cgit v1.2.3