aboutsummaryrefslogtreecommitdiff
path: root/C/Xz.h
diff options
context:
space:
mode:
Diffstat (limited to 'C/Xz.h')
-rw-r--r--C/Xz.h56
1 files changed, 37 insertions, 19 deletions
diff --git a/C/Xz.h b/C/Xz.h
index 849b944..d5001f6 100644
--- a/C/Xz.h
+++ b/C/Xz.h
@@ -1,21 +1,23 @@
1/* Xz.h - Xz interface 1/* Xz.h - Xz interface
22021-04-01 : Igor Pavlov : Public domain */ 22023-04-13 : Igor Pavlov : Public domain */
3 3
4#ifndef __XZ_H 4#ifndef ZIP7_INC_XZ_H
5#define __XZ_H 5#define ZIP7_INC_XZ_H
6 6
7#include "Sha256.h" 7#include "Sha256.h"
8#include "Delta.h"
8 9
9EXTERN_C_BEGIN 10EXTERN_C_BEGIN
10 11
11#define XZ_ID_Subblock 1 12#define XZ_ID_Subblock 1
12#define XZ_ID_Delta 3 13#define XZ_ID_Delta 3
13#define XZ_ID_X86 4 14#define XZ_ID_X86 4
14#define XZ_ID_PPC 5 15#define XZ_ID_PPC 5
15#define XZ_ID_IA64 6 16#define XZ_ID_IA64 6
16#define XZ_ID_ARM 7 17#define XZ_ID_ARM 7
17#define XZ_ID_ARMT 8 18#define XZ_ID_ARMT 8
18#define XZ_ID_SPARC 9 19#define XZ_ID_SPARC 9
20#define XZ_ID_ARM64 0xa
19#define XZ_ID_LZMA2 0x21 21#define XZ_ID_LZMA2 0x21
20 22
21unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value); 23unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value);
@@ -53,7 +55,7 @@ typedef struct
53#define XzBlock_HasUnsupportedFlags(p) (((p)->flags & ~(XZ_BF_NUM_FILTERS_MASK | XZ_BF_PACK_SIZE | XZ_BF_UNPACK_SIZE)) != 0) 55#define XzBlock_HasUnsupportedFlags(p) (((p)->flags & ~(XZ_BF_NUM_FILTERS_MASK | XZ_BF_PACK_SIZE | XZ_BF_UNPACK_SIZE)) != 0)
54 56
55SRes XzBlock_Parse(CXzBlock *p, const Byte *header); 57SRes XzBlock_Parse(CXzBlock *p, const Byte *header);
56SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStream *inStream, BoolInt *isIndex, UInt32 *headerSizeRes); 58SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStreamPtr inStream, BoolInt *isIndex, UInt32 *headerSizeRes);
57 59
58/* ---------- xz stream ---------- */ 60/* ---------- xz stream ---------- */
59 61
@@ -101,7 +103,7 @@ typedef UInt16 CXzStreamFlags;
101unsigned XzFlags_GetCheckSize(CXzStreamFlags f); 103unsigned XzFlags_GetCheckSize(CXzStreamFlags f);
102 104
103SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf); 105SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf);
104SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStream *inStream); 106SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStreamPtr inStream);
105 107
106typedef struct 108typedef struct
107{ 109{
@@ -112,6 +114,7 @@ typedef struct
112typedef struct 114typedef struct
113{ 115{
114 CXzStreamFlags flags; 116 CXzStreamFlags flags;
117 // Byte _pad[6];
115 size_t numBlocks; 118 size_t numBlocks;
116 CXzBlockSizes *blocks; 119 CXzBlockSizes *blocks;
117 UInt64 startOffset; 120 UInt64 startOffset;
@@ -134,7 +137,7 @@ typedef struct
134 137
135void Xzs_Construct(CXzs *p); 138void Xzs_Construct(CXzs *p);
136void Xzs_Free(CXzs *p, ISzAllocPtr alloc); 139void Xzs_Free(CXzs *p, ISzAllocPtr alloc);
137SRes Xzs_ReadBackward(CXzs *p, ILookInStream *inStream, Int64 *startOffset, ICompressProgress *progress, ISzAllocPtr alloc); 140SRes Xzs_ReadBackward(CXzs *p, ILookInStreamPtr inStream, Int64 *startOffset, ICompressProgressPtr progress, ISzAllocPtr alloc);
138 141
139UInt64 Xzs_GetNumBlocks(const CXzs *p); 142UInt64 Xzs_GetNumBlocks(const CXzs *p);
140UInt64 Xzs_GetUnpackSize(const CXzs *p); 143UInt64 Xzs_GetUnpackSize(const CXzs *p);
@@ -160,9 +163,9 @@ typedef enum
160} ECoderFinishMode; 163} ECoderFinishMode;
161 164
162 165
163typedef struct _IStateCoder 166typedef struct
164{ 167{
165 void *p; 168 void *p; // state object;
166 void (*Free)(void *p, ISzAllocPtr alloc); 169 void (*Free)(void *p, ISzAllocPtr alloc);
167 SRes (*SetProps)(void *p, const Byte *props, size_t propSize, ISzAllocPtr alloc); 170 SRes (*SetProps)(void *p, const Byte *props, size_t propSize, ISzAllocPtr alloc);
168 void (*Init)(void *p); 171 void (*Init)(void *p);
@@ -174,6 +177,20 @@ typedef struct _IStateCoder
174} IStateCoder; 177} IStateCoder;
175 178
176 179
180typedef struct
181{
182 UInt32 methodId;
183 UInt32 delta;
184 UInt32 ip;
185 UInt32 X86_State;
186 Byte delta_State[DELTA_STATE_SIZE];
187} CXzBcFilterStateBase;
188
189typedef SizeT (*Xz_Func_BcFilterStateBase_Filter)(CXzBcFilterStateBase *p, Byte *data, SizeT size);
190
191SRes Xz_StateCoder_Bc_SetFromMethod_Func(IStateCoder *p, UInt64 id,
192 Xz_Func_BcFilterStateBase_Filter func, ISzAllocPtr alloc);
193
177 194
178#define MIXCODER_NUM_FILTERS_MAX 4 195#define MIXCODER_NUM_FILTERS_MAX 4
179 196
@@ -422,7 +439,7 @@ typedef struct
422 size_t outStep_ST; // size of output buffer for Single-Thread decoding 439 size_t outStep_ST; // size of output buffer for Single-Thread decoding
423 BoolInt ignoreErrors; // if set to 1, the decoder can ignore some errors and it skips broken parts of data. 440 BoolInt ignoreErrors; // if set to 1, the decoder can ignore some errors and it skips broken parts of data.
424 441
425 #ifndef _7ZIP_ST 442 #ifndef Z7_ST
426 unsigned numThreads; // the number of threads for Multi-Thread decoding. if (umThreads == 1) it will use Single-thread decoding 443 unsigned numThreads; // the number of threads for Multi-Thread decoding. if (umThreads == 1) it will use Single-thread decoding
427 size_t inBufSize_MT; // size of small input data buffers for Multi-Thread decoding. Big number of such small buffers can be created 444 size_t inBufSize_MT; // size of small input data buffers for Multi-Thread decoding. Big number of such small buffers can be created
428 size_t memUseMax; // the limit of total memory usage for Multi-Thread decoding. 445 size_t memUseMax; // the limit of total memory usage for Multi-Thread decoding.
@@ -432,8 +449,9 @@ typedef struct
432 449
433void XzDecMtProps_Init(CXzDecMtProps *p); 450void XzDecMtProps_Init(CXzDecMtProps *p);
434 451
435 452typedef struct CXzDecMt CXzDecMt;
436typedef void * CXzDecMtHandle; 453typedef CXzDecMt * CXzDecMtHandle;
454// Z7_DECLARE_HANDLE(CXzDecMtHandle)
437 455
438/* 456/*
439 alloc : XzDecMt uses CAlignOffsetAlloc internally for addresses allocated by (alloc). 457 alloc : XzDecMt uses CAlignOffsetAlloc internally for addresses allocated by (alloc).
@@ -503,14 +521,14 @@ SRes XzDecMt_Decode(CXzDecMtHandle p,
503 const CXzDecMtProps *props, 521 const CXzDecMtProps *props,
504 const UInt64 *outDataSize, // NULL means undefined 522 const UInt64 *outDataSize, // NULL means undefined
505 int finishMode, // 0 - partial unpacking is allowed, 1 - xz stream(s) must be finished 523 int finishMode, // 0 - partial unpacking is allowed, 1 - xz stream(s) must be finished
506 ISeqOutStream *outStream, 524 ISeqOutStreamPtr outStream,
507 // Byte *outBuf, size_t *outBufSize, 525 // Byte *outBuf, size_t *outBufSize,
508 ISeqInStream *inStream, 526 ISeqInStreamPtr inStream,
509 // const Byte *inData, size_t inDataSize, 527 // const Byte *inData, size_t inDataSize,
510 CXzStatInfo *stat, // out: decoding results and statistics 528 CXzStatInfo *stat, // out: decoding results and statistics
511 int *isMT, // out: 0 means that ST (Single-Thread) version was used 529 int *isMT, // out: 0 means that ST (Single-Thread) version was used
512 // 1 means that MT (Multi-Thread) version was used 530 // 1 means that MT (Multi-Thread) version was used
513 ICompressProgress *progress); 531 ICompressProgressPtr progress);
514 532
515EXTERN_C_END 533EXTERN_C_END
516 534