mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 00:47:28 +01:00
Place some vars at the top of functions
This commit is contained in:
1 parent
87b8b44778
commit
bac74a830d
6 files changed
+15
-11
No files matched your search
@@ -33,7 +33,12 @@ pub func decoder.set_ignore_checksum!(ic base.bool) {
|
||||
}
|
||||
|
||||
pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
|
||||
var x base.u16 = args.src.read_u16be!??()
|
||||
var x base.u16
|
||||
var checksum_got base.u32
|
||||
var z base.status
|
||||
var checksum_want base.u32
|
||||
|
||||
x = args.src.read_u16be!??()
|
||||
if ((x >> 8) & 0x0F) != 0x08 {
|
||||
return "?bad compression method"
|
||||
}
|
||||
@@ -48,10 +53,9 @@ 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 {
|
||||
args.dst.set_mark!()
|
||||
var z base.status =? this.flate.decode!??(dst:args.dst, src:args.src)
|
||||
z =? this.flate.decode!??(dst:args.dst, src:args.src)
|
||||
if not this.ignore_checksum {
|
||||
checksum_got = this.checksum.update!(x:args.dst.since_mark())
|
||||
}
|
||||
@@ -60,7 +64,7 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
|
||||
}
|
||||
yield z
|
||||
}
|
||||
var checksum_want base.u32 = args.src.read_u32be!??()
|
||||
checksum_want = args.src.read_u32be!??()
|
||||
if (not this.ignore_checksum) and (checksum_got != checksum_want) {
|
||||
return "?bad checksum"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user