1
0
Fork 0

WSS conversion quickfix: reserving memory so that AString doesn't need to re-alloc (but still uses painfully slow push_back()s )

git-svn-id: http://mc-server.googlecode.com/svn/trunk@366 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-03-05 16:43:06 +00:00
parent 4d65ffffc0
commit 01c5d6e128
1 changed files with 2 additions and 0 deletions

View File

@ -455,6 +455,7 @@ void cWSSCompact::cPAKFile::UpdateChunk1To2()
// Old version is 128 blocks high with YZX axis order
AString ConvertedData;
ConvertedData.reserve(cChunk::c_BlockDataSize); // Pre-alloc, so that push_back() and append() don't need to re-alloc
unsigned int InChunkOffset = 0;
for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z )
{
@ -524,6 +525,7 @@ void cWSSCompact::cPAKFile::UpdateChunk1To2()
// Done converting
m_DataContents = NewDataContents;
m_ChunkVersion = 2;
LOGINFO("Updated \"%s\" version 1 to version 2", m_FileName.c_str() );
}