Add while label to std/deflate decode_huffman_slow

This commit is contained in:
Nigel Tao committed 2021-11-20 20:14:37 +11:00
1 parent bb8623b472
commit ede0590ead
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -28176,13 +28176,13 @@ wuffs_deflate__decoder__decode_huffman_slow(
&iop_a_dst, io0_a_dst, io2_a_dst, v_length, (v_dist_minus_1 + 1));
if (v_length <= v_n_copied) {
v_length = 0;
goto label__5__break;
goto label__inner__break;
}
v_length -= v_n_copied;
status = wuffs_base__make_status(wuffs_base__suspension__short_write);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(10);
}
label__5__break:;
label__inner__break:;
}
label__loop__break:;
self->private_impl.f_bits = v_bits;
+3 -3
View File
@@ -201,7 +201,7 @@ pri func decoder.decode_huffman_slow?(dst: base.io_writer, src: base.io_reader)
n_bits -= table_entry_n_bits
}
while true {
while.inner true {
// Copy from this.history.
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_length() {
// Set (hlen, hdist) to be the length-distance pair to copy
@@ -255,11 +255,11 @@ pri func decoder.decode_huffman_slow?(dst: base.io_writer, src: base.io_reader)
up_to: length, distance: (dist_minus_1 + 1))
if length <= n_copied {
length = 0
break
break.inner
}
length -= n_copied
yield? base."$short write"
} endwhile
} endwhile.inner
} endwhile.loop
// TODO: "assert n_bits < 8"? What about (bits >> n_bits)?