Skip to content

Commit 8362838

Browse files
authored
Merge pull request #61 from fancycode/lzma-sdk-1900
Update to LZMA SDK 19.00
2 parents 7b6e1f2 + 9a1eb35 commit 8362838

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+948
-838
lines changed

patches/streaming_encoder.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Index: pylzma/src/sdk/C/LzmaEnc.c
22
===================================================================
33
--- pylzma.orig/src/sdk/C/LzmaEnc.c
44
+++ pylzma/src/sdk/C/LzmaEnc.c
5-
@@ -2092,8 +2092,9 @@ void LzmaEnc_Destroy(CLzmaEncHandle p, I
5+
@@ -2259,8 +2259,9 @@ void LzmaEnc_Destroy(CLzmaEncHandle p, I
66
}
77

88

@@ -13,7 +13,7 @@ Index: pylzma/src/sdk/C/LzmaEnc.c
1313
UInt32 nowPos32, startPos32;
1414
if (p->needInit)
1515
{
16-
@@ -2526,7 +2527,7 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEn
16+
@@ -2715,7 +2716,7 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEn
1717
return SZ_OK;
1818
}
1919

@@ -22,12 +22,12 @@ Index: pylzma/src/sdk/C/LzmaEnc.c
2222
ISzAllocPtr alloc, ISzAllocPtr allocBig)
2323
{
2424
CLzmaEnc *p = (CLzmaEnc *)pp;
25-
@@ -2785,3 +2786,9 @@ SRes LzmaEncode(Byte *dest, SizeT *destL
25+
@@ -2974,3 +2975,9 @@ SRes LzmaEncode(Byte *dest, SizeT *destL
2626
LzmaEnc_Destroy(p, alloc, allocBig);
2727
return res;
2828
}
2929
+
30-
+Bool LzmaEnc_IsFinished(CLzmaEncHandle pp)
30+
+BoolInt LzmaEnc_IsFinished(CLzmaEncHandle pp)
3131
+{
3232
+ CLzmaEnc *p = (CLzmaEnc *)pp;
3333
+ return p->finished;
@@ -44,7 +44,7 @@ Index: pylzma/src/sdk/C/LzmaEnc.h
4444
+
4545
+SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ISzAllocPtr alloc, ISzAllocPtr allocBig);
4646
+SRes LzmaEnc_CodeOneBlock(CLzmaEncHandle pp, UInt32 maxPackSize, UInt32 maxUnpackSize);
47-
+Bool LzmaEnc_IsFinished(CLzmaEncHandle pp);
47+
+BoolInt LzmaEnc_IsFinished(CLzmaEncHandle pp);
4848
+void LzmaEnc_Finish(CLzmaEncHandle pp);
4949
+
5050
#endif

patches/strict_prototype.patch

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ Index: pylzma/src/sdk/C/CpuArch.h
22
===================================================================
33
--- pylzma.orig/src/sdk/C/CpuArch.h
44
+++ pylzma/src/sdk/C/CpuArch.h
5-
@@ -325,8 +325,8 @@ int x86cpuid_GetFirm(const Cx86cpuid *p)
5+
@@ -325,9 +325,9 @@ int x86cpuid_GetFirm(const Cx86cpuid *p)
66
#define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) & 0xF))
77
#define x86cpuid_GetStepping(ver) (ver & 0xF)
88

9-
-Bool CPU_Is_InOrder();
10-
-Bool CPU_Is_Aes_Supported();
11-
+Bool CPU_Is_InOrder(void);
12-
+Bool CPU_Is_Aes_Supported(void);
9+
-BoolInt CPU_Is_InOrder();
10+
-BoolInt CPU_Is_Aes_Supported();
11+
-BoolInt CPU_IsSupported_PageGB();
12+
+BoolInt CPU_Is_InOrder(void);
13+
+BoolInt CPU_Is_Aes_Supported(void);
14+
+BoolInt CPU_IsSupported_PageGB(void);
1315

1416
#endif
1517

src/pylzma/pylzma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ pylzma_bcj2_decode(PyObject *self, PyObject *args)
238238
dec.bufs[BCJ2_STREAM_RC] = (const Byte *) rc_data;
239239
dec.lims[BCJ2_STREAM_RC] = (const Byte *) (rc_data + rc_length);
240240

241-
dec.dest = PyBytes_AS_STRING(result);
241+
dec.dest = (Byte *) PyBytes_AS_STRING(result);
242242
dec.destLim = dec.dest + dest_len;
243243
Bcj2Dec_Init(&dec);
244244

src/pylzma/pylzma_streams.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ CreateMemoryInOutStream(CMemoryInOutStream *stream)
8989
stream->avail = INITIAL_BLOCKSIZE;
9090
}
9191

92-
Bool
92+
BoolInt
9393
MemoryInOutStreamAppend(CMemoryInOutStream *stream, Byte *data, size_t size)
9494
{
9595
if (!size) {

src/pylzma/pylzma_streams.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void CreateMemoryInStream(CMemoryInStream *stream, Byte *data, size_t size);
4343
typedef CMemoryInStream CMemoryInOutStream;
4444

4545
void CreateMemoryInOutStream(CMemoryInOutStream *stream);
46-
Bool MemoryInOutStreamAppend(CMemoryInOutStream *stream, Byte *data, size_t size);
46+
BoolInt MemoryInOutStreamAppend(CMemoryInOutStream *stream, Byte *data, size_t size);
4747

4848
typedef struct
4949
{

src/sdk/C/7zArcIn.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* 7zArcIn.c -- 7z Input functions
2-
2017-04-03 : Igor Pavlov : Public domain */
2+
2018-12-31 : Igor Pavlov : Public domain */
33

44
#include "Precomp.h"
55

@@ -19,7 +19,7 @@
1919
{ MY_ALLOC(Byte, to, size, alloc); memcpy(to, from, size); }
2020

2121
#define MY_ALLOC_ZE_AND_CPY(to, size, from, alloc) \
22-
{ if ((size) == 0) p = NULL; else { MY_ALLOC_AND_CPY(to, size, from, alloc) } }
22+
{ if ((size) == 0) to = NULL; else { MY_ALLOC_AND_CPY(to, size, from, alloc) } }
2323

2424
#define k7zMajorVersion 0
2525

@@ -666,7 +666,7 @@ static SRes ReadUnpackInfo(CSzAr *p,
666666
MY_ALLOC(size_t, p->FoCodersOffsets, (size_t)numFolders + 1, alloc);
667667
MY_ALLOC(UInt32, p->FoStartPackStreamIndex, (size_t)numFolders + 1, alloc);
668668
MY_ALLOC(UInt32, p->FoToCoderUnpackSizes, (size_t)numFolders + 1, alloc);
669-
MY_ALLOC(Byte, p->FoToMainUnpackSizeIndex, (size_t)numFolders, alloc);
669+
MY_ALLOC_ZE(Byte, p->FoToMainUnpackSizeIndex, (size_t)numFolders, alloc);
670670

671671
startBufPtr = sd.Data;
672672

@@ -1744,7 +1744,7 @@ size_t SzArEx_GetFullNameLen(const CSzArEx *p, size_t fileIndex)
17441744
17451745
UInt16 *SzArEx_GetFullNameUtf16_Back(const CSzArEx *p, size_t fileIndex, UInt16 *dest)
17461746
{
1747-
Bool needSlash;
1747+
BoolInt needSlash;
17481748
if (!p->FileNameOffsets)
17491749
{
17501750
*(--dest) = 0;

src/sdk/C/7zDec.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* 7zDec.c -- Decoding from 7z folder
2-
2017-04-03 : Igor Pavlov : Public domain */
2+
2019-02-02 : Igor Pavlov : Public domain */
33

44
#include "Precomp.h"
55

@@ -44,7 +44,7 @@ typedef struct
4444
const Byte *end;
4545
const Byte *begin;
4646
UInt64 processed;
47-
Bool extra;
47+
BoolInt extra;
4848
SRes res;
4949
const ILookInStream *inStream;
5050
} CByteInToLook;
@@ -156,7 +156,7 @@ static SRes SzDecodeLzma(const Byte *props, unsigned propsSize, UInt64 inSize, I
156156
{
157157
SizeT inProcessed = (SizeT)lookahead, dicPos = state.dicPos;
158158
ELzmaStatus status;
159-
res = LzmaDec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status);
159+
res = LzmaDec_DecodeToDic(&state, outSize, (const Byte *)inBuf, &inProcessed, LZMA_FINISH_END, &status);
160160
lookahead -= inProcessed;
161161
inSize -= inProcessed;
162162
if (res != SZ_OK)
@@ -218,7 +218,7 @@ static SRes SzDecodeLzma2(const Byte *props, unsigned propsSize, UInt64 inSize,
218218
{
219219
SizeT inProcessed = (SizeT)lookahead, dicPos = state.decoder.dicPos;
220220
ELzmaStatus status;
221-
res = Lzma2Dec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status);
221+
res = Lzma2Dec_DecodeToDic(&state, outSize, (const Byte *)inBuf, &inProcessed, LZMA_FINISH_END, &status);
222222
lookahead -= inProcessed;
223223
inSize -= inProcessed;
224224
if (res != SZ_OK)
@@ -269,7 +269,7 @@ static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer
269269
return SZ_OK;
270270
}
271271

272-
static Bool IS_MAIN_METHOD(UInt32 m)
272+
static BoolInt IS_MAIN_METHOD(UInt32 m)
273273
{
274274
switch (m)
275275
{
@@ -286,7 +286,7 @@ static Bool IS_MAIN_METHOD(UInt32 m)
286286
return False;
287287
}
288288

289-
static Bool IS_SUPPORTED_CODER(const CSzCoderInfo *c)
289+
static BoolInt IS_SUPPORTED_CODER(const CSzCoderInfo *c)
290290
{
291291
return
292292
c->NumStreams == 1

src/sdk/C/7zTypes.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* 7zTypes.h -- Basic types
2-
2017-07-17 : Igor Pavlov : Public domain */
2+
2018-08-04 : Igor Pavlov : Public domain */
33

44
#ifndef __7Z_TYPES_H
55
#define __7Z_TYPES_H
@@ -103,7 +103,8 @@ typedef UInt32 SizeT;
103103
typedef size_t SizeT;
104104
#endif
105105

106-
typedef int Bool;
106+
typedef int BoolInt;
107+
/* typedef BoolInt Bool; */
107108
#define True 1
108109
#define False 0
109110

src/sdk/C/7zVersion.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#define MY_VER_MAJOR 18
2-
#define MY_VER_MINOR 05
1+
#define MY_VER_MAJOR 19
2+
#define MY_VER_MINOR 00
33
#define MY_VER_BUILD 0
4-
#define MY_VERSION_NUMBERS "18.05"
4+
#define MY_VERSION_NUMBERS "19.00"
55
#define MY_VERSION MY_VERSION_NUMBERS
66

77
#ifdef MY_CPU_NAME
@@ -10,7 +10,7 @@
1010
#define MY_VERSION_CPU MY_VERSION
1111
#endif
1212

13-
#define MY_DATE "2018-04-30"
13+
#define MY_DATE "2019-02-21"
1414
#undef MY_COPYRIGHT
1515
#undef MY_VERSION_COPYRIGHT_DATE
1616
#define MY_AUTHOR_NAME "Igor Pavlov"

src/sdk/C/Bcj2Enc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Bcj2Enc.c -- BCJ2 Encoder (Converter for x86 code)
2-
2017-04-28 : Igor Pavlov : Public domain */
2+
2019-02-02 : Igor Pavlov : Public domain */
33

44
#include "Precomp.h"
55

@@ -52,7 +52,7 @@ void Bcj2Enc_Init(CBcj2Enc *p)
5252
p->probs[i] = kBitModelTotal >> 1;
5353
}
5454

55-
static Bool MY_FAST_CALL RangeEnc_ShiftLow(CBcj2Enc *p)
55+
static BoolInt MY_FAST_CALL RangeEnc_ShiftLow(CBcj2Enc *p)
5656
{
5757
if ((UInt32)p->low < (UInt32)0xFF000000 || (UInt32)(p->low >> 32) != 0)
5858
{
@@ -165,7 +165,7 @@ static void Bcj2Enc_Encode_2(CBcj2Enc *p)
165165

166166
{
167167
Byte context = (Byte)(num == 0 ? p->prevByte : src[-1]);
168-
Bool needConvert;
168+
BoolInt needConvert;
169169

170170
p->bufs[BCJ2_STREAM_MAIN] = dest + 1;
171171
p->ip += (UInt32)num + 1;
@@ -253,7 +253,7 @@ void Bcj2Enc_Encode(CBcj2Enc *p)
253253
{
254254
const Byte *src = p->src;
255255
const Byte *srcLim = p->srcLim;
256-
unsigned finishMode = p->finishMode;
256+
EBcj2Enc_FinishMode finishMode = p->finishMode;
257257

258258
p->src = p->temp;
259259
p->srcLim = p->temp + p->tempPos;

0 commit comments

Comments
 (0)