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
+37 -33

No files matched your search

+8 -6
View File
@@ -638,7 +638,7 @@ pri func decoder.decode_id_part1!??(dst ptr base.pixel_buffer, src base.io_reade
while:inner true {
var w base.io_writer
io_bind (args.src, w) {
io_bind (w) {
w.set!(s:this.uncompressed[this.uncompressed_wi:])
// TODO: enforce that calling r.set_limit has a precondition
// that r.is_bound(), and that you can't suspend inside an
@@ -646,11 +646,13 @@ pri func decoder.decode_id_part1!??(dst ptr base.pixel_buffer, src base.io_reade
// complicated if we must save and re-apply limits.
//
// Should calling r.set_mark also require r.is_bound()?
args.src.set_limit!(l:block_size)
args.src.set_mark!()
var z base.status =? this.lzw.decode!??(dst:w, src:args.src)
this.uncompressed_wi = 4096 - (w.available().min(x:4096) as base.u32)
block_size ~sat-= args.src.since_mark().length()
io_bind (args.src) {
args.src.set_limit!(l:block_size)
args.src.set_mark!()
var z base.status =? this.lzw.decode!??(dst:w, src:args.src)
this.uncompressed_wi = 4096 - (w.available().min(x:4096) as base.u32)
block_size ~sat-= args.src.since_mark().length()
}
}
if (block_size == 0) and (z == base."$short read") {