From bdc06b6e74e52183b3847f932229dd6328240e15 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 1 May 2013 17:00:05 +0000 Subject: FastNBT: Added cFastNBTTag::GetName() git-svn-id: http://mc-server.googlecode.com/svn/trunk@1437 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/WorldStorage/FastNBT.cpp | 1 + source/WorldStorage/FastNBT.h | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/source/WorldStorage/FastNBT.cpp b/source/WorldStorage/FastNBT.cpp index d5dc2b923..e55011069 100644 --- a/source/WorldStorage/FastNBT.cpp +++ b/source/WorldStorage/FastNBT.cpp @@ -505,6 +505,7 @@ void cFastNBTWriter::AddIntArray(const AString & a_Name, const int * a_Value, si Int32 len = htonl(a_NumElements); m_Result.append((const char *)&len, 4); #if defined(ANDROID_NDK) + // Android has alignment issues - cannot byteswap (htonl) an int that is not 32-bit-aligned, which happens in the regular version for (size_t i = 0; i < a_NumElements; i++) { int Element = htonl(a_Value[i]); diff --git a/source/WorldStorage/FastNBT.h b/source/WorldStorage/FastNBT.h index 1cae4879f..7323c29cb 100644 --- a/source/WorldStorage/FastNBT.h +++ b/source/WorldStorage/FastNBT.h @@ -190,6 +190,13 @@ public: return res; } + inline AString GetName(int a_Tag) const + { + AString res; + res.assign(m_Data + m_Tags[a_Tag].m_NameStart, m_Tags[a_Tag].m_NameLength); + return res; + } + protected: const char * m_Data; int m_Length; -- cgit v1.2.3