mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 16:52:18 +01:00
Rename some error messages
This commit is contained in:
1 parent
8474b473ca
commit
3e1cdd1a83
8 files changed
+46
-48
No files matched your search
@@ -17,10 +17,10 @@ packageid "gzip"
|
||||
use "std/crc32"
|
||||
use "std/deflate"
|
||||
|
||||
pub error "bad checksum"
|
||||
pub error "bad compression method"
|
||||
pub error "bad encoding flags"
|
||||
pub error "bad header"
|
||||
pub error "checksum mismatch"
|
||||
pub error "invalid compression method"
|
||||
pub error "invalid encoding flags"
|
||||
|
||||
pub struct decoder?(
|
||||
flate deflate.decoder,
|
||||
@@ -41,7 +41,7 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
return error "bad header"
|
||||
}
|
||||
if in.src.read_u8?() != 0x08 {
|
||||
return error "invalid compression method"
|
||||
return error "bad compression method"
|
||||
}
|
||||
var flags base.u8 = in.src.read_u8?()
|
||||
// TODO: API for returning the header's MTIME field.
|
||||
@@ -85,7 +85,7 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
|
||||
// Reserved flags bits must be zero.
|
||||
if (flags & 0xE0) != 0 {
|
||||
return error "invalid encoding flags"
|
||||
return error "bad encoding flags"
|
||||
}
|
||||
|
||||
// Decode and checksum the DEFLATE-encoded payload.
|
||||
@@ -107,6 +107,6 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
var decoded_length_want base.u32 = in.src.read_u32le?()
|
||||
if (not this.ignore_checksum) and
|
||||
((checksum_got != checksum_want) or (decoded_length_got != decoded_length_want)) {
|
||||
return error "checksum mismatch"
|
||||
return error "bad checksum"
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,10 @@ packageid "zlib"
|
||||
use "std/adler32"
|
||||
use "std/deflate"
|
||||
|
||||
pub error "checksum mismatch"
|
||||
pub error "invalid compression method"
|
||||
pub error "invalid compression window size"
|
||||
pub error "invalid parity check"
|
||||
pub error "bad checksum"
|
||||
pub error "bad compression method"
|
||||
pub error "bad compression window size"
|
||||
pub error "bad parity check"
|
||||
|
||||
pub error "TODO: unsupported preset dictionary"
|
||||
|
||||
@@ -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 compression method"
|
||||
return error "bad compression method"
|
||||
}
|
||||
if (x >> 12) > 0x07 {
|
||||
return error "invalid compression window size"
|
||||
return error "bad compression window size"
|
||||
}
|
||||
if (x & 0x20) != 0 {
|
||||
return error "TODO: unsupported preset dictionary"
|
||||
}
|
||||
if (x % 31) != 0 {
|
||||
return error "invalid parity check"
|
||||
return error "bad parity check"
|
||||
}
|
||||
|
||||
// Decode and checksum the DEFLATE-encoded payload.
|
||||
@@ -64,6 +64,6 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
}
|
||||
var checksum_want base.u32 = in.src.read_u32be?()
|
||||
if (not this.ignore_checksum) and (checksum_got != checksum_want) {
|
||||
return error "checksum mismatch"
|
||||
return error "bad checksum"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user