base38: reassign alphabet and numbers
It changes from " 0-9?a-z" to ".0-9a-z~". The default or placeholder
changes from " " to "." so it's now always visible. The wildcard changes
from "?" to "~" so it's now sorted last.
diff --git a/doc/changelog.md b/doc/changelog.md
index febccf1..52696ba 100644
--- a/doc/changelog.md
+++ b/doc/changelog.md
@@ -43,6 +43,7 @@
- Halved the sizeof `wuffs_foo__bar::unique_ptr`.
- Let `std/png` decode PNG color type 4 to `PIXEL_FORMAT__YA_NONPREMUL` (two
channels) instead of `PIXEL_FORMAT__BGRA_NONPREMUL` (four channels).
+- Reassigned `lib/base38` alphabet and numbers.
- Removed the `std/gif -> std/lzw` dependency.
- Removed `endwhile` keyword.
- Removed `example/bzcat`.
diff --git a/doc/note/base38-and-fourcc.md b/doc/note/base38-and-fourcc.md
index c2888ac..9f35f6a 100644
--- a/doc/note/base38-and-fourcc.md
+++ b/doc/note/base38-and-fourcc.md
@@ -31,26 +31,42 @@
Base38 is a tighter encoding than FourCC, fitting four characters into 21 bits
instead of 32 bits. This is achieved by using a smaller alphabet of 38 possible
-values (space, 0-9, ? or a-z), so that it cannot distinguish between e.g. an
-upper case 'X' and a lower case 'x'. There's also the happy coincidence that
-`38 ** 4 = 0x1FD110 = 2085136` is slightly smaller than `2 ** 21 = 0x200000 =
-2097152`.
+values ('.', 0-9, a-z or '~'), so that it cannot distinguish between e.g. an
+upper case 'X' and a lower case 'x'. There are then two happy coincidences:
-The base38 encoding of `"JPEG"` is `0x122FF6`, which is `1191926`, which is
-`((21 * (38 ** 3)) + (27 * (38 ** 2)) + (16 * (38 ** 1)) + (18 * (38 ** 0)))`.
+- `38 ** 4 = 0x1FD110 = 2085136` is slightly smaller than `2 ** 21 = 0x200000 =
+ 2097152`.
+- 21 bits is just large enough to hold every valid Unicode code point, so that
+ systems and data formats that can hold "one UCP" can be repurposed to
+ alternatively hold "one base38-encoded four-character string".
+
+The base38 encoding of `"jpeg"` is `0x1153D3`, which is `1135571`, which is
+`((20 * (38 ** 3)) + (26 * (38 ** 2)) + (15 * (38 ** 1)) + (17 * (38 ** 0)))`.
+
+The minimum base38 value, 0x000000, corresponds to `"...."`. Depending on
+context, this can be used as a default, built-in or placeholder value.
+
+The maximum base38 value, 0x1FD10F = 2085135, corresponds to `"~~~~"`.
+Depending on context, this can be used as a "matches everything" wildcard.
+
+The maximum 21-bit value, 0x1FFFFF = 2097151, is not a valid base38 value but
+can still be used in some contexts as a sentinel or option-not-set value.
+
+
+### Base38 Namespaces
Using only 21 bits means that we can use base38 values to partition the set of
possible `uint32_t` values into file-format specific enumerations. Each package
(i.e. Wuffs implementation of a specific file format) can define up to 1024
-different values in their own namespace, without conflicting with other
-packages (assuming that there aren't e.g. two `"JPEG"` Wuffs packages in the
-same library). The conventional `uint32_t` packing is:
+local values in their own four-character namespace, without conflicting with
+other packages (assuming that there aren't e.g. two `"jpeg"` Wuffs packages in
+the same library). The conventional `uint32_t` packing is:
- Bit `31` (1 bit) is reserved (zero).
-- Bits `10 ..= 30` (21 bits) are the base38 value, shifted by 10.
-- Bits `0 ..= 9` (10 bits) are the enumeration value.
+- Bits `10 ..= 30` (21 bits) are the base38-encoded namespace, shifted by 10.
+- Bits `0 ..= 9` (10 bits) are the local enumeration value.
For example:
-- [Quirk values](/doc/note/quirks.md) use this `((base38 << 10) | enumeration)`
+- [Quirk values](/doc/note/quirks.md) use this `((namespace << 10) | local)`
scheme.
-- [Tokens](/doc/note/tokens.md) assign 21 out of 64 bits for a Base38 value.
+- [Tokens](/doc/note/tokens.md) assign 21 out of 64 bits for a base38 value.
diff --git a/doc/note/quirks.md b/doc/note/quirks.md
index 1afa484..006631b 100644
--- a/doc/note/quirks.md
+++ b/doc/note/quirks.md
@@ -30,15 +30,16 @@
## Wuffs API
-Each quirk is assigned a `uint32_t` number, packed using the [base38 namespace
+Each quirk is assigned a 31-bit `uint32_t` number (the highest bit is unused),
+whose high 21 bits use the [base38 namespace
convention](/doc/note/base38-and-fourcc.md). Decoders and encoders can have a
`set_quirk!(key: base.u32, value: base.u64) base.status` method whose key
argument is this `uint32_t` number.
-For example, the base38 encoding of `"gif "` and `"json"` is `0x0F8586` and
-`0x124265` respectively, so that the GIF-specific quirks have a `uint32_t` key
-of `((0x0F8586 << 10) | g)` and the JSON-specific quirks have a `uint32_t` key
-of `((0x124265 << 10) | j)`, for some small integers `g` and `j`. The high bits
+For example, the base38 encoding of `"gif."` and `"json"` is `0x0EA964` and
+`0x116642` respectively, so that the GIF-specific quirks have a `uint32_t` key
+of `((0x0EA964 << 10) | g)` and the JSON-specific quirks have a `uint32_t` key
+of `((0x116642 << 10) | j)`, for some small integers `g` and `j`. The high bits
are a namespace. The overall quirk keys are different even if `g` and `j`
re-use the same 10-bit integer.
diff --git a/doc/note/tokens.md b/doc/note/tokens.md
index 3480b6c..9d1ca5e 100644
--- a/doc/note/tokens.md
+++ b/doc/note/tokens.md
@@ -72,10 +72,10 @@
- Bits `42 ..= 62` (21 bits) are the `value_major`.
- Bits `17 ..= 41` (25 bits) are the `value_minor`.
-The `value_major` is a 21-bit [Base38](/doc/note/base38-and-fourcc.md) number.
+The `value_major` is a 21-bit [base38](/doc/note/base38-and-fourcc.md) number.
For example, an HTML tokenizer might produce a combination of "base" tokens
-(see below) and tokens whose `value_major` is `0x109B0B`, the Base38 encoding
-of `html`. The `value_major` forms a namespace that distinguishes e.g.
+(see below) and tokens whose `value_major` is `0x0FBEE8`, the base38 encoding
+of `"html"`. The `value_major` forms a namespace that distinguishes e.g.
HTML-specific tokens from JSON-specific tokens.
If `value_major` is non-zero then `value_minor` has whatever meaning the
diff --git a/lib/base38/base38.go b/lib/base38/base38.go
index 48e08e3..f691f7b 100644
--- a/lib/base38/base38.go
+++ b/lib/base38/base38.go
@@ -10,7 +10,7 @@
// ----------------
-// Package base38 converts a 4-byte string, each byte in [ 0-9?a-z], to a base
+// Package base38 converts a 4-byte string, each byte in [.0-9a-z~], to a base
// 38 number.
package base38
@@ -25,10 +25,13 @@
// Encode encodes a 4-byte string as a uint32 in the range [0, Max].
//
-// Each byte must be ' ', be in the range '0'-'9', be '?' or be in the range
-// 'a'-'z'.
+// Each byte must be one of:
+// - '.'
+// - in the range ['0', '9']
+// - in the range ['a', 'z']
+// - '~'
//
-// The string " " is mapped to zero.
+// The string "...." is mapped to zero.
func Encode(s string) (u uint32, ok bool) {
if len(s) == 4 {
for i := 0; i < 4; i++ {
@@ -47,7 +50,7 @@
}
var table = [256]uint8{
- ' ': 1,
+ '.': 1,
'0': 2,
'1': 3,
'2': 4,
@@ -58,31 +61,31 @@
'7': 9,
'8': 10,
'9': 11,
- '?': 12,
- 'a': 13,
- 'b': 14,
- 'c': 15,
- 'd': 16,
- 'e': 17,
- 'f': 18,
- 'g': 19,
- 'h': 20,
- 'i': 21,
- 'j': 22,
- 'k': 23,
- 'l': 24,
- 'm': 25,
- 'n': 26,
- 'o': 27,
- 'p': 28,
- 'q': 29,
- 'r': 30,
- 's': 31,
- 't': 32,
- 'u': 33,
- 'v': 34,
- 'w': 35,
- 'x': 36,
- 'y': 37,
- 'z': 38,
+ 'a': 12,
+ 'b': 13,
+ 'c': 14,
+ 'd': 15,
+ 'e': 16,
+ 'f': 17,
+ 'g': 18,
+ 'h': 19,
+ 'i': 20,
+ 'j': 21,
+ 'k': 22,
+ 'l': 23,
+ 'm': 24,
+ 'n': 25,
+ 'o': 26,
+ 'p': 27,
+ 'q': 28,
+ 'r': 29,
+ 's': 30,
+ 't': 31,
+ 'u': 32,
+ 'v': 33,
+ 'w': 34,
+ 'x': 35,
+ 'y': 36,
+ 'z': 37,
+ '~': 38,
}
diff --git a/lib/base38/base38_test.go b/lib/base38/base38_test.go
index 7f2ba40..bf772b4 100644
--- a/lib/base38/base38_test.go
+++ b/lib/base38/base38_test.go
@@ -37,23 +37,25 @@
s string
want uint32
}{
- {" ", mk(0, 0, 0, 0)},
- {"0 ", mk(1, 0, 0, 0)},
- {" 0 ", mk(0, 1, 0, 0)},
- {" 0 ", mk(0, 0, 1, 0)},
- {" 0", mk(0, 0, 0, 1)},
- {"??12", mk(11, 11, 2, 3)},
+ {"....", mk(0, 0, 0, 0)},
+ {"0...", mk(1, 0, 0, 0)},
+ {".0..", mk(0, 1, 0, 0)},
+ {"..0.", mk(0, 0, 1, 0)},
+ {"...0", mk(0, 0, 0, 1)},
+ {"aa12", mk(11, 11, 2, 3)},
{"6543", mk(7, 6, 5, 4)},
- {"789a", mk(8, 9, 10, 12)},
- {"bcde", mk(13, 14, 15, 16)},
- {"fghi", mk(17, 18, 19, 20)},
- {"jklm", mk(21, 22, 23, 24)},
- {" m0m", mk(0, 24, 1, 24)},
- {"nopq", mk(25, 26, 27, 28)},
- {"rstu", mk(29, 30, 31, 32)},
- {"vwxy", mk(33, 34, 35, 36)},
- {"z?z9", mk(37, 11, 37, 10)},
- {"zzzz", mk(37, 37, 37, 37)},
+ {"789a", mk(8, 9, 10, 11)},
+ {"bcde", mk(12, 13, 14, 15)},
+ {"fghi", mk(16, 17, 18, 19)},
+ {"jklm", mk(20, 21, 22, 23)},
+ {".m0m", mk(0, 23, 1, 23)},
+ {"nopq", mk(24, 25, 26, 27)},
+ {"rstu", mk(28, 29, 30, 31)},
+ {"vwxy", mk(32, 33, 34, 35)},
+ {"zzzz", mk(36, 36, 36, 36)},
+ {"z~z9", mk(36, 37, 36, 10)},
+ {"~z~9", mk(37, 36, 37, 10)},
+ {"~~~~", mk(37, 37, 37, 37)},
}
maxSeen := false
@@ -81,12 +83,12 @@
func TestInvalid(tt *testing.T) {
testCases := []string{
"",
- " ",
- " ",
- " ",
- "....",
- " ",
- " ",
+ ".",
+ "..",
+ "...",
+ " ",
+ ".....",
+ "......",
"Abcd",
"a\x00cd",
"ab+d",
diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c
index 15cf5a3..6600821 100644
--- a/release/c/wuffs-unsupported-snapshot.c
+++ b/release/c/wuffs-unsupported-snapshot.c
@@ -7965,7 +7965,7 @@
#define WUFFS_CBOR__DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL 9u
-#define WUFFS_CBOR__TOKEN_VALUE_MAJOR 787997u
+#define WUFFS_CBOR__TOKEN_VALUE_MAJOR 731642u
#define WUFFS_CBOR__TOKEN_VALUE_MINOR__DETAIL_MASK 262143u
@@ -9321,19 +9321,19 @@
#define WUFFS_GIF__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u
-#define WUFFS_GIF__QUIRK_DELAY_NUM_DECODED_FRAMES 1041635328u
+#define WUFFS_GIF__QUIRK_DELAY_NUM_DECODED_FRAMES 983928832u
-#define WUFFS_GIF__QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND 1041635329u
+#define WUFFS_GIF__QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND 983928833u
-#define WUFFS_GIF__QUIRK_HONOR_BACKGROUND_COLOR 1041635330u
+#define WUFFS_GIF__QUIRK_HONOR_BACKGROUND_COLOR 983928834u
-#define WUFFS_GIF__QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA 1041635331u
+#define WUFFS_GIF__QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA 983928835u
-#define WUFFS_GIF__QUIRK_IMAGE_BOUNDS_ARE_STRICT 1041635332u
+#define WUFFS_GIF__QUIRK_IMAGE_BOUNDS_ARE_STRICT 983928836u
-#define WUFFS_GIF__QUIRK_REJECT_EMPTY_FRAME 1041635333u
+#define WUFFS_GIF__QUIRK_REJECT_EMPTY_FRAME 983928837u
-#define WUFFS_GIF__QUIRK_REJECT_EMPTY_PALETTE 1041635334u
+#define WUFFS_GIF__QUIRK_REJECT_EMPTY_PALETTE 983928838u
// ---------------- Struct Declarations
@@ -10052,7 +10052,7 @@
#define WUFFS_JPEG__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 51552191232u
-#define WUFFS_JPEG__QUIRK_REJECT_PROGRESSIVE_JPEGS 1220532224u
+#define WUFFS_JPEG__QUIRK_REJECT_PROGRESSIVE_JPEGS 1162824704u
// ---------------- Struct Declarations
@@ -10550,45 +10550,45 @@
#define WUFFS_JSON__DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL 100u
-#define WUFFS_JSON__QUIRK_ALLOW_ASCII_CONTROL_CODES 1225364480u
+#define WUFFS_JSON__QUIRK_ALLOW_ASCII_CONTROL_CODES 1167656960u
-#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_A 1225364481u
+#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_A 1167656961u
-#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_CAPITAL_U 1225364482u
+#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_CAPITAL_U 1167656962u
-#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_E 1225364483u
+#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_E 1167656963u
-#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_NEW_LINE 1225364484u
+#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_NEW_LINE 1167656964u
-#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_QUESTION_MARK 1225364485u
+#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_QUESTION_MARK 1167656965u
-#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE 1225364486u
+#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE 1167656966u
-#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_V 1225364487u
+#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_V 1167656967u
-#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS 1225364489u
+#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS 1167656969u
-#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_ZERO 1225364490u
+#define WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_ZERO 1167656970u
-#define WUFFS_JSON__QUIRK_ALLOW_COMMENT_BLOCK 1225364491u
+#define WUFFS_JSON__QUIRK_ALLOW_COMMENT_BLOCK 1167656971u
-#define WUFFS_JSON__QUIRK_ALLOW_COMMENT_LINE 1225364492u
+#define WUFFS_JSON__QUIRK_ALLOW_COMMENT_LINE 1167656972u
-#define WUFFS_JSON__QUIRK_ALLOW_EXTRA_COMMA 1225364493u
+#define WUFFS_JSON__QUIRK_ALLOW_EXTRA_COMMA 1167656973u
-#define WUFFS_JSON__QUIRK_ALLOW_INF_NAN_NUMBERS 1225364494u
+#define WUFFS_JSON__QUIRK_ALLOW_INF_NAN_NUMBERS 1167656974u
-#define WUFFS_JSON__QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR 1225364495u
+#define WUFFS_JSON__QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR 1167656975u
-#define WUFFS_JSON__QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK 1225364496u
+#define WUFFS_JSON__QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK 1167656976u
-#define WUFFS_JSON__QUIRK_ALLOW_TRAILING_FILLER 1225364497u
+#define WUFFS_JSON__QUIRK_ALLOW_TRAILING_FILLER 1167656977u
-#define WUFFS_JSON__QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF 1225364498u
+#define WUFFS_JSON__QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF 1167656978u
-#define WUFFS_JSON__QUIRK_JSON_POINTER_ALLOW_TILDE_N_TILDE_R_TILDE_T 1225364499u
+#define WUFFS_JSON__QUIRK_JSON_POINTER_ALLOW_TILDE_N_TILDE_R_TILDE_T 1167656979u
-#define WUFFS_JSON__QUIRK_REPLACE_INVALID_UNICODE 1225364500u
+#define WUFFS_JSON__QUIRK_REPLACE_INVALID_UNICODE 1167656980u
// ---------------- Struct Declarations
@@ -10834,9 +10834,9 @@
#define WUFFS_LZMA__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 4294967568u
-#define WUFFS_LZMA__QUIRK_ALLOW_NON_ZERO_INITIAL_BYTE 1348001792u
+#define WUFFS_LZMA__QUIRK_ALLOW_NON_ZERO_INITIAL_BYTE 1290294272u
-#define WUFFS_LZMA__QUIRK_FORMAT_EXTENSION 1348001793u
+#define WUFFS_LZMA__QUIRK_FORMAT_EXTENSION 1290294273u
// ---------------- Struct Declarations
@@ -11395,7 +11395,7 @@
#define WUFFS_LZW__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u
-#define WUFFS_LZW__QUIRK_LITERAL_WIDTH_PLUS_ONE 1348378624u
+#define WUFFS_LZW__QUIRK_LITERAL_WIDTH_PLUS_ONE 1290672128u
// ---------------- Struct Declarations
@@ -12351,7 +12351,7 @@
// ---------------- Public Consts
-#define WUFFS_ZLIB__QUIRK_JUST_RAW_DEFLATE 2113790976u
+#define WUFFS_ZLIB__QUIRK_JUST_RAW_DEFLATE 2056083456u
#define WUFFS_ZLIB__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u
@@ -15503,7 +15503,7 @@
// ---------------- Public Consts
-#define WUFFS_XZ__QUIRK_DECODE_STANDALONE_CONCATENATED_STREAMS 2021322752u
+#define WUFFS_XZ__QUIRK_DECODE_STANDALONE_CONCATENATED_STREAMS 1963655168u
#define WUFFS_XZ__DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE 0u
@@ -36534,7 +36534,7 @@
(((uint64_t)(((uint32_t)(WUFFS_CBOR__TOKEN_LENGTHS[v_c_minor])))) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
} else {
*iop_a_dst++ = wuffs_base__make_token(
- (((uint64_t)(787997u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
+ (((uint64_t)(731642u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
(((uint64_t)(16777216u)) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(9u)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
}
@@ -36758,12 +36758,12 @@
}
if (v_string_length < 262144u) {
*iop_a_dst++ = wuffs_base__make_token(
- (((uint64_t)(787997u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
+ (((uint64_t)(731642u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
(((uint64_t)((4194304u | ((uint32_t)(v_string_length))))) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(((uint32_t)(WUFFS_CBOR__TOKEN_LENGTHS[v_c_minor])))) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
} else {
*iop_a_dst++ = wuffs_base__make_token(
- (((uint64_t)(787997u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
+ (((uint64_t)(731642u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
(((uint64_t)((4194304u | ((uint32_t)((v_string_length >> 46u)))))) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(1u)) << WUFFS_BASE__TOKEN__CONTINUED__SHIFT) |
(((uint64_t)(0u)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
@@ -36776,7 +36776,7 @@
} else if (v_c_major == 7u) {
if (v_c_minor < 20u) {
*iop_a_dst++ = wuffs_base__make_token(
- (((uint64_t)(787997u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
+ (((uint64_t)(731642u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
(((uint64_t)((8388608u | ((uint32_t)((v_string_length & 255u)))))) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(1u)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
goto label__goto_parsed_a_leaf_value__break;
@@ -36795,7 +36795,7 @@
break;
}
*iop_a_dst++ = wuffs_base__make_token(
- (((uint64_t)(787997u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
+ (((uint64_t)(731642u)) << WUFFS_BASE__TOKEN__VALUE_MAJOR__SHIFT) |
(((uint64_t)((8388608u | ((uint32_t)((v_string_length & 255u)))))) << WUFFS_BASE__TOKEN__VALUE_MINOR__SHIFT) |
(((uint64_t)(2u)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
goto label__goto_parsed_a_leaf_value__break;
@@ -43050,7 +43050,7 @@
88u, 77u, 80u,
};
-#define WUFFS_GIF__QUIRKS_BASE 1041635328u
+#define WUFFS_GIF__QUIRKS_BASE 983928832u
#define WUFFS_GIF__QUIRKS_COUNT 7u
@@ -43309,8 +43309,8 @@
uint32_t v_key = 0;
- if (a_key >= 1041635328u) {
- v_key = (a_key - 1041635328u);
+ if (a_key >= 983928832u) {
+ v_key = (a_key - 983928832u);
if (v_key < 7u) {
if (self->private_impl.f_quirks[v_key]) {
return 1u;
@@ -43338,8 +43338,8 @@
: wuffs_base__error__initialize_not_called);
}
- if ((self->private_impl.f_call_sequence == 0u) && (a_key >= 1041635328u)) {
- a_key -= 1041635328u;
+ if ((self->private_impl.f_call_sequence == 0u) && (a_key >= 983928832u)) {
+ a_key -= 983928832u;
if (a_key < 7u) {
self->private_impl.f_quirks[a_key] = (a_value > 0u);
return wuffs_base__make_status(NULL);
@@ -46921,7 +46921,7 @@
248u, 249u, 250u,
};
-#define WUFFS_JPEG__QUIRKS_BASE 1220532224u
+#define WUFFS_JPEG__QUIRKS_BASE 1162824704u
// ---------------- Private Initializer Prototypes
@@ -48840,7 +48840,7 @@
if (self->private_impl.f_use_lower_quality) {
return 18446744073709551615u;
}
- } else if (a_key == 1220532224u) {
+ } else if (a_key == 1162824704u) {
if (self->private_impl.f_reject_progressive_jpegs) {
return 1u;
}
@@ -48869,7 +48869,7 @@
if (a_key == 2u) {
self->private_impl.f_use_lower_quality = (a_value >= 9223372036854775808u);
return wuffs_base__make_status(NULL);
- } else if (a_key == 1220532224u) {
+ } else if (a_key == 1162824704u) {
self->private_impl.f_reject_progressive_jpegs = (a_value != 0u);
return wuffs_base__make_status(NULL);
}
@@ -53887,7 +53887,7 @@
0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
};
-#define WUFFS_JSON__QUIRKS_BASE 1225364480u
+#define WUFFS_JSON__QUIRKS_BASE 1167656960u
#define WUFFS_JSON__QUIRKS_COUNT 21u
@@ -54040,8 +54040,8 @@
uint32_t v_key = 0;
- if (a_key >= 1225364480u) {
- v_key = (a_key - 1225364480u);
+ if (a_key >= 1167656960u) {
+ v_key = (a_key - 1167656960u);
if (v_key < 21u) {
if (self->private_impl.f_quirks[v_key]) {
return 1u;
@@ -54069,8 +54069,8 @@
: wuffs_base__error__initialize_not_called);
}
- if (a_key >= 1225364480u) {
- a_key -= 1225364480u;
+ if (a_key >= 1167656960u) {
+ a_key -= 1167656960u;
if (a_key < 21u) {
self->private_impl.f_quirks[a_key] = (a_value > 0u);
return wuffs_base__make_status(NULL);
@@ -55924,7 +55924,7 @@
0u, 1u, 2u, 3u, 3u, 3u, 3u, 3u,
};
-#define WUFFS_LZMA__QUIRKS_BASE 1348001792u
+#define WUFFS_LZMA__QUIRKS_BASE 1290294272u
// ---------------- Private Initializer Prototypes
@@ -58091,11 +58091,11 @@
return 0;
}
- if (a_key == 1348001792u) {
+ if (a_key == 1290294272u) {
if (self->private_impl.f_allow_non_zero_initial_byte) {
return 1u;
}
- } else if (a_key == 1348001793u) {
+ } else if (a_key == 1290294273u) {
return ((uint64_t)(self->private_impl.f_format_extension));
}
return 0u;
@@ -58122,9 +58122,9 @@
uint32_t v_v = 0;
uint32_t v_n = 0;
- if (a_key == 1348001792u) {
+ if (a_key == 1290294272u) {
self->private_impl.f_allow_non_zero_initial_byte = (a_value > 0u);
- } else if (a_key == 1348001793u) {
+ } else if (a_key == 1290294273u) {
if (a_value == 0u) {
self->private_impl.f_format_extension = 0u;
return wuffs_base__make_status(NULL);
@@ -59511,7 +59511,7 @@
uint8_t t_1 = *iop_a_src++;
v_c8 = t_1;
}
- v_status = wuffs_lzma__decoder__set_quirk(&self->private_data.f_lzma, 1348001793u, (1u | (((uint64_t)(v_c8)) << 8u)));
+ v_status = wuffs_lzma__decoder__set_quirk(&self->private_data.f_lzma, 1290294273u, (1u | (((uint64_t)(v_c8)) << 8u)));
if ( ! wuffs_base__status__is_ok(&v_status)) {
if (v_status.repr == wuffs_base__error__bad_argument) {
status = wuffs_base__make_status(wuffs_lzip__error__bad_header);
@@ -59528,7 +59528,7 @@
}
self->private_impl.f_ssize_have = 0u;
self->private_impl.f_dsize_have = 0u;
- wuffs_lzma__decoder__set_quirk(&self->private_data.f_lzma, 1348001792u, 1u);
+ wuffs_lzma__decoder__set_quirk(&self->private_data.f_lzma, 1290294272u, 1u);
while (true) {
v_dmark = ((uint64_t)(iop_a_dst - io0_a_dst));
v_smark = ((uint64_t)(iop_a_src - io0_a_src));
@@ -59715,7 +59715,7 @@
// ---------------- Private Consts
-#define WUFFS_LZW__QUIRKS_BASE 1348378624u
+#define WUFFS_LZW__QUIRKS_BASE 1290672128u
// ---------------- Private Initializer Prototypes
@@ -59836,7 +59836,7 @@
return 0;
}
- if (a_key == 1348378624u) {
+ if (a_key == 1290672128u) {
return ((uint64_t)(self->private_impl.f_pending_literal_width_plus_one));
}
return 0u;
@@ -59860,7 +59860,7 @@
: wuffs_base__error__initialize_not_called);
}
- if (a_key == 1348378624u) {
+ if (a_key == 1290672128u) {
if (a_value > 9u) {
return wuffs_base__make_status(wuffs_base__error__bad_argument);
}
@@ -62496,7 +62496,7 @@
// ---------------- Private Consts
-#define WUFFS_ZLIB__QUIRKS_BASE 2113790976u
+#define WUFFS_ZLIB__QUIRKS_BASE 2056083456u
#define WUFFS_ZLIB__QUIRKS_COUNT 1u
@@ -62681,8 +62681,8 @@
if ((a_key == 1u) && self->private_impl.f_ignore_checksum) {
return 1u;
- } else if (a_key >= 2113790976u) {
- v_key = (a_key - 2113790976u);
+ } else if (a_key >= 2056083456u) {
+ v_key = (a_key - 2056083456u);
if (v_key < 1u) {
if (self->private_impl.f_quirks[v_key]) {
return 1u;
@@ -62716,8 +62716,8 @@
} else if (a_key == 1u) {
self->private_impl.f_ignore_checksum = (a_value > 0u);
return wuffs_base__make_status(NULL);
- } else if (a_key >= 2113790976u) {
- a_key -= 2113790976u;
+ } else if (a_key >= 2056083456u) {
+ a_key -= 2056083456u;
if (a_key < 1u) {
self->private_impl.f_quirks[a_key] = (a_value > 0u);
return wuffs_base__make_status(NULL);
@@ -78818,7 +78818,7 @@
4u, 4u, 0u, 0u, 4u, 4u, 0u, 0u,
};
-#define WUFFS_XZ__QUIRKS_BASE 2021322752u
+#define WUFFS_XZ__QUIRKS_BASE 1963655168u
static const uint8_t
WUFFS_XZ__CHECKSUM_LENGTH[4] WUFFS_BASE__POTENTIALLY_UNUSED = {
@@ -79562,7 +79562,7 @@
if (self->private_impl.f_ignore_checksum) {
return 1u;
}
- } else if (a_key == 2021322752u) {
+ } else if (a_key == 1963655168u) {
if (self->private_impl.f_standalone_format) {
return 1u;
}
@@ -79591,7 +79591,7 @@
if (a_key == 1u) {
self->private_impl.f_ignore_checksum = (a_value > 0u);
return wuffs_base__make_status(NULL);
- } else if (a_key == 2021322752u) {
+ } else if (a_key == 1963655168u) {
self->private_impl.f_standalone_format = (a_value > 0u);
return wuffs_base__make_status(NULL);
}
@@ -80915,7 +80915,7 @@
uint8_t t_10 = *iop_a_src++;
v_c8 = t_10;
}
- v_status = wuffs_lzma__decoder__set_quirk(&self->private_data.f_lzma, 1348001793u, (2u | (((uint64_t)(v_c8)) << 8u)));
+ v_status = wuffs_lzma__decoder__set_quirk(&self->private_data.f_lzma, 1290294273u, (2u | (((uint64_t)(v_c8)) << 8u)));
if ( ! wuffs_base__status__is_ok(&v_status)) {
status = wuffs_base__make_status(wuffs_xz__error__bad_filter);
goto exit;
diff --git a/script/base38-encode.go b/script/base38-encode.go
index ee3fb39..c3edbab 100644
--- a/script/base38-encode.go
+++ b/script/base38-encode.go
@@ -36,7 +36,7 @@
args := os.Args
if len(args) > 1 {
for _, arg := range args[1:] {
- arg := (strings.ToLower(arg) + " ")[:4]
+ arg := (strings.ToLower(arg) + "....")[:4]
if code, ok := base38.Encode(arg); ok {
code0 := fmt.Sprintf("0x%06X", code)
code1 := fmt.Sprintf("0x%08X", code<<10)
diff --git a/script/print-json-token-debug-format.c b/script/print-json-token-debug-format.c
index 4f0325d..7718ac7 100644
--- a/script/print-json-token-debug-format.c
+++ b/script/print-json-token-debug-format.c
@@ -255,9 +255,9 @@
};
const int g_base38_decode[38] = {
- ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '?', //
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', //
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', //
+ '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', //
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', //
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '~', //
};
const char* //
@@ -341,10 +341,10 @@
if (vmajor > 0) {
char vmajor_name[5];
- vmajor_name[0] = '*';
- vmajor_name[1] = '*';
- vmajor_name[2] = '*';
- vmajor_name[3] = '*';
+ vmajor_name[0] = '?';
+ vmajor_name[1] = '?';
+ vmajor_name[2] = '?';
+ vmajor_name[3] = '?';
vmajor_name[4] = '\x00';
uint32_t m = vmajor;
if (m < 38 * 38 * 38 * 38) {
@@ -364,7 +364,7 @@
vmajor_name[3] = g_base38_decode[m3];
}
- printf("vmajor=0x%06" PRIX32 ":%s vminor=0x%07" PRIX32 "\n", vmajor,
+ printf("vmajor=0x%06" PRIX32 "=%s vminor=0x%07" PRIX32 "\n", vmajor,
vmajor_name, vminor);
} else if (vmajor == 0) {
printf("vbc=%s vbd=0x%06" PRIX32 "\n", g_vbc_names[vbc & 15], vbd);
diff --git a/std/cbor/decode_cbor.wuffs b/std/cbor/decode_cbor.wuffs
index 126c27a..c43a299 100644
--- a/std/cbor/decode_cbor.wuffs
+++ b/std/cbor/decode_cbor.wuffs
@@ -37,8 +37,8 @@
// --------
-// TOKEN_VALUE_MAJOR is the base-38 encoding of "cbor".
-pub const TOKEN_VALUE_MAJOR : base.u32 = 0x0C_061D
+// TOKEN_VALUE_MAJOR is the base38 encoding of "cbor".
+pub const TOKEN_VALUE_MAJOR : base.u32 = 0x0B_29FA
// TOKEN_VALUE_MINOR__DETAIL_MASK is a mask for the low 18 bits of a token's
// value_minor. 18 is 64 - base.TOKEN__VALUE_EXTENSION__NUM_BITS.
diff --git a/std/gif/decode_quirks.wuffs b/std/gif/decode_quirks.wuffs
index c9720b8..8b17226 100644
--- a/std/gif/decode_quirks.wuffs
+++ b/std/gif/decode_quirks.wuffs
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
-// The base38 encoding of "gif " is 0x0F_8586. Left shifting by 10 gives
-// 0x3E16_1800.
-pri const QUIRKS_BASE : base.u32 = 0x3E16_1800
+// The base38 encoding of "gif." is 0x0E_A964. Left shifting by 10 gives
+// 0x3AA5_9000.
+pri const QUIRKS_BASE : base.u32 = 0x3AA5_9000
// --------
@@ -32,7 +32,7 @@
// see the N+1'th frame's header (or the end-of-animation terminator), so that
// e.g. the API for visiting the N'th frame can also return whether it's the
// final frame. Enabling this quirk allows for matching that behavior.
-pub const QUIRK_DELAY_NUM_DECODED_FRAMES : base.u32 = 0x3E16_1800 | 0x00
+pub const QUIRK_DELAY_NUM_DECODED_FRAMES : base.u32 = 0x3AA5_9000 | 0x00
// When this quirk is enabled, the background color of the first frame is set
// to black whenever that first frame has a local (frame-specific) palette.
@@ -44,7 +44,7 @@
//
// There isn't really much of a rationale for this, other than it matches the
// behavior of another GIF implementation.
-pub const QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND : base.u32 = 0x3E16_1800 | 0x01
+pub const QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND : base.u32 = 0x3AA5_9000 | 0x01
// When this quirk is enabled, the background color is taken from the GIF
// instead of always being transparent black. If the background color index in
@@ -60,12 +60,12 @@
// processing WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND. In both
// cases, the caller of Wuffs, not Wuffs itself, is responsible for filling the
// pixel buffer with that color.
-pub const QUIRK_HONOR_BACKGROUND_COLOR : base.u32 = 0x3E16_1800 | 0x02
+pub const QUIRK_HONOR_BACKGROUND_COLOR : base.u32 = 0x3AA5_9000 | 0x02
// When this quirk is enabled, silently ignore e.g. a frame that reports a
// width and height of 6 pixels each, followed by 50 pixel values. In that
// case, we process the first 36 pixel values and discard the excess 14.
-pub const QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA : base.u32 = 0x3E16_1800 | 0x03
+pub const QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA : base.u32 = 0x3AA5_9000 | 0x03
// When this quirk is enabled, if the initial frame bounds extends beyond the
// image bounds, then the image bounds stay unchanged. By default (with this
@@ -74,14 +74,14 @@
//
// For more discussion, see
// https://github.com/google/wuffs/blob/main/test/data/artificial/gif-frame-out-of-bounds.gif.make-artificial.txt
-pub const QUIRK_IMAGE_BOUNDS_ARE_STRICT : base.u32 = 0x3E16_1800 | 0x04
+pub const QUIRK_IMAGE_BOUNDS_ARE_STRICT : base.u32 = 0x3AA5_9000 | 0x04
// When this quirk is enabled, a frame with zero width or height is rejected
// during decode_frame (but accepted during decode_frame_config).
-pub const QUIRK_REJECT_EMPTY_FRAME : base.u32 = 0x3E16_1800 | 0x05
+pub const QUIRK_REJECT_EMPTY_FRAME : base.u32 = 0x3AA5_9000 | 0x05
// When this quirk is enabled, a frame with no explicit palette is rejected,
// instead of implicitly having a palette with every entry being opaque black.
-pub const QUIRK_REJECT_EMPTY_PALETTE : base.u32 = 0x3E16_1800 | 0x06
+pub const QUIRK_REJECT_EMPTY_PALETTE : base.u32 = 0x3AA5_9000 | 0x06
pri const QUIRKS_COUNT : base.u32 = 0x07
diff --git a/std/jpeg/decode_quirks.wuffs b/std/jpeg/decode_quirks.wuffs
index 1676947..2401dfd 100644
--- a/std/jpeg/decode_quirks.wuffs
+++ b/std/jpeg/decode_quirks.wuffs
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
-// The base38 encoding of "jpeg" is 0x122FF6. Left shifting by 10 gives
-// 0x48BF_D800.
-pri const QUIRKS_BASE : base.u32 = 0x48BF_D800
+// The base38 encoding of "jpeg" is 0x11_53D3. Left shifting by 10 gives
+// 0x454F_4C00.
+pri const QUIRKS_BASE : base.u32 = 0x454F_4C00
// --------
@@ -35,7 +35,7 @@
// encountering a progressive JPEG. This results in more readable calling code,
// instead of commenting about "positive work buffer minimum length implies a
// progressive JPEG".
-pub const QUIRK_REJECT_PROGRESSIVE_JPEGS : base.u32 = 0x48BF_D800 | 0x00
+pub const QUIRK_REJECT_PROGRESSIVE_JPEGS : base.u32 = 0x454F_4C00 | 0x00
// --------
diff --git a/std/json/decode_quirks.wuffs b/std/json/decode_quirks.wuffs
index 72b8d93..ac3f75c 100644
--- a/std/json/decode_quirks.wuffs
+++ b/std/json/decode_quirks.wuffs
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
-// The base38 encoding of "json" is 0x12_4265. Left shifting by 10 gives
-// 0x4909_9400.
-pri const QUIRKS_BASE : base.u32 = 0x4909_9400
+// The base38 encoding of "json" is 0x11_6642. Left shifting by 10 gives
+// 0x4599_0800.
+pri const QUIRKS_BASE : base.u32 = 0x4599_0800
// --------
@@ -30,22 +30,22 @@
//
// Any indentation following a new line is not stripped, but remains part of
// the decoded string.
-pub const QUIRK_ALLOW_ASCII_CONTROL_CODES : base.u32 = 0x4909_9400 | 0x00
+pub const QUIRK_ALLOW_ASCII_CONTROL_CODES : base.u32 = 0x4599_0800 | 0x00
// When this quirk is enabled, e.g. "abc\az" is accepted as a JSON string,
// equivalent to "abc\u0007z", containing an ASCII Bell control character.
-pub const QUIRK_ALLOW_BACKSLASH_A : base.u32 = 0x4909_9400 | 0x01
+pub const QUIRK_ALLOW_BACKSLASH_A : base.u32 = 0x4599_0800 | 0x01
// When this quirk is enabled, e.g. "abc\U0001F4A9z" is accepted as a JSON
// string, equivalent to "abc\uD83D\uDCA9z", containing the U+0001F4A9 PILE OF
// POO Unicode code point. There are exactly 8 encoded bytes after each "\U".
//
// This quirk can combine with QUIRK_REPLACE_INVALID_UNICODE.
-pub const QUIRK_ALLOW_BACKSLASH_CAPITAL_U : base.u32 = 0x4909_9400 | 0x02
+pub const QUIRK_ALLOW_BACKSLASH_CAPITAL_U : base.u32 = 0x4599_0800 | 0x02
// When this quirk is enabled, e.g. "abc\ez" is accepted as a JSON string,
// equivalent to "abc\u001Bz", containing an ASCII Escape control character.
-pub const QUIRK_ALLOW_BACKSLASH_E : base.u32 = 0x4909_9400 | 0x03
+pub const QUIRK_ALLOW_BACKSLASH_E : base.u32 = 0x4599_0800 | 0x03
// When this quirk is enabled, e.g. ("abc\
// z") is accepted as a JSON string, equivalent to "abc\nz".
@@ -56,22 +56,22 @@
//
// Any indentation following a new line is not stripped, but remains part of
// the decoded string.
-pub const QUIRK_ALLOW_BACKSLASH_NEW_LINE : base.u32 = 0x4909_9400 | 0x04
+pub const QUIRK_ALLOW_BACKSLASH_NEW_LINE : base.u32 = 0x4599_0800 | 0x04
// When this quirk is enabled, e.g. "abc\?z" is accepted as a JSON string,
// equivalent to "abc?z".
-pub const QUIRK_ALLOW_BACKSLASH_QUESTION_MARK : base.u32 = 0x4909_9400 | 0x05
+pub const QUIRK_ALLOW_BACKSLASH_QUESTION_MARK : base.u32 = 0x4599_0800 | 0x05
// When this quirk is enabled, e.g. "abc\'z" is accepted as a JSON string,
// equivalent to "abc'z".
-pub const QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE : base.u32 = 0x4909_9400 | 0x06
+pub const QUIRK_ALLOW_BACKSLASH_SINGLE_QUOTE : base.u32 = 0x4599_0800 | 0x06
// When this quirk is enabled, e.g. "abc\vz" is accepted as a JSON string,
// equivalent to "abc\u000Bz", containing an ASCII Vertical Tab control
// character.
-pub const QUIRK_ALLOW_BACKSLASH_V : base.u32 = 0x4909_9400 | 0x07
+pub const QUIRK_ALLOW_BACKSLASH_V : base.u32 = 0x4599_0800 | 0x07
-// (0x4909_9400 | 0x08) is reserved for QUIRK_ALLOW_BACKSLASH_X_AS_BYTES. This
+// (0x4599_0800 | 0x08) is reserved for QUIRK_ALLOW_BACKSLASH_X_AS_BYTES. This
// quirk used to be implemented, but it was removed due to its complexity.
// Enabling it (as a run-time option) meant that decoded JSON strings are no
// longer guaranteed to be valid UTF-8. We could re-implement it (i.e. undo
@@ -86,11 +86,11 @@
//
// There are exactly 2 encoded bytes after each "\x". "\x", "\x9", "\x9$" and
// "\X99" are all still rejected.
-pub const QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS : base.u32 = 0x4909_9400 | 0x09
+pub const QUIRK_ALLOW_BACKSLASH_X_AS_CODE_POINTS : base.u32 = 0x4599_0800 | 0x09
// When this quirk is enabled, e.g. "abc\0z" is accepted as a JSON string,
// equivalent to "abc\u0000z", containing an ASCII NUL control character.
-pub const QUIRK_ALLOW_BACKSLASH_ZERO : base.u32 = 0x4909_9400 | 0x0A
+pub const QUIRK_ALLOW_BACKSLASH_ZERO : base.u32 = 0x4599_0800 | 0x0A
// When this quirk is enabled, "/* C/C++ style block comments */" are accepted
// anywhere whitespace would be. See also QUIRK_ALLOW_TRAILING_FILLER.
@@ -100,7 +100,7 @@
//
// To avoid ambiguity (as comments can contain new lines), this quirk cannot be
// combined with QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF.
-pub const QUIRK_ALLOW_COMMENT_BLOCK : base.u32 = 0x4909_9400 | 0x0B
+pub const QUIRK_ALLOW_COMMENT_BLOCK : base.u32 = 0x4599_0800 | 0x0B
// When this quirk is enabled, "// C/C++ style line comments\n" are accepted
// anywhere whitespace would be. See also QUIRK_ALLOW_TRAILING_FILLER.
@@ -119,7 +119,7 @@
//
// To avoid ambiguity (as comments can contain new lines), this quirk cannot be
// combined with QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF.
-pub const QUIRK_ALLOW_COMMENT_LINE : base.u32 = 0x4909_9400 | 0x0C
+pub const QUIRK_ALLOW_COMMENT_LINE : base.u32 = 0x4599_0800 | 0x0C
// When this quirk is enabled, there may be a comma after the final array
// element or object key-value pair and before the closing "]" or "}". A comma
@@ -128,12 +128,12 @@
//
// For example, `[1,]`, `[1,2,3,]` and `{"k":"v",}` all become acceptable, but
// `[,]`, `{,}` and `{"k",:"v"}` are still rejected.
-pub const QUIRK_ALLOW_EXTRA_COMMA : base.u32 = 0x4909_9400 | 0x0D
+pub const QUIRK_ALLOW_EXTRA_COMMA : base.u32 = 0x4599_0800 | 0x0D
// When this quirk is enabled, "inf", "Infinity", "NAN" and their
// case-insensitive variants, optionally preceded immediately by "-" or "+",
// are accepted anywhere a JSON number would be.
-pub const QUIRK_ALLOW_INF_NAN_NUMBERS : base.u32 = 0x4909_9400 | 0x0E
+pub const QUIRK_ALLOW_INF_NAN_NUMBERS : base.u32 = 0x4599_0800 | 0x0E
// When this quirk is enabled, the input byte stream may optionally start with
// "\x1E" (the ASCII Record Separator control character). That byte is skipped
@@ -145,7 +145,7 @@
// When combined with QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF, this format is
// also known as RFC 7464, Json Text Sequences and MIME type
// "application/json-seq".
-pub const QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR : base.u32 = 0x4909_9400 | 0x0F
+pub const QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR : base.u32 = 0x4599_0800 | 0x0F
// When this quirk is enabled, the input byte stream may optionally start with
// "\xEF\xBB\xBF", the UTF-8 encoding of the Unicode BOM (Byte Order Mark).
@@ -153,7 +153,7 @@
//
// When combined with QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR, either mark
// may come first in the byte stream.
-pub const QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK : base.u32 = 0x4909_9400 | 0x10
+pub const QUIRK_ALLOW_LEADING_UNICODE_BYTE_ORDER_MARK : base.u32 = 0x4599_0800 | 0x10
// When this quirk is enabled, following a successful decoding of a top-level
// JSON value, any trailing whitespace (ASCII characters 0x09, 0x0A, 0x0D or
@@ -166,7 +166,7 @@
// To avoid ambiguity, this quirk cannot be combined with
// QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF. Unlike that quirk, enabling this
// quirk will consume multiple trailing '\n' bytes.
-pub const QUIRK_ALLOW_TRAILING_FILLER : base.u32 = 0x4909_9400 | 0x11
+pub const QUIRK_ALLOW_TRAILING_FILLER : base.u32 = 0x4599_0800 | 0x11
// When this quirk is enabled, following a successful decoding of a top-level
// JSON value, any trailing whitespace (ASCII characters 0x09, 0x0A, 0x0D or
@@ -202,14 +202,14 @@
// When combined with QUIRK_ALLOW_LEADING_ASCII_RECORD_SEPARATOR, this format
// is also known as RFC 7464, Json Text Sequences and MIME type
// "application/json-seq".
-pub const QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF : base.u32 = 0x4909_9400 | 0x12
+pub const QUIRK_EXPECT_TRAILING_NEW_LINE_OR_EOF : base.u32 = 0x4599_0800 | 0x12
// When this quirk is enabled, JSON Pointer strings containing "~n", "~r" or
// "~t", which would otherwise be invalid, are unescaped as "\n", "\r" or "\t".
//
// This quirk isn't used by Wuffs' std/json package per se, but it is used by
// the wuffs_aux::DecodeJson function.
-pub const QUIRK_JSON_POINTER_ALLOW_TILDE_N_TILDE_R_TILDE_T : base.u32 = 0x4909_9400 | 0x13
+pub const QUIRK_JSON_POINTER_ALLOW_TILDE_N_TILDE_R_TILDE_T : base.u32 = 0x4599_0800 | 0x13
// When this quirk is enabled, invalid UTF-8 inside a JSON string is accepted.
// Each byte of invalid UTF-8 is equivalent to "\uFFFD", the Unicode
@@ -225,6 +225,6 @@
// When combined with QUIRK_ALLOW_BACKSLASH_CAPITAL_U, a "\U12345678" 10-byte
// unit that is an invalid Unicode code point (i.e. in the range U+D800 ..=
// U+DFFF or above U+10FFFF) is similarly replaced with U+FFFD.
-pub const QUIRK_REPLACE_INVALID_UNICODE : base.u32 = 0x4909_9400 | 0x14
+pub const QUIRK_REPLACE_INVALID_UNICODE : base.u32 = 0x4599_0800 | 0x14
pri const QUIRKS_COUNT : base.u32 = 0x15
diff --git a/std/lzma/decode_quirks.wuffs b/std/lzma/decode_quirks.wuffs
index 78140d3..16094fe 100644
--- a/std/lzma/decode_quirks.wuffs
+++ b/std/lzma/decode_quirks.wuffs
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
-// The base38 encoding of "lzma" is 0x141638. Left shifting by 10 gives
-// 0x5058_E000.
-pri const QUIRKS_BASE : base.u32 = 0x5058_E000
+// The base38 encoding of "lzma" is 0x13_3A15. Left shifting by 10 gives
+// 0x4CE8_5400.
+pri const QUIRKS_BASE : base.u32 = 0x4CE8_5400
// --------
@@ -22,7 +22,7 @@
// initial byte [after properties or other headers] is not equal to ZERO, the
// LZMA Decoder must stop decoding and report error" from the spec
// https://raw.githubusercontent.com/jljusten/LZMA-SDK/781863cdf592da3e97420f50de5dac056ad352a5/DOC/lzma-specification.txt
-pub const QUIRK_ALLOW_NON_ZERO_INITIAL_BYTE : base.u32 = 0x5058_E000 | 0x00
+pub const QUIRK_ALLOW_NON_ZERO_INITIAL_BYTE : base.u32 = 0x4CE8_5400 | 0x00
// When this quirk is set, a positive value indicates an extension to the LZMA
// format. Zero means to use the default LZMA format.
@@ -39,4 +39,4 @@
// For LZMA2, the high 7 bytes (shifted right by 8) must be less than or equal
// to 40 and indicates the dictionary size. See section "5.3.1. LZMA2" of
// https://tukaani.org/xz/xz-file-format.txt
-pub const QUIRK_FORMAT_EXTENSION : base.u32 = 0x5058_E000 | 0x01
+pub const QUIRK_FORMAT_EXTENSION : base.u32 = 0x4CE8_5400 | 0x01
diff --git a/std/lzw/decode_quirks.wuffs b/std/lzw/decode_quirks.wuffs
index 0bdd6ef..6c13b4e 100644
--- a/std/lzw/decode_quirks.wuffs
+++ b/std/lzw/decode_quirks.wuffs
@@ -12,13 +12,13 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
-// The base38 encoding of "lzw " is 0x1417A8. Left shifting by 10 gives
-// 0x505E_A000.
-pri const QUIRKS_BASE : base.u32 = 0x505E_A000
+// The base38 encoding of "lzw." is 0x13_3B86. Left shifting by 10 gives
+// 0x4CEE_1800.
+pri const QUIRKS_BASE : base.u32 = 0x4CEE_1800
// --------
// When this quirk is set (to a value in the range 0 ..= 9), a positive value
// is one more than the initial number of bits of a literal code. Zero means to
// use the default literal width, 8.
-pub const QUIRK_LITERAL_WIDTH_PLUS_ONE : base.u32 = 0x505E_A000 | 0x00
+pub const QUIRK_LITERAL_WIDTH_PLUS_ONE : base.u32 = 0x4CEE_1800 | 0x00
diff --git a/std/xz/decode_quirks.wuffs b/std/xz/decode_quirks.wuffs
index d0ba2f5..9b6885e 100644
--- a/std/xz/decode_quirks.wuffs
+++ b/std/xz/decode_quirks.wuffs
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
-// The base38 encoding of "xz " is 0x1E1EBC. Left shifting by 10 gives
-// 0x787A_F000.
-pri const QUIRKS_BASE : base.u32 = 0x787A_F000
+// The base38 encoding of "xz.." is 0x1D_42C0. Left shifting by 10 gives
+// 0x750B_0000.
+pri const QUIRKS_BASE : base.u32 = 0x750B_0000
// --------
@@ -37,4 +37,4 @@
// XZ-as-part-of-something-else format, not the XZ-standalone format. Like most
// of Wuffs' other std/foobar quirks, decoding a more lenient variant of the
// foobar format is opt-in, not opt-out.
-pub const QUIRK_DECODE_STANDALONE_CONCATENATED_STREAMS : base.u32 = 0x787A_F000 | 0x00
+pub const QUIRK_DECODE_STANDALONE_CONCATENATED_STREAMS : base.u32 = 0x750B_0000 | 0x00
diff --git a/std/zlib/decode_quirks.wuffs b/std/zlib/decode_quirks.wuffs
index f0e7bbb..11729b1 100644
--- a/std/zlib/decode_quirks.wuffs
+++ b/std/zlib/decode_quirks.wuffs
@@ -12,9 +12,9 @@
// Quirks are discussed in (/doc/note/quirks.md).
//
-// The base38 encoding of "zlib" is 0x1F_7F79. Left shifting by 10 gives
-// 0x7DFD_E400.
-pri const QUIRKS_BASE : base.u32 = 0x7DFD_E400
+// The base38 encoding of "zlib" is 0x1E_A356. Left shifting by 10 gives
+// 0x7A8D_5800.
+pri const QUIRKS_BASE : base.u32 = 0x7A8D_5800
// --------
@@ -24,6 +24,6 @@
// A zlib.decoder basically becomes a deflate.decoder. This is useful when the
// caller might want to choose between the two related-but-slightly-different
// formats at run time but would rather not allocate two separate decoders.
-pub const QUIRK_JUST_RAW_DEFLATE : base.u32 = 0x7DFD_E400 | 0x00
+pub const QUIRK_JUST_RAW_DEFLATE : base.u32 = 0x7A8D_5800 | 0x00
pri const QUIRKS_COUNT : base.u32 = 0x01
diff --git a/test/data/cbor-rfc-7049-examples.tokens b/test/data/cbor-rfc-7049-examples.tokens
index ceb0daf..adbcc06 100644
--- a/test/data/cbor-rfc-7049-examples.tokens
+++ b/test/data/cbor-rfc-7049-examples.tokens
Binary files differ