Remove the std/lzw decoder.available method

This commit is contained in:
Nigel Tao committed 2018-12-16 10:21:55 +11:00
1 parent 247232091d
commit 7a02605144
3 files changed
+7 -33

No files matched your search

+2 -2
View File
@@ -661,8 +661,8 @@ pri func decoder.decode_id_part1!??(dst ptr base.pixel_buffer, src base.io_reade
this.compressed_ri ~sat+= r.since_mark().length()
}
if this.lzw.available() > 0 {
var uncompressed slice base.u8 = this.lzw.take_all!()
var uncompressed slice base.u8 = this.lzw.take_all!()
if uncompressed.length() > 0 {
this.copy_to_image_buffer!?(pb:args.dst, src:uncompressed)
}
+2 -6
View File
@@ -266,14 +266,10 @@ pri func decoder.flush!??(dst base.io_writer) {
}
}
// TODO: enforce that available and take_all are only valid to call if decode
// was passed a 0-length dst base.io_writer? The (non-obvious) hard part is to
// TODO: enforce that take_all is only valid to call if decode was always
// passed a 0-length dst base.io_writer? The (non-obvious) hard part is to
// enforce that without regressing benchmarks.
pub func decoder.available() base.u64 {
return this.flush_j as base.u64
}
pub func decoder.take_all!() slice base.u8 {
var s slice base.u8 = this.output[:this.flush_j]
this.flush_j = 0