diff options
Diffstat (limited to '')
-rw-r--r-- | C/Xz.h | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* Xz.h - Xz interface | 1 | /* Xz.h - Xz interface |
2 | 2024-01-26 : Igor Pavlov : Public domain */ | 2 | Igor Pavlov : Public domain */ |
3 | 3 | ||
4 | #ifndef ZIP7_INC_XZ_H | 4 | #ifndef ZIP7_INC_XZ_H |
5 | #define ZIP7_INC_XZ_H | 5 | #define ZIP7_INC_XZ_H |
@@ -121,6 +121,7 @@ typedef struct | |||
121 | UInt64 startOffset; | 121 | UInt64 startOffset; |
122 | } CXzStream; | 122 | } CXzStream; |
123 | 123 | ||
124 | #define Xz_CONSTRUCT(p) { (p)->numBlocks = 0; (p)->blocks = NULL; (p)->flags = 0; } | ||
124 | void Xz_Construct(CXzStream *p); | 125 | void Xz_Construct(CXzStream *p); |
125 | void Xz_Free(CXzStream *p, ISzAllocPtr alloc); | 126 | void Xz_Free(CXzStream *p, ISzAllocPtr alloc); |
126 | 127 | ||
@@ -136,8 +137,13 @@ typedef struct | |||
136 | CXzStream *streams; | 137 | CXzStream *streams; |
137 | } CXzs; | 138 | } CXzs; |
138 | 139 | ||
140 | #define Xzs_CONSTRUCT(p) { (p)->num = 0; (p)->numAllocated = 0; (p)->streams = NULL; } | ||
139 | void Xzs_Construct(CXzs *p); | 141 | void Xzs_Construct(CXzs *p); |
140 | void Xzs_Free(CXzs *p, ISzAllocPtr alloc); | 142 | void Xzs_Free(CXzs *p, ISzAllocPtr alloc); |
143 | /* | ||
144 | Xzs_ReadBackward() must be called for empty CXzs object. | ||
145 | Xzs_ReadBackward() can return non empty object with (p->num != 0) even in case of error. | ||
146 | */ | ||
141 | SRes Xzs_ReadBackward(CXzs *p, ILookInStreamPtr inStream, Int64 *startOffset, ICompressProgressPtr progress, ISzAllocPtr alloc); | 147 | SRes Xzs_ReadBackward(CXzs *p, ILookInStreamPtr inStream, Int64 *startOffset, ICompressProgressPtr progress, ISzAllocPtr alloc); |
142 | 148 | ||
143 | UInt64 Xzs_GetNumBlocks(const CXzs *p); | 149 | UInt64 Xzs_GetNumBlocks(const CXzs *p); |
@@ -268,8 +274,8 @@ typedef struct | |||
268 | size_t outBufSize; | 274 | size_t outBufSize; |
269 | size_t outDataWritten; // the size of data in (outBuf) that were fully unpacked | 275 | size_t outDataWritten; // the size of data in (outBuf) that were fully unpacked |
270 | 276 | ||
271 | Byte shaDigest[SHA256_DIGEST_SIZE]; | 277 | UInt32 shaDigest32[SHA256_DIGEST_SIZE / 4]; |
272 | Byte buf[XZ_BLOCK_HEADER_SIZE_MAX]; | 278 | Byte buf[XZ_BLOCK_HEADER_SIZE_MAX]; // it must be aligned for 4-bytes |
273 | } CXzUnpacker; | 279 | } CXzUnpacker; |
274 | 280 | ||
275 | /* alloc : aligned for cache line allocation is better */ | 281 | /* alloc : aligned for cache line allocation is better */ |