diff --git a/project/src/utils/Bytes.cpp b/project/src/utils/Bytes.cpp index b494513c3..679cafdad 100644 --- a/project/src/utils/Bytes.cpp +++ b/project/src/utils/Bytes.cpp @@ -142,7 +142,7 @@ namespace lime { void Bytes::Resize (int size) { - if (size > _length) { + if (size != _length) { if (!_value) { diff --git a/project/src/utils/LZMA.cpp b/project/src/utils/LZMA.cpp index f6e341922..c1b773ad6 100644 --- a/project/src/utils/LZMA.cpp +++ b/project/src/utils/LZMA.cpp @@ -63,7 +63,7 @@ namespace lime { SizeT inputBufferSize = data->Length (); Byte* inputBufferData = data->Data (); - result->Resize (inputBufferSize + 1024); + result->Resize (inputBufferSize + inputBufferSize / 40 + (1 << 12)); SizeT outputBufferSize = result->Length (); Byte* outputBufferData = result->Data (); @@ -86,7 +86,9 @@ namespace lime { memcpy (outputBufferData, propsData, propsSize); WRITE_LE64 (outputBufferData + propsSize, uncompressedLength); - free(propsData); + result->Resize (outputBufferSize + propsSize + 8); + + free (propsData); }