]>
git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
1 /* 7zTypes.h -- Basic types
2 2013-11-12 : Igor Pavlov : Public domain */
8 /* #include <windows.h> */
17 #ifndef EXTERN_C_BEGIN
19 #define EXTERN_C_BEGIN extern "C" {
20 #define EXTERN_C_END }
22 #define EXTERN_C_BEGIN
31 #define SZ_ERROR_DATA 1
32 #define SZ_ERROR_MEM 2
33 #define SZ_ERROR_CRC 3
34 #define SZ_ERROR_UNSUPPORTED 4
35 #define SZ_ERROR_PARAM 5
36 #define SZ_ERROR_INPUT_EOF 6
37 #define SZ_ERROR_OUTPUT_EOF 7
38 #define SZ_ERROR_READ 8
39 #define SZ_ERROR_WRITE 9
40 #define SZ_ERROR_PROGRESS 10
41 #define SZ_ERROR_FAIL 11
42 #define SZ_ERROR_THREAD 12
44 #define SZ_ERROR_ARCHIVE 16
45 #define SZ_ERROR_NO_ARCHIVE 17
50 /* typedef DWORD WRes; */
51 typedef unsigned WRes
;
57 #define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
60 typedef unsigned char Byte
;
62 typedef unsigned short UInt16
;
64 #ifdef _LZMA_UINT32_IS_ULONG
66 typedef unsigned long UInt32
;
69 typedef unsigned int UInt32
;
74 /* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
75 NOTES: Some code will work incorrectly in that case! */
78 typedef unsigned long UInt64
;
82 #if defined(_MSC_VER) || defined(__BORLANDC__)
83 typedef __int64 Int64
;
84 typedef unsigned __int64 UInt64
;
85 #define UINT64_CONST(n) n
87 typedef long long int Int64
;
88 typedef unsigned long long int UInt64
;
89 #define UINT64_CONST(n) n ## ULL
94 #ifdef _LZMA_NO_SYSTEM_SIZE_T
106 #define MY_STD_CALL __stdcall
114 #define MY_NO_INLINE __declspec(noinline)
119 #define MY_CDECL __cdecl
120 #define MY_FAST_CALL __fastcall
131 /* The following interfaces use first parameter as pointer to structure */
135 Byte (*Read
)(void *p
); /* reads one byte, returns 0 in case of EOF or error */
140 void (*Write
)(void *p
, Byte b
);
145 SRes (*Read
)(void *p
, void *buf
, size_t *size
);
146 /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
147 (output(*size) < input(*size)) is allowed */
150 /* it can return SZ_ERROR_INPUT_EOF */
151 SRes
SeqInStream_Read(ISeqInStream
*stream
, void *buf
, size_t size
);
152 SRes
SeqInStream_Read2(ISeqInStream
*stream
, void *buf
, size_t size
, SRes errorType
);
153 SRes
SeqInStream_ReadByte(ISeqInStream
*stream
, Byte
*buf
);
157 size_t (*Write
)(void *p
, const void *buf
, size_t size
);
158 /* Returns: result - the number of actually written bytes.
159 (result < size) means error */
171 SRes (*Read
)(void *p
, void *buf
, size_t *size
); /* same as ISeqInStream::Read */
172 SRes (*Seek
)(void *p
, Int64
*pos
, ESzSeek origin
);
177 SRes (*Look
)(void *p
, const void **buf
, size_t *size
);
178 /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
179 (output(*size) > input(*size)) is not allowed
180 (output(*size) < input(*size)) is allowed */
181 SRes (*Skip
)(void *p
, size_t offset
);
182 /* offset must be <= output(*size) of Look */
184 SRes (*Read
)(void *p
, void *buf
, size_t *size
);
185 /* reads directly (without buffer). It's same as ISeqInStream::Read */
186 SRes (*Seek
)(void *p
, Int64
*pos
, ESzSeek origin
);
189 SRes
LookInStream_LookRead(ILookInStream
*stream
, void *buf
, size_t *size
);
190 SRes
LookInStream_SeekTo(ILookInStream
*stream
, UInt64 offset
);
192 /* reads via ILookInStream::Read */
193 SRes
LookInStream_Read2(ILookInStream
*stream
, void *buf
, size_t size
, SRes errorType
);
194 SRes
LookInStream_Read(ILookInStream
*stream
, void *buf
, size_t size
);
196 #define LookToRead_BUF_SIZE (1 << 14)
201 ISeekInStream
*realStream
;
204 Byte buf
[LookToRead_BUF_SIZE
];
207 void LookToRead_CreateVTable(CLookToRead
*p
, int lookahead
);
208 void LookToRead_Init(CLookToRead
*p
);
213 ILookInStream
*realStream
;
216 void SecToLook_CreateVTable(CSecToLook
*p
);
221 ILookInStream
*realStream
;
224 void SecToRead_CreateVTable(CSecToRead
*p
);
228 SRes (*Progress
)(void *p
, UInt64 inSize
, UInt64 outSize
);
229 /* Returns: result. (result != SZ_OK) means break.
230 Value (UInt64)(Int64)-1 for size means unknown value. */
235 void *(*Alloc
)(void *p
, size_t size
);
236 void (*Free
)(void *p
, void *address
); /* address can be 0 */
239 #define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
240 #define IAlloc_Free(p, a) (p)->Free((p), a)
244 #define CHAR_PATH_SEPARATOR '\\'
245 #define WCHAR_PATH_SEPARATOR L'\\'
246 #define STRING_PATH_SEPARATOR "\\"
247 #define WSTRING_PATH_SEPARATOR L"\\"
251 #define CHAR_PATH_SEPARATOR '/'
252 #define WCHAR_PATH_SEPARATOR L'/'
253 #define STRING_PATH_SEPARATOR "/"
254 #define WSTRING_PATH_SEPARATOR L"/"