mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Implement gzip decode
This commit is contained in:
1 parent
a26e365992
commit
86d0ade206
6 files changed
+405
-13
No files matched your search
@@ -47,6 +47,8 @@ pub func decoder.decode?(dst writer1, src reader1)() {
|
||||
if (x % 31) != 0 {
|
||||
return error "invalid zlib parity check"
|
||||
}
|
||||
|
||||
// Decode and checksum the DEFLATE-encoded payload.
|
||||
var checksum u32
|
||||
while true {
|
||||
in.dst.mark()
|
||||
@@ -59,6 +61,7 @@ pub func decoder.decode?(dst writer1, src reader1)() {
|
||||
}
|
||||
yield z
|
||||
}
|
||||
// TODO: read the 4 bytes regardless of this.ignore_checksum.
|
||||
if (not this.ignore_checksum) and (checksum != in.src.read_u32be?()) {
|
||||
return error "checksum mismatch"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user