From 86757b7e62ce6e3a30c66eda2f2aeacbfe2450d6 Mon Sep 17 00:00:00 2001 From: "josh.macdonald" Date: Thu, 19 Jul 2012 07:05:59 +0000 Subject: Add support for lzma secondary compression (-S lzma) --- xdelta3/config.h.in | 6 ++ xdelta3/configure.ac | 2 + xdelta3/ltmain.sh | 2 +- xdelta3/m4/ltversion.m4 | 2 +- xdelta3/xdelta3-decode.h | 2 + xdelta3/xdelta3-djw.h | 9 ++- xdelta3/xdelta3-fgk.h | 8 +- xdelta3/xdelta3-lzma.h | 185 +++++++++++++++++++++++++++++++++++++++++++++++ xdelta3/xdelta3-main.h | 4 + xdelta3/xdelta3-second.h | 38 +++++----- xdelta3/xdelta3-test.h | 10 ++- xdelta3/xdelta3.c | 59 ++++++++++++--- xdelta3/xdelta3.h | 8 +- 13 files changed, 292 insertions(+), 43 deletions(-) create mode 100644 xdelta3/xdelta3-lzma.h diff --git a/xdelta3/config.h.in b/xdelta3/config.h.in index 19266b3..50345b3 100644 --- a/xdelta3/config.h.in +++ b/xdelta3/config.h.in @@ -6,6 +6,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `lzma' library (-llzma). */ +#undef HAVE_LIBLZMA + +/* Define to 1 if you have the header file. */ +#undef HAVE_LZMA_H + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H diff --git a/xdelta3/configure.ac b/xdelta3/configure.ac index 8d1707f..70b733a 100644 --- a/xdelta3/configure.ac +++ b/xdelta3/configure.ac @@ -7,6 +7,8 @@ AM_INIT_AUTOMAKE([1.9 no-define foreign tar-ustar]) AC_DISABLE_STATIC AC_PROG_CC AC_PROG_CXX +AC_CHECK_HEADERS([lzma.h]) +AC_CHECK_LIB(lzma, lzma_easy_buffer_encode) #AM_PATH_PYTHON(,, [:]) #AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) #AX_PYTHON_DEVEL() diff --git a/xdelta3/ltmain.sh b/xdelta3/ltmain.sh index 4159958..377d47b 120000 --- a/xdelta3/ltmain.sh +++ b/xdelta3/ltmain.sh @@ -1 +1 @@ -/usr/share/libtool/config/ltmain.sh \ No newline at end of file +/usr/local/share/libtool/config/ltmain.sh \ No newline at end of file diff --git a/xdelta3/m4/ltversion.m4 b/xdelta3/m4/ltversion.m4 index 5eb474f..f5bd471 120000 --- a/xdelta3/m4/ltversion.m4 +++ b/xdelta3/m4/ltversion.m4 @@ -1 +1 @@ -/usr/share/aclocal/ltversion.m4 \ No newline at end of file +/usr/local/share/aclocal/ltversion.m4 \ No newline at end of file diff --git a/xdelta3/xdelta3-decode.h b/xdelta3/xdelta3-decode.h index d33a79e..c0cb578 100644 --- a/xdelta3/xdelta3-decode.h +++ b/xdelta3/xdelta3-decode.h @@ -807,6 +807,8 @@ xd3_decode_input (xd3_stream *stream) FGK_CASE (stream); case VCD_DJW_ID: DJW_CASE (stream); + case VCD_LZMA_ID: + LZMA_CASE (stream); default: stream->msg = "unknown secondary compressor ID"; return XD3_INVALID_INPUT; diff --git a/xdelta3/xdelta3-djw.h b/xdelta3/xdelta3-djw.h index be9cbf2..d6e2881 100644 --- a/xdelta3/xdelta3-djw.h +++ b/xdelta3/xdelta3-djw.h @@ -200,7 +200,9 @@ static const uint8_t djw_encode_12basic[DJW_BASIC_CODES] = /*********************************************************************/ static djw_stream* djw_alloc (xd3_stream *stream); -static void djw_init (djw_stream *h); +static int djw_init (xd3_stream *stream, + djw_stream *h, + int is_encode); static void djw_destroy (xd3_stream *stream, djw_stream *h); @@ -229,10 +231,11 @@ djw_alloc (xd3_stream *stream) return (djw_stream*) xd3_alloc (stream, sizeof (djw_stream), 1); } -static void -djw_init (djw_stream *h) +static int +djw_init (xd3_stream *stream, djw_stream *h, int is_encode) { /* Fields are initialized prior to use. */ + return 0; } static void diff --git a/xdelta3/xdelta3-fgk.h b/xdelta3/xdelta3-fgk.h index 6c61a96..7011500 100644 --- a/xdelta3/xdelta3-fgk.h +++ b/xdelta3/xdelta3-fgk.h @@ -106,7 +106,9 @@ struct _fgk_stream /*********************************************************************/ static fgk_stream* fgk_alloc (xd3_stream *stream /*, usize_t alphabet_size */); -static void fgk_init (fgk_stream *h); +static int fgk_init (xd3_stream *stream, + fgk_stream *h, + int is_encode); static int fgk_encode_data (fgk_stream *h, usize_t n); static inline fgk_bit fgk_get_encoded_bit (fgk_stream *h); @@ -186,7 +188,7 @@ static fgk_stream* fgk_alloc (xd3_stream *stream /*, int alphabet_size0 */) return h; } -static void fgk_init (fgk_stream *h) +static int fgk_init (xd3_stream *stream, fgk_stream *h, int is_encode) { usize_t ui; ssize_t si; @@ -219,6 +221,8 @@ static void fgk_init (fgk_stream *h) { fgk_init_node (h->alphabet + si, (usize_t) si, h->alphabet_size); } + + return 0; } static void fgk_swap_ptrs(fgk_node **one, fgk_node **two) diff --git a/xdelta3/xdelta3-lzma.h b/xdelta3/xdelta3-lzma.h new file mode 100644 index 0000000..aa48e84 --- /dev/null +++ b/xdelta3/xdelta3-lzma.h @@ -0,0 +1,185 @@ +/* xdelta 3 - delta compression tools and library + * Copyright (C) 2012. Joshua P. MacDonald + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* Note: The use of the _easy_ decoder means we're not calling the + * xd3_stream malloc hooks. TODO(jmacd) Fix if anyone cares. */ + +#ifndef _XDELTA3_LZMA_H_ +#define _XDELTA3_LZMA_H_ + +#include + +typedef struct _xd3_lzma_stream xd3_lzma_stream; + +struct _xd3_lzma_stream { + lzma_stream lzma; +}; + +xd3_sec_stream* +xd3_lzma_alloc (xd3_stream *stream) +{ + return (xd3_sec_stream*) xd3_alloc (stream, sizeof (xd3_lzma_stream), 1); +} + +void +xd3_lzma_destroy (xd3_stream *stream, xd3_sec_stream *sec_stream) +{ + xd3_lzma_stream *ls = (xd3_lzma_stream*) sec_stream; + lzma_end (&ls->lzma); + xd3_free (stream, ls); +} + +int +xd3_lzma_init (xd3_stream *stream, xd3_lzma_stream *sec, int is_encode) +{ + int ret; + + memset (&sec->lzma, 0, sizeof(sec->lzma)); + + if (is_encode) + { + int level = (stream->flags & XD3_COMPLEVEL_MASK) >> XD3_COMPLEVEL_SHIFT; + + ret = lzma_easy_encoder (&sec->lzma, level, LZMA_CHECK_CRC32); + } + else + { + ret = lzma_stream_decoder (&sec->lzma, UINT64_MAX, 0); + } + + if (ret != LZMA_OK) + { + stream->msg = "lzma stream init failed"; + return XD3_INTERNAL; + } + + return 0; +} + +int xd3_decode_lzma (xd3_stream *stream, xd3_lzma_stream *sec, + const uint8_t **input_pos, + const uint8_t *const input_end, + uint8_t **output_pos, + const uint8_t *const output_end) +{ + uint8_t *output = *output_pos; + const uint8_t *input = *input_pos; + size_t avail_in = input_end - input; + size_t avail_out = output_end - output; + + sec->lzma.avail_in = avail_in; + sec->lzma.next_in = input; + sec->lzma.avail_out = avail_out; + sec->lzma.next_out = output; + + while (sec->lzma.avail_in != 0 || sec->lzma.avail_out != 0) + { + int lret = lzma_code (&sec->lzma, LZMA_FINISH); + + if (sec->lzma.avail_out == 0 || lret == LZMA_STREAM_END) + { + (*output_pos) = sec->lzma.next_out; + (*input_pos) = sec->lzma.next_in; + } + + switch (lret) + { + case LZMA_STREAM_END: + return 0; + case LZMA_OK: + break; + + default: + stream->msg = "lzma decoding error"; + return XD3_INTERNAL; + } + } + + return 0; +} + +#if XD3_ENCODER + +int xd3_encode_lzma (xd3_stream *stream, + xd3_lzma_stream *sec, + xd3_output *input, + xd3_output *output, + xd3_sec_cfg *cfg) + +{ + lzma_action action = LZMA_RUN; + + sec->lzma.next_in = NULL; + sec->lzma.avail_in = 0; + sec->lzma.next_out = (output->base + output->next); + sec->lzma.avail_out = (output->avail - output->next); + + while (1) + { + int lret; + + if (sec->lzma.avail_in == 0 && input != NULL) + { + sec->lzma.avail_in = input->next; + sec->lzma.next_in = input->base; + + if ((input = input->next_page) == NULL) + { + action = LZMA_SYNC_FLUSH; + } + } + + lret = lzma_code (&sec->lzma, action); + + if (sec->lzma.avail_out == 0 || lret == LZMA_STREAM_END) + { + size_t nwrite = (output->avail - output->next) - sec->lzma.avail_out; + output->next += nwrite; + + if (output->next == output->avail) + { + if ((output = xd3_alloc_output (stream, output)) == NULL) + { + return ENOMEM; + } + + sec->lzma.next_out = output->base; + sec->lzma.avail_out = output->avail; + } + } + + switch (lret) + { + case LZMA_OK: + break; + + case LZMA_STREAM_END: + return 0; + + default: + stream->msg = "lzma encoding error"; + return XD3_INTERNAL; + } + } + + return 0; +} + +#endif /* XD3_ENCODER */ + +#endif /* _XDELTA3_LZMA_H_ */ diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h index d68aa98..d2058c2 100644 --- a/xdelta3/xdelta3-main.h +++ b/xdelta3/xdelta3-main.h @@ -1161,6 +1161,10 @@ main_set_secondary_flags (xd3_config *config) { config->flags |= XD3_SEC_FGK; } + else if (strcmp (option_secondary, "lzma") == 0 && HAVE_LZMA_H) + { + config->flags |= XD3_SEC_LZMA; + } else if (strncmp (option_secondary, "djw", 3) == 0 && SECONDARY_DJW) { usize_t level = XD3_DEFAULT_SECONDARY_LEVEL; diff --git a/xdelta3/xdelta3-second.h b/xdelta3/xdelta3-second.h index f72ed9b..b9830ab 100644 --- a/xdelta3/xdelta3-second.h +++ b/xdelta3/xdelta3-second.h @@ -94,25 +94,27 @@ xd3_test_clean_bits (xd3_stream *stream, bit_state *bits) } #endif -static xd3_sec_stream* -xd3_get_secondary (xd3_stream *stream, xd3_sec_stream **sec_streamp) +static int +xd3_get_secondary (xd3_stream *stream, xd3_sec_stream **sec_streamp, + int is_encode) { - xd3_sec_stream *sec_stream; - - if ((sec_stream = *sec_streamp) == NULL) + if (*sec_streamp == NULL) { + int ret; + if ((*sec_streamp = stream->sec_type->alloc (stream)) == NULL) { - return NULL; + stream->msg = "error initializing secondary stream"; + return XD3_INVALID; } - sec_stream = *sec_streamp; - - /* If cuumulative stats, init once. */ - stream->sec_type->init (sec_stream); + if ((ret = stream->sec_type->init (stream, *sec_streamp, is_encode)) != 0) + { + return ret; + } } - return sec_stream; + return 0; } static int @@ -120,14 +122,13 @@ xd3_decode_secondary (xd3_stream *stream, xd3_desect *sect, xd3_sec_stream **sec_streamp) { - xd3_sec_stream *sec_stream; uint32_t dec_size; uint8_t *out_used; int ret; - if ((sec_stream = xd3_get_secondary (stream, sec_streamp)) == NULL) + if ((ret = xd3_get_secondary (stream, sec_streamp, 0)) != 0) { - return ENOMEM; + return ret; } /* Decode the size, allocate the buffer. */ @@ -141,7 +142,7 @@ xd3_decode_secondary (xd3_stream *stream, out_used = sect->copied2; - if ((ret = stream->sec_type->decode (stream, sec_stream, + if ((ret = stream->sec_type->decode (stream, *sec_streamp, & sect->buf, sect->buf_max, & out_used, out_used + dec_size))) { @@ -244,7 +245,6 @@ xd3_encode_secondary (xd3_stream *stream, xd3_sec_cfg *cfg, int *did_it) { - xd3_sec_stream *sec_stream; xd3_output *tmp_head; xd3_output *tmp_tail; @@ -257,9 +257,9 @@ xd3_encode_secondary (xd3_stream *stream, if (orig_size < SECONDARY_MIN_INPUT) { return 0; } - if ((sec_stream = xd3_get_secondary (stream, sec_streamp)) == NULL) + if ((ret = xd3_get_secondary (stream, sec_streamp, 1)) != 0) { - return ENOMEM; + return ret; } tmp_head = xd3_alloc_output (stream, NULL); @@ -268,7 +268,7 @@ xd3_encode_secondary (xd3_stream *stream, * simpler, but is a little gross. Should not need the entire * section in contiguous memory, but it is much easier this way. */ if ((ret = xd3_emit_size (stream, & tmp_head, orig_size)) || - (ret = stream->sec_type->encode (stream, sec_stream, *head, + (ret = stream->sec_type->encode (stream, *sec_streamp, *head, tmp_head, cfg))) { goto getout; diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h index bd04f56..7464c4f 100644 --- a/xdelta3/xdelta3-test.h +++ b/xdelta3/xdelta3-test.h @@ -1185,7 +1185,7 @@ static int sec_dist_func7 (xd3_stream *stream, xd3_output *data) { int i, ret, x; - for (i = 0; i < ALPHABET_SIZE*20; i += 1) + for (i = 0; i < ALPHABET_SIZE*200; i += 1) { x = mt_random (&static_mtrand) % ALPHABET_SIZE; if ((ret = xd3_emit_byte (stream, & data, x))) { return ret; } @@ -1305,7 +1305,7 @@ test_secondary_decode (xd3_stream *stream, if ((dec_stream = sec->alloc (stream)) == NULL) { return ENOMEM; } - sec->init (dec_stream); + if ((ret = sec->init (stream, dec_stream, 0)) != 0) { goto fail; } dec_input_used = dec_input; dec_input_end = dec_input + compress_size; @@ -1382,7 +1382,7 @@ test_secondary (xd3_stream *stream, const xd3_sec_type *sec, usize_t groups) if ((ret = sec_dists[test_i] (stream, in_head))) { goto fail; } - sec->init (enc_stream); + if ((ret = sec->init (stream, enc_stream, 1)) != 0) { goto fail; } /* Encode data */ if ((ret = sec->encode (stream, enc_stream, @@ -1482,6 +1482,8 @@ IF_FGK (static int test_secondary_fgk (xd3_stream *stream, usize_t gp) { return test_secondary (stream, & fgk_sec_type, gp); }) IF_DJW (static int test_secondary_huff (xd3_stream *stream, usize_t gp) { return test_secondary (stream, & djw_sec_type, gp); }) +IF_LZMA (static int test_secondary_lzma (xd3_stream *stream, usize_t gp) + { return test_secondary (stream, & lzma_sec_type, gp); }) #endif /*********************************************************************** @@ -2818,6 +2820,7 @@ xd3_selftest (void) DO_TEST (decompress_single_bit_error, 0, 3); DO_TEST (decompress_single_bit_error, XD3_ADLER32, 3); + IF_LZMA (DO_TEST (decompress_single_bit_error, XD3_SEC_LZMA, 3)); IF_FGK (DO_TEST (decompress_single_bit_error, XD3_SEC_FGK, 3)); IF_DJW (DO_TEST (decompress_single_bit_error, XD3_SEC_DJW, 8)); @@ -2840,6 +2843,7 @@ xd3_selftest (void) DO_TEST (recode_command, 0, 0); #endif + IF_LZMA (DO_TEST (secondary_lzma, 0, 1)); IF_DJW (DO_TEST (secondary_huff, 0, DJW_MAX_GROUPS)); IF_FGK (DO_TEST (secondary_fgk, 0, 1)); diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 9d9e52c..cb6bde6 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c @@ -278,17 +278,17 @@ #define VCDIFF_TOOLS XD3_MAIN #endif -#ifndef SECONDARY_FGK /* one from the algorithm preservation department: */ -#define SECONDARY_FGK 0 /* adaptive Huffman routines */ +#ifndef SECONDARY_FGK /* one from the algorithm preservation department: */ +#define SECONDARY_FGK 0 /* adaptive Huffman routines */ #endif -#ifndef SECONDARY_DJW /* semi-adaptive/static Huffman for the eventual */ -#define SECONDARY_DJW 0 /* standardization, off by default until such time. */ +#ifndef SECONDARY_DJW /* semi-adaptive/static Huffman for the eventual */ +#define SECONDARY_DJW 0 /* standardization, off by default until such time. */ #endif -#ifndef GENERIC_ENCODE_TABLES /* These three are the RFC-spec'd app-specific */ -#define GENERIC_ENCODE_TABLES 0 /* code features. This is tested but not recommended */ -#endif /* unless there's a real application. */ +#ifndef GENERIC_ENCODE_TABLES /* These three are the RFC-spec app-specific */ +#define GENERIC_ENCODE_TABLES 0 /* code features. This is tested but not */ +#endif /* recommended unless there's a real use. */ #ifndef GENERIC_ENCODE_TABLES_COMPUTE #define GENERIC_ENCODE_TABLES_COMPUTE 0 #endif @@ -326,6 +326,7 @@ typedef enum { VCD_DJW_ID = 1, + VCD_LZMA_ID = 2, VCD_FGK_ID = 16 /* Note: these are not standard IANA-allocated IDs! */ } xd3_secondary_ids; @@ -371,7 +372,7 @@ XD3_MAKELIST(xd3_rlist, xd3_rinst, link); #define CODE_TABLE_VCDIFF_SIZE (6 * 256) /* Should fit a compressed code * table string */ -#define SECONDARY_ANY (SECONDARY_DJW || SECONDARY_FGK) +#define SECONDARY_ANY (SECONDARY_DJW || SECONDARY_FGK || HAVE_LZMA_H) #define ALPHABET_SIZE 256 /* Used in test code--size of the secondary * compressor alphabet. */ @@ -630,7 +631,9 @@ struct _xd3_sec_type xd3_sec_stream* (*alloc) (xd3_stream *stream); void (*destroy) (xd3_stream *stream, xd3_sec_stream *sec); - void (*init) (xd3_sec_stream *sec); + int (*init) (xd3_stream *stream, + xd3_sec_stream *sec_stream, + int is_encode); int (*decode) (xd3_stream *stream, xd3_sec_stream *sec_stream, const uint8_t **input, @@ -703,6 +706,19 @@ extern const xd3_sec_type djw_sec_type; return XD3_INTERNAL; #endif +#if HAVE_LZMA_H +extern const xd3_sec_type lzma_sec_type; +#define IF_LZMA(x) x +#define LZMA_CASE(s) \ + s->sec_type = & lzma_sec_type; \ + break; +#else +#define IF_LZMA(x) +#define LZMA_CASE(s) \ + s->msg = "unavailable secondary compressor: LZMA"; \ + return XD3_INTERNAL; +#endif + /***********************************************************************/ #include "xdelta3-hash.h" @@ -731,7 +747,7 @@ const xd3_sec_type fgk_sec_type = SEC_NOFLAGS, (xd3_sec_stream* (*)(xd3_stream*)) fgk_alloc, (void (*)(xd3_stream*, xd3_sec_stream*)) fgk_destroy, - (void (*)(xd3_sec_stream*)) fgk_init, + (int (*)(xd3_stream*, xd3_sec_stream*, int)) fgk_init, (int (*)(xd3_stream*, xd3_sec_stream*, const uint8_t**, const uint8_t*, uint8_t**, const uint8_t*)) xd3_decode_fgk, IF_ENCODER((int (*)(xd3_stream*, xd3_sec_stream*, xd3_output*, @@ -748,7 +764,7 @@ const xd3_sec_type djw_sec_type = SEC_COUNT_FREQS, (xd3_sec_stream* (*)(xd3_stream*)) djw_alloc, (void (*)(xd3_stream*, xd3_sec_stream*)) djw_destroy, - (void (*)(xd3_sec_stream*)) djw_init, + (int (*)(xd3_stream*, xd3_sec_stream*, int)) djw_init, (int (*)(xd3_stream*, xd3_sec_stream*, const uint8_t**, const uint8_t*, uint8_t**, const uint8_t*)) xd3_decode_huff, IF_ENCODER((int (*)(xd3_stream*, xd3_sec_stream*, xd3_output*, @@ -756,6 +772,23 @@ const xd3_sec_type djw_sec_type = }; #endif +#if HAVE_LZMA_H +#include "xdelta3-lzma.h" +const xd3_sec_type lzma_sec_type = +{ + VCD_LZMA_ID, + "lzma", + SEC_NOFLAGS, + (xd3_sec_stream* (*)(xd3_stream*)) xd3_lzma_alloc, + (void (*)(xd3_stream*, xd3_sec_stream*)) xd3_lzma_destroy, + (int (*)(xd3_stream*, xd3_sec_stream*, int)) xd3_lzma_init, + (int (*)(xd3_stream*, xd3_sec_stream*, const uint8_t**, const uint8_t*, + uint8_t**, const uint8_t*)) xd3_decode_lzma, + IF_ENCODER((int (*)(xd3_stream*, xd3_sec_stream*, xd3_output*, + xd3_output*, xd3_sec_cfg*)) xd3_encode_lzma) +}; +#endif + #if XD3_MAIN || PYTHON_MODULE || SWIG_MODULE || NOT_MAIN #include "xdelta3-main.h" #endif @@ -1678,7 +1711,7 @@ static inline int xd3_emit_bytes (xd3_stream *stream, xd3_output **outputp, const uint8_t *base, - usize_t size) + usize_t size) { xd3_output *output = (*outputp); @@ -2381,6 +2414,8 @@ xd3_config_stream(xd3_stream *stream, FGK_CASE (stream); case XD3_SEC_DJW: DJW_CASE (stream); + case XD3_SEC_LZMA: + LZMA_CASE (stream); default: stream->msg = "too many secondary compressor types set"; return XD3_INTERNAL; diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h index 5c1e5a5..8a94729 100644 --- a/xdelta3/xdelta3.h +++ b/xdelta3/xdelta3.h @@ -29,6 +29,8 @@ #define _ISOC99_SOURCE #define _C99_SOURCE +#include "config.h" + #include #include #include @@ -358,7 +360,9 @@ typedef enum XD3_SEC_DJW = (1 << 5), /* use DJW static huffman */ XD3_SEC_FGK = (1 << 6), /* use FGK adaptive huffman */ - XD3_SEC_TYPE = (XD3_SEC_DJW | XD3_SEC_FGK), + XD3_SEC_LZMA = (1 << 24), /* use LZMA secondary */ + + XD3_SEC_TYPE = (XD3_SEC_DJW | XD3_SEC_FGK | XD3_SEC_LZMA), XD3_SEC_NODATA = (1 << 7), /* disable secondary compression of the data section. */ @@ -391,7 +395,7 @@ typedef enum * and is independent of compression level). This is for * convenience, especially with xd3_encode_memory(). */ - XD3_COMPLEVEL_SHIFT = 20, /* 20 - 24 */ + XD3_COMPLEVEL_SHIFT = 20, /* 20 - 23 */ XD3_COMPLEVEL_MASK = (0xF << XD3_COMPLEVEL_SHIFT), XD3_COMPLEVEL_1 = (1 << XD3_COMPLEVEL_SHIFT), XD3_COMPLEVEL_2 = (2 << XD3_COMPLEVEL_SHIFT), -- cgit v1.2.3