Update to 7-Zip 17.00 Beta

This commit is contained in:
Tino Reichardt
2017-04-30 14:14:14 +02:00
parent 54389d6e2f
commit aa5ba75da0
451 changed files with 15746 additions and 8574 deletions

View File

@@ -1,5 +1,5 @@
/* Ppmd8.c -- PPMdI codec
2016-05-21 : Igor Pavlov : Public domain
2017-04-03 : Igor Pavlov : Public domain
This code is based on PPMd var.I (2002): Dmitry Shkarin : Public domain */
#include "Precomp.h"
@@ -15,7 +15,7 @@ static const UInt16 kInitBinEsc[] = { 0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x64A1, 0x
#define UNIT_SIZE 12
#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE)
#define U2I(nu) (p->Units2Indx[(nu) - 1])
#define U2I(nu) (p->Units2Indx[(size_t)(nu) - 1])
#define I2U(indx) (p->Indx2Units[indx])
#ifdef PPMD_32BIT
@@ -86,16 +86,16 @@ void Ppmd8_Construct(CPpmd8 *p)
}
}
void Ppmd8_Free(CPpmd8 *p, ISzAlloc *alloc)
void Ppmd8_Free(CPpmd8 *p, ISzAllocPtr alloc)
{
alloc->Free(alloc, p->Base);
ISzAlloc_Free(alloc, p->Base);
p->Size = 0;
p->Base = 0;
}
Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size, ISzAlloc *alloc)
Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size, ISzAllocPtr alloc)
{
if (p->Base == 0 || p->Size != size)
if (!p->Base || p->Size != size)
{
Ppmd8_Free(p, alloc);
p->AlignOffset =
@@ -104,7 +104,7 @@ Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size, ISzAlloc *alloc)
#else
4 - (size & 3);
#endif
if ((p->Base = (Byte *)alloc->Alloc(alloc, p->AlignOffset + size)) == 0)
if ((p->Base = (Byte *)ISzAlloc_Alloc(alloc, p->AlignOffset + size)) == 0)
return False;
p->Size = size;
}
@@ -386,7 +386,7 @@ static void RestartModel(CPpmd8 *p)
for (i = m = 0; m < 24; m++)
{
while (p->NS2Indx[i + 3] == m + 3)
while (p->NS2Indx[(size_t)i + 3] == m + 3)
i++;
for (k = 0; k < 32; k++)
{
@@ -905,7 +905,7 @@ static void UpdateModel(CPpmd8 *p)
/* Expand for one UNIT */
unsigned oldNU = (ns1 + 1) >> 1;
unsigned i = U2I(oldNU);
if (i != U2I(oldNU + 1))
if (i != U2I((size_t)oldNU + 1))
{
void *ptr = AllocUnits(p, i + 1);
void *oldPtr;
@@ -1038,7 +1038,7 @@ CPpmd_See *Ppmd8_MakeEscFreq(CPpmd8 *p, unsigned numMasked1, UInt32 *escFreq)
CPpmd_See *see;
if (p->MinContext->NumStats != 0xFF)
{
see = p->See[(unsigned)p->NS2Indx[(unsigned)p->MinContext->NumStats + 2] - 3] +
see = p->See[(size_t)(unsigned)p->NS2Indx[(size_t)(unsigned)p->MinContext->NumStats + 2] - 3] +
(p->MinContext->SummFreq > 11 * ((unsigned)p->MinContext->NumStats + 1)) +
2 * (unsigned)(2 * (unsigned)p->MinContext->NumStats <
((unsigned)SUFFIX(p->MinContext)->NumStats + numMasked1)) +