mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Fix some built-in methods' effects
This commit is contained in:
1 parent
2919e51575
commit
131732e7eb
8 files changed
+21
-24
No files matched your search
@@ -123,7 +123,7 @@ pub struct decoder?(
|
||||
|
||||
pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
while true {
|
||||
in.dst.set_mark()
|
||||
in.dst.set_mark!()
|
||||
var z base.status = try this.decode_blocks?(dst:in.dst, src:in.src)
|
||||
if not z.is_suspension() {
|
||||
return z
|
||||
@@ -229,7 +229,7 @@ pri func decoder.decode_uncompressed?(dst base.io_writer, src base.io_reader)()
|
||||
}
|
||||
length = length.low_bits(n:16)
|
||||
while true {
|
||||
var n_copied base.u32 = in.dst.copy_from_reader32(r:in.src, length:length)
|
||||
var n_copied base.u32 = in.dst.copy_from_reader32!(r:in.src, length:length)
|
||||
if length <= n_copied {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -318,13 +318,13 @@ pri func decoder.decode_huffman_fast?(dst base.io_writer, src base.io_reader)()
|
||||
// TODO: copy_from_slice32 should probably update the
|
||||
// "in.dst.available() >= 258" fact. It should certainly
|
||||
// invalidate any fact that was "<=" instead of ">=".
|
||||
n_copied = in.dst.copy_from_slice32(
|
||||
n_copied = in.dst.copy_from_slice32!(
|
||||
s:this.history[hdist & 0x7FFF:], length:hlen)
|
||||
if hlen <= n_copied {
|
||||
break
|
||||
}
|
||||
hlen -= n_copied
|
||||
in.dst.copy_from_slice32(s:this.history[:], length:hlen)
|
||||
in.dst.copy_from_slice32!(s:this.history[:], length:hlen)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ pri func decoder.decode_huffman_fast?(dst base.io_writer, src base.io_reader)()
|
||||
assert (length as base.u64) <= in.dst.available() via "a <= b: a <= c; c <= b"(c:258)
|
||||
|
||||
// Copy from in.dst.
|
||||
in.dst.copy_from_history32(distance:(dist_minus_1 + 1), length:length)
|
||||
in.dst.copy_from_history32!(distance:(dist_minus_1 + 1), length:length)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader)()
|
||||
|
||||
// Copy from hdist to the end of this.history.
|
||||
while true {
|
||||
n_copied = in.dst.copy_from_slice32(
|
||||
n_copied = in.dst.copy_from_slice32!(
|
||||
s:this.history[hdist & 0x7FFF:], length:hlen)
|
||||
if hlen <= n_copied {
|
||||
hlen = 0
|
||||
@@ -226,7 +226,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader)()
|
||||
// Copy from the start of this.history, if we wrapped around.
|
||||
if hlen > 0 {
|
||||
while true {
|
||||
n_copied = in.dst.copy_from_slice32(
|
||||
n_copied = in.dst.copy_from_slice32!(
|
||||
s:this.history[hdist & 0x7FFF:], length:hlen)
|
||||
if hlen <= n_copied {
|
||||
hlen = 0
|
||||
@@ -246,7 +246,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader)()
|
||||
}
|
||||
|
||||
// Copy from in.dst.
|
||||
n_copied = in.dst.copy_from_history32(distance:(dist_minus_1 + 1), length:length)
|
||||
n_copied = in.dst.copy_from_history32!(distance:(dist_minus_1 + 1), length:length)
|
||||
if length <= n_copied {
|
||||
length = 0
|
||||
break
|
||||
|
||||
@@ -334,7 +334,7 @@ pri func decoder.decode_id?(dst base.io_writer, src base.io_reader)() {
|
||||
this.previous_lzw_decode_ended_abruptly = true
|
||||
|
||||
while true {
|
||||
in.src.set_mark()
|
||||
in.src.set_mark!()
|
||||
io_bind (in.src) {
|
||||
// TODO: enforce that calling r.set_limit has a precondition
|
||||
// that r.is_bound(), and that you can't suspend inside an
|
||||
@@ -342,7 +342,7 @@ pri func decoder.decode_id?(dst base.io_writer, src base.io_reader)() {
|
||||
// complicated if we must save and re-apply limits.
|
||||
//
|
||||
// Should calling r.set_mark also require r.is_bound()?
|
||||
in.src.set_limit(l:block_size)
|
||||
in.src.set_limit!(l:block_size)
|
||||
var z base.status = try this.lzw.decode?(dst:in.dst, src:in.src)
|
||||
}
|
||||
if z.is_ok() {
|
||||
|
||||
@@ -110,7 +110,7 @@ pri func lzw_decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
inv c < 256,
|
||||
{
|
||||
var expansion slice base.u8 = this.stack[s:]
|
||||
var n_copied base.u64 = in.dst.copy_from_slice(s:expansion)
|
||||
var n_copied base.u64 = in.dst.copy_from_slice!(s:expansion)
|
||||
if n_copied == expansion.length() {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
var checksum_got base.u32
|
||||
var decoded_length_got base.u32
|
||||
while true {
|
||||
in.dst.set_mark()
|
||||
in.dst.set_mark!()
|
||||
var z base.status = try this.flate.decode?(dst:in.dst, src:in.src)
|
||||
if not this.ignore_checksum {
|
||||
checksum_got = this.checksum.update(x:in.dst.since_mark())
|
||||
|
||||
@@ -52,7 +52,7 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
// Decode and checksum the DEFLATE-encoded payload.
|
||||
var checksum_got base.u32
|
||||
while true {
|
||||
in.dst.set_mark()
|
||||
in.dst.set_mark!()
|
||||
var z base.status = try this.flate.decode?(dst:in.dst, src:in.src)
|
||||
if not this.ignore_checksum {
|
||||
checksum_got = this.checksum.update(x:in.dst.since_mark())
|
||||
|
||||
Reference in new issue
Block a user