diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2021-03-31 21:01:54 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2021-03-31 21:01:54 +0100 |
commit | e708ae66a41c5f5eccc043bcf02bd0dccb132403 (patch) | |
tree | 379292cd016a6a9c8c94bc5f40480509d44e8be2 | |
parent | e6c790fc877a231653f92b70c75a456812b5be0d (diff) | |
download | libnsgif-e708ae66a41c5f5eccc043bcf02bd0dccb132403.tar.gz libnsgif-e708ae66a41c5f5eccc043bcf02bd0dccb132403.tar.bz2 |
lzw: Slight simplification of clear code handling.
-rw-r--r-- | src/lzw.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -232,9 +232,9 @@ static lzw_result lzw__clear_codes( uint8_t *stack_pos; /* Reset dictionary building context */ - ctx->current_code_size = ctx->initial_code_size + 1; - ctx->current_code_size_max = (1 << ctx->current_code_size) - 1; - ctx->current_entry = (1 << ctx->initial_code_size) + 2; + ctx->current_code_size = ctx->initial_code_size; + ctx->current_code_size_max = (1 << ctx->initial_code_size) - 1; + ctx->current_entry = ctx->eoi_code + 1; /* There might be a sequence of clear codes, so process them all */ do { @@ -288,7 +288,7 @@ lzw_result lzw_decode_init( ctx->input.sb_bit_count = 0; /* Initialise the dictionary building context */ - ctx->initial_code_size = code_size; + ctx->initial_code_size = code_size + 1; ctx->clear_code = (1 << code_size) + 0; ctx->eoi_code = (1 << code_size) + 1; |