1
/* Types.h -- Basic types
2
2008-11-23 : Igor Pavlov : Public domain */
13
/* aCaB -- lame workaround for "Byte" refef */
18
#define SZ_ERROR_DATA 1
19
#define SZ_ERROR_MEM 2
20
#define SZ_ERROR_CRC 3
21
#define SZ_ERROR_UNSUPPORTED 4
22
#define SZ_ERROR_PARAM 5
23
#define SZ_ERROR_INPUT_EOF 6
24
#define SZ_ERROR_OUTPUT_EOF 7
25
#define SZ_ERROR_READ 8
26
#define SZ_ERROR_WRITE 9
27
#define SZ_ERROR_PROGRESS 10
28
#define SZ_ERROR_FAIL 11
29
#define SZ_ERROR_THREAD 12
31
#define SZ_ERROR_ARCHIVE 16
32
#define SZ_ERROR_NO_ARCHIVE 17
43
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
46
/* aCaB -- use Byte defined in zconf.h
47
typedef unsigned char Byte;
50
typedef unsigned short UInt16;
52
#ifdef _LZMA_UINT32_IS_ULONG
54
typedef unsigned long UInt32;
57
typedef unsigned int UInt32;
62
/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
63
NOTES: Some code will work incorrectly in that case! */
66
typedef unsigned long UInt64;
70
#if defined(_MSC_VER) || defined(__BORLANDC__)
71
typedef __int64 Int64;
72
typedef unsigned __int64 UInt64;
74
typedef long long int Int64;
75
typedef unsigned long long int UInt64;
80
#ifdef _LZMA_NO_SYSTEM_SIZE_T
94
#define MY_NO_INLINE __declspec(noinline)
99
#define MY_CDECL __cdecl
100
#define MY_STD_CALL __stdcall
101
#define MY_FAST_CALL MY_NO_INLINE __fastcall
112
/* The following interfaces use first parameter as pointer to structure */
116
SRes (*Read)(void *p, void *buf, size_t *size);
117
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
118
(output(*size) < input(*size)) is allowed */
121
/* it can return SZ_ERROR_INPUT_EOF */
122
SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
123
SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
124
SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
128
size_t (*Write)(void *p, const void *buf, size_t size);
129
/* Returns: result - the number of actually written bytes.
130
(result < size) means error */
142
SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
143
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
148
SRes (*Look)(void *p, void **buf, size_t *size);
149
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
150
(output(*size) > input(*size)) is not allowed
151
(output(*size) < input(*size)) is allowed */
152
SRes (*Skip)(void *p, size_t offset);
153
/* offset must be <= output(*size) of Look */
155
SRes (*Read)(void *p, void *buf, size_t *size);
156
/* reads directly (without buffer). It's same as ISeqInStream::Read */
157
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
160
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
161
SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
163
/* reads via ILookInStream::Read */
164
SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
165
SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
167
#define LookToRead_BUF_SIZE (1 << 14)
172
ISeekInStream *realStream;
175
Byte buf[LookToRead_BUF_SIZE];
178
void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
179
void LookToRead_Init(CLookToRead *p);
184
ILookInStream *realStream;
187
void SecToLook_CreateVTable(CSecToLook *p);
192
ILookInStream *realStream;
195
void SecToRead_CreateVTable(CSecToRead *p);
199
SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
200
/* Returns: result. (result != SZ_OK) means break.
201
Value (UInt64)(Int64)-1 for size means unknown value. */
206
void *(*Alloc)(void *p, size_t size);
207
void (*Free)(void *p, void *address); /* address can be 0 */
210
#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
211
#define IAlloc_Free(p, a) (p)->Free((p), a)