Split multi-arg io_bind into multiple io_bind's

This commit is contained in:
Nigel Tao committed 2018-12-09 07:54:48 +11:00
1 parent f1c5bb6cb7
commit 3aff5e6f42
2 files changed
+7 -3

No files matched your search

+4 -2
View File
@@ -9390,7 +9390,6 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
while (true) { while (true) {
v_w = ((wuffs_base__io_writer){}); v_w = ((wuffs_base__io_writer){});
{ {
wuffs_base__io_reader o_0_a_src = a_src;
wuffs_base__io_writer o_0_v_w = v_w; wuffs_base__io_writer o_0_v_w = v_w;
uint8_t* o_0_iop_v_w = iop_v_w; uint8_t* o_0_iop_v_w = iop_v_w;
uint8_t* o_0_io1_v_w = io1_v_w; uint8_t* o_0_io1_v_w = io1_v_w;
@@ -9402,6 +9401,8 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
.len = 4096, .len = 4096,
}), }),
self->private_impl.f_uncompressed_wi)); self->private_impl.f_uncompressed_wi));
{
wuffs_base__io_reader o_1_a_src = a_src;
wuffs_base__io_reader__set_limit(&a_src, iop_a_src, v_block_size); wuffs_base__io_reader__set_limit(&a_src, iop_a_src, v_block_size);
wuffs_base__io_reader__set_mark(&a_src, iop_a_src); wuffs_base__io_reader__set_mark(&a_src, iop_a_src);
{ {
@@ -9430,10 +9431,11 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
.len = (size_t)(iop_a_src - a_src.private_impl.mark), .len = (size_t)(iop_a_src - a_src.private_impl.mark),
}) })
.len))); .len)));
a_src = o_1_a_src;
}
v_w = o_0_v_w; v_w = o_0_v_w;
iop_v_w = o_0_iop_v_w; iop_v_w = o_0_iop_v_w;
io1_v_w = o_0_io1_v_w; io1_v_w = o_0_io1_v_w;
a_src = o_0_a_src;
} }
if ((v_block_size == 0) && if ((v_block_size == 0) &&
(v_z == wuffs_base__suspension__short_read)) { (v_z == wuffs_base__suspension__short_read)) {
+3 -1
View File
@@ -638,7 +638,7 @@ pri func decoder.decode_id_part1!??(dst ptr base.pixel_buffer, src base.io_reade
while:inner true { while:inner true {
var w base.io_writer var w base.io_writer
io_bind (args.src, w) { io_bind (w) {
w.set!(s:this.uncompressed[this.uncompressed_wi:]) w.set!(s:this.uncompressed[this.uncompressed_wi:])
// TODO: enforce that calling r.set_limit has a precondition // TODO: enforce that calling r.set_limit has a precondition
// that r.is_bound(), and that you can't suspend inside an // that r.is_bound(), and that you can't suspend inside an
@@ -646,12 +646,14 @@ pri func decoder.decode_id_part1!??(dst ptr base.pixel_buffer, src base.io_reade
// complicated if we must save and re-apply limits. // complicated if we must save and re-apply limits.
// //
// Should calling r.set_mark also require r.is_bound()? // Should calling r.set_mark also require r.is_bound()?
io_bind (args.src) {
args.src.set_limit!(l:block_size) args.src.set_limit!(l:block_size)
args.src.set_mark!() args.src.set_mark!()
var z base.status =? this.lzw.decode!??(dst:w, src:args.src) var z base.status =? this.lzw.decode!??(dst:w, src:args.src)
this.uncompressed_wi = 4096 - (w.available().min(x:4096) as base.u32) this.uncompressed_wi = 4096 - (w.available().min(x:4096) as base.u32)
block_size ~sat-= args.src.since_mark().length() block_size ~sat-= args.src.since_mark().length()
} }
}
if (block_size == 0) and (z == base."$short read") { if (block_size == 0) and (z == base."$short read") {
break:inner break:inner