mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 16:47:28 +01:00
Rename checksum fields and variables
This commit is contained in:
1 parent
86d0ade206
commit
72449fa0ec
7 files changed
+28
-28
No files matched your search
@@ -89,12 +89,12 @@ pub func decoder.decode?(dst writer1, src reader1)() {
|
||||
}
|
||||
|
||||
// Decode and checksum the DEFLATE-encoded payload.
|
||||
var checksum u32
|
||||
var checksum_got u32
|
||||
while true {
|
||||
in.dst.mark()
|
||||
var z status = try this.flate.decode?(dst:in.dst, src:in.src)
|
||||
if not this.ignore_checksum {
|
||||
// TODO: checksum = this.checksum.update(x:in.dst.since_mark())
|
||||
// TODO: checksum_got = this.checksum.update(x:in.dst.since_mark())
|
||||
}
|
||||
if z.is_ok() {
|
||||
break
|
||||
@@ -102,7 +102,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?()) {
|
||||
if (not this.ignore_checksum) and (checksum_got != in.src.read_u32be?()) {
|
||||
// TODO: return error "checksum mismatch"
|
||||
}
|
||||
// TODO: handle the 4 byte ISIZE field.
|
||||
|
||||
@@ -25,7 +25,7 @@ pub error "TODO: unsupported zlib preset dictionary"
|
||||
|
||||
pub struct decoder?(
|
||||
flate deflate.decoder,
|
||||
adler adler32,
|
||||
checksum adler32,
|
||||
ignore_checksum bool,
|
||||
)
|
||||
|
||||
@@ -49,12 +49,12 @@ pub func decoder.decode?(dst writer1, src reader1)() {
|
||||
}
|
||||
|
||||
// Decode and checksum the DEFLATE-encoded payload.
|
||||
var checksum u32
|
||||
var checksum_got u32
|
||||
while true {
|
||||
in.dst.mark()
|
||||
var z status = try this.flate.decode?(dst:in.dst, src:in.src)
|
||||
if not this.ignore_checksum {
|
||||
checksum = this.adler.update(x:in.dst.since_mark())
|
||||
checksum_got = this.checksum.update(x:in.dst.since_mark())
|
||||
}
|
||||
if z.is_ok() {
|
||||
break
|
||||
@@ -62,7 +62,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?()) {
|
||||
if (not this.ignore_checksum) and (checksum_got != in.src.read_u32be?()) {
|
||||
return error "checksum mismatch"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user