lzma: Update LZMA SDK code from 25.01 to 26.05
PATCH 1/1 lzma: Update LZMA SDK code from 25.01 to 26.05
In order to keep future maintenance at a minimum, as it has been around a year since the last time we updated the LZMA code, update it again. This brings us in line with the 26.05 release and there are few changes here which have an impact on us.
Signed-off-by Tom Rini <[email protected]>
--- lib/lzma/7zC.txt | 4 ++-- lib/lzma/7zTypes.h | 7 +++++-- lib/lzma/Compiler.h | 43 ++++++++++++++++++++++++++++++++++++++++++- lib/lzma/LzmaDec.c | 18 +++++++++++------- lib/lzma/Precomp.h | 14 +++++++------- 5 files changed, 67 insertions(+), 19 deletions(-)
lib/lzma/7zC.txt +2 -2
@@ -165,8 +165,8 @@ Memory usage for archive Decompressing: - Memory for LZMA decompressing structures - Main pool: - Memory for decompressed solid block - - Memory for temprorary buffers, if BCJ2 fileter is used. Usually these - temprorary buffers can be about 15% of solid block size. + - Memory for temporary buffers, if BCJ2 filter is used. Usually these + temporary buffers can be about 15% of solid block size. 7z Decoder doesn't allocate memory for compressed blocks.
lib/lzma/7zTypes.h +5 -2
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: LZMA-SDK-9.22 */ /* 7zTypes.h -- Basic types -2024-01-24 : Igor Pavlov : Public domain */ +: Igor Pavlov : Public domain */ #ifndef ZIP7_7Z_TYPES_H #define ZIP7_7Z_TYPES_H
@@ -46,8 +46,9 @@ EXTERN_C_BEGINtypedef int SRes ;#ifdef _MSC_VER +#define MY_ALIGN_IN_STRUCT (n) __declspec(align(n))#if _MSC_VER >1200 -#define MY_ALIGN (n) __declspec(align(n)) +#define MY_ALIGN (n) MY_ALIGN_IN_STRUCT(n)#else #define MY_ALIGN (n)#endif
@@ -58,6 +59,7 @@ typedef int SRes;#define MY_ALIGN(n) alignas(n) */ #define MY_ALIGN (n) __attribute__ ((aligned(n))) +#define MY_ALIGN_IN_STRUCT (n) MY_ALIGN(n)#endif #ifdef _WIN32
@@ -532,6 +534,7 @@ struct ISzAlloc#define Z7_DECLARE_HANDLE (name) struct name##_dummy{int unused;}; typedef struct name##_dummy *name;#define Z7_memset_0_ARRAY (a) memset((a), 0, sizeof(a)) +#define Z7_memset_0_VAR (a) memset(&(a), 0, sizeof(a))#ifndef Z7_ARRAY_SIZE #define Z7_ARRAY_SIZE (a) (sizeof(a) / sizeof((a)[0]))
lib/lzma/Compiler.h +42 -1
63 lines not on this page · raw message
lib/lzma/LzmaDec.c +11 -7
@@ -1,6 +1,6 @@// SPDX-License-Identifier: LZMA-SDK-9.22 /* LzmaDec.c -- LZMA Decoder -2023-04-07 : Igor Pavlov : Public domain */ +: Igor Pavlov : Public domain */ #include "Precomp.h"
@@ -463,8 +463,10 @@ int Z7_FASTCALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit)if (state >= kNumStates) {UInt32 distance; - prob = probs + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates -1 ) << kNumPosSlotBits); + { +const unsigned temp = (len < kNumLenToPosStates ? len : kNumLenToPosStates -1 ) << kNumPosSlotBits; + prob = probs + PosSlot + temp; + } TREE_6_DECODE(prob, distance)if (distance >= kStartPosModelIndex) {
@@ -853,9 +855,10 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Bytif (state <4 ) {unsigned posSlot; - prob = probs + PosSlot + - ((len < kNumLenToPosStates -1 ? len : kNumLenToPosStates -1 ) << - kNumPosSlotBits); + { +const unsigned temp = (len < kNumLenToPosStates -1 ? len : kNumLenToPosStates -1 ) << kNumPosSlotBits; + prob = probs + PosSlot + temp; + } TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot)if (posSlot >= kStartPosModelIndex) {
@@ -863,7 +866,8 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Bytif (posSlot < kEndPosModelIndex) { - prob = probs + SpecPos + ((2 | (posSlot &1 )) << numDirectBits); +const unsigned temp = (2 | (posSlot &1 )) << numDirectBits; + prob = probs + SpecPos + temp; }else {
lib/lzma/Precomp.h +7 -7
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: LZMA-SDK-9.22 */ /* Precomp.h -- precompilation file -2024-01-25 : Igor Pavlov : Public domain */ +: Igor Pavlov : Public domain */ #ifndef ZIP7_INC_PRECOMP_H #define ZIP7_INC_PRECOMP_H
@@ -41,18 +41,18 @@#endif */ +#ifndef Z7_LARGE_PAGES +#if !defined(Z7_NO_LARGE_PAGES ) && !defined(UNDER_CE ) +#define Z7_LARGE_PAGES 1 +#endif +#endif +#ifdef _WIN32/* this "Precomp.h" file must be included before <windows.h>, if we want to define _WIN32_WINNT before <windows.h>. */ -#ifndef Z7_LARGE_PAGES -#ifndef Z7_NO_LARGE_PAGES -#define Z7_LARGE_PAGES 1 -#endif -#endif -#ifndef Z7_LONG_PATH #ifndef Z7_NO_LONG_PATH #define Z7_LONG_PATH 1
Signature · 1 line
2.43.0
Quoted 6 lines · Tom Rini
In order to keep future maintenance at a minimum, as it has been around a year since the last time we updated the LZMA code, update it again. This brings us in line with the 26.05 release and there are few changes here which have an impact on us.
Applied to u-boot/next, thanks!
[1/1] lzma: Update LZMA SDK code from 25.01 to 26.05
commit: 6201222134cd704b5717211fc917e2ca6263577a
Signature · 1 line
Tom