Add a "?" prefix to non-built-in status messages

This commit is contained in:
Nigel Tao committed 2018-08-12 14:07:40 +10:00
1 parent 0ed0ead057
commit b385c30b4f
11 files changed
+152 -154

No files matched your search

+9 -9
View File
@@ -17,10 +17,10 @@ packageid "gzip"
use "std/crc32"
use "std/deflate"
pub error (0x01) "bad checksum"
pub error (0x02) "bad compression method"
pub error (0x03) "bad encoding flags"
pub error (0x04) "bad header"
pub error (0x01) "?bad checksum"
pub error (0x02) "?bad compression method"
pub error (0x03) "?bad encoding flags"
pub error (0x04) "?bad header"
pub struct decoder?(
flate deflate.decoder,
@@ -36,15 +36,15 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
// Read the header.
var c base.u8 = args.src.read_u8!??()
if c != 0x1F {
return error "bad header"
return error "?bad header"
}
c = args.src.read_u8!??()
if c != 0x8B {
return error "bad header"
return error "?bad header"
}
c = args.src.read_u8!??()
if c != 0x08 {
return error "bad compression method"
return error "?bad compression method"
}
var flags base.u8 = args.src.read_u8!??()
// TODO: API for returning the header's MTIME field.
@@ -87,7 +87,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 "bad encoding flags"
return error "?bad encoding flags"
}
// Decode and checksum the DEFLATE-encoded payload.
@@ -109,6 +109,6 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
var decoded_length_want base.u32 = args.src.read_u32le!??()
if (not this.ignore_checksum) and
((checksum_got != checksum_want) or (decoded_length_got != decoded_length_want)) {
return error "bad checksum"
return error "?bad checksum"
}
}