mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 00:38:14 +01:00
Prepare for introducing copy_from_slice.
This commit is contained in:
1 parent
36ba4b866c
commit
66f712039b
3 files changed
+37
-16
No files matched your search
@@ -218,6 +218,7 @@ pri func decoder.decode_uncompressed?(dst writer1, src reader1)() {
|
||||
}
|
||||
length -= n
|
||||
if in.dst.available() == 0 {
|
||||
// TODO: "closed for writes" instead?
|
||||
return suspension "short write"
|
||||
} else {
|
||||
return suspension "short read"
|
||||
@@ -401,6 +402,7 @@ pri func decoder.decode_huffman?(dst writer1, src reader1)() {
|
||||
return error "internal error: inconsistent Huffman decoder state"
|
||||
}
|
||||
length -= n
|
||||
// TODO: "closed for writes" instead?
|
||||
return suspension "short write"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,10 +105,17 @@ pub func lzw_decoder.decode?(dst writer1, src reader1)() {
|
||||
this.stack[4095] = c as u8
|
||||
}
|
||||
|
||||
// TODO: the "x:s" arg is a placeholder, and should be something
|
||||
// like (this.stack[s:]), which means defining a slice type (and
|
||||
// type checking, bounds checking and code generation for it).
|
||||
in.dst.write?(x:s)
|
||||
while true,
|
||||
inv n_bits < 8,
|
||||
inv c < 256,
|
||||
{
|
||||
var expansion[] u8 = this.stack[s:]
|
||||
// TODO: change write to copy_from_slice.
|
||||
in.dst.write?(x:expansion)
|
||||
if expansion.length() == 0 { // Avoid "unused variable" C compiler warning.
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if save_code <= 4095 {
|
||||
this.suffixes[save_code] = c as u8
|
||||
|
||||
Reference in new issue
Block a user