mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 18:07:15 -06:00
Update to 7-Zip Version 21.02
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../C/Alloc.h"
|
||||
#include "../../../C/CpuArch.h"
|
||||
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
@@ -21,7 +20,7 @@ void CEncProps::Normalize(int level)
|
||||
if (level < 0) level = 5;
|
||||
if (level > 9) level = 9;
|
||||
if (MemSize == (UInt32)(Int32)-1)
|
||||
MemSize = level >= 9 ? ((UInt32)192 << 20) : ((UInt32)1 << (level + 19));
|
||||
MemSize = (UInt32)1 << (level + 19);
|
||||
const unsigned kMult = 16;
|
||||
if (MemSize / kMult > ReduceSize)
|
||||
{
|
||||
@@ -43,8 +42,8 @@ CEncoder::CEncoder():
|
||||
_inBuf(NULL)
|
||||
{
|
||||
_props.Normalize(-1);
|
||||
_rangeEnc.Stream = &_outStream.vt;
|
||||
Ppmd7_Construct(&_ppmd);
|
||||
_ppmd.rc.enc.Stream = &_outStream.vt;
|
||||
}
|
||||
|
||||
CEncoder::~CEncoder()
|
||||
@@ -120,8 +119,8 @@ HRESULT CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outS
|
||||
_outStream.Stream = outStream;
|
||||
_outStream.Init();
|
||||
|
||||
Ppmd7z_RangeEnc_Init(&_rangeEnc);
|
||||
Ppmd7_Init(&_ppmd, _props.Order);
|
||||
Ppmd7z_Init_RangeEnc(&_ppmd);
|
||||
Ppmd7_Init(&_ppmd, (unsigned)_props.Order);
|
||||
|
||||
UInt64 processed = 0;
|
||||
for (;;)
|
||||
@@ -131,19 +130,27 @@ HRESULT CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outS
|
||||
if (size == 0)
|
||||
{
|
||||
// We don't write EndMark in PPMD-7z.
|
||||
// Ppmd7_EncodeSymbol(&_ppmd, &_rangeEnc, -1);
|
||||
Ppmd7z_RangeEnc_FlushData(&_rangeEnc);
|
||||
// Ppmd7z_EncodeSymbol(&_ppmd, -1);
|
||||
Ppmd7z_Flush_RangeEnc(&_ppmd);
|
||||
return _outStream.Flush();
|
||||
}
|
||||
for (UInt32 i = 0; i < size; i++)
|
||||
const Byte *buf = _inBuf;
|
||||
const Byte *lim = buf + size;
|
||||
/*
|
||||
for (; buf < lim; buf++)
|
||||
{
|
||||
Ppmd7_EncodeSymbol(&_ppmd, &_rangeEnc, _inBuf[i]);
|
||||
Ppmd7z_EncodeSymbol(&_ppmd, *buf);
|
||||
RINOK(_outStream.Res);
|
||||
}
|
||||
*/
|
||||
|
||||
Ppmd7z_EncodeSymbols(&_ppmd, buf, lim);
|
||||
RINOK(_outStream.Res);
|
||||
|
||||
processed += size;
|
||||
if (progress)
|
||||
{
|
||||
UInt64 outSize = _outStream.GetProcessed();
|
||||
const UInt64 outSize = _outStream.GetProcessed();
|
||||
RINOK(progress->SetRatioInfo(&processed, &outSize));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user