summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/FastNBT.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-07 14:24:25 +0100
committermadmaxoft <github@xoft.cz>2014-01-07 14:24:25 +0100
commit934b90c121def4f6f9a7c919727cadeeca49981f (patch)
tree8ca75ec9f6f0bb3a937657e863375ac8920fc66e /src/WorldStorage/FastNBT.cpp
parentAdded Base64Encode(). (diff)
downloadcuberite-934b90c121def4f6f9a7c919727cadeeca49981f.tar
cuberite-934b90c121def4f6f9a7c919727cadeeca49981f.tar.gz
cuberite-934b90c121def4f6f9a7c919727cadeeca49981f.tar.bz2
cuberite-934b90c121def4f6f9a7c919727cadeeca49981f.tar.lz
cuberite-934b90c121def4f6f9a7c919727cadeeca49981f.tar.xz
cuberite-934b90c121def4f6f9a7c919727cadeeca49981f.tar.zst
cuberite-934b90c121def4f6f9a7c919727cadeeca49981f.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/FastNBT.cpp13
1 files changed, 8 insertions, 5 deletions
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)
)
{