summaryrefslogtreecommitdiffstats
path: root/converter/cNBTData.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-30 12:41:18 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-30 12:41:18 +0100
commitca1d98a7baf7d650c02e027c6c15dfc8eeeb171d (patch)
treec2bdc0ef32a29ffad7bb7b6f34aeb8bee8ceda30 /converter/cNBTData.cpp
parentLast changes to the converter before bed. (diff)
downloadcuberite-ca1d98a7baf7d650c02e027c6c15dfc8eeeb171d.tar
cuberite-ca1d98a7baf7d650c02e027c6c15dfc8eeeb171d.tar.gz
cuberite-ca1d98a7baf7d650c02e027c6c15dfc8eeeb171d.tar.bz2
cuberite-ca1d98a7baf7d650c02e027c6c15dfc8eeeb171d.tar.lz
cuberite-ca1d98a7baf7d650c02e027c6c15dfc8eeeb171d.tar.xz
cuberite-ca1d98a7baf7d650c02e027c6c15dfc8eeeb171d.tar.zst
cuberite-ca1d98a7baf7d650c02e027c6c15dfc8eeeb171d.zip
Diffstat (limited to '')
-rw-r--r--converter/cNBTData.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/converter/cNBTData.cpp b/converter/cNBTData.cpp
index 5bc6e3ddf..fc0dd628e 100644
--- a/converter/cNBTData.cpp
+++ b/converter/cNBTData.cpp
@@ -357,6 +357,11 @@ void cNBTCompound::PrintData( int a_Depth, std::string a_Name )
printf("%s BYTE %s (%i)\n", Prefix, itr->first.c_str(), itr->second );
}
+ for( ByteArrayMap::iterator itr = m_ByteArrays.begin(); itr != m_ByteArrays.end(); itr++ )
+ {
+ printf("%s BYTE ARRAY %s (length: %i)\n", Prefix, itr->first.c_str(), sizeof(itr->second) );
+ }
+
delete Prefix;
}
@@ -524,9 +529,9 @@ void cNBTData::ParseLong( bool a_bNamed )
{
std::string Name;
if( a_bNamed ) Name = ReadName();
- long Value = ReadLong();
+ long long Value = ReadLong();
- PutInteger( Name, Value );
+ PutInteger( Name, (int)Value );
printf("LONG: %s %li\n", Name.c_str(), Value );//re
}
@@ -554,12 +559,8 @@ void cNBTData::ParseByteArray( bool a_bNamed )
char* ByteArray = new char[ Length ];
if( Length > 0 )
{
- for(int i = 0; i < Length; i++, m_Index++)
- {
- ByteArray[i] = m_Buffer[ m_Index ];
- //ByteArray[i].push_back( m_Buffer[m_Index] );
- //String.push_back( m_Buffer[m_Index] );
- }
+ memcpy( ByteArray, &m_Buffer[ m_Index ], Length );
+ m_Index += Length;
}
PutByteArray( Name, ByteArray );
@@ -607,11 +608,11 @@ int cNBTData::ReadInt()
return ntohl( Value );
}
-long cNBTData::ReadLong()
+long long cNBTData::ReadLong()
{
- long Value = 0;
- memcpy( &Value, m_Buffer+m_Index, sizeof(long) );
- m_Index+=sizeof(long);
+ long long Value = 0;
+ memcpy( &Value, m_Buffer+m_Index, sizeof(long long) );
+ m_Index+=sizeof(long long);
return ntohl( Value );
}
@@ -757,4 +758,4 @@ void cNBTList::Clear()
}
}
m_List.clear();
-}
+} \ No newline at end of file