Rename some error messages

This commit is contained in:
Nigel Tao committed 2018-06-02 13:16:50 +10:00
1 parent 8474b473ca
commit 3e1cdd1a83
8 files changed
+46 -48

No files matched your search

+10 -10
View File
@@ -1467,10 +1467,10 @@ typedef int32_t wuffs_gzip__status;
#define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D
#define WUFFS_GZIP__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_GZIP__SUSPENSION_END_OF_DATA 14 // 0x0000000E
#define WUFFS_GZIP__ERROR_BAD_HEADER -1080566784 // 0xBF97DC00 #define WUFFS_GZIP__ERROR_BAD_CHECKSUM -1080566784 // 0xBF97DC00
#define WUFFS_GZIP__ERROR_CHECKSUM_MISMATCH -1080566783 // 0xBF97DC01 #define WUFFS_GZIP__ERROR_BAD_COMPRESSION_METHOD -1080566783 // 0xBF97DC01
#define WUFFS_GZIP__ERROR_INVALID_COMPRESSION_METHOD -1080566782 // 0xBF97DC02 #define WUFFS_GZIP__ERROR_BAD_ENCODING_FLAGS -1080566782 // 0xBF97DC02
#define WUFFS_GZIP__ERROR_INVALID_ENCODING_FLAGS -1080566781 // 0xBF97DC03 #define WUFFS_GZIP__ERROR_BAD_HEADER -1080566781 // 0xBF97DC03
bool wuffs_gzip__status__is_error(wuffs_gzip__status s); bool wuffs_gzip__status__is_error(wuffs_gzip__status s);
@@ -2123,10 +2123,10 @@ bool wuffs_gzip__status__is_error(wuffs_gzip__status s) {
} }
const char* wuffs_gzip__status__strings[4] = { const char* wuffs_gzip__status__strings[4] = {
"gzip: bad checksum",
"gzip: bad compression method",
"gzip: bad encoding flags",
"gzip: bad header", "gzip: bad header",
"gzip: checksum mismatch",
"gzip: invalid compression method",
"gzip: invalid encoding flags",
}; };
const char* wuffs_gzip__status__string(wuffs_gzip__status s) { const char* wuffs_gzip__status__string(wuffs_gzip__status s) {
@@ -2306,7 +2306,7 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
} }
uint8_t t_2 = *ioptr_src++; uint8_t t_2 = *ioptr_src++;
if (t_2 != 8) { if (t_2 != 8) {
status = WUFFS_GZIP__ERROR_INVALID_COMPRESSION_METHOD; status = WUFFS_GZIP__ERROR_BAD_COMPRESSION_METHOD;
goto exit; goto exit;
} }
{ {
@@ -2410,7 +2410,7 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
ioptr_src += self->private_impl.c_decode[0].scratch; ioptr_src += self->private_impl.c_decode[0].scratch;
} }
if ((v_flags & 224) != 0) { if ((v_flags & 224) != 0) {
status = WUFFS_GZIP__ERROR_INVALID_ENCODING_FLAGS; status = WUFFS_GZIP__ERROR_BAD_ENCODING_FLAGS;
goto exit; goto exit;
} }
v_checksum_got = 0; v_checksum_got = 0;
@@ -2516,7 +2516,7 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
if (!self->private_impl.f_ignore_checksum && if (!self->private_impl.f_ignore_checksum &&
((v_checksum_got != v_checksum_want) || ((v_checksum_got != v_checksum_want) ||
(v_decoded_length_got != v_decoded_length_want))) { (v_decoded_length_got != v_decoded_length_want))) {
status = WUFFS_GZIP__ERROR_CHECKSUM_MISMATCH; status = WUFFS_GZIP__ERROR_BAD_CHECKSUM;
goto exit; goto exit;
} }
+12 -13
View File
@@ -1468,11 +1468,10 @@ typedef int32_t wuffs_zlib__status;
#define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D
#define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 14 // 0x0000000E
#define WUFFS_ZLIB__ERROR_CHECKSUM_MISMATCH -33692672 // 0xFDFDE400 #define WUFFS_ZLIB__ERROR_BAD_CHECKSUM -33692672 // 0xFDFDE400
#define WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_METHOD -33692671 // 0xFDFDE401 #define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_METHOD -33692671 // 0xFDFDE401
#define WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_WINDOW_SIZE \ #define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_WINDOW_SIZE -33692670 // 0xFDFDE402
-33692670 // 0xFDFDE402 #define WUFFS_ZLIB__ERROR_BAD_PARITY_CHECK -33692669 // 0xFDFDE403
#define WUFFS_ZLIB__ERROR_INVALID_PARITY_CHECK -33692669 // 0xFDFDE403
#define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \ #define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \
-33692668 // 0xFDFDE404 -33692668 // 0xFDFDE404
@@ -2123,10 +2122,10 @@ bool wuffs_zlib__status__is_error(wuffs_zlib__status s) {
} }
const char* wuffs_zlib__status__strings[5] = { const char* wuffs_zlib__status__strings[5] = {
"zlib: checksum mismatch", "zlib: bad checksum",
"zlib: invalid compression method", "zlib: bad compression method",
"zlib: invalid compression window size", "zlib: bad compression window size",
"zlib: invalid parity check", "zlib: bad parity check",
"zlib: TODO: unsupported preset dictionary", "zlib: TODO: unsupported preset dictionary",
}; };
@@ -2303,11 +2302,11 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
v_x = t_1; v_x = t_1;
} }
if (((v_x >> 8) & 15) != 8) { if (((v_x >> 8) & 15) != 8) {
status = WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_METHOD; status = WUFFS_ZLIB__ERROR_BAD_COMPRESSION_METHOD;
goto exit; goto exit;
} }
if ((v_x >> 12) > 7) { if ((v_x >> 12) > 7) {
status = WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_WINDOW_SIZE; status = WUFFS_ZLIB__ERROR_BAD_COMPRESSION_WINDOW_SIZE;
goto exit; goto exit;
} }
if ((v_x & 32) != 0) { if ((v_x & 32) != 0) {
@@ -2315,7 +2314,7 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
goto exit; goto exit;
} }
if ((v_x % 31) != 0) { if ((v_x % 31) != 0) {
status = WUFFS_ZLIB__ERROR_INVALID_PARITY_CHECK; status = WUFFS_ZLIB__ERROR_BAD_PARITY_CHECK;
goto exit; goto exit;
} }
v_checksum_got = 0; v_checksum_got = 0;
@@ -2383,7 +2382,7 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
} }
if (!self->private_impl.f_ignore_checksum && if (!self->private_impl.f_ignore_checksum &&
(v_checksum_got != v_checksum_want)) { (v_checksum_got != v_checksum_want)) {
status = WUFFS_ZLIB__ERROR_CHECKSUM_MISMATCH; status = WUFFS_ZLIB__ERROR_BAD_CHECKSUM;
goto exit; goto exit;
} }
+4 -4
View File
@@ -1467,10 +1467,10 @@ typedef int32_t wuffs_gzip__status;
#define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D
#define WUFFS_GZIP__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_GZIP__SUSPENSION_END_OF_DATA 14 // 0x0000000E
#define WUFFS_GZIP__ERROR_BAD_HEADER -1080566784 // 0xBF97DC00 #define WUFFS_GZIP__ERROR_BAD_CHECKSUM -1080566784 // 0xBF97DC00
#define WUFFS_GZIP__ERROR_CHECKSUM_MISMATCH -1080566783 // 0xBF97DC01 #define WUFFS_GZIP__ERROR_BAD_COMPRESSION_METHOD -1080566783 // 0xBF97DC01
#define WUFFS_GZIP__ERROR_INVALID_COMPRESSION_METHOD -1080566782 // 0xBF97DC02 #define WUFFS_GZIP__ERROR_BAD_ENCODING_FLAGS -1080566782 // 0xBF97DC02
#define WUFFS_GZIP__ERROR_INVALID_ENCODING_FLAGS -1080566781 // 0xBF97DC03 #define WUFFS_GZIP__ERROR_BAD_HEADER -1080566781 // 0xBF97DC03
bool wuffs_gzip__status__is_error(wuffs_gzip__status s); bool wuffs_gzip__status__is_error(wuffs_gzip__status s);
+4 -5
View File
@@ -1468,11 +1468,10 @@ typedef int32_t wuffs_zlib__status;
#define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D
#define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 14 // 0x0000000E
#define WUFFS_ZLIB__ERROR_CHECKSUM_MISMATCH -33692672 // 0xFDFDE400 #define WUFFS_ZLIB__ERROR_BAD_CHECKSUM -33692672 // 0xFDFDE400
#define WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_METHOD -33692671 // 0xFDFDE401 #define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_METHOD -33692671 // 0xFDFDE401
#define WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_WINDOW_SIZE \ #define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_WINDOW_SIZE -33692670 // 0xFDFDE402
-33692670 // 0xFDFDE402 #define WUFFS_ZLIB__ERROR_BAD_PARITY_CHECK -33692669 // 0xFDFDE403
#define WUFFS_ZLIB__ERROR_INVALID_PARITY_CHECK -33692669 // 0xFDFDE403
#define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \ #define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \
-33692668 // 0xFDFDE404 -33692668 // 0xFDFDE404
+6 -6
View File
@@ -17,10 +17,10 @@ packageid "gzip"
use "std/crc32" use "std/crc32"
use "std/deflate" use "std/deflate"
pub error "bad checksum"
pub error "bad compression method"
pub error "bad encoding flags"
pub error "bad header" pub error "bad header"
pub error "checksum mismatch"
pub error "invalid compression method"
pub error "invalid encoding flags"
pub struct decoder?( pub struct decoder?(
flate deflate.decoder, flate deflate.decoder,
@@ -41,7 +41,7 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
return error "bad header" return error "bad header"
} }
if in.src.read_u8?() != 0x08 { if in.src.read_u8?() != 0x08 {
return error "invalid compression method" return error "bad compression method"
} }
var flags base.u8 = in.src.read_u8?() var flags base.u8 = in.src.read_u8?()
// TODO: API for returning the header's MTIME field. // 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. // Reserved flags bits must be zero.
if (flags & 0xE0) != 0 { if (flags & 0xE0) != 0 {
return error "invalid encoding flags" return error "bad encoding flags"
} }
// Decode and checksum the DEFLATE-encoded payload. // 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?() var decoded_length_want base.u32 = in.src.read_u32le?()
if (not this.ignore_checksum) and if (not this.ignore_checksum) and
((checksum_got != checksum_want) or (decoded_length_got != decoded_length_want)) { ((checksum_got != checksum_want) or (decoded_length_got != decoded_length_want)) {
return error "checksum mismatch" return error "bad checksum"
} }
} }
+8 -8
View File
@@ -17,10 +17,10 @@ packageid "zlib"
use "std/adler32" use "std/adler32"
use "std/deflate" use "std/deflate"
pub error "checksum mismatch" pub error "bad checksum"
pub error "invalid compression method" pub error "bad compression method"
pub error "invalid compression window size" pub error "bad compression window size"
pub error "invalid parity check" pub error "bad parity check"
pub error "TODO: unsupported preset dictionary" 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)() { pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
var x base.u16 = in.src.read_u16be?() var x base.u16 = in.src.read_u16be?()
if ((x >> 8) & 0x0F) != 0x08 { if ((x >> 8) & 0x0F) != 0x08 {
return error "invalid compression method" return error "bad compression method"
} }
if (x >> 12) > 0x07 { if (x >> 12) > 0x07 {
return error "invalid compression window size" return error "bad compression window size"
} }
if (x & 0x20) != 0 { if (x & 0x20) != 0 {
return error "TODO: unsupported preset dictionary" return error "TODO: unsupported preset dictionary"
} }
if (x % 31) != 0 { if (x % 31) != 0 {
return error "invalid parity check" return error "bad parity check"
} }
// Decode and checksum the DEFLATE-encoded payload. // 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?() var checksum_want base.u32 = in.src.read_u32be?()
if (not this.ignore_checksum) and (checksum_got != checksum_want) { if (not this.ignore_checksum) and (checksum_got != checksum_want) {
return error "checksum mismatch" return error "bad checksum"
} }
} }
+1 -1
View File
@@ -139,7 +139,7 @@ bool do_test_wuffs_gzip_checksum(bool ignore_checksum, uint32_t bad_checksum) {
want = WUFFS_GZIP__SUSPENSION_SHORT_READ; want = WUFFS_GZIP__SUSPENSION_SHORT_READ;
} else { } else {
want = (bad_checksum && !ignore_checksum) want = (bad_checksum && !ignore_checksum)
? WUFFS_GZIP__ERROR_CHECKSUM_MISMATCH ? WUFFS_GZIP__ERROR_BAD_CHECKSUM
: WUFFS_GZIP__STATUS_OK; : WUFFS_GZIP__STATUS_OK;
} }
+1 -1
View File
@@ -153,7 +153,7 @@ bool do_test_wuffs_zlib_checksum(bool ignore_checksum, bool bad_checksum) {
want = WUFFS_ZLIB__SUSPENSION_SHORT_READ; want = WUFFS_ZLIB__SUSPENSION_SHORT_READ;
} else { } else {
want = (bad_checksum && !ignore_checksum) want = (bad_checksum && !ignore_checksum)
? WUFFS_ZLIB__ERROR_CHECKSUM_MISMATCH ? WUFFS_ZLIB__ERROR_BAD_CHECKSUM
: WUFFS_ZLIB__STATUS_OK; : WUFFS_ZLIB__STATUS_OK;
} }