mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 06:06:59 -06:00
Update to 7-Zip Version 18.05
This commit is contained in:
23
C/Lzma2Enc.c
23
C/Lzma2Enc.c
@@ -1,5 +1,5 @@
|
||||
/* Lzma2Enc.c -- LZMA2 Encoder
|
||||
2017-08-28 : Igor Pavlov : Public domain */
|
||||
2018-04-27 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -369,7 +369,9 @@ typedef struct
|
||||
|
||||
ISeqOutStream *outStream;
|
||||
Byte *outBuf;
|
||||
size_t outBufSize;
|
||||
size_t outBuf_Rem; /* remainder in outBuf */
|
||||
|
||||
size_t outBufSize; /* size of allocated outBufs[i] */
|
||||
size_t outBufsDataSizes[MTCODER__BLOCKS_MAX];
|
||||
Bool mtCoder_WasConstructed;
|
||||
CMtCoder mtCoder;
|
||||
@@ -666,7 +668,7 @@ static SRes Lzma2Enc_MtCallback_Code(void *pp, unsigned coderIndex, unsigned out
|
||||
|
||||
if (!dest)
|
||||
{
|
||||
dest = ISzAlloc_Alloc(me->alloc, me->outBufSize);
|
||||
dest = (Byte *)ISzAlloc_Alloc(me->alloc, me->outBufSize);
|
||||
if (!dest)
|
||||
return SZ_ERROR_MEM;
|
||||
me->outBufs[outBufIndex] = dest;
|
||||
@@ -674,7 +676,8 @@ static SRes Lzma2Enc_MtCallback_Code(void *pp, unsigned coderIndex, unsigned out
|
||||
|
||||
MtProgressThunk_CreateVTable(&progressThunk);
|
||||
progressThunk.mtProgress = &me->mtCoder.mtProgress;
|
||||
progressThunk.index = coderIndex;
|
||||
progressThunk.inSize = 0;
|
||||
progressThunk.outSize = 0;
|
||||
|
||||
res = Lzma2Enc_EncodeMt1(me,
|
||||
&me->coders[coderIndex],
|
||||
@@ -698,10 +701,10 @@ static SRes Lzma2Enc_MtCallback_Write(void *pp, unsigned outBufIndex)
|
||||
if (me->outStream)
|
||||
return ISeqOutStream_Write(me->outStream, data, size) == size ? SZ_OK : SZ_ERROR_WRITE;
|
||||
|
||||
if (size > me->outBufSize)
|
||||
if (size > me->outBuf_Rem)
|
||||
return SZ_ERROR_OUTPUT_EOF;
|
||||
memcpy(me->outBuf, data, size);
|
||||
me->outBufSize -= size;
|
||||
me->outBuf_Rem -= size;
|
||||
me->outBuf += size;
|
||||
return SZ_OK;
|
||||
}
|
||||
@@ -720,10 +723,10 @@ SRes Lzma2Enc_Encode2(CLzma2EncHandle pp,
|
||||
CLzma2Enc *p = (CLzma2Enc *)pp;
|
||||
|
||||
if (inStream && inData)
|
||||
return E_INVALIDARG;
|
||||
return SZ_ERROR_PARAM;
|
||||
|
||||
if (outStream && outBuf)
|
||||
return E_INVALIDARG;
|
||||
return SZ_ERROR_PARAM;
|
||||
|
||||
{
|
||||
unsigned i;
|
||||
@@ -748,11 +751,11 @@ SRes Lzma2Enc_Encode2(CLzma2EncHandle pp,
|
||||
|
||||
p->outStream = outStream;
|
||||
p->outBuf = NULL;
|
||||
p->outBufSize = 0;
|
||||
p->outBuf_Rem = 0;
|
||||
if (!outStream)
|
||||
{
|
||||
p->outBuf = outBuf;
|
||||
p->outBufSize = *outBufSize;
|
||||
p->outBuf_Rem = *outBufSize;
|
||||
*outBufSize = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user