diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp index dd8e0da31..910661f60 100644 --- a/src/BlockArea.cpp +++ b/src/BlockArea.cpp @@ -828,7 +828,7 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int int yd = dy - dx / 2; int zd = dz - dx / 2; - while (true) + for (;;) { RelSetData(a_RelX1, a_RelY1, a_RelZ1, a_DataTypes, a_BlockType, a_BlockMeta, a_BlockLight, a_BlockSkyLight); @@ -860,7 +860,7 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int int xd = dx - dy / 2; int zd = dz - dy / 2; - while (true) + for (;;) { RelSetData(a_RelX1, a_RelY1, a_RelZ1, a_DataTypes, a_BlockType, a_BlockMeta, a_BlockLight, a_BlockSkyLight); @@ -894,7 +894,7 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int int xd = dx - dz / 2; int yd = dy - dz / 2; - while (true) + for (;;) { RelSetData(a_RelX1, a_RelY1, a_RelZ1, a_DataTypes, a_BlockType, a_BlockMeta, a_BlockLight, a_BlockSkyLight); diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp index df45bb4c2..c94113f5c 100644 --- a/src/Generating/Caves.cpp +++ b/src/Generating/Caves.cpp @@ -285,7 +285,7 @@ bool cCaveTunnel::RefineDefPoints(const cCaveDefPoints & a_Src, cCaveDefPoints & void cCaveTunnel::Smooth(void) { cCaveDefPoints Pts; - while (true) + for (;;) { if (!RefineDefPoints(m_Points, Pts)) { @@ -331,7 +331,7 @@ void cCaveTunnel::FinishLinear(void) int yd = dy - dx / 2; int zd = dz - dx / 2; - while (true) + for (;;) { m_Points.push_back(cCaveDefPoint(PrevX, PrevY, PrevZ, R)); @@ -363,7 +363,7 @@ void cCaveTunnel::FinishLinear(void) int xd = dx - dy / 2; int zd = dz - dy / 2; - while (true) + for (;;) { m_Points.push_back(cCaveDefPoint(PrevX, PrevY, PrevZ, R)); @@ -397,7 +397,7 @@ void cCaveTunnel::FinishLinear(void) int xd = dx - dz / 2; int yd = dy - dz / 2; - while (true) + for (;;) { m_Points.push_back(cCaveDefPoint(PrevX, PrevY, PrevZ, R)); diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp index 15e352e30..eb9fe92ba 100644 --- a/src/Generating/DistortedHeightmap.cpp +++ b/src/Generating/DistortedHeightmap.cpp @@ -774,10 +774,11 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in return; } default: + { ASSERT(!"Unhandled biome"); return; + } } // switch (Biome) - ASSERT(!"Unexpected fallthrough"); } diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 866551e8a..145fe22e0 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -528,7 +528,7 @@ cFinishGenFluidSprings::cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cI bool IsWater = (a_Fluid == E_BLOCK_WATER); AString SectionName = IsWater ? "WaterSprings" : "LavaSprings"; AString DefaultHeightDistribution; - int DefaultChance; + int DefaultChance = 0; switch (a_World.GetDimension()) { case dimNether: diff --git a/src/Items/ItemSeeds.h b/src/Items/ItemSeeds.h index 8ca86663f..67f0d38bd 100644 --- a/src/Items/ItemSeeds.h +++ b/src/Items/ItemSeeds.h @@ -56,7 +56,6 @@ public: case E_ITEM_SEEDS: a_BlockType = E_BLOCK_CROPS; return true; default: a_BlockType = E_BLOCK_AIR; return true; } - return false; } } ; diff --git a/src/Protocol/Protocol132.h b/src/Protocol/Protocol132.h index d36384a88..80fc8740a 100644 --- a/src/Protocol/Protocol132.h +++ b/src/Protocol/Protocol132.h @@ -14,9 +14,9 @@ #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4127) - #pragma warning(disable:4244) - #pragma warning(disable:4231) #pragma warning(disable:4189) + #pragma warning(disable:4231) + #pragma warning(disable:4244) #pragma warning(disable:4702) #endif diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 8536689c3..7d1f723a3 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -983,7 +983,7 @@ void cProtocol172::AddReceivedData(const char * a_Data, int a_Size) } // Handle all complete packets: - while (true) + for (;;) { UInt32 PacketLen; if (!m_ReceivedData.ReadVarInt(PacketLen)) diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp index 64220f09a..8f80c3f75 100644 --- a/src/WorldStorage/FastNBT.cpp +++ b/src/WorldStorage/FastNBT.cpp @@ -16,9 +16,12 @@ #define NBT_RESERVE_SIZE 200 #endif // NBT_RESERVE_SIZE -#define RETURN_FALSE_IF_FALSE(X) do { if (!X) return false; } while (0) - - +#ifdef _MSC_VER + // Dodge a C4127 (conditional expression is constant) for this specific macro usage + #define RETURN_FALSE_IF_FALSE(X) do { if (!X) return false; } while ((false, false)) +#else + #define RETURN_FALSE_IF_FALSE(X) do { if (!X) return false; } while (false) +#endif @@ -99,7 +102,7 @@ bool cParsedNBT::ReadCompound(void) // Reads the latest tag as a compound int ParentIdx = m_Tags.size() - 1; int PrevSibling = -1; - while (true) + for (;;) { NEEDBYTES(1); eTagType TagType = (eTagType)(m_Data[m_Pos]); @@ -276,7 +279,7 @@ int cParsedNBT::FindChildByName(int a_Tag, const char * a_Name, size_t a_NameLen for (int Child = m_Tags[a_Tag].m_FirstChild; Child != -1; Child = m_Tags[Child].m_NextSibling) { if ( - (m_Tags[Child].m_NameLength == a_NameLength) && + (m_Tags[Child].m_NameLength == (int)a_NameLength) && (memcmp(m_Data + m_Tags[Child].m_NameStart, a_Name, a_NameLength) == 0) ) {