summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-09 19:33:22 +0200
committerMattes D <github@xoft.cz>2014-05-09 19:33:22 +0200
commit5b54dc3eacca565531446d9c8cc9be7be084670c (patch)
tree528508f261c4d6e9bf27b728c292480d1588c6cb
parentWorld pre-generation distance is settable in world.ini. (diff)
downloadcuberite-5b54dc3eacca565531446d9c8cc9be7be084670c.tar
cuberite-5b54dc3eacca565531446d9c8cc9be7be084670c.tar.gz
cuberite-5b54dc3eacca565531446d9c8cc9be7be084670c.tar.bz2
cuberite-5b54dc3eacca565531446d9c8cc9be7be084670c.tar.lz
cuberite-5b54dc3eacca565531446d9c8cc9be7be084670c.tar.xz
cuberite-5b54dc3eacca565531446d9c8cc9be7be084670c.tar.zst
cuberite-5b54dc3eacca565531446d9c8cc9be7be084670c.zip
-rw-r--r--src/WorldStorage/FastNBT.cpp4
-rw-r--r--src/WorldStorage/FastNBT.h14
-rw-r--r--src/WorldStorage/FireworksSerializer.cpp4
-rw-r--r--src/WorldStorage/SchematicFileSerializer.cpp4
-rw-r--r--src/WorldStorage/WSSAnvil.cpp2
-rw-r--r--src/WorldStorage/WSSAnvil.h2
6 files changed, 15 insertions, 15 deletions
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp
index 52e998f88..c4a6a7a5b 100644
--- a/src/WorldStorage/FastNBT.cpp
+++ b/src/WorldStorage/FastNBT.cpp
@@ -79,11 +79,11 @@ bool cParsedNBT::Parse(void)
-bool cParsedNBT::ReadString(int & a_StringStart, int & a_StringLen)
+bool cParsedNBT::ReadString(size_t & a_StringStart, size_t & a_StringLen)
{
NEEDBYTES(2);
a_StringStart = m_Pos + 2;
- a_StringLen = GetBEShort(m_Data + m_Pos);
+ a_StringLen = (size_t)GetBEShort(m_Data + m_Pos);
if (a_StringLen < 0)
{
// Invalid string length
diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h
index 7b0af4927..fe28005ac 100644
--- a/src/WorldStorage/FastNBT.h
+++ b/src/WorldStorage/FastNBT.h
@@ -61,10 +61,10 @@ public:
// The following members are indices into the data stream. m_DataLength == 0 if no data available
// They must not be pointers, because the datastream may be copied into another AString object in the meantime.
- int m_NameStart;
- int m_NameLength;
- int m_DataStart;
- int m_DataLength;
+ size_t m_NameStart;
+ size_t m_NameLength;
+ size_t m_DataStart;
+ size_t m_DataLength;
// The following members are indices into the array returned; -1 if not valid
// They must not be pointers, because pointers would not survive std::vector reallocation
@@ -135,7 +135,7 @@ public:
/** Returns the length of the tag's data, in bytes.
Not valid for Compound or List tags! */
- int GetDataLength (int a_Tag) const
+ size_t GetDataLength (int a_Tag) const
{
ASSERT(m_Tags[(size_t)a_Tag].m_Type != TAG_List);
ASSERT(m_Tags[(size_t)a_Tag].m_Type != TAG_Compound);
@@ -256,10 +256,10 @@ protected:
bool m_IsValid; // True if parsing succeeded
// Used while parsing:
- int m_Pos;
+ size_t m_Pos;
bool Parse(void);
- bool ReadString(int & a_StringStart, int & a_StringLen); // Reads a simple string (2 bytes length + data), sets the string descriptors
+ bool ReadString(size_t & a_StringStart, size_t & a_StringLen); // Reads a simple string (2 bytes length + data), sets the string descriptors
bool ReadCompound(void); // Reads the latest tag as a compound
bool ReadList(eTagType a_ChildrenType); // Reads the latest tag as a list of items of type a_ChildrenType
bool ReadTag(void); // Reads the latest tag, depending on its m_Type setting
diff --git a/src/WorldStorage/FireworksSerializer.cpp b/src/WorldStorage/FireworksSerializer.cpp
index e0cd69634..263c77a1c 100644
--- a/src/WorldStorage/FireworksSerializer.cpp
+++ b/src/WorldStorage/FireworksSerializer.cpp
@@ -96,7 +96,7 @@ void cFireworkItem::ParseFromNBT(cFireworkItem & a_FireworkItem, const cParsedNB
if (ExplosionName == "Colors")
{
// Divide by four as data length returned in bytes
- int DataLength = a_NBT.GetDataLength(explosiontag);
+ size_t DataLength = a_NBT.GetDataLength(explosiontag);
// round to the next highest multiple of four
DataLength -= DataLength % 4;
if (DataLength == 0)
@@ -112,7 +112,7 @@ void cFireworkItem::ParseFromNBT(cFireworkItem & a_FireworkItem, const cParsedNB
}
else if (ExplosionName == "FadeColors")
{
- int DataLength = a_NBT.GetDataLength(explosiontag) / 4;
+ size_t DataLength = a_NBT.GetDataLength(explosiontag) / 4;
// round to the next highest multiple of four
DataLength -= DataLength % 4;
if (DataLength == 0)
diff --git a/src/WorldStorage/SchematicFileSerializer.cpp b/src/WorldStorage/SchematicFileSerializer.cpp
index 2e356b172..5cbff376b 100644
--- a/src/WorldStorage/SchematicFileSerializer.cpp
+++ b/src/WorldStorage/SchematicFileSerializer.cpp
@@ -230,7 +230,7 @@ bool cSchematicFileSerializer::LoadFromSchematicNBT(cBlockArea & a_BlockArea, cP
}
// Copy the block types and metas:
- int NumBytes = (int)a_BlockArea.GetBlockCount();
+ size_t NumBytes = a_BlockArea.GetBlockCount();
if (a_NBT.GetDataLength(TBlockTypes) < NumBytes)
{
LOG("BlockTypes truncated in the schematic file (exp %d, got %d bytes). Loading partial.",
@@ -242,7 +242,7 @@ bool cSchematicFileSerializer::LoadFromSchematicNBT(cBlockArea & a_BlockArea, cP
if (AreMetasPresent)
{
- int NumBytes = (int)a_BlockArea.GetBlockCount();
+ size_t NumBytes = a_BlockArea.GetBlockCount();
if (a_NBT.GetDataLength(TBlockMetas) < NumBytes)
{
LOG("BlockMetas truncated in the schematic file (exp %d, got %d bytes). Loading partial.",
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index c6b0472d0..52cea462c 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -1078,7 +1078,7 @@ void cWSSAnvil::LoadCommandBlockFromNBT(cBlockEntityList & a_BlockEntities, cons
-void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_EntityTagIdx, const char * a_IDTag, int a_IDTagLength)
+void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_EntityTagIdx, const char * a_IDTag, size_t a_IDTagLength)
{
if (strncmp(a_IDTag, "Boat", a_IDTagLength) == 0)
{
diff --git a/src/WorldStorage/WSSAnvil.h b/src/WorldStorage/WSSAnvil.h
index 1773ee882..1493f5f33 100644
--- a/src/WorldStorage/WSSAnvil.h
+++ b/src/WorldStorage/WSSAnvil.h
@@ -145,7 +145,7 @@ protected:
void LoadMobHeadFromNBT (cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadCommandBlockFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx);
- void LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_EntityTagIdx, const char * a_IDTag, int a_IDTagLength);
+ void LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_EntityTagIdx, const char * a_IDTag, size_t a_IDTagLength);
void LoadBoatFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
void LoadEnderCrystalFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);