mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 08:55:11 +01:00
Roll back Tweak how std/lzw yields "short read"
See the previous commit for the rationale.
This commit is contained in:
1 parent
ecb399508c
commit
5aede827ad
2 files changed
+10
-9
No files matched your search
@@ -7176,7 +7176,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
|||||||
v_n_bits |= 24;
|
v_n_bits |= 24;
|
||||||
} else {
|
} else {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (((uint64_t)(io1_a_src - iop_a_src)) <= 0) {
|
while (((uint64_t)(io1_a_src - iop_a_src)) <= 0) {
|
||||||
if (v_j > 0) {
|
if (v_j > 0) {
|
||||||
self->private_impl.f_flush_j = v_j;
|
self->private_impl.f_flush_j = v_j;
|
||||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||||
@@ -7185,8 +7185,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
|||||||
goto suspend;
|
goto suspend;
|
||||||
}
|
}
|
||||||
v_j = 0;
|
v_j = 0;
|
||||||
}
|
} else {
|
||||||
while (((uint64_t)(io1_a_src - iop_a_src)) <= 0) {
|
|
||||||
status = wuffs_base__suspension__short_read;
|
status = wuffs_base__suspension__short_read;
|
||||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(2);
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,16 +81,18 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
|
|||||||
pre n_bits < 12,
|
pre n_bits < 12,
|
||||||
post n_bits >= width,
|
post n_bits >= width,
|
||||||
{
|
{
|
||||||
if args.src.available() <= 0 {
|
// TODO: there is some optimization we could probably do
|
||||||
|
// around here. See commit ecb3995 `Tweak how std/lzw
|
||||||
|
// yields "short read"`.
|
||||||
|
while args.src.available() <= 0,
|
||||||
|
inv n_bits < 12,
|
||||||
|
post args.src.available() > 0,
|
||||||
|
{
|
||||||
if j > 0 {
|
if j > 0 {
|
||||||
this.flush_j = j
|
this.flush_j = j
|
||||||
this.flush!??(dst:args.dst)
|
this.flush!??(dst:args.dst)
|
||||||
j = 0
|
j = 0
|
||||||
}
|
} else {
|
||||||
while args.src.available() <= 0,
|
|
||||||
inv n_bits < 12,
|
|
||||||
post args.src.available() > 0,
|
|
||||||
{
|
|
||||||
yield base."$short read"
|
yield base."$short read"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user