mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +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
+5
-5
@@ -1071,9 +1071,9 @@ typedef int32_t wuffs_deflate__status;
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
|
||||
-1278585851 // 0xB3CA5405
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_FLATE_BLOCK -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
|
||||
-1278585847 // 0xB3CA5409
|
||||
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
|
||||
@@ -1687,9 +1687,9 @@ const char* wuffs_deflate__status__strings[17] = {
|
||||
"deflate: bad Huffman code length repetition",
|
||||
"deflate: bad Huffman code",
|
||||
"deflate: bad Huffman minimum code length",
|
||||
"deflate: bad block",
|
||||
"deflate: bad distance",
|
||||
"deflate: bad distance code count",
|
||||
"deflate: bad flate block",
|
||||
"deflate: bad literal/length code count",
|
||||
"deflate: inconsistent stored block length",
|
||||
"deflate: missing end-of-block code",
|
||||
@@ -2042,7 +2042,7 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_blocks(
|
||||
goto suspend;
|
||||
}
|
||||
} else {
|
||||
status = WUFFS_DEFLATE__ERROR_BAD_FLATE_BLOCK;
|
||||
status = WUFFS_DEFLATE__ERROR_BAD_BLOCK;
|
||||
goto exit;
|
||||
}
|
||||
self->private_impl.f_end_of_block = false;
|
||||
|
||||
+11
-11
@@ -1059,10 +1059,10 @@ typedef int32_t wuffs_gif__status;
|
||||
#define WUFFS_GIF__ERROR_INVALID_CALL_SEQUENCE -2147483637 // 0x8000000B
|
||||
#define WUFFS_GIF__SUSPENSION_END_OF_DATA 12 // 0x0000000C
|
||||
|
||||
#define WUFFS_GIF__ERROR_BAD_GIF_BLOCK -1105848320 // 0xBE161800
|
||||
#define WUFFS_GIF__ERROR_BAD_GIF_EXTENSION_LABEL -1105848319 // 0xBE161801
|
||||
#define WUFFS_GIF__ERROR_BAD_GIF_HEADER -1105848318 // 0xBE161802
|
||||
#define WUFFS_GIF__ERROR_BAD_LZW_LITERAL_WIDTH -1105848317 // 0xBE161803
|
||||
#define WUFFS_GIF__ERROR_BAD_BLOCK -1105848320 // 0xBE161800
|
||||
#define WUFFS_GIF__ERROR_BAD_EXTENSION_LABEL -1105848319 // 0xBE161801
|
||||
#define WUFFS_GIF__ERROR_BAD_HEADER -1105848318 // 0xBE161802
|
||||
#define WUFFS_GIF__ERROR_BAD_LITERAL_WIDTH -1105848317 // 0xBE161803
|
||||
#define WUFFS_GIF__ERROR_LZW_CODE_IS_OUT_OF_RANGE -1105848316 // 0xBE161804
|
||||
#define WUFFS_GIF__ERROR_LZW_PREFIX_CHAIN_IS_CYCLICAL -1105848315 // 0xBE161805
|
||||
|
||||
@@ -1697,10 +1697,10 @@ bool wuffs_gif__status__is_error(wuffs_gif__status s) {
|
||||
}
|
||||
|
||||
const char* wuffs_gif__status__strings[6] = {
|
||||
"gif: bad GIF block",
|
||||
"gif: bad GIF extension label",
|
||||
"gif: bad GIF header",
|
||||
"gif: bad LZW literal width",
|
||||
"gif: bad block",
|
||||
"gif: bad extension label",
|
||||
"gif: bad header",
|
||||
"gif: bad literal width",
|
||||
"gif: LZW code is out of range",
|
||||
"gif: LZW prefix chain is cyclical",
|
||||
};
|
||||
@@ -2030,7 +2030,7 @@ wuffs_gif__status wuffs_gif__decoder__decode_frame(
|
||||
} else if (self->private_impl.f_block_type == 59) {
|
||||
goto label_0_break;
|
||||
} else {
|
||||
status = WUFFS_GIF__ERROR_BAD_GIF_BLOCK;
|
||||
status = WUFFS_GIF__ERROR_BAD_BLOCK;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
@@ -2119,7 +2119,7 @@ static wuffs_gif__status wuffs_gif__decoder__decode_header(
|
||||
}
|
||||
if ((v_c[0] != 71) || (v_c[1] != 73) || (v_c[2] != 70) || (v_c[3] != 56) ||
|
||||
((v_c[4] != 55) && (v_c[4] != 57)) || (v_c[5] != 97)) {
|
||||
status = WUFFS_GIF__ERROR_BAD_GIF_HEADER;
|
||||
status = WUFFS_GIF__ERROR_BAD_HEADER;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -2872,7 +2872,7 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
v_lw = t_12;
|
||||
}
|
||||
if ((v_lw < 2) || (8 < v_lw)) {
|
||||
status = WUFFS_GIF__ERROR_BAD_LZW_LITERAL_WIDTH;
|
||||
status = WUFFS_GIF__ERROR_BAD_LITERAL_WIDTH;
|
||||
goto exit;
|
||||
}
|
||||
wuffs_gif__lzw_decoder__set_literal_width(&self->private_impl.f_lzw,
|
||||
|
||||
+14
-15
@@ -1170,9 +1170,9 @@ typedef int32_t wuffs_deflate__status;
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
|
||||
-1278585851 // 0xB3CA5405
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_FLATE_BLOCK -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
|
||||
-1278585847 // 0xB3CA5409
|
||||
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
|
||||
@@ -1331,11 +1331,10 @@ typedef int32_t wuffs_gzip__status;
|
||||
#define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -2147483637 // 0x8000000B
|
||||
#define WUFFS_GZIP__SUSPENSION_END_OF_DATA 12 // 0x0000000C
|
||||
|
||||
#define WUFFS_GZIP__ERROR_BAD_GZIP_HEADER -1080566784 // 0xBF97DC00
|
||||
#define WUFFS_GZIP__ERROR_CHECKSUM_MISMATCH -1080566783 // 0xBF97DC01
|
||||
#define WUFFS_GZIP__ERROR_INVALID_GZIP_COMPRESSION_METHOD \
|
||||
-1080566782 // 0xBF97DC02
|
||||
#define WUFFS_GZIP__ERROR_INVALID_GZIP_ENCODING_FLAGS -1080566781 // 0xBF97DC03
|
||||
#define WUFFS_GZIP__ERROR_BAD_HEADER -1080566784 // 0xBF97DC00
|
||||
#define WUFFS_GZIP__ERROR_CHECKSUM_MISMATCH -1080566783 // 0xBF97DC01
|
||||
#define WUFFS_GZIP__ERROR_INVALID_COMPRESSION_METHOD -1080566782 // 0xBF97DC02
|
||||
#define WUFFS_GZIP__ERROR_INVALID_ENCODING_FLAGS -1080566781 // 0xBF97DC03
|
||||
|
||||
bool wuffs_gzip__status__is_error(wuffs_gzip__status s);
|
||||
|
||||
@@ -1885,10 +1884,10 @@ bool wuffs_gzip__status__is_error(wuffs_gzip__status s) {
|
||||
}
|
||||
|
||||
const char* wuffs_gzip__status__strings[4] = {
|
||||
"gzip: bad gzip header",
|
||||
"gzip: bad header",
|
||||
"gzip: checksum mismatch",
|
||||
"gzip: invalid gzip compression method",
|
||||
"gzip: invalid gzip encoding flags",
|
||||
"gzip: invalid compression method",
|
||||
"gzip: invalid encoding flags",
|
||||
};
|
||||
|
||||
const char* wuffs_gzip__status__string(wuffs_gzip__status s) {
|
||||
@@ -2037,7 +2036,7 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
if (t_0 != 31) {
|
||||
status = WUFFS_GZIP__ERROR_BAD_GZIP_HEADER;
|
||||
status = WUFFS_GZIP__ERROR_BAD_HEADER;
|
||||
goto exit;
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
@@ -2046,7 +2045,7 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
}
|
||||
uint8_t t_1 = *b_rptr_src++;
|
||||
if (t_1 != 139) {
|
||||
status = WUFFS_GZIP__ERROR_BAD_GZIP_HEADER;
|
||||
status = WUFFS_GZIP__ERROR_BAD_HEADER;
|
||||
goto exit;
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
@@ -2055,7 +2054,7 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
}
|
||||
uint8_t t_2 = *b_rptr_src++;
|
||||
if (t_2 != 8) {
|
||||
status = WUFFS_GZIP__ERROR_INVALID_GZIP_COMPRESSION_METHOD;
|
||||
status = WUFFS_GZIP__ERROR_INVALID_COMPRESSION_METHOD;
|
||||
goto exit;
|
||||
}
|
||||
{
|
||||
@@ -2159,7 +2158,7 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
b_rptr_src += self->private_impl.c_decode[0].scratch;
|
||||
}
|
||||
if ((v_flags & 224) != 0) {
|
||||
status = WUFFS_GZIP__ERROR_INVALID_GZIP_ENCODING_FLAGS;
|
||||
status = WUFFS_GZIP__ERROR_INVALID_ENCODING_FLAGS;
|
||||
goto exit;
|
||||
}
|
||||
v_checksum_got = 0;
|
||||
|
||||
+17
-18
@@ -1171,9 +1171,9 @@ typedef int32_t wuffs_deflate__status;
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
|
||||
-1278585851 // 0xB3CA5405
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_FLATE_BLOCK -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
|
||||
-1278585847 // 0xB3CA5409
|
||||
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
|
||||
@@ -1332,13 +1332,12 @@ typedef int32_t wuffs_zlib__status;
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -2147483637 // 0x8000000B
|
||||
#define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 12 // 0x0000000C
|
||||
|
||||
#define WUFFS_ZLIB__ERROR_CHECKSUM_MISMATCH -33692672 // 0xFDFDE400
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_ZLIB_COMPRESSION_METHOD \
|
||||
-33692671 // 0xFDFDE401
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_ZLIB_COMPRESSION_WINDOW_SIZE \
|
||||
-33692670 // 0xFDFDE402
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_ZLIB_PARITY_CHECK -33692669 // 0xFDFDE403
|
||||
#define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_ZLIB_PRESET_DICTIONARY \
|
||||
#define WUFFS_ZLIB__ERROR_CHECKSUM_MISMATCH -33692672 // 0xFDFDE400
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_METHOD -33692671 // 0xFDFDE401
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_WINDOW_SIZE \
|
||||
-33692670 // 0xFDFDE402
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_PARITY_CHECK -33692669 // 0xFDFDE403
|
||||
#define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \
|
||||
-33692668 // 0xFDFDE404
|
||||
|
||||
bool wuffs_zlib__status__is_error(wuffs_zlib__status s);
|
||||
@@ -1886,10 +1885,10 @@ bool wuffs_zlib__status__is_error(wuffs_zlib__status s) {
|
||||
|
||||
const char* wuffs_zlib__status__strings[5] = {
|
||||
"zlib: checksum mismatch",
|
||||
"zlib: invalid zlib compression method",
|
||||
"zlib: invalid zlib compression window size",
|
||||
"zlib: invalid zlib parity check",
|
||||
"zlib: TODO: unsupported zlib preset dictionary",
|
||||
"zlib: invalid compression method",
|
||||
"zlib: invalid compression window size",
|
||||
"zlib: invalid parity check",
|
||||
"zlib: TODO: unsupported preset dictionary",
|
||||
};
|
||||
|
||||
const char* wuffs_zlib__status__string(wuffs_zlib__status s) {
|
||||
@@ -2051,19 +2050,19 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
v_x = t_1;
|
||||
}
|
||||
if (((v_x >> 8) & 15) != 8) {
|
||||
status = WUFFS_ZLIB__ERROR_INVALID_ZLIB_COMPRESSION_METHOD;
|
||||
status = WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_METHOD;
|
||||
goto exit;
|
||||
}
|
||||
if ((v_x >> 12) > 7) {
|
||||
status = WUFFS_ZLIB__ERROR_INVALID_ZLIB_COMPRESSION_WINDOW_SIZE;
|
||||
status = WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_WINDOW_SIZE;
|
||||
goto exit;
|
||||
}
|
||||
if ((v_x & 32) != 0) {
|
||||
status = WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_ZLIB_PRESET_DICTIONARY;
|
||||
status = WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY;
|
||||
goto exit;
|
||||
}
|
||||
if ((v_x % 31) != 0) {
|
||||
status = WUFFS_ZLIB__ERROR_INVALID_ZLIB_PARITY_CHECK;
|
||||
status = WUFFS_ZLIB__ERROR_INVALID_PARITY_CHECK;
|
||||
goto exit;
|
||||
}
|
||||
v_checksum_got = 0;
|
||||
|
||||
+3
-3
@@ -1071,9 +1071,9 @@ typedef int32_t wuffs_deflate__status;
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
|
||||
-1278585851 // 0xB3CA5405
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_FLATE_BLOCK -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
|
||||
-1278585847 // 0xB3CA5409
|
||||
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
|
||||
|
||||
+4
-4
@@ -1059,10 +1059,10 @@ typedef int32_t wuffs_gif__status;
|
||||
#define WUFFS_GIF__ERROR_INVALID_CALL_SEQUENCE -2147483637 // 0x8000000B
|
||||
#define WUFFS_GIF__SUSPENSION_END_OF_DATA 12 // 0x0000000C
|
||||
|
||||
#define WUFFS_GIF__ERROR_BAD_GIF_BLOCK -1105848320 // 0xBE161800
|
||||
#define WUFFS_GIF__ERROR_BAD_GIF_EXTENSION_LABEL -1105848319 // 0xBE161801
|
||||
#define WUFFS_GIF__ERROR_BAD_GIF_HEADER -1105848318 // 0xBE161802
|
||||
#define WUFFS_GIF__ERROR_BAD_LZW_LITERAL_WIDTH -1105848317 // 0xBE161803
|
||||
#define WUFFS_GIF__ERROR_BAD_BLOCK -1105848320 // 0xBE161800
|
||||
#define WUFFS_GIF__ERROR_BAD_EXTENSION_LABEL -1105848319 // 0xBE161801
|
||||
#define WUFFS_GIF__ERROR_BAD_HEADER -1105848318 // 0xBE161802
|
||||
#define WUFFS_GIF__ERROR_BAD_LITERAL_WIDTH -1105848317 // 0xBE161803
|
||||
#define WUFFS_GIF__ERROR_LZW_CODE_IS_OUT_OF_RANGE -1105848316 // 0xBE161804
|
||||
#define WUFFS_GIF__ERROR_LZW_PREFIX_CHAIN_IS_CYCLICAL -1105848315 // 0xBE161805
|
||||
|
||||
|
||||
+7
-8
@@ -1170,9 +1170,9 @@ typedef int32_t wuffs_deflate__status;
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
|
||||
-1278585851 // 0xB3CA5405
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_FLATE_BLOCK -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
|
||||
-1278585847 // 0xB3CA5409
|
||||
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
|
||||
@@ -1331,11 +1331,10 @@ typedef int32_t wuffs_gzip__status;
|
||||
#define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -2147483637 // 0x8000000B
|
||||
#define WUFFS_GZIP__SUSPENSION_END_OF_DATA 12 // 0x0000000C
|
||||
|
||||
#define WUFFS_GZIP__ERROR_BAD_GZIP_HEADER -1080566784 // 0xBF97DC00
|
||||
#define WUFFS_GZIP__ERROR_CHECKSUM_MISMATCH -1080566783 // 0xBF97DC01
|
||||
#define WUFFS_GZIP__ERROR_INVALID_GZIP_COMPRESSION_METHOD \
|
||||
-1080566782 // 0xBF97DC02
|
||||
#define WUFFS_GZIP__ERROR_INVALID_GZIP_ENCODING_FLAGS -1080566781 // 0xBF97DC03
|
||||
#define WUFFS_GZIP__ERROR_BAD_HEADER -1080566784 // 0xBF97DC00
|
||||
#define WUFFS_GZIP__ERROR_CHECKSUM_MISMATCH -1080566783 // 0xBF97DC01
|
||||
#define WUFFS_GZIP__ERROR_INVALID_COMPRESSION_METHOD -1080566782 // 0xBF97DC02
|
||||
#define WUFFS_GZIP__ERROR_INVALID_ENCODING_FLAGS -1080566781 // 0xBF97DC03
|
||||
|
||||
bool wuffs_gzip__status__is_error(wuffs_gzip__status s);
|
||||
|
||||
|
||||
+9
-10
@@ -1171,9 +1171,9 @@ typedef int32_t wuffs_deflate__status;
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
|
||||
-1278585851 // 0xB3CA5405
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_FLATE_BLOCK -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408
|
||||
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
|
||||
-1278585847 // 0xB3CA5409
|
||||
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
|
||||
@@ -1332,13 +1332,12 @@ typedef int32_t wuffs_zlib__status;
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -2147483637 // 0x8000000B
|
||||
#define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 12 // 0x0000000C
|
||||
|
||||
#define WUFFS_ZLIB__ERROR_CHECKSUM_MISMATCH -33692672 // 0xFDFDE400
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_ZLIB_COMPRESSION_METHOD \
|
||||
-33692671 // 0xFDFDE401
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_ZLIB_COMPRESSION_WINDOW_SIZE \
|
||||
-33692670 // 0xFDFDE402
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_ZLIB_PARITY_CHECK -33692669 // 0xFDFDE403
|
||||
#define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_ZLIB_PRESET_DICTIONARY \
|
||||
#define WUFFS_ZLIB__ERROR_CHECKSUM_MISMATCH -33692672 // 0xFDFDE400
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_METHOD -33692671 // 0xFDFDE401
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_COMPRESSION_WINDOW_SIZE \
|
||||
-33692670 // 0xFDFDE402
|
||||
#define WUFFS_ZLIB__ERROR_INVALID_PARITY_CHECK -33692669 // 0xFDFDE403
|
||||
#define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \
|
||||
-33692668 // 0xFDFDE404
|
||||
|
||||
bool wuffs_zlib__status__is_error(wuffs_zlib__status s);
|
||||
|
||||
@@ -20,9 +20,9 @@ pub error "bad Huffman code length count"
|
||||
pub error "bad Huffman code length repetition"
|
||||
pub error "bad Huffman code"
|
||||
pub error "bad Huffman minimum code length"
|
||||
pub error "bad block"
|
||||
pub error "bad distance"
|
||||
pub error "bad distance code count"
|
||||
pub error "bad flate block"
|
||||
pub error "bad literal/length code count"
|
||||
pub error "inconsistent stored block length"
|
||||
pub error "missing end-of-block code"
|
||||
@@ -195,7 +195,7 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader)() {
|
||||
} else if type == 2 {
|
||||
this.init_dynamic_huffman?(src:in.src)
|
||||
} else {
|
||||
return error "bad flate block"
|
||||
return error "bad block"
|
||||
}
|
||||
|
||||
this.end_of_block = false
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
packageid "gif "
|
||||
|
||||
pub error "bad GIF block"
|
||||
pub error "bad GIF extension label"
|
||||
pub error "bad GIF header"
|
||||
pub error "bad LZW literal width"
|
||||
pub error "bad block"
|
||||
pub error "bad extension label"
|
||||
pub error "bad header"
|
||||
pub error "bad literal width"
|
||||
|
||||
pub struct decoder?(
|
||||
width base.u32[..65535],
|
||||
@@ -107,7 +107,7 @@ pub func decoder.decode_frame?(dst base.io_writer, src base.io_reader)() {
|
||||
} else if this.block_type == 0x3B { // The spec calls 0x3B the "Trailer".
|
||||
break
|
||||
} else {
|
||||
return error "bad GIF block"
|
||||
return error "bad block"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ pri func decoder.decode_header?(src base.io_reader)() {
|
||||
}
|
||||
if (c[0] != 0x47) or (c[1] != 0x49) or (c[2] != 0x46) or (c[3] != 0x38) or
|
||||
((c[4] != 0x37) and (c[4] != 0x39)) or (c[5] != 0x61) {
|
||||
return error "bad GIF header"
|
||||
return error "bad header"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ pri func decoder.decode_id?(dst base.io_writer, src base.io_reader)() {
|
||||
|
||||
var lw base.u8 = in.src.read_u8?()
|
||||
if (lw < 2) or (8 < lw) {
|
||||
return error "bad LZW literal width"
|
||||
return error "bad literal width"
|
||||
}
|
||||
this.lzw.set_literal_width!(lw:lw as base.u32)
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ packageid "gzip"
|
||||
use "std/crc32"
|
||||
use "std/deflate"
|
||||
|
||||
pub error "bad gzip header"
|
||||
pub error "bad header"
|
||||
pub error "checksum mismatch"
|
||||
pub error "invalid gzip compression method"
|
||||
pub error "invalid gzip encoding flags"
|
||||
pub error "invalid compression method"
|
||||
pub error "invalid encoding flags"
|
||||
|
||||
pub struct decoder?(
|
||||
flate deflate.decoder,
|
||||
@@ -35,13 +35,13 @@ pub func decoder.set_ignore_checksum!(ic base.bool)() {
|
||||
pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
// Read the header.
|
||||
if in.src.read_u8?() != 0x1F {
|
||||
return error "bad gzip header"
|
||||
return error "bad header"
|
||||
}
|
||||
if in.src.read_u8?() != 0x8B {
|
||||
return error "bad gzip header"
|
||||
return error "bad header"
|
||||
}
|
||||
if in.src.read_u8?() != 0x08 {
|
||||
return error "invalid gzip compression method"
|
||||
return error "invalid 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 gzip encoding flags"
|
||||
return error "invalid encoding flags"
|
||||
}
|
||||
|
||||
// Decode and checksum the DEFLATE-encoded payload.
|
||||
|
||||
@@ -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.
|
||||
|
||||
+3
-3
@@ -666,10 +666,10 @@ void test_wuffs_gif_decode_input_is_a_png() {
|
||||
|
||||
wuffs_gif__status status =
|
||||
wuffs_gif__decoder__decode_config(&dec, &ic, src_reader);
|
||||
if (status != WUFFS_GIF__ERROR_BAD_GIF_HEADER) {
|
||||
if (status != WUFFS_GIF__ERROR_BAD_HEADER) {
|
||||
FAIL("decode_config: got %" PRIi32 " (%s), want %" PRIi32 " (%s)", status,
|
||||
wuffs_gif__status__string(status), WUFFS_GIF__ERROR_BAD_GIF_HEADER,
|
||||
wuffs_gif__status__string(WUFFS_GIF__ERROR_BAD_GIF_HEADER));
|
||||
wuffs_gif__status__string(status), WUFFS_GIF__ERROR_BAD_HEADER,
|
||||
wuffs_gif__status__string(WUFFS_GIF__ERROR_BAD_HEADER));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user