]>
git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/Types.h
4 Based on LZMA SDK 4.65:
6 2008-11-23 : Igor Pavlov : Public domain
8 Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
9 This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
38 #define SZ_ERROR_DATA 1
39 #define SZ_ERROR_MEM 2
40 #define SZ_ERROR_CRC 3
41 #define SZ_ERROR_UNSUPPORTED 4
42 #define SZ_ERROR_PARAM 5
43 #define SZ_ERROR_INPUT_EOF 6
44 #define SZ_ERROR_OUTPUT_EOF 7
45 #define SZ_ERROR_READ 8
46 #define SZ_ERROR_WRITE 9
47 #define SZ_ERROR_PROGRESS 10
48 #define SZ_ERROR_FAIL 11
49 #define SZ_ERROR_THREAD 12
51 #define SZ_ERROR_ARCHIVE 16
52 #define SZ_ERROR_NO_ARCHIVE 17
63 #define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
66 typedef unsigned char Byte
;
68 typedef unsigned short UInt16
;
70 #ifdef _LZMA_UINT32_IS_ULONG
72 typedef unsigned long UInt32
;
75 typedef unsigned int UInt32
;
80 /* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
81 NOTES: Some code will work incorrectly in that case! */
84 typedef unsigned long UInt64
;
88 #if defined(_MSC_VER) || defined(__BORLANDC__)
89 typedef __int64 Int64
;
90 typedef unsigned __int64 UInt64
;
92 typedef long long int Int64
;
93 typedef unsigned long long int UInt64
;
98 #ifdef _LZMA_NO_SYSTEM_SIZE_T
101 typedef size_t SizeT
;
112 #define MY_NO_INLINE __declspec(noinline)
117 #define MY_CDECL __cdecl
118 #define MY_STD_CALL __stdcall
119 #define MY_FAST_CALL MY_NO_INLINE __fastcall
130 /* The following interfaces use first parameter as pointer to structure */
134 SRes (*Read
)(void *p
, void *buf
, size_t *size
);
135 /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
136 (output(*size) < input(*size)) is allowed */
139 /* it can return SZ_ERROR_INPUT_EOF */
140 SRes
SeqInStream_Read(ISeqInStream
*stream
, void *buf
, size_t size
);
141 SRes
SeqInStream_Read2(ISeqInStream
*stream
, void *buf
, size_t size
, SRes errorType
);
142 SRes
SeqInStream_ReadByte(ISeqInStream
*stream
, Byte
*buf
);
146 size_t (*Write
)(void *p
, const void *buf
, size_t size
);
147 /* Returns: result - the number of actually written bytes.
148 (result < size) means error */
160 SRes (*Read
)(void *p
, void *buf
, size_t *size
); /* same as ISeqInStream::Read */
161 SRes (*Seek
)(void *p
, Int64
*pos
, ESzSeek origin
);
166 SRes (*Look
)(void *p
, void **buf
, size_t *size
);
167 /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
168 (output(*size) > input(*size)) is not allowed
169 (output(*size) < input(*size)) is allowed */
170 SRes (*Skip
)(void *p
, size_t offset
);
171 /* offset must be <= output(*size) of Look */
173 SRes (*Read
)(void *p
, void *buf
, size_t *size
);
174 /* reads directly (without buffer). It's same as ISeqInStream::Read */
175 SRes (*Seek
)(void *p
, Int64
*pos
, ESzSeek origin
);
178 SRes
LookInStream_LookRead(ILookInStream
*stream
, void *buf
, size_t *size
);
179 SRes
LookInStream_SeekTo(ILookInStream
*stream
, UInt64 offset
);
181 /* reads via ILookInStream::Read */
182 SRes
LookInStream_Read2(ILookInStream
*stream
, void *buf
, size_t size
, SRes errorType
);
183 SRes
LookInStream_Read(ILookInStream
*stream
, void *buf
, size_t size
);
185 #define LookToRead_BUF_SIZE (1 << 14)
190 ISeekInStream
*realStream
;
193 Byte buf
[LookToRead_BUF_SIZE
];
196 void LookToRead_CreateVTable(CLookToRead
*p
, int lookahead
);
197 void LookToRead_Init(CLookToRead
*p
);
202 ILookInStream
*realStream
;
205 void SecToLook_CreateVTable(CSecToLook
*p
);
210 ILookInStream
*realStream
;
213 void SecToRead_CreateVTable(CSecToRead
*p
);
217 SRes (*Progress
)(void *p
, UInt64 inSize
, UInt64 outSize
);
218 /* Returns: result. (result != SZ_OK) means break.
219 Value (UInt64)(Int64)-1 for size means unknown value. */
224 void *(*Alloc
)(void *p
, size_t size
);
225 void (*Free
)(void *p
, void *address
); /* address can be 0 */
228 #define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
229 #define IAlloc_Free(p, a) (p)->Free((p), a)