diff options
Diffstat (limited to 'linux/lib/xz/xz_dec_lzma2.c')
-rw-r--r-- | linux/lib/xz/xz_dec_lzma2.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/linux/lib/xz/xz_dec_lzma2.c b/linux/lib/xz/xz_dec_lzma2.c index ad36e29..3b8ccfc 100644 --- a/linux/lib/xz/xz_dec_lzma2.c +++ b/linux/lib/xz/xz_dec_lzma2.c @@ -283,7 +283,7 @@ struct xz_dec_lzma2 { * Reset the dictionary state. When in single-call mode, set up the beginning * of the dictionary to point to the actual output buffer. */ -static void XZ_FUNC dict_reset(struct dictionary *dict, struct xz_buf *b) +static void dict_reset(struct dictionary *dict, struct xz_buf *b) { if (DEC_IS_SINGLE(dict->mode)) { dict->buf = b->out + b->out_pos; @@ -297,7 +297,7 @@ static void XZ_FUNC dict_reset(struct dictionary *dict, struct xz_buf *b) } /* Set dictionary write limit */ -static void XZ_FUNC dict_limit(struct dictionary *dict, size_t out_max) +static void dict_limit(struct dictionary *dict, size_t out_max) { if (dict->end - dict->pos <= out_max) dict->limit = dict->end; @@ -306,7 +306,7 @@ static void XZ_FUNC dict_limit(struct dictionary *dict, size_t out_max) } /* Return true if at least one byte can be written into the dictionary. */ -static inline bool XZ_FUNC dict_has_space(const struct dictionary *dict) +static inline bool dict_has_space(const struct dictionary *dict) { return dict->pos < dict->limit; } @@ -317,8 +317,7 @@ static inline bool XZ_FUNC dict_has_space(const struct dictionary *dict) * still empty. This special case is needed for single-call decoding to * avoid writing a '\0' to the end of the destination buffer. */ -static inline uint32_t XZ_FUNC dict_get( - const struct dictionary *dict, uint32_t dist) +static inline uint32_t dict_get(const struct dictionary *dict, uint32_t dist) { size_t offset = dict->pos - dist - 1; @@ -331,7 +330,7 @@ static inline uint32_t XZ_FUNC dict_get( /* * Put one byte into the dictionary. It is assumed that there is space for it. */ -static inline void XZ_FUNC dict_put(struct dictionary *dict, uint8_t byte) +static inline void dict_put(struct dictionary *dict, uint8_t byte) { dict->buf[dict->pos++] = byte; @@ -344,8 +343,7 @@ static inline void XZ_FUNC dict_put(struct dictionary *dict, uint8_t byte) * invalid, false is returned. On success, true is returned and *len is * updated to indicate how many bytes were left to be repeated. */ -static bool XZ_FUNC dict_repeat( - struct dictionary *dict, uint32_t *len, uint32_t dist) +static bool dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist) { size_t back; uint32_t left; @@ -373,7 +371,7 @@ static bool XZ_FUNC dict_repeat( } /* Copy uncompressed data as is from input to dictionary and output buffers. */ -static void XZ_FUNC dict_uncompressed( +static void dict_uncompressed( struct dictionary *dict, struct xz_buf *b, uint32_t *left) { size_t copy_size; @@ -416,7 +414,7 @@ static void XZ_FUNC dict_uncompressed( * enough space in b->out. This is guaranteed because caller uses dict_limit() * before decoding data into the dictionary. */ -static uint32_t XZ_FUNC dict_flush(struct dictionary *dict, struct xz_buf *b) +static uint32_t dict_flush(struct dictionary *dict, struct xz_buf *b) { size_t copy_size = dict->pos - dict->start; @@ -438,7 +436,7 @@ static uint32_t XZ_FUNC dict_flush(struct dictionary *dict, struct xz_buf *b) *****************/ /* Reset the range decoder. */ -static void XZ_FUNC rc_reset(struct rc_dec *rc) +static void rc_reset(struct rc_dec *rc) { rc->range = (uint32_t)-1; rc->code = 0; @@ -449,7 +447,7 @@ static void XZ_FUNC rc_reset(struct rc_dec *rc) * Read the first five initial bytes into rc->code if they haven't been * read already. (Yes, the first byte gets completely ignored.) */ -static bool XZ_FUNC rc_read_init(struct rc_dec *rc, struct xz_buf *b) +static bool rc_read_init(struct rc_dec *rc, struct xz_buf *b) { while (rc->init_bytes_left > 0) { if (b->in_pos == b->in_size) @@ -463,7 +461,7 @@ static bool XZ_FUNC rc_read_init(struct rc_dec *rc, struct xz_buf *b) } /* Return true if there may not be enough input for the next decoding loop. */ -static inline bool XZ_FUNC rc_limit_exceeded(const struct rc_dec *rc) +static inline bool rc_limit_exceeded(const struct rc_dec *rc) { return rc->in_pos > rc->in_limit; } @@ -472,13 +470,13 @@ static inline bool XZ_FUNC rc_limit_exceeded(const struct rc_dec *rc) * Return true if it is possible (from point of view of range decoder) that * we have reached the end of the LZMA chunk. */ -static inline bool XZ_FUNC rc_is_finished(const struct rc_dec *rc) +static inline bool rc_is_finished(const struct rc_dec *rc) { return rc->code == 0; } /* Read the next input byte if needed. */ -static __always_inline void XZ_FUNC rc_normalize(struct rc_dec *rc) +static __always_inline void rc_normalize(struct rc_dec *rc) { if (rc->range < RC_TOP_VALUE) { rc->range <<= RC_SHIFT_BITS; @@ -497,7 +495,7 @@ static __always_inline void XZ_FUNC rc_normalize(struct rc_dec *rc) * of the code generated by GCC 3.x decreases 10-15 %. (GCC 4.3 doesn't care, * and it generates 10-20 % faster code than GCC 3.x from this file anyway.) */ -static __always_inline int XZ_FUNC rc_bit(struct rc_dec *rc, uint16_t *prob) +static __always_inline int rc_bit(struct rc_dec *rc, uint16_t *prob) { uint32_t bound; int bit; @@ -519,7 +517,7 @@ static __always_inline int XZ_FUNC rc_bit(struct rc_dec *rc, uint16_t *prob) } /* Decode a bittree starting from the most significant bit. */ -static __always_inline uint32_t XZ_FUNC rc_bittree( +static __always_inline uint32_t rc_bittree( struct rc_dec *rc, uint16_t *probs, uint32_t limit) { uint32_t symbol = 1; @@ -535,7 +533,7 @@ static __always_inline uint32_t XZ_FUNC rc_bittree( } /* Decode a bittree starting from the least significant bit. */ -static __always_inline void XZ_FUNC rc_bittree_reverse(struct rc_dec *rc, +static __always_inline void rc_bittree_reverse(struct rc_dec *rc, uint16_t *probs, uint32_t *dest, uint32_t limit) { uint32_t symbol = 1; @@ -552,7 +550,7 @@ static __always_inline void XZ_FUNC rc_bittree_reverse(struct rc_dec *rc, } /* Decode direct bits (fixed fifty-fifty probability) */ -static inline void XZ_FUNC rc_direct( +static inline void rc_direct( struct rc_dec *rc, uint32_t *dest, uint32_t limit) { uint32_t mask; @@ -572,7 +570,7 @@ static inline void XZ_FUNC rc_direct( ********/ /* Get pointer to literal coder probability array. */ -static uint16_t * XZ_FUNC lzma_literal_probs(struct xz_dec_lzma2 *s) +static uint16_t *lzma_literal_probs(struct xz_dec_lzma2 *s) { uint32_t prev_byte = dict_get(&s->dict, 0); uint32_t low = prev_byte >> (8 - s->lzma.lc); @@ -581,7 +579,7 @@ static uint16_t * XZ_FUNC lzma_literal_probs(struct xz_dec_lzma2 *s) } /* Decode a literal (one 8-bit byte) */ -static void XZ_FUNC lzma_literal(struct xz_dec_lzma2 *s) +static void lzma_literal(struct xz_dec_lzma2 *s) { uint16_t *probs; uint32_t symbol; @@ -619,7 +617,7 @@ static void XZ_FUNC lzma_literal(struct xz_dec_lzma2 *s) } /* Decode the length of the match into s->lzma.len. */ -static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l, +static void lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l, uint32_t pos_state) { uint16_t *probs; @@ -646,7 +644,7 @@ static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l, } /* Decode a match. The distance will be stored in s->lzma.rep0. */ -static void XZ_FUNC lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state) +static void lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state) { uint16_t *probs; uint32_t dist_slot; @@ -688,7 +686,7 @@ static void XZ_FUNC lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state) * Decode a repeated match. The distance is one of the four most recently * seen matches. The distance will be stored in s->lzma.rep0. */ -static void XZ_FUNC lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state) +static void lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state) { uint32_t tmp; @@ -722,7 +720,7 @@ static void XZ_FUNC lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state) } /* LZMA decoder core */ -static bool XZ_FUNC lzma_main(struct xz_dec_lzma2 *s) +static bool lzma_main(struct xz_dec_lzma2 *s) { uint32_t pos_state; @@ -767,7 +765,7 @@ static bool XZ_FUNC lzma_main(struct xz_dec_lzma2 *s) * Reset the LZMA decoder and range decoder state. Dictionary is nore reset * here, because LZMA state may be reset without resetting the dictionary. */ -static void XZ_FUNC lzma_reset(struct xz_dec_lzma2 *s) +static void lzma_reset(struct xz_dec_lzma2 *s) { uint16_t *probs; size_t i; @@ -799,7 +797,7 @@ static void XZ_FUNC lzma_reset(struct xz_dec_lzma2 *s) * from the decoded lp and pb values. On success, the LZMA decoder state is * reset and true is returned. */ -static bool XZ_FUNC lzma_props(struct xz_dec_lzma2 *s, uint8_t props) +static bool lzma_props(struct xz_dec_lzma2 *s, uint8_t props) { if (props > (4 * 5 + 4) * 9 + 8) return false; @@ -846,7 +844,7 @@ static bool XZ_FUNC lzma_props(struct xz_dec_lzma2 *s, uint8_t props) * function. We decode a few bytes from the temporary buffer so that we can * continue decoding from the caller-supplied input buffer again. */ -static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b) +static bool lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b) { size_t in_avail; uint32_t tmp; @@ -931,7 +929,7 @@ static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b) * Take care of the LZMA2 control layer, and forward the job of actual LZMA * decoding or copying of uncompressed chunks to other functions. */ -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_run( +XZ_EXTERN enum xz_ret xz_dec_lzma2_run( struct xz_dec_lzma2 *s, struct xz_buf *b) { uint32_t tmp; @@ -1104,7 +1102,7 @@ XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_run( return XZ_OK; } -XZ_EXTERN struct xz_dec_lzma2 * XZ_FUNC xz_dec_lzma2_create( +XZ_EXTERN struct xz_dec_lzma2 *xz_dec_lzma2_create( enum xz_mode mode, uint32_t dict_max) { struct xz_dec_lzma2 *s = kmalloc(sizeof(*s), GFP_KERNEL); @@ -1128,7 +1126,7 @@ XZ_EXTERN struct xz_dec_lzma2 * XZ_FUNC xz_dec_lzma2_create( return s; } -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_reset( +XZ_EXTERN enum xz_ret xz_dec_lzma2_reset( struct xz_dec_lzma2 *s, uint8_t props) { /* This limits dictionary size to 3 GiB to keep parsing simpler. */ @@ -1166,7 +1164,7 @@ XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_reset( return XZ_OK; } -XZ_EXTERN void XZ_FUNC xz_dec_lzma2_end(struct xz_dec_lzma2 *s) +XZ_EXTERN void xz_dec_lzma2_end(struct xz_dec_lzma2 *s) { if (DEC_IS_MULTI(s->dict.mode)) vfree(s->dict.buf); |