Shrink LZMA encoded buffer
This commit is contained in:
@@ -142,7 +142,7 @@ namespace lime {
|
|||||||
|
|
||||||
void Bytes::Resize (int size) {
|
void Bytes::Resize (int size) {
|
||||||
|
|
||||||
if (size > _length) {
|
if (size != _length) {
|
||||||
|
|
||||||
if (!_value) {
|
if (!_value) {
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace lime {
|
|||||||
SizeT inputBufferSize = data->Length ();
|
SizeT inputBufferSize = data->Length ();
|
||||||
Byte* inputBufferData = data->Data ();
|
Byte* inputBufferData = data->Data ();
|
||||||
|
|
||||||
result->Resize (inputBufferSize + 1024);
|
result->Resize (inputBufferSize + inputBufferSize / 40 + (1 << 12));
|
||||||
|
|
||||||
SizeT outputBufferSize = result->Length ();
|
SizeT outputBufferSize = result->Length ();
|
||||||
Byte* outputBufferData = result->Data ();
|
Byte* outputBufferData = result->Data ();
|
||||||
@@ -86,7 +86,9 @@ namespace lime {
|
|||||||
memcpy (outputBufferData, propsData, propsSize);
|
memcpy (outputBufferData, propsData, propsSize);
|
||||||
WRITE_LE64 (outputBufferData + propsSize, uncompressedLength);
|
WRITE_LE64 (outputBufferData + propsSize, uncompressedLength);
|
||||||
|
|
||||||
free(propsData);
|
result->Resize (outputBufferSize + propsSize + 8);
|
||||||
|
|
||||||
|
free (propsData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user