From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.4706.1607998138479814724 for ; Mon, 14 Dec 2020 18:08:58 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: weix.c.liu@intel.com) IronPort-SDR: 5LNgxx7ZX2C8LZhuBRjXqmeyhcXHyrPbLVPbJAANQlyV1giOptTGpJFal0lwOfFuka35ubNZCt 3TsW45N/Bq6A== X-IronPort-AV: E=McAfee;i="6000,8403,9835"; a="162560658" X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="162560658" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2020 18:07:25 -0800 IronPort-SDR: X7SbTrlurL6mmVYwj+FvZK5+kea05/yOqSv1rofmdg/hO3tZ1VYTBj4jGp6bDPwkSCyDChrtv6 Til+ZUTk2Vpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="335761572" Received: from shwdeopenpsi138.ccr.corp.intel.com ([10.239.49.183]) by fmsmga008.fm.intel.com with ESMTP; 14 Dec 2020 18:07:23 -0800 From: Wei Liu To: devel@edk2.groups.io Cc: Wei Liu , Liming Gao , Dandan Bi , Laszlo Ersek Subject: [PATCH 2/2] MdeModulePkg Lzma: Update LZMA SDK version to 19.00 Date: Tue, 15 Dec 2020 10:06:51 +0800 Message-Id: <20201215020651.1912-2-weix.c.liu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: <20201215020651.1912-1-weix.c.liu@intel.com> References: <20201215020651.1912-1-weix.c.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3101 New formal release in https://www.7-zip.org/sdk.html is 19.00. Cc: Liming Gao Cc: Dandan Bi Cc: Laszlo Ersek Signed-off-by: Wei Liu --- MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt = | 6 +++--- MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.i= nf | 6 +++--- MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf = | 6 +++--- MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h = | 5 +++-- MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zVersion.h = | 8 ++++---- MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/CpuArch.h = | 9 +++++---- MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c = | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++---------------------------------------- MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c = | 34 +++++++++++++++++----------------- MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-history.txt = | 22 ++++++++++++++++++++++ MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt = | 2 +- 10 files changed, 160 insertions(+), 77 deletions(-) diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.t= xt b/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt index 3f3895b4cf..8095b6edd2 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt @@ -1,4 +1,4 @@ -LzmaCustomDecompressLib is based on the LZMA SDK 18.05.=0D -LZMA SDK 18.05 was placed in the public domain on=0D -2018-04-30. It was released on the=0D +LzmaCustomDecompressLib is based on the LZMA SDK 19.00.=0D +LZMA SDK 19.00 was placed in the public domain on=0D +2019-02-21. It was released on the=0D http://www.7-zip.org/sdk.html website.=0D diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDec= ompressLib.inf b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCusto= mDecompressLib.inf index d789e7dc42..3a0647e7f8 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompress= Lib.inf +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompress= Lib.inf @@ -1,11 +1,11 @@ ## @file=0D # LzmaArchCustomDecompressLib produces LZMA custom decompression algorith= m with the converter for the different arch code.=0D #=0D -# It is based on the LZMA SDK 18.05=0D -# LZMA SDK 18.05 was placed in the public domain on 2018-04-30.=0D +# It is based on the LZMA SDK 19.00=0D +# LZMA SDK 19.00 was placed in the public domain on 2019-02-21.=0D # It was released on the http://www.7-zip.org/sdk.html website.=0D #=0D -# Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
= =0D +# Copyright (c) 2012 - 2020, Intel Corporation. All rights reserved.
= =0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompr= essLib.inf b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompr= essLib.inf index 4ed1d83a40..39e66136c4 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.= inf +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.= inf @@ -1,11 +1,11 @@ ## @file=0D # LzmaCustomDecompressLib produces LZMA custom decompression algorithm.=0D #=0D -# It is based on the LZMA SDK 18.05.=0D -# LZMA SDK 18.05 was placed in the public domain on 2018-04-30.=0D +# It is based on the LZMA SDK 19.00.=0D +# LZMA SDK 19.00 was placed in the public domain on 2019-02-21.=0D # It was released on the http://www.7-zip.org/sdk.html website.=0D #=0D -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
= =0D +# Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.
= =0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h b= /MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h index c89b5c2433..42b7040dd7 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h @@ -1,5 +1,5 @@ /* 7zTypes.h -- Basic types=0D -2017-07-17 : Igor Pavlov : Public domain */=0D +2018-08-04 : Igor Pavlov : Public domain */=0D =0D #ifndef __7Z_TYPES_H=0D #define __7Z_TYPES_H=0D @@ -107,7 +107,8 @@ typedef UInt32 SizeT; typedef size_t SizeT;=0D #endif=0D =0D -typedef int Bool;=0D +typedef int BoolInt;=0D +/* typedef BoolInt Bool; */=0D #define True 1=0D #define False 0=0D =0D diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zVersion.h= b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zVersion.h index ed3aa94270..0074c64be9 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zVersion.h +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zVersion.h @@ -1,7 +1,7 @@ -#define MY_VER_MAJOR 18=0D -#define MY_VER_MINOR 05=0D +#define MY_VER_MAJOR 19=0D +#define MY_VER_MINOR 00=0D #define MY_VER_BUILD 0=0D -#define MY_VERSION_NUMBERS "18.05"=0D +#define MY_VERSION_NUMBERS "19.00"=0D #define MY_VERSION MY_VERSION_NUMBERS=0D =0D #ifdef MY_CPU_NAME=0D @@ -10,7 +10,7 @@ #define MY_VERSION_CPU MY_VERSION=0D #endif=0D =0D -#define MY_DATE "2018-04-30"=0D +#define MY_DATE "2019-02-21"=0D #undef MY_COPYRIGHT=0D #undef MY_VERSION_COPYRIGHT_DATE=0D #define MY_AUTHOR_NAME "Igor Pavlov"=0D diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/CpuArch.h b= /MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/CpuArch.h index 7fb27282c7..5f74c1c0cb 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/CpuArch.h +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/CpuArch.h @@ -1,5 +1,5 @@ /* CpuArch.h -- CPU specific code=0D -2017-09-04 : Igor Pavlov : Public domain */=0D +2018-02-18 : Igor Pavlov : Public domain */=0D =0D #ifndef __CPU_ARCH_H=0D #define __CPU_ARCH_H=0D @@ -318,15 +318,16 @@ enum =0D void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d);= =0D =0D -Bool x86cpuid_CheckAndRead(Cx86cpuid *p);=0D +BoolInt x86cpuid_CheckAndRead(Cx86cpuid *p);=0D int x86cpuid_GetFirm(const Cx86cpuid *p);=0D =0D #define x86cpuid_GetFamily(ver) (((ver >> 16) & 0xFF0) | ((ver >> 8) & 0xF= ))=0D #define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) & 0xF= ))=0D #define x86cpuid_GetStepping(ver) (ver & 0xF)=0D =0D -Bool CPU_Is_InOrder();=0D -Bool CPU_Is_Aes_Supported();=0D +BoolInt CPU_Is_InOrder();=0D +BoolInt CPU_Is_Aes_Supported();=0D +BoolInt CPU_IsSupported_PageGB();=0D =0D #endif=0D =0D diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c b/= MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c index 8765cbebfc..904ae0f6cf 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c @@ -1,5 +1,5 @@ /* LzFind.c -- Match finder for LZ algorithms=0D -2017-06-10 : Igor Pavlov : Public domain */=0D +2018-07-08 : Igor Pavlov : Public domain */=0D =0D #include "Precomp.h"=0D =0D @@ -140,7 +140,7 @@ static void MatchFinder_SetDefaultSettings(CMatchFinder= *p) =0D void MatchFinder_Construct(CMatchFinder *p)=0D {=0D - UInt32 i;=0D + unsigned i;=0D p->bufferBase =3D NULL;=0D p->directInput =3D 0;=0D p->hash =3D NULL;=0D @@ -149,7 +149,7 @@ void MatchFinder_Construct(CMatchFinder *p) =0D for (i =3D 0; i < 256; i++)=0D {=0D - UInt32 r =3D i;=0D + UInt32 r =3D (UInt32)i;=0D unsigned j;=0D for (j =3D 0; j < 8; j++)=0D r =3D (r >> 1) ^ (kCrcPoly & ((UInt32)0 - (r & 1)));=0D @@ -370,6 +370,8 @@ static void MatchFinder_Normalize(CMatchFinder *p) MatchFinder_ReduceOffsets(p, subValue);=0D }=0D =0D +=0D +MY_NO_INLINE=0D static void MatchFinder_CheckLimits(CMatchFinder *p)=0D {=0D if (p->pos =3D=3D kMaxValForNormalize)=0D @@ -381,10 +383,16 @@ static void MatchFinder_CheckLimits(CMatchFinder *p) MatchFinder_SetLimits(p);=0D }=0D =0D -static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32= pos, const Byte *cur, CLzRef *son,=0D +=0D +/*=0D + (lenLimit > maxLen)=0D +*/=0D +MY_FORCE_INLINE=0D +static UInt32 * Hc_GetMatchesSpec(unsigned lenLimit, UInt32 curMatch, UInt= 32 pos, const Byte *cur, CLzRef *son,=0D UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,=0D - UInt32 *distances, UInt32 maxLen)=0D + UInt32 *distances, unsigned maxLen)=0D {=0D + /*=0D son[_cyclicBufferPos] =3D curMatch;=0D for (;;)=0D {=0D @@ -402,7 +410,8 @@ static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt= 32 curMatch, UInt32 pos, break;=0D if (maxLen < len)=0D {=0D - *distances++ =3D maxLen =3D len;=0D + maxLen =3D len;=0D + *distances++ =3D len;=0D *distances++ =3D delta - 1;=0D if (len =3D=3D lenLimit)=0D return distances;=0D @@ -410,15 +419,58 @@ static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UI= nt32 curMatch, UInt32 pos, }=0D }=0D }=0D + */=0D +=0D + const Byte *lim =3D cur + lenLimit;=0D + son[_cyclicBufferPos] =3D curMatch;=0D + do=0D + {=0D + UInt32 delta =3D pos - curMatch;=0D + if (delta >=3D _cyclicBufferSize)=0D + break;=0D + {=0D + ptrdiff_t diff;=0D + curMatch =3D son[_cyclicBufferPos - delta + ((delta > _cyclicBufferP= os) ? _cyclicBufferSize : 0)];=0D + diff =3D (ptrdiff_t)0 - delta;=0D + if (cur[maxLen] =3D=3D cur[maxLen + diff])=0D + {=0D + const Byte *c =3D cur;=0D + while (*c =3D=3D c[diff])=0D + {=0D + if (++c =3D=3D lim)=0D + {=0D + distances[0] =3D (UInt32)(lim - cur);=0D + distances[1] =3D delta - 1;=0D + return distances + 2;=0D + }=0D + }=0D + {=0D + unsigned len =3D (unsigned)(c - cur);=0D + if (maxLen < len)=0D + {=0D + maxLen =3D len;=0D + distances[0] =3D (UInt32)len;=0D + distances[1] =3D delta - 1;=0D + distances +=3D 2;=0D + }=0D + }=0D + }=0D + }=0D + }=0D + while (--cutValue);=0D + =0D + return distances;=0D }=0D =0D +=0D +MY_FORCE_INLINE=0D UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, con= st Byte *cur, CLzRef *son,=0D UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,=0D UInt32 *distances, UInt32 maxLen)=0D {=0D - CLzRef *ptr0 =3D son + (_cyclicBufferPos << 1) + 1;=0D - CLzRef *ptr1 =3D son + (_cyclicBufferPos << 1);=0D - UInt32 len0 =3D 0, len1 =3D 0;=0D + CLzRef *ptr0 =3D son + ((size_t)_cyclicBufferPos << 1) + 1;=0D + CLzRef *ptr1 =3D son + ((size_t)_cyclicBufferPos << 1);=0D + unsigned len0 =3D 0, len1 =3D 0;=0D for (;;)=0D {=0D UInt32 delta =3D pos - curMatch;=0D @@ -428,9 +480,10 @@ UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMa= tch, UInt32 pos, const Byt return distances;=0D }=0D {=0D - CLzRef *pair =3D son + ((_cyclicBufferPos - delta + ((delta > _cycli= cBufferPos) ? _cyclicBufferSize : 0)) << 1);=0D + CLzRef *pair =3D son + ((size_t)(_cyclicBufferPos - delta + ((delta = > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);=0D const Byte *pb =3D cur - delta;=0D - UInt32 len =3D (len0 < len1 ? len0 : len1);=0D + unsigned len =3D (len0 < len1 ? len0 : len1);=0D + UInt32 pair0 =3D pair[0];=0D if (pb[len] =3D=3D cur[len])=0D {=0D if (++len !=3D lenLimit && pb[len] =3D=3D cur[len])=0D @@ -439,11 +492,12 @@ UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curM= atch, UInt32 pos, const Byt break;=0D if (maxLen < len)=0D {=0D - *distances++ =3D maxLen =3D len;=0D + maxLen =3D (UInt32)len;=0D + *distances++ =3D (UInt32)len;=0D *distances++ =3D delta - 1;=0D if (len =3D=3D lenLimit)=0D {=0D - *ptr1 =3D pair[0];=0D + *ptr1 =3D pair0;=0D *ptr0 =3D pair[1];=0D return distances;=0D }=0D @@ -470,9 +524,9 @@ UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMat= ch, UInt32 pos, const Byt static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, = const Byte *cur, CLzRef *son,=0D UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)=0D {=0D - CLzRef *ptr0 =3D son + (_cyclicBufferPos << 1) + 1;=0D - CLzRef *ptr1 =3D son + (_cyclicBufferPos << 1);=0D - UInt32 len0 =3D 0, len1 =3D 0;=0D + CLzRef *ptr0 =3D son + ((size_t)_cyclicBufferPos << 1) + 1;=0D + CLzRef *ptr1 =3D son + ((size_t)_cyclicBufferPos << 1);=0D + unsigned len0 =3D 0, len1 =3D 0;=0D for (;;)=0D {=0D UInt32 delta =3D pos - curMatch;=0D @@ -482,9 +536,9 @@ static void SkipMatchesSpec(UInt32 lenLimit, UInt32 cur= Match, UInt32 pos, const return;=0D }=0D {=0D - CLzRef *pair =3D son + ((_cyclicBufferPos - delta + ((delta > _cycli= cBufferPos) ? _cyclicBufferSize : 0)) << 1);=0D + CLzRef *pair =3D son + ((size_t)(_cyclicBufferPos - delta + ((delta = > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);=0D const Byte *pb =3D cur - delta;=0D - UInt32 len =3D (len0 < len1 ? len0 : len1);=0D + unsigned len =3D (len0 < len1 ? len0 : len1);=0D if (pb[len] =3D=3D cur[len])=0D {=0D while (++len !=3D lenLimit)=0D @@ -522,13 +576,13 @@ static void SkipMatchesSpec(UInt32 lenLimit, UInt32 c= urMatch, UInt32 pos, const p->buffer++; \=0D if (++p->pos =3D=3D p->posLimit) MatchFinder_CheckLimits(p);=0D =0D -#define MOVE_POS_RET MOVE_POS return offset;=0D +#define MOVE_POS_RET MOVE_POS return (UInt32)offset;=0D =0D static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }=0D =0D #define GET_MATCHES_HEADER2(minLen, ret_op) \=0D - UInt32 lenLimit; UInt32 hv; const Byte *cur; UInt32 curMatch; \=0D - lenLimit =3D p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos= (p); ret_op; }} \=0D + unsigned lenLimit; UInt32 hv; const Byte *cur; UInt32 curMatch; \=0D + lenLimit =3D (unsigned)p->lenLimit; { if (lenLimit < minLen) { MatchFind= er_MovePos(p); ret_op; }} \=0D cur =3D p->buffer;=0D =0D #define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)=0D @@ -537,22 +591,22 @@ static void MatchFinder_MovePos(CMatchFinder *p) { MO= VE_POS; } #define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyc= licBufferSize, p->cutValue=0D =0D #define GET_MATCHES_FOOTER(offset, maxLen) \=0D - offset =3D (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \= =0D - distances + offset, maxLen) - distances); MOVE_POS_RET;=0D + offset =3D (unsigned)(GetMatchesSpec1((UInt32)lenLimit, curMatch, MF_PAR= AMS(p), \=0D + distances + offset, (UInt32)maxLen) - distances); MOVE_POS_RET;=0D =0D #define SKIP_FOOTER \=0D - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;=0D + SkipMatchesSpec((UInt32)lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;=0D =0D #define UPDATE_maxLen { \=0D ptrdiff_t diff =3D (ptrdiff_t)0 - d2; \=0D const Byte *c =3D cur + maxLen; \=0D const Byte *lim =3D cur + lenLimit; \=0D for (; c !=3D lim; c++) if (*(c + diff) !=3D *c) break; \=0D - maxLen =3D (UInt32)(c - cur); }=0D + maxLen =3D (unsigned)(c - cur); }=0D =0D static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distance= s)=0D {=0D - UInt32 offset;=0D + unsigned offset;=0D GET_MATCHES_HEADER(2)=0D HASH2_CALC;=0D curMatch =3D p->hash[hv];=0D @@ -563,7 +617,7 @@ static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *= p, UInt32 *distances) =0D UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)=0D {=0D - UInt32 offset;=0D + unsigned offset;=0D GET_MATCHES_HEADER(3)=0D HASH_ZIP_CALC;=0D curMatch =3D p->hash[hv];=0D @@ -574,7 +628,8 @@ UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, U= Int32 *distances) =0D static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distance= s)=0D {=0D - UInt32 h2, d2, maxLen, offset, pos;=0D + UInt32 h2, d2, pos;=0D + unsigned maxLen, offset;=0D UInt32 *hash;=0D GET_MATCHES_HEADER(3)=0D =0D @@ -596,12 +651,12 @@ static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder= *p, UInt32 *distances) if (d2 < p->cyclicBufferSize && *(cur - d2) =3D=3D *cur)=0D {=0D UPDATE_maxLen=0D - distances[0] =3D maxLen;=0D + distances[0] =3D (UInt32)maxLen;=0D distances[1] =3D d2 - 1;=0D offset =3D 2;=0D if (maxLen =3D=3D lenLimit)=0D {=0D - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));=0D + SkipMatchesSpec((UInt32)lenLimit, curMatch, MF_PARAMS(p));=0D MOVE_POS_RET;=0D }=0D }=0D @@ -611,7 +666,8 @@ static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *= p, UInt32 *distances) =0D static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distance= s)=0D {=0D - UInt32 h2, h3, d2, d3, maxLen, offset, pos;=0D + UInt32 h2, h3, d2, d3, pos;=0D + unsigned maxLen, offset;=0D UInt32 *hash;=0D GET_MATCHES_HEADER(4)=0D =0D @@ -634,7 +690,8 @@ static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *= p, UInt32 *distances) =0D if (d2 < p->cyclicBufferSize && *(cur - d2) =3D=3D *cur)=0D {=0D - distances[0] =3D maxLen =3D 2;=0D + maxLen =3D 2;=0D + distances[0] =3D 2;=0D distances[1] =3D d2 - 1;=0D offset =3D 2;=0D }=0D @@ -650,10 +707,10 @@ static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder= *p, UInt32 *distances) if (offset !=3D 0)=0D {=0D UPDATE_maxLen=0D - distances[(size_t)offset - 2] =3D maxLen;=0D + distances[(size_t)offset - 2] =3D (UInt32)maxLen;=0D if (maxLen =3D=3D lenLimit)=0D {=0D - SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));=0D + SkipMatchesSpec((UInt32)lenLimit, curMatch, MF_PARAMS(p));=0D MOVE_POS_RET;=0D }=0D }=0D @@ -743,7 +800,8 @@ static UInt32 Bt5_MatchFinder_GetMatches(CMatchFinder *= p, UInt32 *distances) =0D static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distance= s)=0D {=0D - UInt32 h2, h3, d2, d3, maxLen, offset, pos;=0D + UInt32 h2, h3, d2, d3, pos;=0D + unsigned maxLen, offset;=0D UInt32 *hash;=0D GET_MATCHES_HEADER(4)=0D =0D @@ -766,7 +824,8 @@ static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *= p, UInt32 *distances) =0D if (d2 < p->cyclicBufferSize && *(cur - d2) =3D=3D *cur)=0D {=0D - distances[0] =3D maxLen =3D 2;=0D + maxLen =3D 2;=0D + distances[0] =3D 2;=0D distances[1] =3D d2 - 1;=0D offset =3D 2;=0D }=0D @@ -782,7 +841,7 @@ static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *= p, UInt32 *distances) if (offset !=3D 0)=0D {=0D UPDATE_maxLen=0D - distances[(size_t)offset - 2] =3D maxLen;=0D + distances[(size_t)offset - 2] =3D (UInt32)maxLen;=0D if (maxLen =3D=3D lenLimit)=0D {=0D p->son[p->cyclicBufferPos] =3D curMatch;=0D @@ -793,7 +852,7 @@ static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *= p, UInt32 *distances) if (maxLen < 3)=0D maxLen =3D 3;=0D =0D - offset =3D (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),= =0D + offset =3D (unsigned)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)= ,=0D distances + offset, maxLen) - (distances));=0D MOVE_POS_RET=0D }=0D @@ -879,12 +938,12 @@ static UInt32 Hc5_MatchFinder_GetMatches(CMatchFinder= *p, UInt32 *distances) =0D UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)=0D {=0D - UInt32 offset;=0D + unsigned offset;=0D GET_MATCHES_HEADER(3)=0D HASH_ZIP_CALC;=0D curMatch =3D p->hash[hv];=0D p->hash[hv] =3D p->pos;=0D - offset =3D (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),= =0D + offset =3D (unsigned)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)= ,=0D distances, 2) - (distances));=0D MOVE_POS_RET=0D }=0D diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c b= /MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c index a262319928..80fb74525a 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzmaDec.c @@ -1,15 +1,15 @@ /* LzmaDec.c -- LZMA Decoder=0D -2018-02-28 : Igor Pavlov : Public domain */=0D +2018-07-04 : Igor Pavlov : Public domain */=0D =0D #include "Precomp.h"=0D =0D -/* #include "CpuArch.h" */=0D -#include "LzmaDec.h"=0D -=0D #ifndef EFIAPI=0D #include =0D #endif=0D =0D +/* #include "CpuArch.h" */=0D +#include "LzmaDec.h"=0D +=0D #define kNumTopBits 24=0D #define kTopValue ((UInt32)1 << kNumTopBits)=0D =0D @@ -21,7 +21,7 @@ =0D #define NORMALIZE if (range < kTopValue) { range <<=3D 8; code =3D (code <= < 8) | (*buf++); }=0D =0D -#define IF_BIT_0(p) ttt =3D *(p); NORMALIZE; bound =3D (range >> kNumBitMo= delTotalBits) * ttt; if (code < bound)=0D +#define IF_BIT_0(p) ttt =3D *(p); NORMALIZE; bound =3D (range >> kNumBitMo= delTotalBits) * (UInt32)ttt; if (code < bound)=0D #define UPDATE_0(p) range =3D bound; *(p) =3D (CLzmaProb)(ttt + ((kBitMode= lTotal - ttt) >> kNumMoveBits));=0D #define UPDATE_1(p) range -=3D bound; code -=3D bound; *(p) =3D (CLzmaProb= )(ttt - (ttt >> kNumMoveBits));=0D #define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \=0D @@ -68,7 +68,7 @@ =0D #define NORMALIZE_CHECK if (range < kTopValue) { if (buf >=3D bufLimit) re= turn DUMMY_ERROR; range <<=3D 8; code =3D (code << 8) | (*buf++); }=0D =0D -#define IF_BIT_0_CHECK(p) ttt =3D *(p); NORMALIZE_CHECK; bound =3D (range = >> kNumBitModelTotalBits) * ttt; if (code < bound)=0D +#define IF_BIT_0_CHECK(p) ttt =3D *(p); NORMALIZE_CHECK; bound =3D (range = >> kNumBitModelTotalBits) * (UInt32)ttt; if (code < bound)=0D #define UPDATE_0_CHECK range =3D bound;=0D #define UPDATE_1_CHECK range -=3D bound; code -=3D bound;=0D #define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \=0D @@ -541,7 +541,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT li= mit, const Byte *bufLimit curLen =3D ((rem < len) ? (unsigned)rem : len);=0D pos =3D dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0);=0D =0D - processedPos +=3D curLen;=0D + processedPos +=3D (UInt32)curLen;=0D =0D len -=3D curLen;=0D if (curLen <=3D dicBufSize - pos)=0D @@ -549,7 +549,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT li= mit, const Byte *bufLimit Byte *dest =3D dic + dicPos;=0D ptrdiff_t src =3D (ptrdiff_t)pos - (ptrdiff_t)dicPos;=0D const Byte *lim =3D dest + curLen;=0D - dicPos +=3D curLen;=0D + dicPos +=3D (SizeT)curLen;=0D do=0D *(dest) =3D (Byte)*(dest + src);=0D while (++dest !=3D lim);=0D @@ -574,14 +574,14 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT = limit, const Byte *bufLimit p->buf =3D buf;=0D p->range =3D range;=0D p->code =3D code;=0D - p->remainLen =3D len;=0D + p->remainLen =3D (UInt32)len;=0D p->dicPos =3D dicPos;=0D p->processedPos =3D processedPos;=0D p->reps[0] =3D rep0;=0D p->reps[1] =3D rep1;=0D p->reps[2] =3D rep2;=0D p->reps[3] =3D rep3;=0D - p->state =3D state;=0D + p->state =3D (UInt32)state;=0D =0D return SZ_OK;=0D }=0D @@ -603,8 +603,8 @@ static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, = SizeT limit) if (p->checkDicSize =3D=3D 0 && p->prop.dicSize - p->processedPos <=3D= len)=0D p->checkDicSize =3D p->prop.dicSize;=0D =0D - p->processedPos +=3D len;=0D - p->remainLen -=3D len;=0D + p->processedPos +=3D (UInt32)len;=0D + p->remainLen -=3D (UInt32)len;=0D while (len !=3D 0)=0D {=0D len--;=0D @@ -852,7 +852,7 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, c= onst Byte *buf, SizeT inS }=0D =0D =0D -void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)=0D +void LzmaDec_InitDicAndState(CLzmaDec *p, BoolInt initDic, BoolInt initSta= te)=0D {=0D p->remainLen =3D kMatchSpecLenStart + 1;=0D p->tempBufSize =3D 0;=0D @@ -981,10 +981,10 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,= const Byte *src, SizeT *sr p->tempBufSize =3D rem;=0D if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)=0D {=0D - int dummyRes =3D LzmaDec_TryDummy(p, p->tempBuf, rem);=0D + int dummyRes =3D LzmaDec_TryDummy(p, p->tempBuf, (SizeT)rem);=0D if (dummyRes =3D=3D DUMMY_ERROR)=0D {=0D - (*srcLen) +=3D lookAhead;=0D + (*srcLen) +=3D (SizeT)lookAhead;=0D *status =3D LZMA_STATUS_NEEDS_MORE_INPUT;=0D return SZ_OK;=0D }=0D @@ -1007,9 +1007,9 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,= const Byte *src, SizeT *sr return SZ_ERROR_FAIL; /* some internal error */=0D lookAhead -=3D rem;=0D }=0D - (*srcLen) +=3D lookAhead;=0D + (*srcLen) +=3D (SizeT)lookAhead;=0D src +=3D lookAhead;=0D - inSize -=3D lookAhead;=0D + inSize -=3D (SizeT)lookAhead;=0D p->tempBufSize =3D 0;=0D }=0D }=0D diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-hist= ory.txt b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-history= .txt index 5ad9a5b1b9..a1515bea0b 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-history.txt +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-history.txt @@ -1,6 +1,28 @@ HISTORY of the LZMA SDK=0D -----------------------=0D =0D +19.00 2019-02-21=0D +-------------------------=0D +- Encryption strength for 7z archives was increased:=0D + the size of random initialization vector was increased from 64-bit to 12= 8-bit,=0D + and the pseudo-random number generator was improved.=0D +- The bug in 7zIn.c code was fixed.=0D +=0D +=0D +18.06 2018-12-30=0D +-------------------------=0D +- The speed for LZMA/LZMA2 compressing was increased by 3-10%,=0D + and there are minor changes in compression ratio.=0D +- Some bugs were fixed.=0D +- The bug in 7-Zip 18.02-18.05 was fixed:=0D + There was memory leak in multithreading xz decoder - XzDecMt_Decode(),=0D + if xz stream contains only one block.=0D +- The changes for MSVS compiler makefiles: =0D + - the makefiles now use "PLATFORM" macroname with values (x64, x86, arm= 64)=0D + instead of "CPU" macroname with values (AMD64, ARM64).=0D + - the makefiles by default now use static version of the run-time libra= ry.=0D +=0D +=0D 18.05 2018-04-30=0D -------------------------=0D - The speed for LZMA/LZMA2 compressing was increased=0D diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.= txt b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt index bf0b3a5ee6..6bb6fa194e 100644 --- a/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt +++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt @@ -1,4 +1,4 @@ -LZMA SDK 18.05=0D +LZMA SDK 19.00=0D --------------=0D =0D LZMA SDK provides the documentation, samples, header files,=0D --=20 2.27.0.windows.1