mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Fix a lzw_decoder bug.
This commit is contained in:
1 parent
f403d0faa8
commit
2fd08e0cf8
3 files changed
+2
-5
No files matched your search
+1
-1
@@ -298,7 +298,7 @@ label_0_continue:;
|
||||
sizeof(self->f_stack) - v_s);
|
||||
a_dst->wi += sizeof(self->f_stack) - v_s;
|
||||
if (v_use_save_code) {
|
||||
self->f_suffixes[v_save_code] = self->f_stack[4095];
|
||||
self->f_suffixes[v_save_code] = ((uint8_t)(v_c));
|
||||
self->f_prefixes[v_save_code] = ((uint16_t)(v_prev_code));
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -94,7 +94,7 @@ pub func lzw_decoder.decode?(dst ptr buf1, src ptr buf1, src_final bool)() {
|
||||
in.dst.write?(x:s)
|
||||
|
||||
if use_save_code {
|
||||
this.suffixes[save_code] = this.stack[4095]
|
||||
this.suffixes[save_code] = c as u8
|
||||
this.prefixes[save_code] = prev_code as u16
|
||||
}
|
||||
|
||||
|
||||
@@ -64,12 +64,9 @@ void test_lzw_decode() {
|
||||
goto cleanup1;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: fix the bug and uncomment this test.
|
||||
if (!buf1s_equal(&got, &want)) {
|
||||
goto cleanup1;
|
||||
}
|
||||
*/
|
||||
// As a sanity check, the first decoded byte should be 0xDC.
|
||||
if (got.ptr[0] != 0xDC) {
|
||||
FAIL("first decoded byte: got 0x%02x, want 0x%02x", (int)(got.ptr[0]),
|
||||
|
||||
Reference in new issue
Block a user