summaryrefslogtreecommitdiffstats
path: root/converter/cNBTData.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-30 09:04:40 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-30 09:04:40 +0100
commit5134805bd749e927afa2da16a98ddfb837477b92 (patch)
tree42a49a4e9e8067a1eacdbbfdb745c7ccf3abe723 /converter/cNBTData.cpp
parentAdded Long Tag. It'll now go through the entire NBT data without erroring out. I'm not sure that it's actually saving all tag 7 data though. (diff)
downloadcuberite-5134805bd749e927afa2da16a98ddfb837477b92.tar
cuberite-5134805bd749e927afa2da16a98ddfb837477b92.tar.gz
cuberite-5134805bd749e927afa2da16a98ddfb837477b92.tar.bz2
cuberite-5134805bd749e927afa2da16a98ddfb837477b92.tar.lz
cuberite-5134805bd749e927afa2da16a98ddfb837477b92.tar.xz
cuberite-5134805bd749e927afa2da16a98ddfb837477b92.tar.zst
cuberite-5134805bd749e927afa2da16a98ddfb837477b92.zip
Diffstat (limited to 'converter/cNBTData.cpp')
-rw-r--r--converter/cNBTData.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/converter/cNBTData.cpp b/converter/cNBTData.cpp
index 845e8382b..5bc6e3ddf 100644
--- a/converter/cNBTData.cpp
+++ b/converter/cNBTData.cpp
@@ -112,15 +112,15 @@ void cNBTData::Compress()
unsigned char* Compressed = new unsigned char[MAXNBTSIZE];
/* allocate deflate state */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- strm.avail_in = m_BufferSize;
- strm.avail_out = MAXNBTSIZE;
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+ strm.avail_in = m_BufferSize;
+ strm.avail_out = MAXNBTSIZE;
strm.next_in =(Bytef*)m_Buffer;
- strm.next_out = Compressed;
- strm.total_in = 0;
- strm.total_out = 0;
+ strm.next_out = Compressed;
+ strm.total_in = 0;
+ strm.total_out = 0;
ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15+MAX_WBITS, 8, Z_DEFAULT_STRATEGY);
if (ret != Z_OK)
{
@@ -189,19 +189,19 @@ bool cNBTData::Decompress()
unsigned char* out = new unsigned char[MAXNBTSIZE];
/* allocate inflate state */
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
- strm.avail_in = Z_NULL;
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+ strm.avail_in = Z_NULL;
strm.next_in = Z_NULL;
- strm.avail_in = m_BufferSize;
- strm.avail_out = Z_NULL;
+ strm.avail_in = m_BufferSize;
+ strm.avail_out = Z_NULL;
strm.next_in = (Bytef*)m_Buffer;
- strm.next_out = Z_NULL;
- strm.avail_out = MAXNBTSIZE;
- strm.next_out = out;
- strm.total_in = 0;
- strm.total_out = 0;
+ strm.next_out = Z_NULL;
+ strm.avail_out = MAXNBTSIZE;
+ strm.next_out = out;
+ strm.total_in = 0;
+ strm.total_out = 0;
ret = inflateInit2(&strm, 16+MAX_WBITS);
if (ret != Z_OK)
@@ -551,18 +551,20 @@ void cNBTData::ParseByteArray( bool a_bNamed )
int Length = ReadInt();
std::string String;
-
+ char* ByteArray = new char[ Length ];
if( Length > 0 )
{
for(int i = 0; i < Length; i++, m_Index++)
{
- String.push_back( m_Buffer[m_Index] );
+ ByteArray[i] = m_Buffer[ m_Index ];
+ //ByteArray[i].push_back( m_Buffer[m_Index] );
+ //String.push_back( m_Buffer[m_Index] );
}
}
- PutByteArray( Name, String );
+ PutByteArray( Name, ByteArray );
- printf("VALUE: %s (%s)\n", Name.c_str(), String.c_str() );//re
+ printf("VALUE: %s First 5 Chars: (%i,%i,%i,%i,%i)\n", Name.c_str(), ByteArray[0],ByteArray[1],ByteArray[2],ByteArray[3],ByteArray[4] );//re
}
std::string cNBTData::ReadName()