mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 00:47:28 +01:00
Remove some redundancy in error messages
This commit is contained in:
1 parent
37ca5e8504
commit
ee777d66c5
13 files changed
+97
-101
No files matched your search
@@ -18,11 +18,11 @@ use "std/adler32"
|
||||
use "std/deflate"
|
||||
|
||||
pub error "checksum mismatch"
|
||||
pub error "invalid zlib compression method"
|
||||
pub error "invalid zlib compression window size"
|
||||
pub error "invalid zlib parity check"
|
||||
pub error "invalid compression method"
|
||||
pub error "invalid compression window size"
|
||||
pub error "invalid parity check"
|
||||
|
||||
pub error "TODO: unsupported zlib preset dictionary"
|
||||
pub error "TODO: unsupported preset dictionary"
|
||||
|
||||
pub struct decoder?(
|
||||
flate deflate.decoder,
|
||||
@@ -37,16 +37,16 @@ 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 = in.src.read_u16be?()
|
||||
if ((x >> 8) & 0x0F) != 0x08 {
|
||||
return error "invalid zlib compression method"
|
||||
return error "invalid compression method"
|
||||
}
|
||||
if (x >> 12) > 0x07 {
|
||||
return error "invalid zlib compression window size"
|
||||
return error "invalid compression window size"
|
||||
}
|
||||
if (x & 0x20) != 0 {
|
||||
return error "TODO: unsupported zlib preset dictionary"
|
||||
return error "TODO: unsupported preset dictionary"
|
||||
}
|
||||
if (x % 31) != 0 {
|
||||
return error "invalid zlib parity check"
|
||||
return error "invalid parity check"
|
||||
}
|
||||
|
||||
// Decode and checksum the DEFLATE-encoded payload.
|
||||
|
||||
Reference in new issue
Block a user