From b6b86b7270ca3f44b0b2a24ffe8292e87e762713 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:43:37 +0200 Subject: Fixed warnings in FastNBT. --- src/WorldStorage/FastNBT.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/WorldStorage/FastNBT.h') diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h index 5e5af3ca3..bcf93228f 100644 --- a/src/WorldStorage/FastNBT.h +++ b/src/WorldStorage/FastNBT.h @@ -237,7 +237,7 @@ public: { ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_String); AString res; - res.assign(m_Data + m_Tags[(size_t)a_Tag].m_DataStart, m_Tags[(size_t)a_Tag].m_DataLength); + res.assign(m_Data + m_Tags[(size_t)a_Tag].m_DataStart, (size_t)m_Tags[(size_t)a_Tag].m_DataLength); return res; } @@ -245,7 +245,7 @@ public: inline AString GetName(int a_Tag) const { AString res; - res.assign(m_Data + m_Tags[(size_t)a_Tag].m_NameStart, m_Tags[(size_t)a_Tag].m_NameLength); + res.assign(m_Data + m_Tags[(size_t)a_Tag].m_NameStart, (size_t)m_Tags[(size_t)a_Tag].m_NameLength); return res; } -- cgit v1.2.3 From fb58ef55beddc73500029ae6c0fe08400de550d2 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 8 May 2014 20:16:35 +0200 Subject: Fixed MSVC 64-bit build warnings. --- src/WorldStorage/FastNBT.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/WorldStorage/FastNBT.h') diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h index bcf93228f..7b0af4927 100644 --- a/src/WorldStorage/FastNBT.h +++ b/src/WorldStorage/FastNBT.h @@ -114,7 +114,7 @@ Each primitive tag also stores the length of the contained data, in bytes. class cParsedNBT { public: - cParsedNBT(const char * a_Data, int a_Length); + cParsedNBT(const char * a_Data, size_t a_Length); bool IsValid(void) const {return m_IsValid; } @@ -251,7 +251,7 @@ public: protected: const char * m_Data; - int m_Length; + size_t m_Length; std::vector m_Tags; bool m_IsValid; // True if parsing succeeded @@ -319,7 +319,7 @@ protected: bool IsStackTopCompound(void) const { return (m_Stack[m_CurrentStack].m_Type == TAG_Compound); } - void WriteString(const char * a_Data, short a_Length); + void WriteString(const char * a_Data, UInt16 a_Length); inline void TagCommon(const AString & a_Name, eTagType a_Type) { @@ -330,7 +330,7 @@ protected: { // Compound: add the type and name: m_Result.push_back((char)a_Type); - WriteString(a_Name.c_str(), (short)a_Name.length()); + WriteString(a_Name.c_str(), (UInt16)a_Name.length()); } else { -- cgit v1.2.3 From 5b54dc3eacca565531446d9c8cc9be7be084670c Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 9 May 2014 19:33:22 +0200 Subject: Build fixes after the last size_t batch. --- src/WorldStorage/FastNBT.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/WorldStorage/FastNBT.h') 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 -- cgit v1.2.3 From 5e198c673009cf8ca9d92cf59848999bc96bbc37 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:50:58 +0200 Subject: Basic style fixes. --- src/WorldStorage/FastNBT.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/WorldStorage/FastNBT.h') diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h index fe28005ac..7aa83fc24 100644 --- a/src/WorldStorage/FastNBT.h +++ b/src/WorldStorage/FastNBT.h @@ -5,11 +5,11 @@ /* The fast parser parses the data into a vector of cFastNBTTag structures. These structures describe the NBT tree, -but themselves are allocated in a vector, thus minimizing reallocation. +but themselves are allocated in a vector, thus minimizing reallocation. The structures have a minimal constructor, setting all member "pointers" to "invalid". The fast writer doesn't need a NBT tree structure built beforehand, it is commanded to open, append and close tags -(just like XML); it keeps the internal tag stack and reports errors in usage. +(just like XML); it keeps the internal tag stack and reports errors in usage. It directly outputs a string containing the serialized NBT data. */ @@ -173,7 +173,7 @@ public: } /** Returns the value stored in a Byte tag. Not valid for any other tag type. */ - inline unsigned char GetByte(int a_Tag) const + inline unsigned char GetByte(int a_Tag) const { ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_Byte); return (unsigned char)(m_Data[(size_t)m_Tags[(size_t)a_Tag].m_DataStart]); -- cgit v1.2.3 From 4191be7ddba820af4ed0c505a8d62416c2b7a8b4 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Jul 2014 15:36:13 -0700 Subject: Removed redundant semicolons and re-added warning --- src/WorldStorage/FastNBT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/WorldStorage/FastNBT.h') diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h index 7aa83fc24..4ef72e379 100644 --- a/src/WorldStorage/FastNBT.h +++ b/src/WorldStorage/FastNBT.h @@ -160,7 +160,7 @@ public: /** Returns the direct child tag of the specified name, or -1 if no such tag. */ int FindChildByName(int a_Tag, const char * a_Name, size_t a_NameLength = 0) const; - /** Returns the child tag of the specified path (Name1\Name2\Name3...), or -1 if no such tag. */ + /** Returns the child tag of the specified path (Name1/Name2/Name3...), or -1 if no such tag. */ int FindTagByPath(int a_Tag, const AString & a_Path) const; eTagType GetType(int a_Tag) const { return m_Tags[(size_t)a_Tag].m_Type; } -- cgit v1.2.3