mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Implement the gzip checksum
Also fix a bug in ast.Raw.SetPackage, discovered because type checking failed to show that "[] u8" and "[] u8" are equivalent types.
This commit is contained in:
1 parent
153d1276a1
commit
a8e40fedc9
7 files changed
+184
-28
No files matched your search
@@ -94,16 +94,19 @@ pub func decoder.decode?(dst writer1, src reader1)() {
|
||||
in.dst.mark()
|
||||
var z status = try this.flate.decode?(dst:in.dst, src:in.src)
|
||||
if not this.ignore_checksum {
|
||||
// TODO: checksum_got = this.checksum.update(x:in.dst.since_mark())
|
||||
checksum_got = this.checksum.update(x:in.dst.since_mark())
|
||||
}
|
||||
if z.is_ok() {
|
||||
break
|
||||
}
|
||||
yield z
|
||||
}
|
||||
var checksum_want u32 = in.src.read_u32be?()
|
||||
var checksum_want u32 = in.src.read_u32le?()
|
||||
var decoded_length_want u32 = in.src.read_u32le?()
|
||||
if (not this.ignore_checksum) and (checksum_got != checksum_want) {
|
||||
// TODO: return error "checksum mismatch"
|
||||
return error "checksum mismatch"
|
||||
}
|
||||
if decoded_length_want != 0 {
|
||||
// TODO: compare with decoded_length_got.
|
||||
}
|
||||
// TODO: handle the 4 byte ISIZE field.
|
||||
}
|
||||
Reference in new issue
Block a user