mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-10-09 23:27:11 +02:00
Update POCO library.
This commit is contained in:
1 parent
8d15f4b6e9
commit
233fc103f9
2521 files changed
+257092
-72789
No files matched your search
Vendored
+3
-3
@@ -136,17 +136,17 @@ void SzAr_Free(CSzAr *p, ISzAlloc *alloc);
|
||||
*outBufferSize
|
||||
You can consider "*outBuffer" as cache of solid block. If your archive is solid,
|
||||
it will increase decompression speed.
|
||||
|
||||
|
||||
If you use external function, you can declare these 3 cache variables
|
||||
(blockIndex, outBuffer, outBufferSize) as static in that external function.
|
||||
|
||||
|
||||
Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CSzAr db;
|
||||
|
||||
|
||||
UInt64 startPosAfterHeader;
|
||||
UInt64 dataPos;
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -52,11 +52,11 @@ void MY_FAST_CALL CrcGenerateTable()
|
||||
UInt32 r = g_CrcTable[i - 256];
|
||||
g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
|
||||
}
|
||||
|
||||
|
||||
#ifdef MY_CPU_LE
|
||||
|
||||
g_CrcUpdate = CrcUpdateT4;
|
||||
|
||||
|
||||
#if CRC_NUM_TABLES == 8
|
||||
if (!CPU_Is_InOrder())
|
||||
g_CrcUpdate = CrcUpdateT8;
|
||||
|
||||
Vendored
+10
-10
@@ -120,12 +120,12 @@ WRes File_Read(CSzFile *p, void *data, size_t *size)
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
|
||||
*size = fread(data, 1, originalSize, p->file);
|
||||
if (*size == originalSize)
|
||||
return 0;
|
||||
return ferror(p->file);
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ WRes File_Write(CSzFile *p, const void *data, size_t *size)
|
||||
size_t originalSize = *size;
|
||||
if (originalSize == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
|
||||
*size = 0;
|
||||
@@ -160,7 +160,7 @@ WRes File_Write(CSzFile *p, const void *data, size_t *size)
|
||||
if (*size == originalSize)
|
||||
return 0;
|
||||
return ferror(p->file);
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
|
||||
int moveMethod;
|
||||
int res;
|
||||
switch (origin)
|
||||
@@ -203,14 +203,14 @@ WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
|
||||
res = fseek(p->file, (long)*pos, moveMethod);
|
||||
*pos = ftell(p->file);
|
||||
return res;
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
WRes File_GetLength(CSzFile *p, UInt64 *length)
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
|
||||
|
||||
DWORD sizeHigh;
|
||||
DWORD sizeLow = GetFileSize(p->handle, &sizeHigh);
|
||||
if (sizeLow == 0xFFFFFFFF)
|
||||
@@ -221,15 +221,15 @@ WRes File_GetLength(CSzFile *p, UInt64 *length)
|
||||
}
|
||||
*length = (((UInt64)sizeHigh) << 32) + sizeLow;
|
||||
return 0;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
long pos = ftell(p->file);
|
||||
int res = fseek(p->file, 0, SEEK_END);
|
||||
*length = ftell(p->file);
|
||||
fseek(p->file, pos, SEEK_SET);
|
||||
return res;
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Vendored
+12
-12
@@ -537,12 +537,12 @@ static SRes SzGetNextFolderItem(CSzData *sd, CSzFolder *folder, ISzAlloc *alloc)
|
||||
{
|
||||
UInt32 numCoders, numBindPairs, numPackStreams, i;
|
||||
UInt32 numInStreams = 0, numOutStreams = 0;
|
||||
|
||||
|
||||
RINOK(SzReadNumber32(sd, &numCoders));
|
||||
if (numCoders > NUM_FOLDER_CODERS_MAX)
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
folder->NumCoders = numCoders;
|
||||
|
||||
|
||||
MY_ALLOC(CSzCoderInfo, folder->Coders, (size_t)numCoders, alloc);
|
||||
|
||||
for (i = 0; i < numCoders; i++)
|
||||
@@ -810,7 +810,7 @@ static SRes SzReadSubStreamsInfo(
|
||||
numDigests += numSubstreams;
|
||||
}
|
||||
|
||||
|
||||
|
||||
si = 0;
|
||||
for (;;)
|
||||
{
|
||||
@@ -963,8 +963,8 @@ static SRes SzReadHeader2(
|
||||
RINOK(SzReadArchiveProperties(sd));
|
||||
RINOK(SzReadID(sd, &type));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (type == k7zIdMainStreamsInfo)
|
||||
{
|
||||
RINOK(SzReadStreamsInfo(sd,
|
||||
@@ -982,7 +982,7 @@ static SRes SzReadHeader2(
|
||||
return SZ_OK;
|
||||
if (type != k7zIdFilesInfo)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
|
||||
|
||||
RINOK(SzReadNumber32(sd, &numFiles));
|
||||
p->db.NumFiles = numFiles;
|
||||
|
||||
@@ -1165,19 +1165,19 @@ static SRes SzReadAndDecodePackedStreams2(
|
||||
RINOK(SzReadStreamsInfo(sd, &dataStartPos, p,
|
||||
&numUnpackStreams, unpackSizes, digestsDefined, digests,
|
||||
allocTemp, allocTemp));
|
||||
|
||||
|
||||
dataStartPos += baseOffset;
|
||||
if (p->NumFolders != 1)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
|
||||
folder = p->Folders;
|
||||
unpackSize = SzFolder_GetUnpackSize(folder);
|
||||
|
||||
|
||||
RINOK(LookInStream_SeekTo(inStream, dataStartPos));
|
||||
|
||||
if (!Buf_Create(outBuffer, (size_t)unpackSize, allocTemp))
|
||||
return SZ_ERROR_MEM;
|
||||
|
||||
|
||||
res = SzFolder_Decode(folder, p->PackSizes,
|
||||
inStream, dataStartPos,
|
||||
outBuffer->data, (size_t)unpackSize, allocTemp);
|
||||
@@ -1240,7 +1240,7 @@ static SRes SzArEx_Open2(
|
||||
nextHeaderCRC = GetUi32(header + 28);
|
||||
|
||||
p->startPosAfterHeader = startArcPos + k7zStartHeaderSize;
|
||||
|
||||
|
||||
if (CrcCalc(header + 12, 20) != GetUi32(header + 8))
|
||||
return SZ_ERROR_CRC;
|
||||
|
||||
@@ -1356,9 +1356,9 @@ SRes SzArEx_Extract(
|
||||
*blockIndex = folderIndex;
|
||||
IAlloc_Free(allocMain, *outBuffer);
|
||||
*outBuffer = 0;
|
||||
|
||||
|
||||
RINOK(LookInStream_SeekTo(inStream, startOffset));
|
||||
|
||||
|
||||
if (res == SZ_OK)
|
||||
{
|
||||
*outBufferSize = unpackSize;
|
||||
|
||||
Vendored
+2
-2
@@ -99,7 +99,7 @@ void *BigAlloc(size_t size)
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _7ZIP_LARGE_PAGES
|
||||
if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
|
||||
{
|
||||
@@ -118,7 +118,7 @@ void BigFree(void *address)
|
||||
if (address != 0)
|
||||
fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
|
||||
#endif
|
||||
|
||||
|
||||
if (address == 0)
|
||||
return;
|
||||
VirtualFree(address, 0, MEM_RELEASE);
|
||||
|
||||
+3
-3
@@ -51,12 +51,12 @@ ArchiveEntry::ArchiveEntry(const ArchiveEntry& entry):
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
ArchiveEntry::~ArchiveEntry()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
ArchiveEntry& ArchiveEntry::operator = (const ArchiveEntry& entry)
|
||||
{
|
||||
ArchiveEntry temp(entry);
|
||||
@@ -65,7 +65,7 @@ ArchiveEntry& ArchiveEntry::operator = (const ArchiveEntry& entry)
|
||||
}
|
||||
|
||||
|
||||
void ArchiveEntry::swap(ArchiveEntry& entry)
|
||||
void ArchiveEntry::swap(ArchiveEntry& entry) noexcept
|
||||
{
|
||||
std::swap(_type, entry._type);
|
||||
std::swap(_path, entry._path);
|
||||
|
||||
Vendored
+5
-5
@@ -48,14 +48,14 @@ SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
((UInt32)data[i + 0] << 11) |
|
||||
(((UInt32)data[i + 3] & 0x7) << 8) |
|
||||
(data[i + 2]);
|
||||
|
||||
|
||||
src <<= 1;
|
||||
if (encoding)
|
||||
dest = ip + (UInt32)i + src;
|
||||
else
|
||||
dest = src - (ip + (UInt32)i);
|
||||
dest >>= 1;
|
||||
|
||||
|
||||
data[i + 1] = (Byte)(0xF0 | ((dest >> 19) & 0x7));
|
||||
data[i + 0] = (Byte)(dest >> 11);
|
||||
data[i + 3] = (Byte)(0xF8 | ((dest >> 8) & 0x7));
|
||||
@@ -80,7 +80,7 @@ SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
((UInt32)data[i + 1] << 16) |
|
||||
((UInt32)data[i + 2] << 8) |
|
||||
((UInt32)data[i + 3] & (~3));
|
||||
|
||||
|
||||
UInt32 dest;
|
||||
if (encoding)
|
||||
dest = ip + (UInt32)i + src;
|
||||
@@ -113,14 +113,14 @@ SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
((UInt32)data[i + 2] << 8) |
|
||||
((UInt32)data[i + 3]);
|
||||
UInt32 dest;
|
||||
|
||||
|
||||
src <<= 2;
|
||||
if (encoding)
|
||||
dest = ip + i + src;
|
||||
else
|
||||
dest = src - (ip + i);
|
||||
dest >>= 2;
|
||||
|
||||
|
||||
dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF) | (dest & 0x3FFFFF) | 0x40000000;
|
||||
|
||||
data[i + 0] = (Byte)(dest >> 24);
|
||||
|
||||
Vendored
+4
-4
@@ -13,23 +13,23 @@ extern "C" {
|
||||
/*
|
||||
These functions convert relative addresses to absolute addresses
|
||||
in CALL instructions to increase the compression ratio.
|
||||
|
||||
|
||||
In:
|
||||
data - data buffer
|
||||
size - size of data
|
||||
ip - current virtual Instruction Pinter (IP) value
|
||||
state - state variable for x86 converter
|
||||
encoding - 0 (for decoding), 1 (for encoding)
|
||||
|
||||
|
||||
Out:
|
||||
state - state variable for x86 converter
|
||||
|
||||
Returns:
|
||||
The number of processed bytes. If you call these functions with multiple calls,
|
||||
you must start next call with first byte after block of processed bytes.
|
||||
|
||||
|
||||
Type Endian Alignment LookAhead
|
||||
|
||||
|
||||
x86 little 1 4
|
||||
ARMT little 2 2
|
||||
ARM little 4 0
|
||||
|
||||
Vendored
+5
-5
@@ -42,20 +42,20 @@ SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF);
|
||||
UInt32 dest;
|
||||
src |= ((UInt32)(instNorm >> 36) & 1) << 20;
|
||||
|
||||
|
||||
src <<= 4;
|
||||
|
||||
|
||||
if (encoding)
|
||||
dest = ip + (UInt32)i + src;
|
||||
else
|
||||
dest = src - (ip + (UInt32)i);
|
||||
|
||||
|
||||
dest >>= 4;
|
||||
|
||||
|
||||
instNorm &= ~((UInt64)(0x8FFFFF) << 13);
|
||||
instNorm |= ((UInt64)(dest & 0xFFFFF) << 13);
|
||||
instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20));
|
||||
|
||||
|
||||
instruction &= (1 << bitRes) - 1;
|
||||
instruction |= (instNorm << bitRes);
|
||||
for (j = 0; j < 6; j++)
|
||||
|
||||
Vendored
+1
-1
@@ -81,7 +81,7 @@ static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d)
|
||||
: "0" (function)) ;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#else
|
||||
|
||||
int CPUInfo[4];
|
||||
|
||||
Vendored
+2
-2
@@ -512,7 +512,7 @@ static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||
|
||||
delta2 = p->pos - p->hash[hash2Value];
|
||||
curMatch = p->hash[kFix3HashSize + hashValue];
|
||||
|
||||
|
||||
p->hash[hash2Value] =
|
||||
p->hash[kFix3HashSize + hashValue] = p->pos;
|
||||
|
||||
@@ -546,7 +546,7 @@ static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||
delta2 = p->pos - p->hash[ hash2Value];
|
||||
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
|
||||
curMatch = p->hash[kFix4HashSize + hashValue];
|
||||
|
||||
|
||||
p->hash[ hash2Value] =
|
||||
p->hash[kFix3HashSize + hash3Value] =
|
||||
p->hash[kFix4HashSize + hashValue] = p->pos;
|
||||
|
||||
Vendored
+8
-8
@@ -58,7 +58,7 @@ void MtSync_StopWriting(CMtSync *p)
|
||||
p->csWasEntered = False;
|
||||
}
|
||||
Semaphore_Release1(&p->freeSemaphore);
|
||||
|
||||
|
||||
Event_Wait(&p->wasStopped);
|
||||
|
||||
while (myNumBlocks++ != p->numProcessedBlocks)
|
||||
@@ -108,12 +108,12 @@ static SRes MtSync_Create2(CMtSync *p, unsigned (MY_STD_CALL *startAddress)(void
|
||||
RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart));
|
||||
RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStarted));
|
||||
RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped));
|
||||
|
||||
|
||||
RINOK_THREAD(Semaphore_Create(&p->freeSemaphore, numBlocks, numBlocks));
|
||||
RINOK_THREAD(Semaphore_Create(&p->filledSemaphore, 0, numBlocks));
|
||||
|
||||
p->needStart = True;
|
||||
|
||||
|
||||
RINOK_THREAD(Thread_Create(&p->thread, startAddress, obj));
|
||||
p->wasCreated = True;
|
||||
return SZ_OK;
|
||||
@@ -385,7 +385,7 @@ void BtFillBlock(CMatchFinderMt *p, UInt32 globalBlockIndex)
|
||||
CriticalSection_Enter(&sync->cs);
|
||||
sync->csWasEntered = True;
|
||||
}
|
||||
|
||||
|
||||
BtGetMatches(p, p->btBuf + (globalBlockIndex & kMtBtNumBlocksMask) * kMtBtBlockSize);
|
||||
|
||||
if (p->pos > kMtMaxValForNormalize - kMtBtBlockSize)
|
||||
@@ -561,7 +561,7 @@ UInt32 * MixMatches2(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
||||
const Byte *cur = p->pointerToCurPos;
|
||||
UInt32 lzPos = p->lzPos;
|
||||
MT_HASH2_CALC
|
||||
|
||||
|
||||
curMatch2 = hash[hash2Value];
|
||||
hash[hash2Value] = lzPos;
|
||||
|
||||
@@ -584,7 +584,7 @@ UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
||||
|
||||
curMatch2 = hash[ hash2Value];
|
||||
curMatch3 = hash[kFix3HashSize + hash3Value];
|
||||
|
||||
|
||||
hash[ hash2Value] =
|
||||
hash[kFix3HashSize + hash3Value] =
|
||||
lzPos;
|
||||
@@ -616,11 +616,11 @@ UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
||||
const Byte *cur = p->pointerToCurPos;
|
||||
UInt32 lzPos = p->lzPos;
|
||||
MT_HASH4_CALC
|
||||
|
||||
|
||||
curMatch2 = hash[ hash2Value];
|
||||
curMatch3 = hash[kFix3HashSize + hash3Value];
|
||||
curMatch4 = hash[kFix4HashSize + hash4Value];
|
||||
|
||||
|
||||
hash[ hash2Value] =
|
||||
hash[kFix3HashSize + hash3Value] =
|
||||
hash[kFix4HashSize + hash4Value] =
|
||||
|
||||
Vendored
+2
-2
@@ -62,7 +62,7 @@ typedef struct _CMatchFinderMt
|
||||
const UInt32 *crc;
|
||||
|
||||
Mf_Mix_Matches MixMatchesFunc;
|
||||
|
||||
|
||||
/* LZ + BT */
|
||||
CMtSync btSync;
|
||||
Byte btDummy[kMtCacheLineDummy];
|
||||
@@ -85,7 +85,7 @@ typedef struct _CMatchFinderMt
|
||||
/* BT + Hash */
|
||||
CMtSync hashSync;
|
||||
/* Byte hashDummy[kMtCacheLineDummy]; */
|
||||
|
||||
|
||||
/* Hash */
|
||||
Mf_GetHeads GetHeadsFunc;
|
||||
CMatchFinder *MatchFinder;
|
||||
|
||||
Vendored
+7
-7
@@ -114,17 +114,17 @@ static ELzma2State Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b)
|
||||
else
|
||||
p->unpackSize = (UInt32)(p->control & 0x1F) << 16;
|
||||
return LZMA2_STATE_UNPACK0;
|
||||
|
||||
|
||||
case LZMA2_STATE_UNPACK0:
|
||||
p->unpackSize |= (UInt32)b << 8;
|
||||
return LZMA2_STATE_UNPACK1;
|
||||
|
||||
|
||||
case LZMA2_STATE_UNPACK1:
|
||||
p->unpackSize |= (UInt32)b;
|
||||
p->unpackSize++;
|
||||
PRF(printf(" %8d", p->unpackSize));
|
||||
return (LZMA2_IS_UNCOMPRESSED_STATE(p)) ? LZMA2_STATE_DATA : LZMA2_STATE_PACK0;
|
||||
|
||||
|
||||
case LZMA2_STATE_PACK0:
|
||||
p->packSize = (UInt32)b << 8;
|
||||
return LZMA2_STATE_PACK1;
|
||||
@@ -199,7 +199,7 @@ SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
|
||||
SizeT destSizeCur = dicLimit - dicPos;
|
||||
SizeT srcSizeCur = inSize - *srcLen;
|
||||
ELzmaFinishMode curFinishMode = LZMA_FINISH_ANY;
|
||||
|
||||
|
||||
if (p->unpackSize <= destSizeCur)
|
||||
{
|
||||
destSizeCur = (SizeT)p->unpackSize;
|
||||
@@ -250,7 +250,7 @@ SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
|
||||
Bool initState = (mode > 0);
|
||||
if ((!initDic && p->needInitDic) || (!initState && p->needInitState))
|
||||
return SZ_ERROR_DATA;
|
||||
|
||||
|
||||
LzmaDec_InitDicAndState(&p->decoder, initDic, initState);
|
||||
p->needInitDic = False;
|
||||
p->needInitState = False;
|
||||
@@ -258,9 +258,9 @@ SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
|
||||
}
|
||||
if (srcSizeCur > p->packSize)
|
||||
srcSizeCur = (SizeT)p->packSize;
|
||||
|
||||
|
||||
res = LzmaDec_DecodeToDic(&p->decoder, dicPos + destSizeCur, src, &srcSizeCur, curFinishMode, status);
|
||||
|
||||
|
||||
src += srcSizeCur;
|
||||
*srcLen += srcSizeCur;
|
||||
p->packSize -= (UInt32)srcSizeCur;
|
||||
|
||||
Vendored
+9
-9
@@ -83,11 +83,11 @@ static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf,
|
||||
if (packSize < lzHeaderSize)
|
||||
return SZ_ERROR_OUTPUT_EOF;
|
||||
packSize -= lzHeaderSize;
|
||||
|
||||
|
||||
LzmaEnc_SaveState(p->enc);
|
||||
res = LzmaEnc_CodeOneMemBlock(p->enc, p->needInitState,
|
||||
outBuf + lzHeaderSize, &packSize, LZMA2_PACK_SIZE_MAX, &unpackSize);
|
||||
|
||||
|
||||
PRF(printf("\npackSize = %7d unpackSize = %7d ", packSize, unpackSize));
|
||||
|
||||
if (unpackSize == 0)
|
||||
@@ -146,10 +146,10 @@ static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf,
|
||||
outBuf[destPos++] = (Byte)u;
|
||||
outBuf[destPos++] = (Byte)(pm >> 8);
|
||||
outBuf[destPos++] = (Byte)pm;
|
||||
|
||||
|
||||
if (p->needInitProp)
|
||||
outBuf[destPos++] = p->props;
|
||||
|
||||
|
||||
p->needInitProp = False;
|
||||
p->needInitState = False;
|
||||
destPos += packSize;
|
||||
@@ -244,7 +244,7 @@ typedef struct
|
||||
{
|
||||
Byte propEncoded;
|
||||
CLzma2EncProps props;
|
||||
|
||||
|
||||
Byte *outBuf;
|
||||
|
||||
ISzAlloc *alloc;
|
||||
@@ -322,10 +322,10 @@ static SRes MtCallbackImp_Code(void *pp, unsigned index, Byte *dest, size_t *des
|
||||
if (srcSize != 0)
|
||||
{
|
||||
RINOK(Lzma2EncInt_Init(p, &mainEncoder->props));
|
||||
|
||||
|
||||
RINOK(LzmaEnc_MemPrepare(p->enc, src, srcSize, LZMA2_KEEP_WINDOW_SIZE,
|
||||
mainEncoder->alloc, mainEncoder->allocBig));
|
||||
|
||||
|
||||
while (p->srcPos < srcSize)
|
||||
{
|
||||
size_t packSize = destLim - *destSize;
|
||||
@@ -460,7 +460,7 @@ SRes Lzma2Enc_Encode(CLzma2EncHandle pp,
|
||||
|
||||
mtCallback.funcTable.Code = MtCallbackImp_Code;
|
||||
mtCallback.lzma2Enc = p;
|
||||
|
||||
|
||||
p->mtCoder.progress = progress;
|
||||
p->mtCoder.inStream = inStream;
|
||||
p->mtCoder.outStream = outStream;
|
||||
@@ -470,7 +470,7 @@ SRes Lzma2Enc_Encode(CLzma2EncHandle pp,
|
||||
p->mtCoder.blockSize = p->props.blockSize;
|
||||
p->mtCoder.destBlockSize = p->props.blockSize + (p->props.blockSize >> 10) + 16;
|
||||
p->mtCoder.numThreads = p->props.numBlockThreads;
|
||||
|
||||
|
||||
return MtCoder_Code(&p->mtCoder);
|
||||
}
|
||||
#endif
|
||||
|
||||
Vendored
+3
-3
@@ -26,7 +26,7 @@ int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
LzmaEncProps_Init(&props);
|
||||
props.level = level;
|
||||
props.dictSize = dictSize;
|
||||
|
||||
|
||||
*destLen = 0;
|
||||
if (outSize2 < LZMA86_HEADER_SIZE)
|
||||
return SZ_ERROR_OUTPUT_EOF;
|
||||
@@ -78,12 +78,12 @@ int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
break;
|
||||
if (useFilter && i == 0)
|
||||
curModeIsFiltered = True;
|
||||
|
||||
|
||||
curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed,
|
||||
curModeIsFiltered ? filteredStream : src, srcLen,
|
||||
&props, dest + 1, &outPropsSize, 0,
|
||||
NULL, &g_Alloc, &g_Alloc);
|
||||
|
||||
|
||||
if (curRes != SZ_ERROR_OUTPUT_EOF)
|
||||
{
|
||||
if (curRes != SZ_OK)
|
||||
|
||||
Vendored
+6
-6
@@ -141,7 +141,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
||||
Byte *dic = p->dic;
|
||||
SizeT dicBufSize = p->dicBufSize;
|
||||
SizeT dicPos = p->dicPos;
|
||||
|
||||
|
||||
UInt32 processedPos = p->processedPos;
|
||||
UInt32 checkDicSize = p->checkDicSize;
|
||||
unsigned len = 0;
|
||||
@@ -324,7 +324,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
||||
{
|
||||
NORMALIZE
|
||||
range >>= 1;
|
||||
|
||||
|
||||
{
|
||||
UInt32 t;
|
||||
code -= range;
|
||||
@@ -723,7 +723,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
|
||||
SizeT inSize = *srcLen;
|
||||
(*srcLen) = 0;
|
||||
LzmaDec_WriteRem(p, dicLimit);
|
||||
|
||||
|
||||
*status = LZMA_STATUS_NOT_SPECIFIED;
|
||||
|
||||
while (p->remainLen != kMatchSpecLenStart)
|
||||
@@ -769,7 +769,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
|
||||
|
||||
if (p->needInitState)
|
||||
LzmaDec_InitStateReal(p);
|
||||
|
||||
|
||||
if (p->tempBufSize == 0)
|
||||
{
|
||||
SizeT processed;
|
||||
@@ -900,12 +900,12 @@ SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
Byte d;
|
||||
|
||||
|
||||
if (size < LZMA_PROPS_SIZE)
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
else
|
||||
dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
|
||||
|
||||
|
||||
if (dicSize < LZMA_DIC_MIN)
|
||||
dicSize = LZMA_DIC_MIN;
|
||||
p->dicSize = dicSize;
|
||||
|
||||
Vendored
+2
-2
@@ -130,7 +130,7 @@ LzmaDec_Allocate* can return:
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||
*/
|
||||
|
||||
|
||||
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
|
||||
void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
|
||||
|
||||
@@ -159,7 +159,7 @@ void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
|
||||
*/
|
||||
|
||||
/* LzmaDec_DecodeToDic
|
||||
|
||||
|
||||
The decoding to internal dictionary buffer (CLzmaDec::dic).
|
||||
You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
|
||||
|
||||
|
||||
Vendored
+20
-20
@@ -119,7 +119,7 @@ void LzmaEnc_FastPosInit(Byte *g_FastPos)
|
||||
int c = 2, slotFast;
|
||||
g_FastPos[0] = 0;
|
||||
g_FastPos[1] = 1;
|
||||
|
||||
|
||||
for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++)
|
||||
{
|
||||
UInt32 k = (1 << ((slotFast >> 1) - 1));
|
||||
@@ -256,7 +256,7 @@ typedef struct
|
||||
CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
|
||||
CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
|
||||
CLzmaProb posAlignEncoder[1 << kNumAlignBits];
|
||||
|
||||
|
||||
CLenPriceEnc lenEnc;
|
||||
CLenPriceEnc repLenEnc;
|
||||
|
||||
@@ -279,7 +279,7 @@ typedef struct
|
||||
#ifndef _7ZIP_ST
|
||||
Byte pad[128];
|
||||
#endif
|
||||
|
||||
|
||||
UInt32 optimumEndIndex;
|
||||
UInt32 optimumCurrentIndex;
|
||||
|
||||
@@ -287,7 +287,7 @@ typedef struct
|
||||
UInt32 numPairs;
|
||||
UInt32 numAvail;
|
||||
COptimal opt[kNumOpts];
|
||||
|
||||
|
||||
#ifndef LZMA_LOG_BSR
|
||||
Byte g_FastPos[1 << kNumLogBits];
|
||||
#endif
|
||||
@@ -321,14 +321,14 @@ typedef struct
|
||||
CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
|
||||
CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
|
||||
CLzmaProb posAlignEncoder[1 << kNumAlignBits];
|
||||
|
||||
|
||||
CLenPriceEnc lenEnc;
|
||||
CLenPriceEnc repLenEnc;
|
||||
|
||||
unsigned lclp;
|
||||
|
||||
Bool fastMode;
|
||||
|
||||
|
||||
CRangeEnc rc;
|
||||
|
||||
Bool writeEndMark;
|
||||
@@ -917,10 +917,10 @@ static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur)
|
||||
{
|
||||
UInt32 posPrev = posMem;
|
||||
UInt32 backCur = backMem;
|
||||
|
||||
|
||||
backMem = p->opt[posPrev].backPrev;
|
||||
posMem = p->opt[posPrev].posPrev;
|
||||
|
||||
|
||||
p->opt[posPrev].backPrev = backCur;
|
||||
p->opt[posPrev].posPrev = cur;
|
||||
cur = posPrev;
|
||||
@@ -951,7 +951,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
||||
return lenRes;
|
||||
}
|
||||
p->optimumCurrentIndex = p->optimumEndIndex = 0;
|
||||
|
||||
|
||||
if (p->additionalOffset == 0)
|
||||
mainLen = ReadMatchDistances(p, &numPairs);
|
||||
else
|
||||
@@ -1249,7 +1249,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
||||
|
||||
matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]);
|
||||
repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]);
|
||||
|
||||
|
||||
if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0))
|
||||
{
|
||||
UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState);
|
||||
@@ -1311,7 +1311,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
startLen = 2; /* speed optimization */
|
||||
{
|
||||
UInt32 repIndex;
|
||||
@@ -1342,10 +1342,10 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
||||
}
|
||||
while (--lenTest >= 2);
|
||||
lenTest = lenTestTemp;
|
||||
|
||||
|
||||
if (repIndex == 0)
|
||||
startLen = lenTest + 1;
|
||||
|
||||
|
||||
/* if (_maxMode) */
|
||||
{
|
||||
UInt32 lenTest2 = lenTest + 1;
|
||||
@@ -1369,7 +1369,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
||||
nextRepMatchPrice = curAndLenCharPrice +
|
||||
GET_PRICE_1(p->isMatch[state2][posStateNext]) +
|
||||
GET_PRICE_1(p->isRep[state2]);
|
||||
|
||||
|
||||
/* for (; lenTest2 >= 2; lenTest2--) */
|
||||
{
|
||||
UInt32 curAndLenPrice;
|
||||
@@ -1424,7 +1424,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
||||
curAndLenPrice += p->distancesPrices[lenToPosState][curBack];
|
||||
else
|
||||
curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask];
|
||||
|
||||
|
||||
opt = &p->opt[cur + lenTest];
|
||||
if (curAndLenPrice < opt->price)
|
||||
{
|
||||
@@ -1458,7 +1458,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
||||
nextRepMatchPrice = curAndLenCharPrice +
|
||||
GET_PRICE_1(p->isMatch[state2][posStateNext]) +
|
||||
GET_PRICE_1(p->isRep[state2]);
|
||||
|
||||
|
||||
/* for (; lenTest2 >= 2; lenTest2--) */
|
||||
{
|
||||
UInt32 offset = cur + lenTest + 1 + lenTest2;
|
||||
@@ -1570,7 +1570,7 @@ static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes)
|
||||
MovePos(p, repLen - 1);
|
||||
return repLen;
|
||||
}
|
||||
|
||||
|
||||
if (mainLen < 2 || numAvail <= 2)
|
||||
return 1;
|
||||
|
||||
@@ -1584,7 +1584,7 @@ static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes)
|
||||
(p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
|
||||
for (i = 0; i < LZMA_NUM_REPS; i++)
|
||||
{
|
||||
@@ -1845,7 +1845,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
|
||||
pos -= LZMA_NUM_REPS;
|
||||
GetPosSlot(pos, posSlot);
|
||||
RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot);
|
||||
|
||||
|
||||
if (posSlot >= kStartPosModelIndex)
|
||||
{
|
||||
UInt32 footerBits = ((posSlot >> 1) - 1);
|
||||
@@ -2150,7 +2150,7 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
|
||||
p->rc.outStream = &outStream.funcTable;
|
||||
|
||||
res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize);
|
||||
|
||||
|
||||
*unpackSize = (UInt32)(p->nowPos64 - nowPos64);
|
||||
*destLen -= outStream.rem;
|
||||
if (outStream.overflow)
|
||||
|
||||
Vendored
+2
-2
@@ -38,7 +38,7 @@ outPropsSize -
|
||||
LZMA Encoder will use defult values for any parameter, if it is
|
||||
-1 for any from: level, loc, lp, pb, fb, numThreads
|
||||
0 for dictSize
|
||||
|
||||
|
||||
level - compression level: 0 <= level <= 9;
|
||||
|
||||
level dictSize algo fb
|
||||
@@ -50,7 +50,7 @@ level - compression level: 0 <= level <= 9;
|
||||
5: 16 MB 1 32
|
||||
6: 32 MB 1 32
|
||||
7+: 64 MB 1 64
|
||||
|
||||
|
||||
The default value for "level" is 5.
|
||||
|
||||
algo = 0 means fast method
|
||||
|
||||
Vendored
+2
-2
@@ -190,9 +190,9 @@ static SRes MtThread_Process(CMtThread *p, Bool *stop)
|
||||
*stop = True;
|
||||
if (Event_Wait(&p->canRead) != 0)
|
||||
return SZ_ERROR_THREAD;
|
||||
|
||||
|
||||
next = GET_NEXT_THREAD(p);
|
||||
|
||||
|
||||
if (p->stopReading)
|
||||
{
|
||||
next->stopReading = True;
|
||||
|
||||
Vendored
+2
-2
@@ -14,7 +14,7 @@ typedef struct
|
||||
CAutoResetEvent startEvent;
|
||||
CAutoResetEvent finishedEvent;
|
||||
int stop;
|
||||
|
||||
|
||||
THREAD_FUNC_TYPE func;
|
||||
LPVOID param;
|
||||
THREAD_FUNC_RET_TYPE res;
|
||||
@@ -75,7 +75,7 @@ typedef struct _CMtCoder
|
||||
size_t blockSize;
|
||||
size_t destBlockSize;
|
||||
unsigned numThreads;
|
||||
|
||||
|
||||
ISeqInStream *inStream;
|
||||
ISeqOutStream *outStream;
|
||||
ICompressProgress *progress;
|
||||
|
||||
Vendored
+1
-1
@@ -82,5 +82,5 @@ typedef
|
||||
p[i+7] = p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = ~(size_t)0; }}
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
|
||||
#endif
|
||||
Vendored
+18
-18
@@ -148,7 +148,7 @@ static void GlueFreeBlocks(CPpmd7 *p)
|
||||
#else
|
||||
CPpmd7_Node_Ref head = p->AlignOffset + p->Size;
|
||||
#endif
|
||||
|
||||
|
||||
CPpmd7_Node_Ref n = head;
|
||||
unsigned i;
|
||||
|
||||
@@ -175,7 +175,7 @@ static void GlueFreeBlocks(CPpmd7 *p)
|
||||
NODE(n)->Prev = head;
|
||||
if (p->LoUnit != p->HiUnit)
|
||||
((CPpmd7_Node *)p->LoUnit)->Stamp = 1;
|
||||
|
||||
|
||||
/* Glue free blocks */
|
||||
while (n != head)
|
||||
{
|
||||
@@ -193,7 +193,7 @@ static void GlueFreeBlocks(CPpmd7 *p)
|
||||
}
|
||||
n = node->Next;
|
||||
}
|
||||
|
||||
|
||||
/* Fill lists of free blocks */
|
||||
for (n = NODE(head)->Next; n != head;)
|
||||
{
|
||||
@@ -319,7 +319,7 @@ static void RestartModel(CPpmd7 *p)
|
||||
for (m = 0; m < 64; m += 8)
|
||||
dest[m] = val;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 25; i++)
|
||||
for (k = 0; k < 16; k++)
|
||||
{
|
||||
@@ -345,10 +345,10 @@ static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip)
|
||||
CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
|
||||
CPpmd_State *ps[PPMD7_MAX_ORDER];
|
||||
unsigned numPs = 0;
|
||||
|
||||
|
||||
if (!skip)
|
||||
ps[numPs++] = p->FoundState;
|
||||
|
||||
|
||||
while (c->Suffix)
|
||||
{
|
||||
CPpmd_Void_Ref successor;
|
||||
@@ -370,10 +370,10 @@ static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip)
|
||||
}
|
||||
ps[numPs++] = s;
|
||||
}
|
||||
|
||||
|
||||
upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch);
|
||||
SetSuccessor(&upState, upBranch + 1);
|
||||
|
||||
|
||||
if (c->NumStats == 1)
|
||||
upState.Freq = ONE_STATE(c)->Freq;
|
||||
else
|
||||
@@ -407,7 +407,7 @@ static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip)
|
||||
c = c1;
|
||||
}
|
||||
while (numPs != 0);
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -423,11 +423,11 @@ static void UpdateModel(CPpmd7 *p)
|
||||
CPpmd_Void_Ref successor, fSuccessor = SUCCESSOR(p->FoundState);
|
||||
CTX_PTR c;
|
||||
unsigned s0, ns;
|
||||
|
||||
|
||||
if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0)
|
||||
{
|
||||
c = SUFFIX(p->MinContext);
|
||||
|
||||
|
||||
if (c->NumStats == 1)
|
||||
{
|
||||
CPpmd_State *s = ONE_STATE(c);
|
||||
@@ -465,7 +465,7 @@ static void UpdateModel(CPpmd7 *p)
|
||||
SetSuccessor(p->FoundState, REF(p->MinContext));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
*p->Text++ = p->FoundState->Symbol;
|
||||
successor = REF(p->Text);
|
||||
if (p->Text >= p->UnitsStart)
|
||||
@@ -473,7 +473,7 @@ static void UpdateModel(CPpmd7 *p)
|
||||
RestartModel(p);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (fSuccessor)
|
||||
{
|
||||
if (fSuccessor <= successor)
|
||||
@@ -497,9 +497,9 @@ static void UpdateModel(CPpmd7 *p)
|
||||
SetSuccessor(p->FoundState, successor);
|
||||
fSuccessor = REF(p->MinContext);
|
||||
}
|
||||
|
||||
|
||||
s0 = p->MinContext->SummFreq - (ns = p->MinContext->NumStats) - (p->FoundState->Freq - 1);
|
||||
|
||||
|
||||
for (c = p->MaxContext; c != p->MinContext; c = SUFFIX(c))
|
||||
{
|
||||
unsigned ns1;
|
||||
@@ -566,7 +566,7 @@ static void UpdateModel(CPpmd7 *p)
|
||||
}
|
||||
p->MaxContext = p->MinContext = CTX(fSuccessor);
|
||||
}
|
||||
|
||||
|
||||
static void Rescale(CPpmd7 *p)
|
||||
{
|
||||
unsigned i, adder, sumFreq, escFreq;
|
||||
@@ -583,7 +583,7 @@ static void Rescale(CPpmd7 *p)
|
||||
adder = (p->OrderFall != 0);
|
||||
s->Freq = (Byte)((s->Freq + adder) >> 1);
|
||||
sumFreq = s->Freq;
|
||||
|
||||
|
||||
i = p->MinContext->NumStats - 1;
|
||||
do
|
||||
{
|
||||
@@ -601,7 +601,7 @@ static void Rescale(CPpmd7 *p)
|
||||
}
|
||||
}
|
||||
while (--i);
|
||||
|
||||
|
||||
if (s->Freq == 0)
|
||||
{
|
||||
unsigned numStats = p->MinContext->NumStats;
|
||||
|
||||
Vendored
+1
-1
@@ -136,5 +136,5 @@ void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p);
|
||||
void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
|
||||
#endif
|
||||
Vendored
+2
-2
@@ -160,11 +160,11 @@ int Ppmd7_DecodeSymbol(CPpmd7 *p, IPpmd7_RangeDec *rc)
|
||||
i -= k;
|
||||
}
|
||||
while (i != num);
|
||||
|
||||
|
||||
see = Ppmd7_MakeEscFreq(p, numMasked, &freqSum);
|
||||
freqSum += hiCnt;
|
||||
count = rc->GetThreshold(rc, freqSum);
|
||||
|
||||
|
||||
if (count < hiCnt)
|
||||
{
|
||||
Byte symbol;
|
||||
|
||||
Vendored
+3
-3
@@ -104,7 +104,7 @@ void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol)
|
||||
sum += s->Freq;
|
||||
}
|
||||
while (--i);
|
||||
|
||||
|
||||
p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol];
|
||||
PPMD_SetAllBitsIn256Bytes(charMask);
|
||||
MASK(s->Symbol) = 0;
|
||||
@@ -149,7 +149,7 @@ void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol)
|
||||
p->MinContext = Ppmd7_GetContext(p, p->MinContext->Suffix);
|
||||
}
|
||||
while (p->MinContext->NumStats == numMasked);
|
||||
|
||||
|
||||
see = Ppmd7_MakeEscFreq(p, numMasked, &escFreq);
|
||||
s = Ppmd7_GetStats(p, p->MinContext);
|
||||
sum = 0;
|
||||
@@ -178,7 +178,7 @@ void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol)
|
||||
s++;
|
||||
}
|
||||
while (--i);
|
||||
|
||||
|
||||
RangeEnc_Encode(rc, sum, escFreq, sum + escFreq);
|
||||
see->Summ = (UInt16)(see->Summ + sum + escFreq);
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -133,7 +133,7 @@ static void Sha256_Transform(UInt32 *state, const UInt32 *data)
|
||||
for (j = 0; j < 8; j++)
|
||||
state[j] += T[j];
|
||||
#endif
|
||||
|
||||
|
||||
/* Wipe variables */
|
||||
/* memset(W, 0, sizeof(W)); */
|
||||
/* memset(T, 0, sizeof(T)); */
|
||||
|
||||
Vendored
+1
-1
@@ -199,7 +199,7 @@ typedef struct
|
||||
unsigned indexPreSize;
|
||||
|
||||
CXzStreamFlags streamFlags;
|
||||
|
||||
|
||||
UInt32 blockHeaderSize;
|
||||
UInt64 packSize;
|
||||
UInt64 unpackSize;
|
||||
|
||||
Vendored
+12
-12
@@ -421,7 +421,7 @@ SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen,
|
||||
const Byte *srcCur;
|
||||
int srcFinishedCur;
|
||||
int encodingWasFinished;
|
||||
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
srcCur = src;
|
||||
@@ -434,7 +434,7 @@ SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen,
|
||||
srcLenCur = p->size[i - 1] - p->pos[i - 1];
|
||||
srcFinishedCur = p->finished[i - 1];
|
||||
}
|
||||
|
||||
|
||||
if (i == p->numCoders - 1)
|
||||
{
|
||||
destCur = dest;
|
||||
@@ -447,7 +447,7 @@ SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen,
|
||||
destCur = p->buf + (CODER_BUF_SIZE * i);
|
||||
destLenCur = CODER_BUF_SIZE;
|
||||
}
|
||||
|
||||
|
||||
res = coder->Code(coder->p, destCur, &destLenCur, srcCur, &srcLenCur, srcFinishedCur, finishMode, &encodingWasFinished);
|
||||
|
||||
if (!encodingWasFinished)
|
||||
@@ -474,7 +474,7 @@ SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen,
|
||||
p->pos[i] = 0;
|
||||
p->finished[i] = encodingWasFinished;
|
||||
}
|
||||
|
||||
|
||||
if (res != SZ_OK)
|
||||
return res;
|
||||
|
||||
@@ -637,20 +637,20 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
|
||||
*status = CODER_STATUS_NOT_FINISHED;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
|
||||
res = MixCoder_Code(&p->decoder, dest, &destLen2, src, &srcLen2, False, finishMode, status);
|
||||
XzCheck_Update(&p->check, dest, destLen2);
|
||||
|
||||
|
||||
(*srcLen) += srcLen2;
|
||||
src += srcLen2;
|
||||
p->packSize += srcLen2;
|
||||
|
||||
|
||||
(*destLen) += destLen2;
|
||||
dest += destLen2;
|
||||
p->unpackSize += destLen2;
|
||||
|
||||
|
||||
RINOK(res);
|
||||
|
||||
|
||||
if (*status == CODER_STATUS_FINISHED_WITH_MARK)
|
||||
{
|
||||
Byte temp[32];
|
||||
@@ -659,14 +659,14 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
|
||||
Sha256_Update(&p->sha, temp, num);
|
||||
p->indexSize += num;
|
||||
p->numBlocks++;
|
||||
|
||||
|
||||
p->state = XZ_STATE_BLOCK_FOOTER;
|
||||
p->pos = 0;
|
||||
p->alignPos = 0;
|
||||
}
|
||||
else if (srcLen2 == 0 && destLen2 == 0)
|
||||
return SZ_OK;
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -872,7 +872,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case XZ_STATE_BLOCK: break; /* to disable GCC warning */
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
-5
@@ -409,10 +409,10 @@ static SRes Xz_Compress(CXzStream *xz, CLzma2WithFilters *lzmaf,
|
||||
int filterIndex = 0;
|
||||
CXzFilter *filter = NULL;
|
||||
const CXzFilterProps *fp = props->filterProps;
|
||||
|
||||
|
||||
XzBlock_ClearFlags(&block);
|
||||
XzBlock_SetNumFilters(&block, 1 + (fp ? 1 : 0));
|
||||
|
||||
|
||||
if (fp)
|
||||
{
|
||||
filter = &block.filters[filterIndex++];
|
||||
@@ -440,13 +440,13 @@ static SRes Xz_Compress(CXzStream *xz, CLzma2WithFilters *lzmaf,
|
||||
seqSizeOutStream.p.Write = MyWrite;
|
||||
seqSizeOutStream.realStream = outStream;
|
||||
seqSizeOutStream.processed = 0;
|
||||
|
||||
|
||||
RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.p));
|
||||
|
||||
|
||||
checkInStream.p.Read = SeqCheckInStream_Read;
|
||||
checkInStream.realStream = inStream;
|
||||
SeqCheckInStream_Init(&checkInStream, XzFlags_GetCheckType(xz->flags));
|
||||
|
||||
|
||||
if (fp)
|
||||
{
|
||||
#ifdef USE_SUBBLOCK
|
||||
|
||||
Vendored
+3
-3
@@ -88,7 +88,7 @@ static SRes Xz_ReadIndex2(CXzStream *p, const Byte *buf, size_t size, ISzAlloc *
|
||||
if (numBlocks != numBlocks64 || numBlocks * 2 > size)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
}
|
||||
|
||||
|
||||
crcStartPos = pos;
|
||||
Xz_Free(p, alloc);
|
||||
if (numBlocks != 0)
|
||||
@@ -149,7 +149,7 @@ static SRes Xz_ReadBackward(CXzStream *p, ILookInStream *stream, Int64 *startOff
|
||||
RINOK(SeekFromCur(stream, startOffset));
|
||||
|
||||
RINOK(LookInStream_Read2(stream, buf, XZ_STREAM_FOOTER_SIZE, SZ_ERROR_NO_ARCHIVE));
|
||||
|
||||
|
||||
if (memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) != 0)
|
||||
{
|
||||
UInt32 total = 0;
|
||||
@@ -185,7 +185,7 @@ static SRes Xz_ReadBackward(CXzStream *p, ILookInStream *stream, Int64 *startOff
|
||||
if (memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) != 0)
|
||||
return SZ_ERROR_NO_ARCHIVE;
|
||||
}
|
||||
|
||||
|
||||
p->flags = (CXzStreamFlags)GetBe16(buf + 8);
|
||||
|
||||
if (!XzFlags_IsSupported(p->flags))
|
||||
|
||||
Reference in new issue
Block a user