summaryrefslogtreecommitdiff
path: root/archival/libunarchive/unxz/xz.h
diff options
context:
space:
mode:
Diffstat (limited to 'archival/libunarchive/unxz/xz.h')
-rw-r--r--archival/libunarchive/unxz/xz.h58
1 files changed, 36 insertions, 22 deletions
diff --git a/archival/libunarchive/unxz/xz.h b/archival/libunarchive/unxz/xz.h
index dbb9ba92d..eb82706b9 100644
--- a/archival/libunarchive/unxz/xz.h
+++ b/archival/libunarchive/unxz/xz.h
@@ -31,20 +31,29 @@
31 31
32/** 32/**
33 * enum xz_ret - Return codes 33 * enum xz_ret - Return codes
34 * @XZ_OK: Everything is OK so far. More input or more output 34 * @XZ_OK: Everything is OK so far. More input or more
35 * space is required to continue. 35 * output space is required to continue.
36 * @XZ_STREAM_END: Operation finished successfully. 36 * @XZ_STREAM_END: Operation finished successfully.
37 * @XZ_MEMLIMIT_ERROR: Not enough memory was preallocated at decoder 37 * @XZ_UNSUPPORTED_CHECK: Integrity check type is not supported. Decoding
38 * initialization time. 38 * is still possible in multi-call mode by simply
39 * @XZ_FORMAT_ERROR: File format was not recognized (wrong magic bytes). 39 * calling xz_dec_run() again.
40 * @XZ_OPTIONS_ERROR: This implementation doesn't support the requested 40 * NOTE: This return value is used only if
41 * compression options. In the decoder this means that 41 * XZ_DEC_ANY_CHECK was defined at build time,
42 * the header CRC32 matches, but the header itself 42 * which is not used in the kernel. Unsupported
43 * specifies something that we don't support. 43 * check types return XZ_OPTIONS_ERROR if
44 * @XZ_DATA_ERROR: Compressed data is corrupt. 44 * XZ_DEC_ANY_CHECK was not defined at build time.
45 * @XZ_BUF_ERROR: Cannot make any progress. Details are slightly 45 * @XZ_MEMLIMIT_ERROR: Not enough memory was preallocated at decoder
46 * different between multi-call and single-call mode; 46 * initialization time.
47 * more information below. 47 * @XZ_FORMAT_ERROR: File format was not recognized (wrong magic
48 * bytes).
49 * @XZ_OPTIONS_ERROR: This implementation doesn't support the requested
50 * compression options. In the decoder this means
51 * that the header CRC32 matches, but the header
52 * itself specifies something that we don't support.
53 * @XZ_DATA_ERROR: Compressed data is corrupt.
54 * @XZ_BUF_ERROR: Cannot make any progress. Details are slightly
55 * different between multi-call and single-call
56 * mode; more information below.
48 * 57 *
49 * In multi-call mode, XZ_BUF_ERROR is returned when two consecutive calls 58 * In multi-call mode, XZ_BUF_ERROR is returned when two consecutive calls
50 * to XZ code cannot consume any input and cannot produce any new output. 59 * to XZ code cannot consume any input and cannot produce any new output.
@@ -62,6 +71,7 @@
62enum xz_ret { 71enum xz_ret {
63 XZ_OK, 72 XZ_OK,
64 XZ_STREAM_END, 73 XZ_STREAM_END,
74 XZ_UNSUPPORTED_CHECK,
65 XZ_MEMLIMIT_ERROR, 75 XZ_MEMLIMIT_ERROR,
66 XZ_FORMAT_ERROR, 76 XZ_FORMAT_ERROR,
67 XZ_OPTIONS_ERROR, 77 XZ_OPTIONS_ERROR,
@@ -129,7 +139,7 @@ struct xz_dec;
129 * 139 *
130 * Because the output buffer is used as the workspace, streams encoded using 140 * Because the output buffer is used as the workspace, streams encoded using
131 * a big dictionary are not a problem in single-call. It is enough that the 141 * a big dictionary are not a problem in single-call. It is enough that the
132 * output buffer is is big enough to hold the actual uncompressed data; it 142 * output buffer is big enough to hold the actual uncompressed data; it
133 * can be smaller than the dictionary size stored in the stream headers. 143 * can be smaller than the dictionary size stored in the stream headers.
134 * 144 *
135 * On success, xz_dec_init() returns a pointer to struct xz_dec, which is 145 * On success, xz_dec_init() returns a pointer to struct xz_dec, which is
@@ -186,23 +196,27 @@ XZ_EXTERN void XZ_FUNC xz_dec_end(struct xz_dec *s);
186 * CRC32 module is used instead, and users of this module don't need to 196 * CRC32 module is used instead, and users of this module don't need to
187 * care about the functions below. 197 * care about the functions below.
188 */ 198 */
189#if !defined(__KERNEL__) || defined(XZ_INTERNAL_CRC32) 199#ifndef XZ_INTERNAL_CRC32
200# ifdef __KERNEL__
201# define XZ_INTERNAL_CRC32 0
202# else
203# define XZ_INTERNAL_CRC32 1
204# endif
205#endif
206
207#if XZ_INTERNAL_CRC32
190/* 208/*
191 * This must be called before any other xz_* function to initialize 209 * This must be called before any other xz_* function to initialize
192 * the CRC32 lookup table. 210 * the CRC32 lookup table.
193 */ 211 */
194#ifndef xz_crc32_init 212XZ_EXTERN void XZ_FUNC xz_crc32_init(void);
195XZ_EXTERN void XZ_FUNC xz_crc32_init(uint32_t *crc32_table);
196#endif
197 213
198/* 214/*
199 * Update CRC32 value using the polynomial from IEEE-802.3. To start a new 215 * Update CRC32 value using the polynomial from IEEE-802.3. To start a new
200 * calculation, the third argument must be zero. To continue the calculation, 216 * calculation, the third argument must be zero. To continue the calculation,
201 * the previously returned value is passed as the third argument. 217 * the previously returned value is passed as the third argument.
202 */ 218 */
203#ifndef xz_crc32 219XZ_EXTERN uint32_t XZ_FUNC xz_crc32(
204XZ_EXTERN uint32_t XZ_FUNC xz_crc32(uint32_t *crc32_table,
205 const uint8_t *buf, size_t size, uint32_t crc); 220 const uint8_t *buf, size_t size, uint32_t crc);
206#endif 221#endif
207#endif 222#endif
208#endif