diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-03-22 00:57:33 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-03-22 00:57:33 +0200 |
commit | 63b74d000eedaebb8485f623e56864ff5ab71064 (patch) | |
tree | 6cdee417634eabd515282882783eeda0322178e4 /src/liblzma/lzma/lzma_encoder.c | |
parent | Fix data corruption in LZMA encoder. Note that this bug was (diff) | |
download | xz-63b74d000eedaebb8485f623e56864ff5ab71064.tar.xz |
Demystified the "state" variable in LZMA code. Use the
word literal instead of char for better consistency.
There are still some names with _char instead of _literal
in lzma_optimum, these may be changed later.
Renamed length coder variables.
This commit doesn't change the program logic.
Diffstat (limited to 'src/liblzma/lzma/lzma_encoder.c')
-rw-r--r-- | src/liblzma/lzma/lzma_encoder.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/liblzma/lzma/lzma_encoder.c b/src/liblzma/lzma/lzma_encoder.c index 01c823ca..f7aec876 100644 --- a/src/liblzma/lzma/lzma_encoder.c +++ b/src/liblzma/lzma/lzma_encoder.c @@ -170,7 +170,7 @@ lzma_lzma_encode(lzma_coder *coder, uint8_t *restrict out, lzma_read_match_distances(coder, &len, &num_distance_pairs); bit_encode_0(coder->is_match[coder->state][0]); - update_char(coder->state); + update_literal(coder->state); const uint8_t cur_byte = coder->lz.buffer[ coder->lz.read_pos - coder->additional_offset]; @@ -244,7 +244,7 @@ lzma_lzma_encode(lzma_coder *coder, uint8_t *restrict out, probability *subcoder = literal_get_subcoder(coder->literal_coder, coder->now_pos, coder->previous_byte); - if (is_char_state(coder->state)) { + if (is_literal_state(coder->state)) { literal_encode(subcoder, cur_byte); } else { const uint8_t match_byte = coder->lz.buffer[ @@ -254,7 +254,7 @@ lzma_lzma_encode(lzma_coder *coder, uint8_t *restrict out, literal_encode_matched(subcoder, match_byte, cur_byte); } - update_char(coder->state); + update_literal(coder->state); coder->previous_byte = cur_byte; } else { @@ -294,16 +294,16 @@ lzma_lzma_encode(lzma_coder *coder, uint8_t *restrict out, if (len == 1) { update_short_rep(coder->state); } else { - length_encode(coder->rep_match_len_encoder, + length_encode(coder->rep_len_encoder, len - MATCH_MIN_LEN, pos_state, best_compression); - update_rep(coder->state); + update_long_rep(coder->state); } } else { bit_encode_0(coder->is_rep[coder->state]); update_match(coder->state); - length_encode(coder->len_encoder, len - MATCH_MIN_LEN, + length_encode(coder->match_len_encoder, len - MATCH_MIN_LEN, pos_state, best_compression); pos -= REP_DISTANCES; @@ -364,7 +364,7 @@ lzma_lzma_encode(lzma_coder *coder, uint8_t *restrict out, const uint32_t len = coder->lz.sequence == SEQ_FLUSH ? LEN_SPECIAL_FLUSH : LEN_SPECIAL_EOPM; - length_encode(coder->len_encoder, len - MATCH_MIN_LEN, + length_encode(coder->match_len_encoder, len - MATCH_MIN_LEN, pos_state, best_compression); const uint32_t pos_slot = (1 << POS_SLOT_BITS) - 1; |