17#define EXTERN_C_BEGIN extern "C" {
29#define SZ_ERROR_DATA 1
32#define SZ_ERROR_UNSUPPORTED 4
33#define SZ_ERROR_PARAM 5
34#define SZ_ERROR_INPUT_EOF 6
35#define SZ_ERROR_OUTPUT_EOF 7
36#define SZ_ERROR_READ 8
37#define SZ_ERROR_WRITE 9
38#define SZ_ERROR_PROGRESS 10
39#define SZ_ERROR_FAIL 11
40#define SZ_ERROR_THREAD 12
42#define SZ_ERROR_ARCHIVE 16
43#define SZ_ERROR_NO_ARCHIVE 17
50 #define MY_ALIGN(n) __declspec(align(n))
60 #define MY_ALIGN(n) __attribute__ ((aligned(n)))
68#define MY_SRes_HRESULT_FROM_WRes(x) HRESULT_FROM_WIN32(x)
78#define MY_FACILITY_ERRNO 0x800
79#define MY_FACILITY_WIN32 7
80#define MY_FACILITY_WRes MY_FACILITY_ERRNO
82#define MY_HRESULT_FROM_errno_CONST_ERROR(x) ((HRESULT)( \
83 ( (HRESULT)(x) & 0x0000FFFF) \
84 | (MY_FACILITY_WRes << 16) \
85 | (HRESULT)0x80000000 ))
87#define MY_SRes_HRESULT_FROM_WRes(x) \
88 ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : MY_HRESULT_FROM_errno_CONST_ERROR(x))
91#define HRESULT_FROM_WIN32(x) MY_SRes_HRESULT_FROM_WRes(x)
113#define ERROR_INVALID_PARAMETER EINVAL
114#define ERROR_INVALID_FUNCTION EINVAL
115#define ERROR_ALREADY_EXISTS EEXIST
116#define ERROR_FILE_EXISTS EEXIST
117#define ERROR_PATH_NOT_FOUND ENOENT
118#define ERROR_FILE_NOT_FOUND ENOENT
119#define ERROR_DISK_FULL ENOSPC
124#define ERROR_TOO_MANY_POSTS ((HRESULT)0x8007012AL)
125#define ERROR_INVALID_REPARSE_DATA ((HRESULT)0x80071128L)
126#define ERROR_REPARSE_TAG_INVALID ((HRESULT)0x80071129L)
130#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
131#define E_INVALIDARG ((HRESULT)0x80070057L)
132#define MY_E_ERROR_NEGATIVE_SEEK ((HRESULT)0x80070083L)
141#define TEXT(quote) quote
143#define FILE_ATTRIBUTE_READONLY 0x0001
144#define FILE_ATTRIBUTE_HIDDEN 0x0002
145#define FILE_ATTRIBUTE_SYSTEM 0x0004
146#define FILE_ATTRIBUTE_DIRECTORY 0x0010
147#define FILE_ATTRIBUTE_ARCHIVE 0x0020
148#define FILE_ATTRIBUTE_DEVICE 0x0040
149#define FILE_ATTRIBUTE_NORMAL 0x0080
150#define FILE_ATTRIBUTE_TEMPORARY 0x0100
151#define FILE_ATTRIBUTE_SPARSE_FILE 0x0200
152#define FILE_ATTRIBUTE_REPARSE_POINT 0x0400
153#define FILE_ATTRIBUTE_COMPRESSED 0x0800
154#define FILE_ATTRIBUTE_OFFLINE 0x1000
155#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x2000
156#define FILE_ATTRIBUTE_ENCRYPTED 0x4000
158#define FILE_ATTRIBUTE_UNIX_EXTENSION 0x8000
164#define RINOK(x) { const int _result_ = (x); if (_result_ != 0) return _result_; }
168#define RINOK_WRes(x) { const WRes _result_ = (x); if (_result_ != 0) return _result_; }
171typedef unsigned char Byte;
173typedef unsigned short UInt16;
175#ifdef Z7_DECL_Int32_AS_long
177typedef unsigned long UInt32;
180typedef unsigned int UInt32;
188typedef unsigned int UINT;
214#define MY_HRES_ERROR_INTERNAL_ERROR ((HRESULT)0x8007054FL)
217#ifdef Z7_DECL_Int64_AS_long
220typedef unsigned long UInt64;
224#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(__clang__)
225typedef __int64
Int64;
226typedef unsigned __int64
UInt64;
228#if defined(__clang__) || defined(__GNUC__)
230typedef int64_t
Int64;
233typedef long long int Int64;
234typedef unsigned long long int UInt64;
241#define UINT64_CONST(n) n
244#ifdef Z7_DECL_SizeT_AS_unsigned_int
245typedef unsigned int SizeT;
266#define Z7_STDCALL __stdcall
274#define Z7_NO_INLINE __declspec(noinline)
279#define Z7_FORCE_INLINE __forceinline
281#define Z7_CDECL __cdecl
282#define Z7_FASTCALL __fastcall
286#if (defined(__GNUC__) && (__GNUC__ >= 4)) \
287 || (defined(__clang__) && (__clang_major__ >= 4)) \
288 || defined(__INTEL_COMPILER) \
290#define Z7_NO_INLINE __attribute__((noinline))
291#define Z7_FORCE_INLINE __attribute__((always_inline)) inline
294#define Z7_FORCE_INLINE
299#if defined(_M_IX86) \
304#elif defined(MY_CPU_AMD64)
317#define Z7_C_IFACE_CONST_QUAL const
319#define Z7_C_IFACE_DECL(a) \
321 typedef Z7_C_IFACE_CONST_QUAL struct a ## _ * a ## Ptr; \
322 typedef struct a ## _ a; \
328 Byte (*Read)(IByteInPtr p);
330#define IByteIn_Read(p) (p)->Read(p)
335 void (*Write)(IByteOutPtr p,
Byte b);
337#define IByteOut_Write(p, b) (p)->Write(p, b)
342 SRes (*Read)(ISeqInStreamPtr p,
void *
buf,
size_t *
size);
346#define ISeqInStream_Read(p, buf, size) (p)->Read(p, buf, size)
358 size_t (*Write)(ISeqOutStreamPtr p,
const void *
buf,
size_t size);
362#define ISeqOutStream_Write(p, buf, size) (p)->Write(p, buf, size)
374 SRes (*Read)(ISeekInStreamPtr p,
void *
buf,
size_t *
size);
377#define ISeekInStream_Read(p, buf, size) (p)->Read(p, buf, size)
378#define ISeekInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
383 SRes (*Look)(ILookInStreamPtr p,
const void **
buf,
size_t *
size);
387 SRes (*Skip)(ILookInStreamPtr p,
size_t offset);
389 SRes (*Read)(ILookInStreamPtr p,
void *
buf,
size_t *
size);
394#define ILookInStream_Look(p, buf, size) (p)->Look(p, buf, size)
395#define ILookInStream_Skip(p, offset) (p)->Skip(p, offset)
396#define ILookInStream_Read(p, buf, size) (p)->Read(p, buf, size)
397#define ILookInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
411 ISeekInStreamPtr realStream;
423#define LookToRead2_INIT(p) { (p)->pos = (p)->size = 0; }
429 ILookInStreamPtr realStream;
439 ILookInStreamPtr realStream;
452#define ICompressProgress_Progress(p, inSize, outSize) (p)->Progress(p, inSize, outSize)
465#define ISzAlloc_Alloc(p, size) (p)->Alloc(p, size)
466#define ISzAlloc_Free(p, a) (p)->Free(p, a)
469#define IAlloc_Alloc(p, size) ISzAlloc_Alloc(p, size)
470#define IAlloc_Free(p, a) ISzAlloc_Free(p, a)
478 #define MY_offsetof(type, m) offsetof(type, m)
483 #define MY_offsetof(type, m) ((size_t)&(((type *)0)->m))
489#ifndef Z7_container_of
504#define Z7_container_of(ptr, type, m) \
505 ((type *)(void *)((char *)(void *) \
506 (1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
508#define Z7_container_of_CONST(ptr, type, m) \
509 ((const type *)(const void *)((const char *)(const void *) \
510 (1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
520#define Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(void *)(ptr))
523#define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_container_of(ptr, type, m)
526#define Z7_CONTAINER_FROM_VTBL_CONST(ptr, type, m) Z7_container_of_CONST(ptr, type, m)
528#define Z7_CONTAINER_FROM_VTBL_CLS(ptr, type, m) Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
532#if defined (__clang__) || defined(__GNUC__)
533#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_CAST_QUAL \
534 _Pragma("GCC diagnostic push") \
535 _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
536#define Z7_DIAGNOSCTIC_IGNORE_END_CAST_QUAL \
537 _Pragma("GCC diagnostic pop")
539#define Z7_DIAGNOSCTIC_IGNORE_BEGIN_CAST_QUAL
540#define Z7_DIAGNOSCTIC_IGNORE_END_CAST_QUAL
543#define Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR(ptr, type, m, p) \
544 Z7_DIAGNOSCTIC_IGNORE_BEGIN_CAST_QUAL \
545 type *p = Z7_CONTAINER_FROM_VTBL(ptr, type, m); \
546 Z7_DIAGNOSCTIC_IGNORE_END_CAST_QUAL
548#define Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(type) \
549 Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR(pp, type, vt, p)
553#define Z7_DECLARE_HANDLE(name) struct name##_dummy{int unused;}; typedef struct name##_dummy *name;
556#define Z7_memset_0_ARRAY(a) memset((a), 0, sizeof(a))
559#define Z7_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
565#define CHAR_PATH_SEPARATOR '\\'
566#define WCHAR_PATH_SEPARATOR L'\\'
567#define STRING_PATH_SEPARATOR "\\"
568#define WSTRING_PATH_SEPARATOR L"\\"
572#define CHAR_PATH_SEPARATOR '/'
573#define WCHAR_PATH_SEPARATOR L'/'
574#define STRING_PATH_SEPARATOR "/"
575#define WSTRING_PATH_SEPARATOR L"/"
579#define k_PropVar_TimePrec_0 0
580#define k_PropVar_TimePrec_Unix 1
581#define k_PropVar_TimePrec_DOS 2
582#define k_PropVar_TimePrec_HighPrec 3
583#define k_PropVar_TimePrec_Base 16
584#define k_PropVar_TimePrec_100ns (k_PropVar_TimePrec_Base + 7)
585#define k_PropVar_TimePrec_1ns (k_PropVar_TimePrec_Base + 9)
void SecToRead_CreateVTable(CSecToRead *p)
Definition 7zStream.c:196
int BoolInt
Definition 7zTypes.h:259
SRes LookInStream_SeekTo(ILookInStreamPtr stream, UInt64 offset)
Definition 7zStream.c:61
unsigned int UINT
Definition 7zTypes.h:188
int INT
Definition 7zTypes.h:186
Int32 INT32
Definition 7zTypes.h:187
SRes LookInStream_LookRead(ILookInStreamPtr stream, void *buf, size_t *size)
Definition 7zStream.c:67
size_t SizeT
Definition 7zTypes.h:247
INT32 LONG
Definition 7zTypes.h:190
int WRes
Definition 7zTypes.h:75
#define EXTERN_C_BEGIN
Definition 7zTypes.h:20
SRes LookInStream_Read(ILookInStreamPtr stream, void *buf, size_t size)
Definition 7zStream.c:91
SRes SeqInStream_ReadMax(ISeqInStreamPtr stream, void *buf, size_t *processedSize)
Definition 7zStream.c:11
UINT32 ULONG
Definition 7zTypes.h:191
unsigned long DWORD_PTR
Definition 7zTypes.h:207
SRes SeqInStream_ReadByte(ISeqInStreamPtr stream, Byte *buf)
Definition 7zStream.c:52
unsigned long UINT_PTR
Definition 7zTypes.h:205
void LookToRead2_CreateVTable(CLookToRead2 *p, int lookahead)
Definition 7zStream.c:167
unsigned long long int UInt64
Definition 7zTypes.h:234
SRes LookInStream_Read2(ILookInStreamPtr stream, void *buf, size_t size, SRes errorType)
Definition 7zStream.c:77
ESzSeek
Definition 7zTypes.h:365
@ SZ_SEEK_END
Definition 7zTypes.h:368
@ SZ_SEEK_SET
Definition 7zTypes.h:366
@ SZ_SEEK_CUR
Definition 7zTypes.h:367
void * LPVOID
Definition 7zTypes.h:200
UINT32 DWORD
Definition 7zTypes.h:194
long LONG_PTR
Definition 7zTypes.h:206
int SRes
Definition 7zTypes.h:45
#define EXTERN_C_END
Definition 7zTypes.h:21
const ISzAlloc * ISzAllocPtr
Definition 7zTypes.h:457
size_t SIZE_T
Definition 7zTypes.h:209
long INT_PTR
Definition 7zTypes.h:204
long long int Int64
Definition 7zTypes.h:233
UInt32 UINT32
Definition 7zTypes.h:189
void SecToLook_CreateVTable(CSecToLook *p)
Definition 7zStream.c:185
#define Z7_C_IFACE_DECL(a)
Definition 7zTypes.h:319
char buf[N_BUF]
Definition spewG.c:36
void(* Free)(ISzAllocPtr p, void *address)
Definition 7zTypes.h:462
short Int16
Definition bzlib_private.h:46
unsigned int UInt32
Definition bzlib_private.h:45
unsigned short UInt16
Definition bzlib_private.h:47
int Int32
Definition bzlib_private.h:44
unsigned char Byte
Definition zconf.h:391
#define b(i)
Definition sha256.c:42