chd 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +30 -0
- data/chd.gemspec +29 -0
- data/ext/chd.c +1008 -0
- data/ext/extconf.rb +60 -0
- data/lib/chd/cd.rb +272 -0
- data/lib/chd/metadata.rb +196 -0
- data/lib/chd/version.rb +4 -0
- data/lib/chd.rb +21 -0
- data/libchdr/CMakeLists.txt +104 -0
- data/libchdr/LICENSE.txt +24 -0
- data/libchdr/README.md +7 -0
- data/libchdr/deps/lzma-19.00/CMakeLists.txt +33 -0
- data/libchdr/deps/lzma-19.00/LICENSE +3 -0
- data/libchdr/deps/lzma-19.00/include/7zTypes.h +375 -0
- data/libchdr/deps/lzma-19.00/include/Alloc.h +51 -0
- data/libchdr/deps/lzma-19.00/include/Bra.h +64 -0
- data/libchdr/deps/lzma-19.00/include/Compiler.h +33 -0
- data/libchdr/deps/lzma-19.00/include/CpuArch.h +336 -0
- data/libchdr/deps/lzma-19.00/include/Delta.h +19 -0
- data/libchdr/deps/lzma-19.00/include/LzFind.h +121 -0
- data/libchdr/deps/lzma-19.00/include/LzHash.h +57 -0
- data/libchdr/deps/lzma-19.00/include/Lzma86.h +111 -0
- data/libchdr/deps/lzma-19.00/include/LzmaDec.h +234 -0
- data/libchdr/deps/lzma-19.00/include/LzmaEnc.h +76 -0
- data/libchdr/deps/lzma-19.00/include/LzmaLib.h +131 -0
- data/libchdr/deps/lzma-19.00/include/Precomp.h +10 -0
- data/libchdr/deps/lzma-19.00/include/Sort.h +18 -0
- data/libchdr/deps/lzma-19.00/lzma-history.txt +446 -0
- data/libchdr/deps/lzma-19.00/lzma.txt +328 -0
- data/libchdr/deps/lzma-19.00/lzma.vcxproj +543 -0
- data/libchdr/deps/lzma-19.00/lzma.vcxproj.filters +17 -0
- data/libchdr/deps/lzma-19.00/src/Alloc.c +455 -0
- data/libchdr/deps/lzma-19.00/src/Bra86.c +82 -0
- data/libchdr/deps/lzma-19.00/src/BraIA64.c +53 -0
- data/libchdr/deps/lzma-19.00/src/CpuArch.c +218 -0
- data/libchdr/deps/lzma-19.00/src/Delta.c +64 -0
- data/libchdr/deps/lzma-19.00/src/LzFind.c +1127 -0
- data/libchdr/deps/lzma-19.00/src/Lzma86Dec.c +54 -0
- data/libchdr/deps/lzma-19.00/src/LzmaDec.c +1185 -0
- data/libchdr/deps/lzma-19.00/src/LzmaEnc.c +1330 -0
- data/libchdr/deps/lzma-19.00/src/Sort.c +141 -0
- data/libchdr/deps/zlib-1.2.11/CMakeLists.txt +29 -0
- data/libchdr/deps/zlib-1.2.11/ChangeLog +1515 -0
- data/libchdr/deps/zlib-1.2.11/FAQ +368 -0
- data/libchdr/deps/zlib-1.2.11/INDEX +68 -0
- data/libchdr/deps/zlib-1.2.11/Makefile +5 -0
- data/libchdr/deps/zlib-1.2.11/Makefile.in +410 -0
- data/libchdr/deps/zlib-1.2.11/README +115 -0
- data/libchdr/deps/zlib-1.2.11/adler32.c +186 -0
- data/libchdr/deps/zlib-1.2.11/compress.c +86 -0
- data/libchdr/deps/zlib-1.2.11/configure +921 -0
- data/libchdr/deps/zlib-1.2.11/crc32.c +442 -0
- data/libchdr/deps/zlib-1.2.11/crc32.h +441 -0
- data/libchdr/deps/zlib-1.2.11/deflate.c +2163 -0
- data/libchdr/deps/zlib-1.2.11/deflate.h +349 -0
- data/libchdr/deps/zlib-1.2.11/doc/algorithm.txt +209 -0
- data/libchdr/deps/zlib-1.2.11/doc/rfc1950.txt +619 -0
- data/libchdr/deps/zlib-1.2.11/doc/rfc1951.txt +955 -0
- data/libchdr/deps/zlib-1.2.11/doc/rfc1952.txt +675 -0
- data/libchdr/deps/zlib-1.2.11/doc/txtvsbin.txt +107 -0
- data/libchdr/deps/zlib-1.2.11/gzclose.c +25 -0
- data/libchdr/deps/zlib-1.2.11/gzguts.h +218 -0
- data/libchdr/deps/zlib-1.2.11/gzlib.c +637 -0
- data/libchdr/deps/zlib-1.2.11/gzread.c +654 -0
- data/libchdr/deps/zlib-1.2.11/gzwrite.c +665 -0
- data/libchdr/deps/zlib-1.2.11/infback.c +640 -0
- data/libchdr/deps/zlib-1.2.11/inffast.c +323 -0
- data/libchdr/deps/zlib-1.2.11/inffast.h +11 -0
- data/libchdr/deps/zlib-1.2.11/inffixed.h +94 -0
- data/libchdr/deps/zlib-1.2.11/inflate.c +1561 -0
- data/libchdr/deps/zlib-1.2.11/inflate.h +125 -0
- data/libchdr/deps/zlib-1.2.11/inftrees.c +304 -0
- data/libchdr/deps/zlib-1.2.11/inftrees.h +62 -0
- data/libchdr/deps/zlib-1.2.11/make_vms.com +867 -0
- data/libchdr/deps/zlib-1.2.11/treebuild.xml +116 -0
- data/libchdr/deps/zlib-1.2.11/trees.c +1203 -0
- data/libchdr/deps/zlib-1.2.11/trees.h +128 -0
- data/libchdr/deps/zlib-1.2.11/uncompr.c +93 -0
- data/libchdr/deps/zlib-1.2.11/zconf.h +534 -0
- data/libchdr/deps/zlib-1.2.11/zconf.h.cmakein +536 -0
- data/libchdr/deps/zlib-1.2.11/zconf.h.in +534 -0
- data/libchdr/deps/zlib-1.2.11/zlib.3 +149 -0
- data/libchdr/deps/zlib-1.2.11/zlib.3.pdf +0 -0
- data/libchdr/deps/zlib-1.2.11/zlib.h +1912 -0
- data/libchdr/deps/zlib-1.2.11/zlib.map +94 -0
- data/libchdr/deps/zlib-1.2.11/zlib.pc.cmakein +13 -0
- data/libchdr/deps/zlib-1.2.11/zlib.pc.in +13 -0
- data/libchdr/deps/zlib-1.2.11/zlib2ansi +152 -0
- data/libchdr/deps/zlib-1.2.11/zutil.c +325 -0
- data/libchdr/deps/zlib-1.2.11/zutil.h +271 -0
- data/libchdr/include/dr_libs/dr_flac.h +12280 -0
- data/libchdr/include/libchdr/bitstream.h +43 -0
- data/libchdr/include/libchdr/cdrom.h +110 -0
- data/libchdr/include/libchdr/chd.h +427 -0
- data/libchdr/include/libchdr/chdconfig.h +10 -0
- data/libchdr/include/libchdr/coretypes.h +60 -0
- data/libchdr/include/libchdr/flac.h +50 -0
- data/libchdr/include/libchdr/huffman.h +90 -0
- data/libchdr/pkg-config.pc.in +10 -0
- data/libchdr/src/libchdr_bitstream.c +125 -0
- data/libchdr/src/libchdr_cdrom.c +415 -0
- data/libchdr/src/libchdr_chd.c +2744 -0
- data/libchdr/src/libchdr_flac.c +302 -0
- data/libchdr/src/libchdr_huffman.c +545 -0
- data/libchdr/src/link.T +5 -0
- data/libchdr/tests/CMakeLists.txt +2 -0
- data/libchdr/tests/benchmark.c +52 -0
- metadata +183 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
add_library(lzma STATIC
|
|
2
|
+
include/7zTypes.h
|
|
3
|
+
include/Alloc.h
|
|
4
|
+
include/Bra.h
|
|
5
|
+
include/Compiler.h
|
|
6
|
+
include/CpuArch.h
|
|
7
|
+
include/Delta.h
|
|
8
|
+
include/LzFind.h
|
|
9
|
+
include/LzHash.h
|
|
10
|
+
include/Lzma86.h
|
|
11
|
+
include/LzmaDec.h
|
|
12
|
+
include/LzmaEnc.h
|
|
13
|
+
include/LzmaLib.h
|
|
14
|
+
include/Precomp.h
|
|
15
|
+
include/Sort.h
|
|
16
|
+
src/Alloc.c
|
|
17
|
+
src/Bra86.c
|
|
18
|
+
src/BraIA64.c
|
|
19
|
+
src/CpuArch.c
|
|
20
|
+
src/Delta.c
|
|
21
|
+
src/LzFind.c
|
|
22
|
+
src/Lzma86Dec.c
|
|
23
|
+
src/LzmaDec.c
|
|
24
|
+
src/LzmaEnc.c
|
|
25
|
+
src/Sort.c
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_definitions(lzma PRIVATE _7ZIP_ST)
|
|
29
|
+
|
|
30
|
+
target_include_directories(lzma PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
31
|
+
target_include_directories(lzma INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
32
|
+
|
|
33
|
+
set_target_properties(lzma PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/* 7zTypes.h -- Basic types
|
|
2
|
+
2018-08-04 : Igor Pavlov : Public domain */
|
|
3
|
+
|
|
4
|
+
#ifndef __7Z_TYPES_H
|
|
5
|
+
#define __7Z_TYPES_H
|
|
6
|
+
|
|
7
|
+
#ifdef _WIN32
|
|
8
|
+
/* #include <windows.h> */
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
#include <stddef.h>
|
|
12
|
+
|
|
13
|
+
#ifndef EXTERN_C_BEGIN
|
|
14
|
+
#ifdef __cplusplus
|
|
15
|
+
#define EXTERN_C_BEGIN extern "C" {
|
|
16
|
+
#define EXTERN_C_END }
|
|
17
|
+
#else
|
|
18
|
+
#define EXTERN_C_BEGIN
|
|
19
|
+
#define EXTERN_C_END
|
|
20
|
+
#endif
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
EXTERN_C_BEGIN
|
|
24
|
+
|
|
25
|
+
#define SZ_OK 0
|
|
26
|
+
|
|
27
|
+
#define SZ_ERROR_DATA 1
|
|
28
|
+
#define SZ_ERROR_MEM 2
|
|
29
|
+
#define SZ_ERROR_CRC 3
|
|
30
|
+
#define SZ_ERROR_UNSUPPORTED 4
|
|
31
|
+
#define SZ_ERROR_PARAM 5
|
|
32
|
+
#define SZ_ERROR_INPUT_EOF 6
|
|
33
|
+
#define SZ_ERROR_OUTPUT_EOF 7
|
|
34
|
+
#define SZ_ERROR_READ 8
|
|
35
|
+
#define SZ_ERROR_WRITE 9
|
|
36
|
+
#define SZ_ERROR_PROGRESS 10
|
|
37
|
+
#define SZ_ERROR_FAIL 11
|
|
38
|
+
#define SZ_ERROR_THREAD 12
|
|
39
|
+
|
|
40
|
+
#define SZ_ERROR_ARCHIVE 16
|
|
41
|
+
#define SZ_ERROR_NO_ARCHIVE 17
|
|
42
|
+
|
|
43
|
+
typedef int SRes;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
#ifdef _WIN32
|
|
47
|
+
|
|
48
|
+
/* typedef DWORD WRes; */
|
|
49
|
+
typedef unsigned WRes;
|
|
50
|
+
#define MY_SRes_HRESULT_FROM_WRes(x) HRESULT_FROM_WIN32(x)
|
|
51
|
+
|
|
52
|
+
#else
|
|
53
|
+
|
|
54
|
+
typedef int WRes;
|
|
55
|
+
#define MY__FACILITY_WIN32 7
|
|
56
|
+
#define MY__FACILITY__WRes MY__FACILITY_WIN32
|
|
57
|
+
#define MY_SRes_HRESULT_FROM_WRes(x) ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : ((HRESULT) (((x) & 0x0000FFFF) | (MY__FACILITY__WRes << 16) | 0x80000000)))
|
|
58
|
+
|
|
59
|
+
#endif
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
#ifndef RINOK
|
|
63
|
+
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
typedef unsigned char Byte;
|
|
67
|
+
typedef short Int16;
|
|
68
|
+
typedef unsigned short UInt16;
|
|
69
|
+
|
|
70
|
+
#ifdef _LZMA_UINT32_IS_ULONG
|
|
71
|
+
typedef long Int32;
|
|
72
|
+
typedef unsigned long UInt32;
|
|
73
|
+
#else
|
|
74
|
+
typedef int Int32;
|
|
75
|
+
typedef unsigned int UInt32;
|
|
76
|
+
#endif
|
|
77
|
+
|
|
78
|
+
#ifdef _SZ_NO_INT_64
|
|
79
|
+
|
|
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! */
|
|
82
|
+
|
|
83
|
+
typedef long Int64;
|
|
84
|
+
typedef unsigned long UInt64;
|
|
85
|
+
|
|
86
|
+
#else
|
|
87
|
+
|
|
88
|
+
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
|
89
|
+
typedef __int64 Int64;
|
|
90
|
+
typedef unsigned __int64 UInt64;
|
|
91
|
+
#define UINT64_CONST(n) n
|
|
92
|
+
#else
|
|
93
|
+
typedef long long int Int64;
|
|
94
|
+
typedef unsigned long long int UInt64;
|
|
95
|
+
#define UINT64_CONST(n) n ## ULL
|
|
96
|
+
#endif
|
|
97
|
+
|
|
98
|
+
#endif
|
|
99
|
+
|
|
100
|
+
#ifdef _LZMA_NO_SYSTEM_SIZE_T
|
|
101
|
+
typedef UInt32 SizeT;
|
|
102
|
+
#else
|
|
103
|
+
typedef size_t SizeT;
|
|
104
|
+
#endif
|
|
105
|
+
|
|
106
|
+
typedef int BoolInt;
|
|
107
|
+
/* typedef BoolInt Bool; */
|
|
108
|
+
#define True 1
|
|
109
|
+
#define False 0
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
#ifdef _WIN32
|
|
113
|
+
#define MY_STD_CALL __stdcall
|
|
114
|
+
#else
|
|
115
|
+
#define MY_STD_CALL
|
|
116
|
+
#endif
|
|
117
|
+
|
|
118
|
+
#ifdef _MSC_VER
|
|
119
|
+
|
|
120
|
+
#if _MSC_VER >= 1300
|
|
121
|
+
#define MY_NO_INLINE __declspec(noinline)
|
|
122
|
+
#else
|
|
123
|
+
#define MY_NO_INLINE
|
|
124
|
+
#endif
|
|
125
|
+
|
|
126
|
+
#define MY_FORCE_INLINE __forceinline
|
|
127
|
+
|
|
128
|
+
#define MY_CDECL __cdecl
|
|
129
|
+
#define MY_FAST_CALL __fastcall
|
|
130
|
+
|
|
131
|
+
#else
|
|
132
|
+
|
|
133
|
+
#define MY_NO_INLINE
|
|
134
|
+
#define MY_FORCE_INLINE
|
|
135
|
+
#define MY_CDECL
|
|
136
|
+
#define MY_FAST_CALL
|
|
137
|
+
|
|
138
|
+
/* inline keyword : for C++ / C99 */
|
|
139
|
+
|
|
140
|
+
/* GCC, clang: */
|
|
141
|
+
/*
|
|
142
|
+
#if defined (__GNUC__) && (__GNUC__ >= 4)
|
|
143
|
+
#define MY_FORCE_INLINE __attribute__((always_inline))
|
|
144
|
+
#define MY_NO_INLINE __attribute__((noinline))
|
|
145
|
+
#endif
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
#endif
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
/* The following interfaces use first parameter as pointer to structure */
|
|
152
|
+
|
|
153
|
+
typedef struct IByteIn IByteIn;
|
|
154
|
+
struct IByteIn
|
|
155
|
+
{
|
|
156
|
+
Byte (*Read)(const IByteIn *p); /* reads one byte, returns 0 in case of EOF or error */
|
|
157
|
+
};
|
|
158
|
+
#define IByteIn_Read(p) (p)->Read(p)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
typedef struct IByteOut IByteOut;
|
|
162
|
+
struct IByteOut
|
|
163
|
+
{
|
|
164
|
+
void (*Write)(const IByteOut *p, Byte b);
|
|
165
|
+
};
|
|
166
|
+
#define IByteOut_Write(p, b) (p)->Write(p, b)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
typedef struct ISeqInStream ISeqInStream;
|
|
170
|
+
struct ISeqInStream
|
|
171
|
+
{
|
|
172
|
+
SRes (*Read)(const ISeqInStream *p, void *buf, size_t *size);
|
|
173
|
+
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
|
174
|
+
(output(*size) < input(*size)) is allowed */
|
|
175
|
+
};
|
|
176
|
+
#define ISeqInStream_Read(p, buf, size) (p)->Read(p, buf, size)
|
|
177
|
+
|
|
178
|
+
/* it can return SZ_ERROR_INPUT_EOF */
|
|
179
|
+
SRes SeqInStream_Read(const ISeqInStream *stream, void *buf, size_t size);
|
|
180
|
+
SRes SeqInStream_Read2(const ISeqInStream *stream, void *buf, size_t size, SRes errorType);
|
|
181
|
+
SRes SeqInStream_ReadByte(const ISeqInStream *stream, Byte *buf);
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
typedef struct ISeqOutStream ISeqOutStream;
|
|
185
|
+
struct ISeqOutStream
|
|
186
|
+
{
|
|
187
|
+
size_t (*Write)(const ISeqOutStream *p, const void *buf, size_t size);
|
|
188
|
+
/* Returns: result - the number of actually written bytes.
|
|
189
|
+
(result < size) means error */
|
|
190
|
+
};
|
|
191
|
+
#define ISeqOutStream_Write(p, buf, size) (p)->Write(p, buf, size)
|
|
192
|
+
|
|
193
|
+
typedef enum
|
|
194
|
+
{
|
|
195
|
+
SZ_SEEK_SET = 0,
|
|
196
|
+
SZ_SEEK_CUR = 1,
|
|
197
|
+
SZ_SEEK_END = 2
|
|
198
|
+
} ESzSeek;
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
typedef struct ISeekInStream ISeekInStream;
|
|
202
|
+
struct ISeekInStream
|
|
203
|
+
{
|
|
204
|
+
SRes (*Read)(const ISeekInStream *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
|
|
205
|
+
SRes (*Seek)(const ISeekInStream *p, Int64 *pos, ESzSeek origin);
|
|
206
|
+
};
|
|
207
|
+
#define ISeekInStream_Read(p, buf, size) (p)->Read(p, buf, size)
|
|
208
|
+
#define ISeekInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
typedef struct ILookInStream ILookInStream;
|
|
212
|
+
struct ILookInStream
|
|
213
|
+
{
|
|
214
|
+
SRes (*Look)(const ILookInStream *p, const void **buf, size_t *size);
|
|
215
|
+
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
|
216
|
+
(output(*size) > input(*size)) is not allowed
|
|
217
|
+
(output(*size) < input(*size)) is allowed */
|
|
218
|
+
SRes (*Skip)(const ILookInStream *p, size_t offset);
|
|
219
|
+
/* offset must be <= output(*size) of Look */
|
|
220
|
+
|
|
221
|
+
SRes (*Read)(const ILookInStream *p, void *buf, size_t *size);
|
|
222
|
+
/* reads directly (without buffer). It's same as ISeqInStream::Read */
|
|
223
|
+
SRes (*Seek)(const ILookInStream *p, Int64 *pos, ESzSeek origin);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
#define ILookInStream_Look(p, buf, size) (p)->Look(p, buf, size)
|
|
227
|
+
#define ILookInStream_Skip(p, offset) (p)->Skip(p, offset)
|
|
228
|
+
#define ILookInStream_Read(p, buf, size) (p)->Read(p, buf, size)
|
|
229
|
+
#define ILookInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
SRes LookInStream_LookRead(const ILookInStream *stream, void *buf, size_t *size);
|
|
233
|
+
SRes LookInStream_SeekTo(const ILookInStream *stream, UInt64 offset);
|
|
234
|
+
|
|
235
|
+
/* reads via ILookInStream::Read */
|
|
236
|
+
SRes LookInStream_Read2(const ILookInStream *stream, void *buf, size_t size, SRes errorType);
|
|
237
|
+
SRes LookInStream_Read(const ILookInStream *stream, void *buf, size_t size);
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
typedef struct
|
|
242
|
+
{
|
|
243
|
+
ILookInStream vt;
|
|
244
|
+
const ISeekInStream *realStream;
|
|
245
|
+
|
|
246
|
+
size_t pos;
|
|
247
|
+
size_t size; /* it's data size */
|
|
248
|
+
|
|
249
|
+
/* the following variables must be set outside */
|
|
250
|
+
Byte *buf;
|
|
251
|
+
size_t bufSize;
|
|
252
|
+
} CLookToRead2;
|
|
253
|
+
|
|
254
|
+
void LookToRead2_CreateVTable(CLookToRead2 *p, int lookahead);
|
|
255
|
+
|
|
256
|
+
#define LookToRead2_Init(p) { (p)->pos = (p)->size = 0; }
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
typedef struct
|
|
260
|
+
{
|
|
261
|
+
ISeqInStream vt;
|
|
262
|
+
const ILookInStream *realStream;
|
|
263
|
+
} CSecToLook;
|
|
264
|
+
|
|
265
|
+
void SecToLook_CreateVTable(CSecToLook *p);
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
typedef struct
|
|
270
|
+
{
|
|
271
|
+
ISeqInStream vt;
|
|
272
|
+
const ILookInStream *realStream;
|
|
273
|
+
} CSecToRead;
|
|
274
|
+
|
|
275
|
+
void SecToRead_CreateVTable(CSecToRead *p);
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
typedef struct ICompressProgress ICompressProgress;
|
|
279
|
+
|
|
280
|
+
struct ICompressProgress
|
|
281
|
+
{
|
|
282
|
+
SRes (*Progress)(const ICompressProgress *p, UInt64 inSize, UInt64 outSize);
|
|
283
|
+
/* Returns: result. (result != SZ_OK) means break.
|
|
284
|
+
Value (UInt64)(Int64)-1 for size means unknown value. */
|
|
285
|
+
};
|
|
286
|
+
#define ICompressProgress_Progress(p, inSize, outSize) (p)->Progress(p, inSize, outSize)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
typedef struct ISzAlloc ISzAlloc;
|
|
291
|
+
typedef const ISzAlloc * ISzAllocPtr;
|
|
292
|
+
|
|
293
|
+
struct ISzAlloc
|
|
294
|
+
{
|
|
295
|
+
void *(*Alloc)(ISzAllocPtr p, size_t size);
|
|
296
|
+
void (*Free)(ISzAllocPtr p, void *address); /* address can be 0 */
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
#define ISzAlloc_Alloc(p, size) (p)->Alloc(p, size)
|
|
300
|
+
#define ISzAlloc_Free(p, a) (p)->Free(p, a)
|
|
301
|
+
|
|
302
|
+
/* deprecated */
|
|
303
|
+
#define IAlloc_Alloc(p, size) ISzAlloc_Alloc(p, size)
|
|
304
|
+
#define IAlloc_Free(p, a) ISzAlloc_Free(p, a)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
#ifndef MY_offsetof
|
|
311
|
+
#ifdef offsetof
|
|
312
|
+
#define MY_offsetof(type, m) offsetof(type, m)
|
|
313
|
+
/*
|
|
314
|
+
#define MY_offsetof(type, m) FIELD_OFFSET(type, m)
|
|
315
|
+
*/
|
|
316
|
+
#else
|
|
317
|
+
#define MY_offsetof(type, m) ((size_t)&(((type *)0)->m))
|
|
318
|
+
#endif
|
|
319
|
+
#endif
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
#ifndef MY_container_of
|
|
324
|
+
|
|
325
|
+
/*
|
|
326
|
+
#define MY_container_of(ptr, type, m) container_of(ptr, type, m)
|
|
327
|
+
#define MY_container_of(ptr, type, m) CONTAINING_RECORD(ptr, type, m)
|
|
328
|
+
#define MY_container_of(ptr, type, m) ((type *)((char *)(ptr) - offsetof(type, m)))
|
|
329
|
+
#define MY_container_of(ptr, type, m) (&((type *)0)->m == (ptr), ((type *)(((char *)(ptr)) - MY_offsetof(type, m))))
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
/*
|
|
333
|
+
GCC shows warning: "perhaps the 'offsetof' macro was used incorrectly"
|
|
334
|
+
GCC 3.4.4 : classes with constructor
|
|
335
|
+
GCC 4.8.1 : classes with non-public variable members"
|
|
336
|
+
*/
|
|
337
|
+
|
|
338
|
+
#define MY_container_of(ptr, type, m) ((type *)((char *)(1 ? (ptr) : &((type *)0)->m) - MY_offsetof(type, m)))
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
#endif
|
|
342
|
+
|
|
343
|
+
#define CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(ptr))
|
|
344
|
+
|
|
345
|
+
/*
|
|
346
|
+
#define CONTAINER_FROM_VTBL(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
|
|
347
|
+
*/
|
|
348
|
+
#define CONTAINER_FROM_VTBL(ptr, type, m) MY_container_of(ptr, type, m)
|
|
349
|
+
|
|
350
|
+
#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
|
|
351
|
+
/*
|
|
352
|
+
#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL(ptr, type, m)
|
|
353
|
+
*/
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
#ifdef _WIN32
|
|
358
|
+
|
|
359
|
+
#define CHAR_PATH_SEPARATOR '\\'
|
|
360
|
+
#define WCHAR_PATH_SEPARATOR L'\\'
|
|
361
|
+
#define STRING_PATH_SEPARATOR "\\"
|
|
362
|
+
#define WSTRING_PATH_SEPARATOR L"\\"
|
|
363
|
+
|
|
364
|
+
#else
|
|
365
|
+
|
|
366
|
+
#define CHAR_PATH_SEPARATOR '/'
|
|
367
|
+
#define WCHAR_PATH_SEPARATOR L'/'
|
|
368
|
+
#define STRING_PATH_SEPARATOR "/"
|
|
369
|
+
#define WSTRING_PATH_SEPARATOR L"/"
|
|
370
|
+
|
|
371
|
+
#endif
|
|
372
|
+
|
|
373
|
+
EXTERN_C_END
|
|
374
|
+
|
|
375
|
+
#endif
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* Alloc.h -- Memory allocation functions
|
|
2
|
+
2018-02-19 : Igor Pavlov : Public domain */
|
|
3
|
+
|
|
4
|
+
#ifndef __COMMON_ALLOC_H
|
|
5
|
+
#define __COMMON_ALLOC_H
|
|
6
|
+
|
|
7
|
+
#include "7zTypes.h"
|
|
8
|
+
|
|
9
|
+
EXTERN_C_BEGIN
|
|
10
|
+
|
|
11
|
+
void *MyAlloc(size_t size);
|
|
12
|
+
void MyFree(void *address);
|
|
13
|
+
|
|
14
|
+
#ifdef _WIN32
|
|
15
|
+
|
|
16
|
+
void SetLargePageSize();
|
|
17
|
+
|
|
18
|
+
void *MidAlloc(size_t size);
|
|
19
|
+
void MidFree(void *address);
|
|
20
|
+
void *BigAlloc(size_t size);
|
|
21
|
+
void BigFree(void *address);
|
|
22
|
+
|
|
23
|
+
#else
|
|
24
|
+
|
|
25
|
+
#define MidAlloc(size) MyAlloc(size)
|
|
26
|
+
#define MidFree(address) MyFree(address)
|
|
27
|
+
#define BigAlloc(size) MyAlloc(size)
|
|
28
|
+
#define BigFree(address) MyFree(address)
|
|
29
|
+
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
extern const ISzAlloc g_Alloc;
|
|
33
|
+
extern const ISzAlloc g_BigAlloc;
|
|
34
|
+
extern const ISzAlloc g_MidAlloc;
|
|
35
|
+
extern const ISzAlloc g_AlignedAlloc;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
typedef struct
|
|
39
|
+
{
|
|
40
|
+
ISzAlloc vt;
|
|
41
|
+
ISzAllocPtr baseAlloc;
|
|
42
|
+
unsigned numAlignBits; /* ((1 << numAlignBits) >= sizeof(void *)) */
|
|
43
|
+
size_t offset; /* (offset == (k * sizeof(void *)) && offset < (1 << numAlignBits) */
|
|
44
|
+
} CAlignOffsetAlloc;
|
|
45
|
+
|
|
46
|
+
void AlignOffsetAlloc_CreateVTable(CAlignOffsetAlloc *p);
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
EXTERN_C_END
|
|
50
|
+
|
|
51
|
+
#endif
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* Bra.h -- Branch converters for executables
|
|
2
|
+
2013-01-18 : Igor Pavlov : Public domain */
|
|
3
|
+
|
|
4
|
+
#ifndef __BRA_H
|
|
5
|
+
#define __BRA_H
|
|
6
|
+
|
|
7
|
+
#include "7zTypes.h"
|
|
8
|
+
|
|
9
|
+
EXTERN_C_BEGIN
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
These functions convert relative addresses to absolute addresses
|
|
13
|
+
in CALL instructions to increase the compression ratio.
|
|
14
|
+
|
|
15
|
+
In:
|
|
16
|
+
data - data buffer
|
|
17
|
+
size - size of data
|
|
18
|
+
ip - current virtual Instruction Pinter (IP) value
|
|
19
|
+
state - state variable for x86 converter
|
|
20
|
+
encoding - 0 (for decoding), 1 (for encoding)
|
|
21
|
+
|
|
22
|
+
Out:
|
|
23
|
+
state - state variable for x86 converter
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
The number of processed bytes. If you call these functions with multiple calls,
|
|
27
|
+
you must start next call with first byte after block of processed bytes.
|
|
28
|
+
|
|
29
|
+
Type Endian Alignment LookAhead
|
|
30
|
+
|
|
31
|
+
x86 little 1 4
|
|
32
|
+
ARMT little 2 2
|
|
33
|
+
ARM little 4 0
|
|
34
|
+
PPC big 4 0
|
|
35
|
+
SPARC big 4 0
|
|
36
|
+
IA64 little 16 0
|
|
37
|
+
|
|
38
|
+
size must be >= Alignment + LookAhead, if it's not last block.
|
|
39
|
+
If (size < Alignment + LookAhead), converter returns 0.
|
|
40
|
+
|
|
41
|
+
Example:
|
|
42
|
+
|
|
43
|
+
UInt32 ip = 0;
|
|
44
|
+
for ()
|
|
45
|
+
{
|
|
46
|
+
; size must be >= Alignment + LookAhead, if it's not last block
|
|
47
|
+
SizeT processed = Convert(data, size, ip, 1);
|
|
48
|
+
data += processed;
|
|
49
|
+
size -= processed;
|
|
50
|
+
ip += processed;
|
|
51
|
+
}
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
#define x86_Convert_Init(state) { state = 0; }
|
|
55
|
+
SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
|
|
56
|
+
SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
|
57
|
+
SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
|
58
|
+
SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
|
59
|
+
SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
|
60
|
+
SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
|
|
61
|
+
|
|
62
|
+
EXTERN_C_END
|
|
63
|
+
|
|
64
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* Compiler.h
|
|
2
|
+
2017-04-03 : Igor Pavlov : Public domain */
|
|
3
|
+
|
|
4
|
+
#ifndef __7Z_COMPILER_H
|
|
5
|
+
#define __7Z_COMPILER_H
|
|
6
|
+
|
|
7
|
+
#ifdef _MSC_VER
|
|
8
|
+
|
|
9
|
+
#ifdef UNDER_CE
|
|
10
|
+
#define RPC_NO_WINDOWS_H
|
|
11
|
+
/* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */
|
|
12
|
+
#pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
|
|
13
|
+
#pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
#if _MSC_VER >= 1300
|
|
17
|
+
#pragma warning(disable : 4996) // This function or variable may be unsafe
|
|
18
|
+
#else
|
|
19
|
+
#pragma warning(disable : 4511) // copy constructor could not be generated
|
|
20
|
+
#pragma warning(disable : 4512) // assignment operator could not be generated
|
|
21
|
+
#pragma warning(disable : 4514) // unreferenced inline function has been removed
|
|
22
|
+
#pragma warning(disable : 4702) // unreachable code
|
|
23
|
+
#pragma warning(disable : 4710) // not inlined
|
|
24
|
+
#pragma warning(disable : 4714) // function marked as __forceinline not inlined
|
|
25
|
+
#pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
#define UNUSED_VAR(x) (void)x;
|
|
31
|
+
/* #define UNUSED_VAR(x) x=x; */
|
|
32
|
+
|
|
33
|
+
#endif
|