Parolin
0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
val
xcx_xz
xz-5.6.2
lzma.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: 0BSD */
2
25
/*
26
* Author: Lasse Collin
27
*/
28
29
#ifndef LZMA_H
30
#define LZMA_H
31
32
/*****************************
33
* Required standard headers *
34
*****************************/
35
36
/*
37
* liblzma API headers need some standard types and macros. To allow
38
* including lzma.h without requiring the application to include other
39
* headers first, lzma.h includes the required standard headers unless
40
* they already seem to be included already or if LZMA_MANUAL_HEADERS
41
* has been defined.
42
*
43
* Here's what types and macros are needed and from which headers:
44
* - stddef.h: size_t, NULL
45
* - stdint.h: uint8_t, uint32_t, uint64_t, UINT32_C(n), uint64_C(n),
46
* UINT32_MAX, UINT64_MAX
47
*
48
* However, inttypes.h is a little more portable than stdint.h, although
49
* inttypes.h declares some unneeded things compared to plain stdint.h.
50
*
51
* The hacks below aren't perfect, specifically they assume that inttypes.h
52
* exists and that it typedefs at least uint8_t, uint32_t, and uint64_t,
53
* and that, in case of incomplete inttypes.h, unsigned int is 32-bit.
54
* If the application already takes care of setting up all the types and
55
* macros properly (for example by using gnulib's stdint.h or inttypes.h),
56
* we try to detect that the macros are already defined and don't include
57
* inttypes.h here again. However, you may define LZMA_MANUAL_HEADERS to
58
* force this file to never include any system headers.
59
*
60
* Some could argue that liblzma API should provide all the required types,
61
* for example lzma_uint64, LZMA_UINT64_C(n), and LZMA_UINT64_MAX. This was
62
* seen as an unnecessary mess, since most systems already provide all the
63
* necessary types and macros in the standard headers.
64
*
65
* Note that liblzma API still has lzma_bool, because using stdbool.h would
66
* break C89 and C++ programs on many systems. sizeof(bool) in C99 isn't
67
* necessarily the same as sizeof(bool) in C++.
68
*/
69
70
#ifndef LZMA_MANUAL_HEADERS
71
/*
72
* I suppose this works portably also in C++. Note that in C++,
73
* we need to get size_t into the global namespace.
74
*/
75
# include <stddef.h>
76
77
/*
78
* Skip inttypes.h if we already have all the required macros. If we
79
* have the macros, we assume that we have the matching typedefs too.
80
*/
81
# if !defined(UINT32_C) || !defined(UINT64_C) \
82
|| !defined(UINT32_MAX) || !defined(UINT64_MAX)
83
/*
84
* MSVC versions older than 2013 have no C99 support, and
85
* thus they cannot be used to compile liblzma. Using an
86
* existing liblzma.dll with old MSVC can work though(*),
87
* but we need to define the required standard integer
88
* types here in a MSVC-specific way.
89
*
90
* (*) If you do this, the existing liblzma.dll probably uses
91
* a different runtime library than your MSVC-built
92
* application. Mixing runtimes is generally bad, but
93
* in this case it should work as long as you avoid
94
* the few rarely-needed liblzma functions that allocate
95
* memory and expect the caller to free it using free().
96
*/
97
# if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1800
98
typedef
unsigned
__int8 uint8_t;
99
typedef
unsigned
__int32 uint32_t;
100
typedef
unsigned
__int64 uint64_t;
101
# else
102
/* Use the standard inttypes.h. */
103
# ifdef __cplusplus
104
/*
105
* C99 sections 7.18.2 and 7.18.4 specify
106
* that C++ implementations define the limit
107
* and constant macros only if specifically
108
* requested. Note that if you want the
109
* format macros (PRIu64 etc.) too, you need
110
* to define __STDC_FORMAT_MACROS before
111
* including lzma.h, since re-including
112
* inttypes.h with __STDC_FORMAT_MACROS
113
* defined doesn't necessarily work.
114
*/
115
# ifndef __STDC_LIMIT_MACROS
116
# define __STDC_LIMIT_MACROS 1
117
# endif
118
# ifndef __STDC_CONSTANT_MACROS
119
# define __STDC_CONSTANT_MACROS 1
120
# endif
121
# endif
122
123
# include <inttypes.h>
124
# endif
125
126
/*
127
* Some old systems have only the typedefs in inttypes.h, and
128
* lack all the macros. For those systems, we need a few more
129
* hacks. We assume that unsigned int is 32-bit and unsigned
130
* long is either 32-bit or 64-bit. If these hacks aren't
131
* enough, the application has to setup the types manually
132
* before including lzma.h.
133
*/
134
# ifndef UINT32_C
135
# if defined(_WIN32) && defined(_MSC_VER)
136
# define UINT32_C(n) n ## UI32
137
# else
138
# define UINT32_C(n) n ## U
139
# endif
140
# endif
141
142
# ifndef UINT64_C
143
# if defined(_WIN32) && defined(_MSC_VER)
144
# define UINT64_C(n) n ## UI64
145
# else
146
/* Get ULONG_MAX. */
147
# include <limits.h>
148
# if ULONG_MAX == 4294967295UL
149
# define UINT64_C(n) n ## ULL
150
# else
151
# define UINT64_C(n) n ## UL
152
# endif
153
# endif
154
# endif
155
156
# ifndef UINT32_MAX
157
# define UINT32_MAX (UINT32_C(4294967295))
158
# endif
159
160
# ifndef UINT64_MAX
161
# define UINT64_MAX (UINT64_C(18446744073709551615))
162
# endif
163
# endif
164
#endif
/* ifdef LZMA_MANUAL_HEADERS */
165
166
167
/******************
168
* LZMA_API macro *
169
******************/
170
171
/*
172
* Some systems require that the functions and function pointers are
173
* declared specially in the headers. LZMA_API_IMPORT is for importing
174
* symbols and LZMA_API_CALL is to specify the calling convention.
175
*
176
* By default it is assumed that the application will link dynamically
177
* against liblzma. #define LZMA_API_STATIC in your application if you
178
* want to link against static liblzma. If you don't care about portability
179
* to operating systems like Windows, or at least don't care about linking
180
* against static liblzma on them, don't worry about LZMA_API_STATIC. That
181
* is, most developers will never need to use LZMA_API_STATIC.
182
*
183
* The GCC variants are a special case on Windows (Cygwin and MinGW-w64).
184
* We rely on GCC doing the right thing with its auto-import feature,
185
* and thus don't use __declspec(dllimport). This way developers don't
186
* need to worry about LZMA_API_STATIC. Also the calling convention is
187
* omitted on Cygwin but not on MinGW-w64.
188
*/
189
#ifndef LZMA_API_IMPORT
190
# if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__GNUC__)
191
# define LZMA_API_IMPORT __declspec(dllimport)
192
# else
193
# define LZMA_API_IMPORT
194
# endif
195
#endif
196
197
#ifndef LZMA_API_CALL
198
# if defined(_WIN32) && !defined(__CYGWIN__)
199
# define LZMA_API_CALL __cdecl
200
# else
201
# define LZMA_API_CALL
202
# endif
203
#endif
204
205
#ifndef LZMA_API
206
# define LZMA_API(type) LZMA_API_IMPORT type LZMA_API_CALL
207
#endif
208
209
210
/***********
211
* nothrow *
212
***********/
213
214
/*
215
* None of the functions in liblzma may throw an exception. Even
216
* the functions that use callback functions won't throw exceptions,
217
* because liblzma would break if a callback function threw an exception.
218
*/
219
#ifndef lzma_nothrow
220
# if defined(__cplusplus)
221
# if __cplusplus >= 201103L || (defined(_MSVC_LANG) \
222
&& _MSVC_LANG >= 201103L)
223
# define lzma_nothrow noexcept
224
# else
225
# define lzma_nothrow throw()
226
# endif
227
# elif defined(__GNUC__) && (__GNUC__ > 3 \
228
|| (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
229
# define lzma_nothrow __attribute__((__nothrow__))
230
# else
231
# define lzma_nothrow
232
# endif
233
#endif
234
235
236
/********************
237
* GNU C extensions *
238
********************/
239
240
/*
241
* GNU C extensions are used conditionally in the public API. It doesn't
242
* break anything if these are sometimes enabled and sometimes not, only
243
* affects warnings and optimizations.
244
*/
245
#if defined(__GNUC__) && __GNUC__ >= 3
246
# ifndef lzma_attribute
247
# define lzma_attribute(attr) __attribute__(attr)
248
# endif
249
250
/* warn_unused_result was added in GCC 3.4. */
251
# ifndef lzma_attr_warn_unused_result
252
# if __GNUC__ == 3 && __GNUC_MINOR__ < 4
253
# define lzma_attr_warn_unused_result
254
# endif
255
# endif
256
257
#else
258
# ifndef lzma_attribute
259
# define lzma_attribute(attr)
260
# endif
261
#endif
262
263
264
#ifndef lzma_attr_pure
265
# define lzma_attr_pure lzma_attribute((__pure__))
266
#endif
267
268
#ifndef lzma_attr_const
269
# define lzma_attr_const lzma_attribute((__const__))
270
#endif
271
272
#ifndef lzma_attr_warn_unused_result
273
# define lzma_attr_warn_unused_result \
274
lzma_attribute((__warn_unused_result__))
275
#endif
276
277
278
/**************
279
* Subheaders *
280
**************/
281
282
#ifdef __cplusplus
283
extern
"C"
{
284
#endif
285
286
/*
287
* Subheaders check that this is defined. It is to prevent including
288
* them directly from applications.
289
*/
290
#define LZMA_H_INTERNAL 1
291
292
/* Basic features */
293
#include "
lzma/version.h
"
294
#include "
lzma/base.h
"
295
#include "
lzma/vli.h
"
296
#include "
lzma/check.h
"
297
298
/* Filters */
299
#include "
lzma/filter.h
"
300
#include "
lzma/bcj.h
"
301
#include "
lzma/delta.h
"
302
#include "
lzma/lzma12.h
"
303
304
/* Container formats */
305
#include "
lzma/container.h
"
306
307
/* Advanced features */
308
#include "
lzma/stream_flags.h
"
309
#include "
lzma/block.h
"
310
#include "
lzma/index.h
"
311
#include "
lzma/index_hash.h
"
312
313
/* Hardware information */
314
#include "
lzma/hardware.h
"
315
316
/*
317
* All subheaders included. Undefine LZMA_H_INTERNAL to prevent applications
318
* re-including the subheaders.
319
*/
320
#undef LZMA_H_INTERNAL
321
322
#ifdef __cplusplus
323
}
324
#endif
325
326
#endif
/* ifndef LZMA_H */
delta.h
version.h
base.h
bcj.h
block.h
check.h
container.h
filter.h
hardware.h
index.h
index_hash.h
lzma12.h
stream_flags.h
vli.h
Generated by
1.12.0