base: add optional_u63 type

This commit is contained in:
Nigel Tao committed 2023-11-19 12:02:24 +11:00
1 parent e517ca4bee
commit 82ea1985b4
32 files changed
+470 -295

No files matched your search

+1
View File
@@ -7,6 +7,7 @@ The LICENSE has changed from a single license (Apache 2) to a dual license
(Apache 2 or MIT, at your option). (Apache 2 or MIT, at your option).
- Added `base.bitvec256`. - Added `base.bitvec256`.
- Added `base.optional_u63`.
- Added `base.hasher_bitvec256`. - Added `base.hasher_bitvec256`.
- Added `base.hasher_u64`. - Added `base.hasher_u64`.
- Added `compact_retaining` and `history_retain_length`. - Added `compact_retaining` and `history_retain_length`.
+3 -1
View File
@@ -208,8 +208,10 @@ main1(int argc, char** argv) {
return wuffs_base__status__message(&status); return wuffs_base__status__message(&status);
} }
wuffs_base__optional_u63 hrl =
wuffs_bzip2__decoder__history_retain_length(&dec);
wuffs_base__io_buffer__compact_retaining( wuffs_base__io_buffer__compact_retaining(
&src, wuffs_bzip2__decoder__history_retain_length(&dec)); &src, wuffs_base__optional_u63__value_or(&hrl, UINT64_MAX));
if (src.meta.wi == src.data.len) { if (src.meta.wi == src.data.len) {
return "main: internal error: no I/O progress possible"; return "main: internal error: no I/O progress possible";
} }
+10 -4
View File
@@ -251,11 +251,17 @@ static void //
ignore_return_value(int ignored) {} ignore_return_value(int ignored) {}
const char* // const char* //
read_more_src(uint64_t history_retain_length) { read_more_src(wuffs_base__optional_u63 history_retain_length) {
if (g_src.meta.closed) { if (g_src.meta.closed) {
return "main: unexpected end of file"; return "main: unexpected end of file";
} }
wuffs_base__io_buffer__compact_retaining(&g_src, history_retain_length); if (wuffs_base__optional_u63__has_value(&history_retain_length)) {
wuffs_base__io_buffer__compact_retaining(
&g_src, wuffs_base__optional_u63__value(&history_retain_length));
}
if (g_src.meta.wi == g_src.data.len) {
return "main: internal error: no I/O progress possible";
}
ssize_t n = read(STDIN_FD, g_src.data.ptr + g_src.meta.wi, ssize_t n = read(STDIN_FD, g_src.data.ptr + g_src.meta.wi,
g_src.data.len - g_src.meta.wi); g_src.data.len - g_src.meta.wi);
if (n > 0) { if (n > 0) {
@@ -281,7 +287,7 @@ load_image_type() {
(wuffs_base__io_buffer__reader_length(&g_src) == g_src.data.len)) { (wuffs_base__io_buffer__reader_length(&g_src) == g_src.data.len)) {
break; break;
} }
TRY(read_more_src(0)); TRY(read_more_src(wuffs_base__make_optional_u63(true, 0)));
} }
return NULL; return NULL;
} }
@@ -406,7 +412,7 @@ advance_for_redirect() {
break; break;
} }
g_src.meta.ri = g_src.meta.wi; g_src.meta.ri = g_src.meta.wi;
TRY(read_more_src(0)); TRY(read_more_src(wuffs_base__make_optional_u63(true, 0)));
} }
return NULL; return NULL;
} }
+2 -2
View File
@@ -1394,7 +1394,7 @@ main1(int argc, char** argv) {
} }
// Check that we've exhausted the input. // Check that we've exhausted the input.
if ((g_src.meta.ri == g_src.meta.wi) && !g_src.meta.closed) { if ((g_src.meta.ri == g_src.meta.wi) && !g_src.meta.closed) {
TRY(read_src(g_dec.history_retain_length())); TRY(read_src(g_dec.history_retain_length().value_or(UINT64_MAX)));
} }
if ((g_src.meta.ri < g_src.meta.wi) || !g_src.meta.closed) { if ((g_src.meta.ri < g_src.meta.wi) || !g_src.meta.closed) {
return "main: valid JSON followed by further (unexpected) data"; return "main: valid JSON followed by further (unexpected) data";
@@ -1405,7 +1405,7 @@ main1(int argc, char** argv) {
if (g_cursor_index != g_src.meta.ri) { if (g_cursor_index != g_src.meta.ri) {
return "main: internal error: inconsistent g_src indexes"; return "main: internal error: inconsistent g_src indexes";
} }
TRY(read_src(g_dec.history_retain_length())); TRY(read_src(g_dec.history_retain_length().value_or(UINT64_MAX)));
g_cursor_index = g_src.meta.ri; g_cursor_index = g_src.meta.ri;
} else if (status.repr == wuffs_base__suspension__short_write) { } else if (status.repr == wuffs_base__suspension__short_write) {
g_tok.compact(); g_tok.compact();
+3 -1
View File
@@ -210,8 +210,10 @@ main1(int argc, char** argv) {
return wuffs_base__status__message(&status); return wuffs_base__status__message(&status);
} }
wuffs_base__optional_u63 hrl =
wuffs_gzip__decoder__history_retain_length(&dec);
wuffs_base__io_buffer__compact_retaining( wuffs_base__io_buffer__compact_retaining(
&src, wuffs_gzip__decoder__history_retain_length(&dec)); &src, wuffs_base__optional_u63__value_or(&hrl, UINT64_MAX));
if (src.meta.wi == src.data.len) { if (src.meta.wi == src.data.len) {
return "main: internal error: no I/O progress possible"; return "main: internal error: no I/O progress possible";
} }
+4 -2
View File
@@ -111,14 +111,16 @@ DecodeCbor(DecodeCborCallbacks& callbacks,
"wuffs_aux::DecodeCbor: internal error: io_buf is closed"; "wuffs_aux::DecodeCbor: internal error: io_buf is closed";
goto done; goto done;
} }
io_buf->compact_retaining(dec->history_retain_length()); io_buf->compact_retaining(
dec->history_retain_length().value_or(UINT64_MAX));
if (io_buf->meta.wi >= io_buf->data.len) { if (io_buf->meta.wi >= io_buf->data.len) {
ret_error_message = ret_error_message =
"wuffs_aux::DecodeCbor: internal error: io_buf is full"; "wuffs_aux::DecodeCbor: internal error: io_buf is full";
goto done; goto done;
} }
cursor_index = io_buf->meta.ri; cursor_index = io_buf->meta.ri;
io_error_message = input.CopyIn(io_buf, dec->history_retain_length()); io_error_message = input.CopyIn(
io_buf, dec->history_retain_length().value_or(UINT64_MAX));
} else { } else {
ret_error_message = tok_status.message(); ret_error_message = tok_status.message();
goto done; goto done;
+10 -8
View File
@@ -436,8 +436,9 @@ redirect:
} else if (io_buf.meta.closed) { } else if (io_buf.meta.closed) {
return DecodeImageResult(DecodeImage_UnexpectedEndOfFile); return DecodeImageResult(DecodeImage_UnexpectedEndOfFile);
} else { } else {
std::string error_message = std::string error_message = input.CopyIn(
input.CopyIn(&io_buf, image_decoder->history_retain_length()); &io_buf,
image_decoder->history_retain_length().value_or(UINT64_MAX));
if (!error_message.empty()) { if (!error_message.empty()) {
return DecodeImageResult(std::move(error_message)); return DecodeImageResult(std::move(error_message));
} }
@@ -519,8 +520,8 @@ redirect:
} else if (io_buf.meta.closed) { } else if (io_buf.meta.closed) {
return DecodeImageResult(DecodeImage_UnexpectedEndOfFile); return DecodeImageResult(DecodeImage_UnexpectedEndOfFile);
} else { } else {
std::string error_message = std::string error_message = input.CopyIn(
input.CopyIn(&io_buf, image_decoder->history_retain_length()); &io_buf, image_decoder->history_retain_length().value_or(UINT64_MAX));
if (!error_message.empty()) { if (!error_message.empty()) {
return DecodeImageResult(std::move(error_message)); return DecodeImageResult(std::move(error_message));
} }
@@ -549,8 +550,8 @@ redirect:
message = DecodeImage_UnexpectedEndOfFile; message = DecodeImage_UnexpectedEndOfFile;
break; break;
} else { } else {
std::string error_message = std::string error_message = input.CopyIn(
input.CopyIn(&io_buf, image_decoder->history_retain_length()); &io_buf, image_decoder->history_retain_length().value_or(UINT64_MAX));
if (!error_message.empty()) { if (!error_message.empty()) {
message = std::move(error_message); message = std::move(error_message);
break; break;
@@ -578,8 +579,9 @@ redirect:
} else if (io_buf.meta.closed) { } else if (io_buf.meta.closed) {
return DecodeImageResult(DecodeImage_UnexpectedEndOfFile); return DecodeImageResult(DecodeImage_UnexpectedEndOfFile);
} else { } else {
std::string error_message = std::string error_message = input.CopyIn(
input.CopyIn(&io_buf, image_decoder->history_retain_length()); &io_buf,
image_decoder->history_retain_length().value_or(UINT64_MAX));
if (!error_message.empty()) { if (!error_message.empty()) {
return DecodeImageResult(std::move(error_message)); return DecodeImageResult(std::move(error_message));
} }
+54 -52
View File
@@ -54,58 +54,60 @@ DecodeJsonArgJsonPointer::DefaultValue() {
// -------- // --------
#define WUFFS_AUX__DECODE_JSON__GET_THE_NEXT_TOKEN \ #define WUFFS_AUX__DECODE_JSON__GET_THE_NEXT_TOKEN \
while (tok_buf.meta.ri >= tok_buf.meta.wi) { \ while (tok_buf.meta.ri >= tok_buf.meta.wi) { \
if (tok_status.repr == nullptr) { \ if (tok_status.repr == nullptr) { \
goto done; \ goto done; \
} else if (tok_status.repr == wuffs_base__suspension__short_write) { \ } else if (tok_status.repr == wuffs_base__suspension__short_write) { \
tok_buf.compact(); \ tok_buf.compact(); \
} else if (tok_status.repr == wuffs_base__suspension__short_read) { \ } else if (tok_status.repr == wuffs_base__suspension__short_read) { \
if (!io_error_message.empty()) { \ if (!io_error_message.empty()) { \
ret_error_message = std::move(io_error_message); \ ret_error_message = std::move(io_error_message); \
goto done; \ goto done; \
} else if (cursor_index != io_buf->meta.ri) { \ } else if (cursor_index != io_buf->meta.ri) { \
ret_error_message = \ ret_error_message = \
"wuffs_aux::DecodeJson: internal error: bad cursor_index"; \ "wuffs_aux::DecodeJson: internal error: bad cursor_index"; \
goto done; \ goto done; \
} else if (io_buf->meta.closed) { \ } else if (io_buf->meta.closed) { \
ret_error_message = \ ret_error_message = \
"wuffs_aux::DecodeJson: internal error: io_buf is closed"; \ "wuffs_aux::DecodeJson: internal error: io_buf is closed"; \
goto done; \ goto done; \
} \ } \
io_buf->compact_retaining(dec->history_retain_length()); \ io_buf->compact_retaining( \
if (io_buf->meta.wi >= io_buf->data.len) { \ dec->history_retain_length().value_or(UINT64_MAX)); \
ret_error_message = \ if (io_buf->meta.wi >= io_buf->data.len) { \
"wuffs_aux::DecodeJson: internal error: io_buf is full"; \ ret_error_message = \
goto done; \ "wuffs_aux::DecodeJson: internal error: io_buf is full"; \
} \ goto done; \
cursor_index = io_buf->meta.ri; \ } \
io_error_message = input.CopyIn(io_buf, dec->history_retain_length()); \ cursor_index = io_buf->meta.ri; \
} else { \ io_error_message = input.CopyIn( \
ret_error_message = tok_status.message(); \ io_buf, dec->history_retain_length().value_or(UINT64_MAX)); \
goto done; \ } else { \
} \ ret_error_message = tok_status.message(); \
tok_status = \ goto done; \
dec->decode_tokens(&tok_buf, io_buf, wuffs_base__empty_slice_u8()); \ } \
if ((tok_buf.meta.ri > tok_buf.meta.wi) || \ tok_status = \
(tok_buf.meta.wi > tok_buf.data.len) || \ dec->decode_tokens(&tok_buf, io_buf, wuffs_base__empty_slice_u8()); \
(io_buf->meta.ri > io_buf->meta.wi) || \ if ((tok_buf.meta.ri > tok_buf.meta.wi) || \
(io_buf->meta.wi > io_buf->data.len)) { \ (tok_buf.meta.wi > tok_buf.data.len) || \
ret_error_message = \ (io_buf->meta.ri > io_buf->meta.wi) || \
"wuffs_aux::DecodeJson: internal error: bad buffer indexes"; \ (io_buf->meta.wi > io_buf->data.len)) { \
goto done; \ ret_error_message = \
} \ "wuffs_aux::DecodeJson: internal error: bad buffer indexes"; \
} \ goto done; \
wuffs_base__token token = tok_buf.data.ptr[tok_buf.meta.ri++]; \ } \
uint64_t token_len = token.length(); \ } \
if ((io_buf->meta.ri < cursor_index) || \ wuffs_base__token token = tok_buf.data.ptr[tok_buf.meta.ri++]; \
((io_buf->meta.ri - cursor_index) < token_len)) { \ uint64_t token_len = token.length(); \
ret_error_message = \ if ((io_buf->meta.ri < cursor_index) || \
"wuffs_aux::DecodeJson: internal error: bad token indexes"; \ ((io_buf->meta.ri - cursor_index) < token_len)) { \
goto done; \ ret_error_message = \
} \ "wuffs_aux::DecodeJson: internal error: bad token indexes"; \
uint8_t* token_ptr = io_buf->data.ptr + cursor_index; \ goto done; \
(void)(token_ptr); \ } \
uint8_t* token_ptr = io_buf->data.ptr + cursor_index; \
(void)(token_ptr); \
cursor_index += static_cast<size_t>(token_len) cursor_index += static_cast<size_t>(token_len)
// -------- // --------
+3
View File
@@ -185,6 +185,9 @@ wuffs_private_impl__u64__sat_sub_indirect(uint64_t* x, uint64_t y) {
#define wuffs_base__utility__make_bitvec256(e00, e01, e02, e03) \ #define wuffs_base__utility__make_bitvec256(e00, e01, e02, e03) \
wuffs_base__make_bitvec256(e00, e01, e02, e03) wuffs_base__make_bitvec256(e00, e01, e02, e03)
#define wuffs_base__utility__make_optional_u63(h, v) \
wuffs_base__make_optional_u63(h, v)
// ---------------- Slices and Tables // ---------------- Slices and Tables
// wuffs_private_impl__slice_u8__prefix returns up to the first up_to bytes of // wuffs_private_impl__slice_u8__prefix returns up to the first up_to bytes of
+64
View File
@@ -894,6 +894,70 @@ wuffs_base__make_bitvec256(uint64_t e00,
// -------- // --------
// wuffs_base__optional_u63 is like a std::optional<uint64_t>, but for C (not
// just C++) and the value can only hold 63 bits (not 64).
//
// Do not manipulate repr directly; it is a private implementation detail.
typedef struct wuffs_base__optional_u63__struct {
uint64_t repr;
#ifdef __cplusplus
inline bool has_value() const;
inline uint64_t value() const;
inline uint64_t value_or(uint64_t default_value) const;
#endif // __cplusplus
} wuffs_base__optional_u63;
// wuffs_base__make_optional_u63 ignores value when has_value is false.
//
// Preconditions:
// - value < (1 << 63).
static inline wuffs_base__optional_u63 //
wuffs_base__make_optional_u63(bool has_value, uint64_t value) {
wuffs_base__optional_u63 res;
res.repr = has_value ? ((value << 1u) | 1u) : 0u;
return res;
}
static inline bool //
wuffs_base__optional_u63__has_value(const wuffs_base__optional_u63* o) {
return o->repr;
}
// wuffs_base__optional_u63__value returns zero when o does not have a value.
static inline uint64_t //
wuffs_base__optional_u63__value(const wuffs_base__optional_u63* o) {
return o->repr >> 1u;
}
static inline uint64_t //
wuffs_base__optional_u63__value_or(const wuffs_base__optional_u63* o,
uint64_t default_value) {
return o->repr ? (o->repr >> 1u) : default_value;
}
#ifdef __cplusplus
inline bool //
wuffs_base__optional_u63::has_value() const {
return wuffs_base__optional_u63__has_value(this);
}
inline uint64_t //
wuffs_base__optional_u63::value() const {
return wuffs_base__optional_u63__value(this);
}
inline uint64_t //
wuffs_base__optional_u63::value_or(uint64_t default_value) const {
return wuffs_base__optional_u63__value_or(this, default_value);
}
#endif // __cplusplus
// --------
// The "defined(__clang__)" isn't redundant. While vanilla clang defines // The "defined(__clang__)" isn't redundant. While vanilla clang defines
// __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not. // __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not.
#if (defined(__GNUC__) || defined(__clang__)) && (__SIZEOF_LONG__ == 8) #if (defined(__GNUC__) || defined(__clang__)) && (__SIZEOF_LONG__ == 8)
+2 -1
View File
@@ -169,7 +169,8 @@ wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) {
// wuffs_base__io_buffer__compact_retaining moves any written but unread bytes // wuffs_base__io_buffer__compact_retaining moves any written but unread bytes
// closer to the start of the buffer. It retains H bytes of history (the most // closer to the start of the buffer. It retains H bytes of history (the most
// recently read bytes), where H is min(buf->meta.ri, history_retain_length). // recently read bytes), where H is min(buf->meta.ri, history_retain_length).
// A postcondition is that buf->meta.ri == H. // It is therefore a no-op if history_retain_length is UINT64_MAX. A
// postcondition is that buf->meta.ri == H.
// //
// wuffs_base__io_buffer__compact_retaining(0) is equivalent to // wuffs_base__io_buffer__compact_retaining(0) is equivalent to
// wuffs_base__io_buffer__compact(). // wuffs_base__io_buffer__compact().
+2 -1
View File
@@ -451,7 +451,8 @@ wuffs_base__token_buffer__compact(wuffs_base__token_buffer* buf) {
// wuffs_base__token_buffer__compact_retaining moves any written but unread // wuffs_base__token_buffer__compact_retaining moves any written but unread
// tokens closer to the start of the buffer. It retains H tokens of history // tokens closer to the start of the buffer. It retains H tokens of history
// (the most recently read tokens), where H is min(buf->meta.ri, // (the most recently read tokens), where H is min(buf->meta.ri,
// history_retain_length). A postcondition is that buf->meta.ri == H. // history_retain_length). It is therefore a no-op if history_retain_length is
// UINT64_MAX. A postcondition is that buf->meta.ri == H.
// //
// wuffs_base__token_buffer__compact_retaining(0) is equivalent to // wuffs_base__token_buffer__compact_retaining(0) is equivalent to
// wuffs_base__token_buffer__compact(). // wuffs_base__token_buffer__compact().
+3
View File
@@ -351,6 +351,9 @@ func writeOutParamZeroValue(b *buffer, tm *t.Map, typ *a.TypeExpr) error {
case t.IDBitvec256: case t.IDBitvec256:
b.writes("wuffs_base__utility__make_bitvec256(0u, 0u, 0u, 0u)") b.writes("wuffs_base__utility__make_bitvec256(0u, 0u, 0u, 0u)")
return nil return nil
case t.IDOptionalU63:
b.writes("wuffs_base__utility__make_optional_u63(false, 0u)")
return nil
case t.IDRangeIEU32: case t.IDRangeIEU32:
b.writes("wuffs_base__utility__empty_range_ie_u32()") b.writes("wuffs_base__utility__empty_range_ie_u32()")
return nil return nil
+6 -3
View File
@@ -286,6 +286,8 @@ var Types = []string{
"bitvec256", "bitvec256",
"optional_u63",
"empty_struct", "empty_struct",
"bool", "bool",
"utility", "utility",
@@ -377,6 +379,7 @@ var funcsOther = [...]string{
"utility.empty_rect_ie_u32() rect_ie_u32", "utility.empty_rect_ie_u32() rect_ie_u32",
"utility.empty_slice_u8() slice u8", "utility.empty_slice_u8() slice u8",
"utility.make_bitvec256(e00: u64, e01: u64, e02: u64, e03: u64) bitvec256", "utility.make_bitvec256(e00: u64, e01: u64, e02: u64, e03: u64) bitvec256",
"utility.make_optional_u63(has_value: bool, value: u64[..= 0x7FFF_FFFF_FFFF_FFFF]) optional_u63",
"utility.make_pixel_format(repr: u32) pixel_format", "utility.make_pixel_format(repr: u32) pixel_format",
"utility.make_range_ii_u32(min_incl: u32, max_incl: u32) range_ii_u32", "utility.make_range_ii_u32(min_incl: u32, max_incl: u32) range_ii_u32",
"utility.make_range_ie_u32(min_incl: u32, max_excl: u32) range_ie_u32", "utility.make_range_ie_u32(min_incl: u32, max_excl: u32) range_ie_u32",
@@ -998,7 +1001,7 @@ var InterfaceFuncs = []string{
"image_decoder.decode_image_config?(dst: nptr image_config, src: io_reader)", "image_decoder.decode_image_config?(dst: nptr image_config, src: io_reader)",
"image_decoder.frame_dirty_rect() rect_ie_u32", "image_decoder.frame_dirty_rect() rect_ie_u32",
"image_decoder.get_quirk(key: u32) u64", "image_decoder.get_quirk(key: u32) u64",
"image_decoder.history_retain_length() u64", "image_decoder.history_retain_length() optional_u63",
"image_decoder.num_animation_loops() u32", "image_decoder.num_animation_loops() u32",
"image_decoder.num_decoded_frame_configs() u64", "image_decoder.num_decoded_frame_configs() u64",
"image_decoder.num_decoded_frames() u64", "image_decoder.num_decoded_frames() u64",
@@ -1011,7 +1014,7 @@ var InterfaceFuncs = []string{
// ---- io_transformer // ---- io_transformer
"io_transformer.get_quirk(key: u32) u64", "io_transformer.get_quirk(key: u32) u64",
"io_transformer.history_retain_length() u64", "io_transformer.history_retain_length() optional_u63",
"io_transformer.set_quirk!(key: u32, value: u64) status", "io_transformer.set_quirk!(key: u32, value: u64) status",
"io_transformer.transform_io?(dst: io_writer, src: io_reader, workbuf: slice u8)", "io_transformer.transform_io?(dst: io_writer, src: io_reader, workbuf: slice u8)",
"io_transformer.workbuf_len() range_ii_u64", "io_transformer.workbuf_len() range_ii_u64",
@@ -1020,7 +1023,7 @@ var InterfaceFuncs = []string{
"token_decoder.decode_tokens?(dst: token_writer, src: io_reader, workbuf: slice u8)", "token_decoder.decode_tokens?(dst: token_writer, src: io_reader, workbuf: slice u8)",
"token_decoder.get_quirk(key: u32) u64", "token_decoder.get_quirk(key: u32) u64",
"token_decoder.history_retain_length() u64", "token_decoder.history_retain_length() optional_u63",
"token_decoder.set_quirk!(key: u32, value: u64) status", "token_decoder.set_quirk!(key: u32, value: u64) status",
"token_decoder.workbuf_len() range_ii_u64", "token_decoder.workbuf_len() range_ii_u64",
} }
+4
View File
@@ -44,6 +44,8 @@ var (
typeExprBitvec256 = a.NewTypeExpr(0, t.IDBase, t.IDBitvec256, nil, nil, nil) typeExprBitvec256 = a.NewTypeExpr(0, t.IDBase, t.IDBitvec256, nil, nil, nil)
typeExprOptionalU63 = a.NewTypeExpr(0, t.IDBase, t.IDOptionalU63, nil, nil, nil)
typeExprEmptyStruct = a.NewTypeExpr(0, t.IDBase, t.IDEmptyStruct, nil, nil, nil) typeExprEmptyStruct = a.NewTypeExpr(0, t.IDBase, t.IDEmptyStruct, nil, nil, nil)
typeExprBool = a.NewTypeExpr(0, t.IDBase, t.IDBool, nil, nil, nil) typeExprBool = a.NewTypeExpr(0, t.IDBase, t.IDBool, nil, nil, nil)
typeExprUtility = a.NewTypeExpr(0, t.IDBase, t.IDUtility, nil, nil, nil) typeExprUtility = a.NewTypeExpr(0, t.IDBase, t.IDUtility, nil, nil, nil)
@@ -115,6 +117,8 @@ var builtInTypeMap = typeMap{
t.IDBitvec256: typeExprBitvec256, t.IDBitvec256: typeExprBitvec256,
t.IDOptionalU63: typeExprOptionalU63,
t.IDEmptyStruct: typeExprEmptyStruct, t.IDEmptyStruct: typeExprEmptyStruct,
t.IDBool: typeExprBool, t.IDBool: typeExprBool,
t.IDUtility: typeExprUtility, t.IDUtility: typeExprUtility,
+4
View File
@@ -474,6 +474,8 @@ const (
IDBitvec128 = ID(0x118) IDBitvec128 = ID(0x118)
IDBitvec256 = ID(0x119) IDBitvec256 = ID(0x119)
IDOptionalU63 = ID(0x11C)
IDBase = ID(0x120) IDBase = ID(0x120)
IDBool = ID(0x121) IDBool = ID(0x121)
IDEmptyIOReader = ID(0x122) IDEmptyIOReader = ID(0x122)
@@ -921,6 +923,8 @@ var builtInsByID = [nBuiltInIDs]string{
IDBitvec128: "bitvec128", IDBitvec128: "bitvec128",
IDBitvec256: "bitvec256", IDBitvec256: "bitvec256",
IDOptionalU63: "optional_u63",
IDBase: "base", IDBase: "base",
IDBool: "bool", IDBool: "bool",
IDEmptyIOReader: "empty_io_reader", IDEmptyIOReader: "empty_io_reader",
+265 -190
View File
@@ -1165,6 +1165,70 @@ wuffs_base__make_bitvec256(uint64_t e00,
// -------- // --------
// wuffs_base__optional_u63 is like a std::optional<uint64_t>, but for C (not
// just C++) and the value can only hold 63 bits (not 64).
//
// Do not manipulate repr directly; it is a private implementation detail.
typedef struct wuffs_base__optional_u63__struct {
uint64_t repr;
#ifdef __cplusplus
inline bool has_value() const;
inline uint64_t value() const;
inline uint64_t value_or(uint64_t default_value) const;
#endif // __cplusplus
} wuffs_base__optional_u63;
// wuffs_base__make_optional_u63 ignores value when has_value is false.
//
// Preconditions:
// - value < (1 << 63).
static inline wuffs_base__optional_u63 //
wuffs_base__make_optional_u63(bool has_value, uint64_t value) {
wuffs_base__optional_u63 res;
res.repr = has_value ? ((value << 1u) | 1u) : 0u;
return res;
}
static inline bool //
wuffs_base__optional_u63__has_value(const wuffs_base__optional_u63* o) {
return o->repr;
}
// wuffs_base__optional_u63__value returns zero when o does not have a value.
static inline uint64_t //
wuffs_base__optional_u63__value(const wuffs_base__optional_u63* o) {
return o->repr >> 1u;
}
static inline uint64_t //
wuffs_base__optional_u63__value_or(const wuffs_base__optional_u63* o,
uint64_t default_value) {
return o->repr ? (o->repr >> 1u) : default_value;
}
#ifdef __cplusplus
inline bool //
wuffs_base__optional_u63::has_value() const {
return wuffs_base__optional_u63__has_value(this);
}
inline uint64_t //
wuffs_base__optional_u63::value() const {
return wuffs_base__optional_u63__value(this);
}
inline uint64_t //
wuffs_base__optional_u63::value_or(uint64_t default_value) const {
return wuffs_base__optional_u63__value_or(this, default_value);
}
#endif // __cplusplus
// --------
// The "defined(__clang__)" isn't redundant. While vanilla clang defines // The "defined(__clang__)" isn't redundant. While vanilla clang defines
// __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not. // __GNUC__, clang-cl (which mimics MSVC's cl.exe) does not.
#if (defined(__GNUC__) || defined(__clang__)) && (__SIZEOF_LONG__ == 8) #if (defined(__GNUC__) || defined(__clang__)) && (__SIZEOF_LONG__ == 8)
@@ -3093,7 +3157,8 @@ wuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) {
// wuffs_base__io_buffer__compact_retaining moves any written but unread bytes // wuffs_base__io_buffer__compact_retaining moves any written but unread bytes
// closer to the start of the buffer. It retains H bytes of history (the most // closer to the start of the buffer. It retains H bytes of history (the most
// recently read bytes), where H is min(buf->meta.ri, history_retain_length). // recently read bytes), where H is min(buf->meta.ri, history_retain_length).
// A postcondition is that buf->meta.ri == H. // It is therefore a no-op if history_retain_length is UINT64_MAX. A
// postcondition is that buf->meta.ri == H.
// //
// wuffs_base__io_buffer__compact_retaining(0) is equivalent to // wuffs_base__io_buffer__compact_retaining(0) is equivalent to
// wuffs_base__io_buffer__compact(). // wuffs_base__io_buffer__compact().
@@ -3677,7 +3742,8 @@ wuffs_base__token_buffer__compact(wuffs_base__token_buffer* buf) {
// wuffs_base__token_buffer__compact_retaining moves any written but unread // wuffs_base__token_buffer__compact_retaining moves any written but unread
// tokens closer to the start of the buffer. It retains H tokens of history // tokens closer to the start of the buffer. It retains H tokens of history
// (the most recently read tokens), where H is min(buf->meta.ri, // (the most recently read tokens), where H is min(buf->meta.ri,
// history_retain_length). A postcondition is that buf->meta.ri == H. // history_retain_length). It is therefore a no-op if history_retain_length is
// UINT64_MAX. A postcondition is that buf->meta.ri == H.
// //
// wuffs_base__token_buffer__compact_retaining(0) is equivalent to // wuffs_base__token_buffer__compact_retaining(0) is equivalent to
// wuffs_base__token_buffer__compact(). // wuffs_base__token_buffer__compact().
@@ -6439,7 +6505,7 @@ typedef struct wuffs_base__image_decoder__func_ptrs__struct {
uint64_t (*get_quirk)( uint64_t (*get_quirk)(
const void* self, const void* self,
uint32_t a_key); uint32_t a_key);
uint64_t (*history_retain_length)( wuffs_base__optional_u63 (*history_retain_length)(
const void* self); const void* self);
uint32_t (*num_animation_loops)( uint32_t (*num_animation_loops)(
const void* self); const void* self);
@@ -6506,7 +6572,7 @@ wuffs_base__image_decoder__get_quirk(
uint32_t a_key); uint32_t a_key);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_base__image_decoder__history_retain_length( wuffs_base__image_decoder__history_retain_length(
const wuffs_base__image_decoder* self); const wuffs_base__image_decoder* self);
@@ -6612,7 +6678,7 @@ struct wuffs_base__image_decoder__struct {
this, a_key); this, a_key);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_base__image_decoder__history_retain_length(this); return wuffs_base__image_decoder__history_retain_length(this);
} }
@@ -6683,7 +6749,7 @@ typedef struct wuffs_base__io_transformer__func_ptrs__struct {
uint64_t (*get_quirk)( uint64_t (*get_quirk)(
const void* self, const void* self,
uint32_t a_key); uint32_t a_key);
uint64_t (*history_retain_length)( wuffs_base__optional_u63 (*history_retain_length)(
const void* self); const void* self);
wuffs_base__status (*set_quirk)( wuffs_base__status (*set_quirk)(
void* self, void* self,
@@ -6707,7 +6773,7 @@ wuffs_base__io_transformer__get_quirk(
uint32_t a_key); uint32_t a_key);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_base__io_transformer__history_retain_length( wuffs_base__io_transformer__history_retain_length(
const wuffs_base__io_transformer* self); const wuffs_base__io_transformer* self);
@@ -6752,7 +6818,7 @@ struct wuffs_base__io_transformer__struct {
this, a_key); this, a_key);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_base__io_transformer__history_retain_length(this); return wuffs_base__io_transformer__history_retain_length(this);
} }
@@ -6797,7 +6863,7 @@ typedef struct wuffs_base__token_decoder__func_ptrs__struct {
uint64_t (*get_quirk)( uint64_t (*get_quirk)(
const void* self, const void* self,
uint32_t a_key); uint32_t a_key);
uint64_t (*history_retain_length)( wuffs_base__optional_u63 (*history_retain_length)(
const void* self); const void* self);
wuffs_base__status (*set_quirk)( wuffs_base__status (*set_quirk)(
void* self, void* self,
@@ -6824,7 +6890,7 @@ wuffs_base__token_decoder__get_quirk(
uint32_t a_key); uint32_t a_key);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_base__token_decoder__history_retain_length( wuffs_base__token_decoder__history_retain_length(
const wuffs_base__token_decoder* self); const wuffs_base__token_decoder* self);
@@ -6870,7 +6936,7 @@ struct wuffs_base__token_decoder__struct {
this, a_key); this, a_key);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_base__token_decoder__history_retain_length(this); return wuffs_base__token_decoder__history_retain_length(this);
} }
@@ -7268,7 +7334,7 @@ wuffs_bmp__decoder__tell_me_more(
wuffs_base__io_buffer* a_src); wuffs_base__io_buffer* a_src);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_bmp__decoder__history_retain_length( wuffs_bmp__decoder__history_retain_length(
const wuffs_bmp__decoder* self); const wuffs_bmp__decoder* self);
@@ -7497,7 +7563,7 @@ struct wuffs_bmp__decoder__struct {
return wuffs_bmp__decoder__tell_me_more(this, a_dst, a_minfo, a_src); return wuffs_bmp__decoder__tell_me_more(this, a_dst, a_minfo, a_src);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_bmp__decoder__history_retain_length(this); return wuffs_bmp__decoder__history_retain_length(this);
} }
@@ -7600,7 +7666,7 @@ wuffs_bzip2__decoder__set_quirk(
uint64_t a_value); uint64_t a_value);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_bzip2__decoder__history_retain_length( wuffs_bzip2__decoder__history_retain_length(
const wuffs_bzip2__decoder* self); const wuffs_bzip2__decoder* self);
@@ -7786,7 +7852,7 @@ struct wuffs_bzip2__decoder__struct {
return wuffs_bzip2__decoder__set_quirk(this, a_key, a_value); return wuffs_bzip2__decoder__set_quirk(this, a_key, a_value);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_bzip2__decoder__history_retain_length(this); return wuffs_bzip2__decoder__history_retain_length(this);
} }
@@ -7906,7 +7972,7 @@ wuffs_cbor__decoder__set_quirk(
uint64_t a_value); uint64_t a_value);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_cbor__decoder__history_retain_length( wuffs_cbor__decoder__history_retain_length(
const wuffs_cbor__decoder* self); const wuffs_cbor__decoder* self);
@@ -8042,7 +8108,7 @@ struct wuffs_cbor__decoder__struct {
return wuffs_cbor__decoder__set_quirk(this, a_key, a_value); return wuffs_cbor__decoder__set_quirk(this, a_key, a_value);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_cbor__decoder__history_retain_length(this); return wuffs_cbor__decoder__history_retain_length(this);
} }
@@ -8602,7 +8668,7 @@ wuffs_deflate__decoder__set_quirk(
uint64_t a_value); uint64_t a_value);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_deflate__decoder__history_retain_length( wuffs_deflate__decoder__history_retain_length(
const wuffs_deflate__decoder* self); const wuffs_deflate__decoder* self);
@@ -8784,7 +8850,7 @@ struct wuffs_deflate__decoder__struct {
return wuffs_deflate__decoder__set_quirk(this, a_key, a_value); return wuffs_deflate__decoder__set_quirk(this, a_key, a_value);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_deflate__decoder__history_retain_length(this); return wuffs_deflate__decoder__history_retain_length(this);
} }
@@ -8950,7 +9016,7 @@ wuffs_gif__decoder__frame_dirty_rect(
const wuffs_gif__decoder* self); const wuffs_gif__decoder* self);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_gif__decoder__history_retain_length( wuffs_gif__decoder__history_retain_length(
const wuffs_gif__decoder* self); const wuffs_gif__decoder* self);
@@ -9251,7 +9317,7 @@ struct wuffs_gif__decoder__struct {
return wuffs_gif__decoder__frame_dirty_rect(this); return wuffs_gif__decoder__frame_dirty_rect(this);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_gif__decoder__history_retain_length(this); return wuffs_gif__decoder__history_retain_length(this);
} }
@@ -9374,7 +9440,7 @@ wuffs_gzip__decoder__set_quirk(
uint64_t a_value); uint64_t a_value);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_gzip__decoder__history_retain_length( wuffs_gzip__decoder__history_retain_length(
const wuffs_gzip__decoder* self); const wuffs_gzip__decoder* self);
@@ -9512,7 +9578,7 @@ struct wuffs_gzip__decoder__struct {
return wuffs_gzip__decoder__set_quirk(this, a_key, a_value); return wuffs_gzip__decoder__set_quirk(this, a_key, a_value);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_gzip__decoder__history_retain_length(this); return wuffs_gzip__decoder__history_retain_length(this);
} }
@@ -9701,7 +9767,7 @@ wuffs_jpeg__decoder__tell_me_more(
wuffs_base__io_buffer* a_src); wuffs_base__io_buffer* a_src);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_jpeg__decoder__history_retain_length( wuffs_jpeg__decoder__history_retain_length(
const wuffs_jpeg__decoder* self); const wuffs_jpeg__decoder* self);
@@ -10026,7 +10092,7 @@ struct wuffs_jpeg__decoder__struct {
return wuffs_jpeg__decoder__tell_me_more(this, a_dst, a_minfo, a_src); return wuffs_jpeg__decoder__tell_me_more(this, a_dst, a_minfo, a_src);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_jpeg__decoder__history_retain_length(this); return wuffs_jpeg__decoder__history_retain_length(this);
} }
@@ -10174,7 +10240,7 @@ wuffs_json__decoder__set_quirk(
uint64_t a_value); uint64_t a_value);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_json__decoder__history_retain_length( wuffs_json__decoder__history_retain_length(
const wuffs_json__decoder* self); const wuffs_json__decoder* self);
@@ -10317,7 +10383,7 @@ struct wuffs_json__decoder__struct {
return wuffs_json__decoder__set_quirk(this, a_key, a_value); return wuffs_json__decoder__set_quirk(this, a_key, a_value);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_json__decoder__history_retain_length(this); return wuffs_json__decoder__history_retain_length(this);
} }
@@ -10423,7 +10489,7 @@ wuffs_lzw__decoder__set_quirk(
uint64_t a_value); uint64_t a_value);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_lzw__decoder__history_retain_length( wuffs_lzw__decoder__history_retain_length(
const wuffs_lzw__decoder* self); const wuffs_lzw__decoder* self);
@@ -10571,7 +10637,7 @@ struct wuffs_lzw__decoder__struct {
return wuffs_lzw__decoder__set_quirk(this, a_key, a_value); return wuffs_lzw__decoder__set_quirk(this, a_key, a_value);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_lzw__decoder__history_retain_length(this); return wuffs_lzw__decoder__history_retain_length(this);
} }
@@ -10747,7 +10813,7 @@ wuffs_netpbm__decoder__tell_me_more(
wuffs_base__io_buffer* a_src); wuffs_base__io_buffer* a_src);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_netpbm__decoder__history_retain_length( wuffs_netpbm__decoder__history_retain_length(
const wuffs_netpbm__decoder* self); const wuffs_netpbm__decoder* self);
@@ -10942,7 +11008,7 @@ struct wuffs_netpbm__decoder__struct {
return wuffs_netpbm__decoder__tell_me_more(this, a_dst, a_minfo, a_src); return wuffs_netpbm__decoder__tell_me_more(this, a_dst, a_minfo, a_src);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_netpbm__decoder__history_retain_length(this); return wuffs_netpbm__decoder__history_retain_length(this);
} }
@@ -11105,7 +11171,7 @@ wuffs_nie__decoder__tell_me_more(
wuffs_base__io_buffer* a_src); wuffs_base__io_buffer* a_src);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_nie__decoder__history_retain_length( wuffs_nie__decoder__history_retain_length(
const wuffs_nie__decoder* self); const wuffs_nie__decoder* self);
@@ -11304,7 +11370,7 @@ struct wuffs_nie__decoder__struct {
return wuffs_nie__decoder__tell_me_more(this, a_dst, a_minfo, a_src); return wuffs_nie__decoder__tell_me_more(this, a_dst, a_minfo, a_src);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_nie__decoder__history_retain_length(this); return wuffs_nie__decoder__history_retain_length(this);
} }
@@ -11418,7 +11484,7 @@ wuffs_zlib__decoder__set_quirk(
uint64_t a_value); uint64_t a_value);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_zlib__decoder__history_retain_length( wuffs_zlib__decoder__history_retain_length(
const wuffs_zlib__decoder* self); const wuffs_zlib__decoder* self);
@@ -11572,7 +11638,7 @@ struct wuffs_zlib__decoder__struct {
return wuffs_zlib__decoder__set_quirk(this, a_key, a_value); return wuffs_zlib__decoder__set_quirk(this, a_key, a_value);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_zlib__decoder__history_retain_length(this); return wuffs_zlib__decoder__history_retain_length(this);
} }
@@ -11753,7 +11819,7 @@ wuffs_png__decoder__tell_me_more(
wuffs_base__io_buffer* a_src); wuffs_base__io_buffer* a_src);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_png__decoder__history_retain_length( wuffs_png__decoder__history_retain_length(
const wuffs_png__decoder* self); const wuffs_png__decoder* self);
@@ -12095,7 +12161,7 @@ struct wuffs_png__decoder__struct {
return wuffs_png__decoder__tell_me_more(this, a_dst, a_minfo, a_src); return wuffs_png__decoder__tell_me_more(this, a_dst, a_minfo, a_src);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_png__decoder__history_retain_length(this); return wuffs_png__decoder__history_retain_length(this);
} }
@@ -12490,7 +12556,7 @@ wuffs_tga__decoder__tell_me_more(
wuffs_base__io_buffer* a_src); wuffs_base__io_buffer* a_src);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_tga__decoder__history_retain_length( wuffs_tga__decoder__history_retain_length(
const wuffs_tga__decoder* self); const wuffs_tga__decoder* self);
@@ -12715,7 +12781,7 @@ struct wuffs_tga__decoder__struct {
return wuffs_tga__decoder__tell_me_more(this, a_dst, a_minfo, a_src); return wuffs_tga__decoder__tell_me_more(this, a_dst, a_minfo, a_src);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_tga__decoder__history_retain_length(this); return wuffs_tga__decoder__history_retain_length(this);
} }
@@ -12877,7 +12943,7 @@ wuffs_wbmp__decoder__tell_me_more(
wuffs_base__io_buffer* a_src); wuffs_base__io_buffer* a_src);
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_wbmp__decoder__history_retain_length( wuffs_wbmp__decoder__history_retain_length(
const wuffs_wbmp__decoder* self); const wuffs_wbmp__decoder* self);
@@ -13082,7 +13148,7 @@ struct wuffs_wbmp__decoder__struct {
return wuffs_wbmp__decoder__tell_me_more(this, a_dst, a_minfo, a_src); return wuffs_wbmp__decoder__tell_me_more(this, a_dst, a_minfo, a_src);
} }
inline uint64_t inline wuffs_base__optional_u63
history_retain_length() const { history_retain_length() const {
return wuffs_wbmp__decoder__history_retain_length(this); return wuffs_wbmp__decoder__history_retain_length(this);
} }
@@ -14417,6 +14483,9 @@ wuffs_private_impl__u64__sat_sub_indirect(uint64_t* x, uint64_t y) {
#define wuffs_base__utility__make_bitvec256(e00, e01, e02, e03) \ #define wuffs_base__utility__make_bitvec256(e00, e01, e02, e03) \
wuffs_base__make_bitvec256(e00, e01, e02, e03) wuffs_base__make_bitvec256(e00, e01, e02, e03)
#define wuffs_base__utility__make_optional_u63(h, v) \
wuffs_base__make_optional_u63(h, v)
// ---------------- Slices and Tables // ---------------- Slices and Tables
// wuffs_private_impl__slice_u8__prefix returns up to the first up_to bytes of // wuffs_private_impl__slice_u8__prefix returns up to the first up_to bytes of
@@ -15760,15 +15829,15 @@ wuffs_base__image_decoder__get_quirk(
} }
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_base__image_decoder__history_retain_length( wuffs_base__image_decoder__history_retain_length(
const wuffs_base__image_decoder* self) { const wuffs_base__image_decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
const wuffs_base__vtable* v = &self->private_impl.first_vtable; const wuffs_base__vtable* v = &self->private_impl.first_vtable;
@@ -15784,7 +15853,7 @@ wuffs_base__image_decoder__history_retain_length(
v++; v++;
} }
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
@@ -16057,15 +16126,15 @@ wuffs_base__io_transformer__get_quirk(
} }
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_base__io_transformer__history_retain_length( wuffs_base__io_transformer__history_retain_length(
const wuffs_base__io_transformer* self) { const wuffs_base__io_transformer* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
const wuffs_base__vtable* v = &self->private_impl.first_vtable; const wuffs_base__vtable* v = &self->private_impl.first_vtable;
@@ -16081,7 +16150,7 @@ wuffs_base__io_transformer__history_retain_length(
v++; v++;
} }
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
@@ -16242,15 +16311,15 @@ wuffs_base__token_decoder__get_quirk(
} }
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_base__token_decoder__history_retain_length( wuffs_base__token_decoder__history_retain_length(
const wuffs_base__token_decoder* self) { const wuffs_base__token_decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
const wuffs_base__vtable* v = &self->private_impl.first_vtable; const wuffs_base__vtable* v = &self->private_impl.first_vtable;
@@ -16266,7 +16335,7 @@ wuffs_base__token_decoder__history_retain_length(
v++; v++;
} }
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
@@ -28575,7 +28644,7 @@ wuffs_bmp__decoder__func_ptrs_for__wuffs_base__image_decoder = {
(wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_bmp__decoder__frame_dirty_rect), (wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_bmp__decoder__frame_dirty_rect),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_bmp__decoder__get_quirk), uint32_t))(&wuffs_bmp__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_bmp__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_bmp__decoder__history_retain_length),
(uint32_t(*)(const void*))(&wuffs_bmp__decoder__num_animation_loops), (uint32_t(*)(const void*))(&wuffs_bmp__decoder__num_animation_loops),
(uint64_t(*)(const void*))(&wuffs_bmp__decoder__num_decoded_frame_configs), (uint64_t(*)(const void*))(&wuffs_bmp__decoder__num_decoded_frame_configs),
(uint64_t(*)(const void*))(&wuffs_bmp__decoder__num_decoded_frames), (uint64_t(*)(const void*))(&wuffs_bmp__decoder__num_decoded_frames),
@@ -31022,18 +31091,18 @@ wuffs_bmp__decoder__do_tell_me_more(
// -------- func bmp.decoder.history_retain_length // -------- func bmp.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_bmp__decoder__history_retain_length( wuffs_bmp__decoder__history_retain_length(
const wuffs_bmp__decoder* self) { const wuffs_bmp__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func bmp.decoder.workbuf_len // -------- func bmp.decoder.workbuf_len
@@ -31366,7 +31435,7 @@ const wuffs_base__io_transformer__func_ptrs
wuffs_bzip2__decoder__func_ptrs_for__wuffs_base__io_transformer = { wuffs_bzip2__decoder__func_ptrs_for__wuffs_base__io_transformer = {
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_bzip2__decoder__get_quirk), uint32_t))(&wuffs_bzip2__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_bzip2__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_bzip2__decoder__history_retain_length),
(wuffs_base__status(*)(void*, (wuffs_base__status(*)(void*,
uint32_t, uint32_t,
uint64_t))(&wuffs_bzip2__decoder__set_quirk), uint64_t))(&wuffs_bzip2__decoder__set_quirk),
@@ -31494,18 +31563,18 @@ wuffs_bzip2__decoder__set_quirk(
// -------- func bzip2.decoder.history_retain_length // -------- func bzip2.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_bzip2__decoder__history_retain_length( wuffs_bzip2__decoder__history_retain_length(
const wuffs_bzip2__decoder* self) { const wuffs_bzip2__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func bzip2.decoder.workbuf_len // -------- func bzip2.decoder.workbuf_len
@@ -32926,7 +32995,7 @@ wuffs_cbor__decoder__func_ptrs_for__wuffs_base__token_decoder = {
wuffs_base__slice_u8))(&wuffs_cbor__decoder__decode_tokens), wuffs_base__slice_u8))(&wuffs_cbor__decoder__decode_tokens),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_cbor__decoder__get_quirk), uint32_t))(&wuffs_cbor__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_cbor__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_cbor__decoder__history_retain_length),
(wuffs_base__status(*)(void*, (wuffs_base__status(*)(void*,
uint32_t, uint32_t,
uint64_t))(&wuffs_cbor__decoder__set_quirk), uint64_t))(&wuffs_cbor__decoder__set_quirk),
@@ -33046,18 +33115,18 @@ wuffs_cbor__decoder__set_quirk(
// -------- func cbor.decoder.history_retain_length // -------- func cbor.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_cbor__decoder__history_retain_length( wuffs_cbor__decoder__history_retain_length(
const wuffs_cbor__decoder* self) { const wuffs_cbor__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func cbor.decoder.workbuf_len // -------- func cbor.decoder.workbuf_len
@@ -35566,7 +35635,7 @@ const wuffs_base__io_transformer__func_ptrs
wuffs_deflate__decoder__func_ptrs_for__wuffs_base__io_transformer = { wuffs_deflate__decoder__func_ptrs_for__wuffs_base__io_transformer = {
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_deflate__decoder__get_quirk), uint32_t))(&wuffs_deflate__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_deflate__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_deflate__decoder__history_retain_length),
(wuffs_base__status(*)(void*, (wuffs_base__status(*)(void*,
uint32_t, uint32_t,
uint64_t))(&wuffs_deflate__decoder__set_quirk), uint64_t))(&wuffs_deflate__decoder__set_quirk),
@@ -35733,18 +35802,18 @@ wuffs_deflate__decoder__set_quirk(
// -------- func deflate.decoder.history_retain_length // -------- func deflate.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_deflate__decoder__history_retain_length( wuffs_deflate__decoder__history_retain_length(
const wuffs_deflate__decoder* self) { const wuffs_deflate__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func deflate.decoder.workbuf_len // -------- func deflate.decoder.workbuf_len
@@ -37975,7 +38044,7 @@ wuffs_gif__decoder__func_ptrs_for__wuffs_base__image_decoder = {
(wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_gif__decoder__frame_dirty_rect), (wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_gif__decoder__frame_dirty_rect),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_gif__decoder__get_quirk), uint32_t))(&wuffs_gif__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_gif__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_gif__decoder__history_retain_length),
(uint32_t(*)(const void*))(&wuffs_gif__decoder__num_animation_loops), (uint32_t(*)(const void*))(&wuffs_gif__decoder__num_animation_loops),
(uint64_t(*)(const void*))(&wuffs_gif__decoder__num_decoded_frame_configs), (uint64_t(*)(const void*))(&wuffs_gif__decoder__num_decoded_frame_configs),
(uint64_t(*)(const void*))(&wuffs_gif__decoder__num_decoded_frames), (uint64_t(*)(const void*))(&wuffs_gif__decoder__num_decoded_frames),
@@ -38558,18 +38627,18 @@ wuffs_gif__decoder__frame_dirty_rect(
// -------- func gif.decoder.history_retain_length // -------- func gif.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_gif__decoder__history_retain_length( wuffs_gif__decoder__history_retain_length(
const wuffs_gif__decoder* self) { const wuffs_gif__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func gif.decoder.workbuf_len // -------- func gif.decoder.workbuf_len
@@ -40893,7 +40962,7 @@ const wuffs_base__io_transformer__func_ptrs
wuffs_gzip__decoder__func_ptrs_for__wuffs_base__io_transformer = { wuffs_gzip__decoder__func_ptrs_for__wuffs_base__io_transformer = {
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_gzip__decoder__get_quirk), uint32_t))(&wuffs_gzip__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_gzip__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_gzip__decoder__history_retain_length),
(wuffs_base__status(*)(void*, (wuffs_base__status(*)(void*,
uint32_t, uint32_t,
uint64_t))(&wuffs_gzip__decoder__set_quirk), uint64_t))(&wuffs_gzip__decoder__set_quirk),
@@ -41038,18 +41107,18 @@ wuffs_gzip__decoder__set_quirk(
// -------- func gzip.decoder.history_retain_length // -------- func gzip.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_gzip__decoder__history_retain_length( wuffs_gzip__decoder__history_retain_length(
const wuffs_gzip__decoder* self) { const wuffs_gzip__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func gzip.decoder.workbuf_len // -------- func gzip.decoder.workbuf_len
@@ -41981,7 +42050,7 @@ wuffs_jpeg__decoder__func_ptrs_for__wuffs_base__image_decoder = {
(wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_jpeg__decoder__frame_dirty_rect), (wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_jpeg__decoder__frame_dirty_rect),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_jpeg__decoder__get_quirk), uint32_t))(&wuffs_jpeg__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_jpeg__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_jpeg__decoder__history_retain_length),
(uint32_t(*)(const void*))(&wuffs_jpeg__decoder__num_animation_loops), (uint32_t(*)(const void*))(&wuffs_jpeg__decoder__num_animation_loops),
(uint64_t(*)(const void*))(&wuffs_jpeg__decoder__num_decoded_frame_configs), (uint64_t(*)(const void*))(&wuffs_jpeg__decoder__num_decoded_frame_configs),
(uint64_t(*)(const void*))(&wuffs_jpeg__decoder__num_decoded_frames), (uint64_t(*)(const void*))(&wuffs_jpeg__decoder__num_decoded_frames),
@@ -46654,18 +46723,18 @@ wuffs_jpeg__decoder__tell_me_more(
// -------- func jpeg.decoder.history_retain_length // -------- func jpeg.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_jpeg__decoder__history_retain_length( wuffs_jpeg__decoder__history_retain_length(
const wuffs_jpeg__decoder* self) { const wuffs_jpeg__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func jpeg.decoder.workbuf_len // -------- func jpeg.decoder.workbuf_len
@@ -48462,7 +48531,7 @@ wuffs_json__decoder__func_ptrs_for__wuffs_base__token_decoder = {
wuffs_base__slice_u8))(&wuffs_json__decoder__decode_tokens), wuffs_base__slice_u8))(&wuffs_json__decoder__decode_tokens),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_json__decoder__get_quirk), uint32_t))(&wuffs_json__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_json__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_json__decoder__history_retain_length),
(wuffs_base__status(*)(void*, (wuffs_base__status(*)(void*,
uint32_t, uint32_t,
uint64_t))(&wuffs_json__decoder__set_quirk), uint64_t))(&wuffs_json__decoder__set_quirk),
@@ -48599,18 +48668,18 @@ wuffs_json__decoder__set_quirk(
// -------- func json.decoder.history_retain_length // -------- func json.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_json__decoder__history_retain_length( wuffs_json__decoder__history_retain_length(
const wuffs_json__decoder* self) { const wuffs_json__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func json.decoder.workbuf_len // -------- func json.decoder.workbuf_len
@@ -50445,7 +50514,7 @@ const wuffs_base__io_transformer__func_ptrs
wuffs_lzw__decoder__func_ptrs_for__wuffs_base__io_transformer = { wuffs_lzw__decoder__func_ptrs_for__wuffs_base__io_transformer = {
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_lzw__decoder__get_quirk), uint32_t))(&wuffs_lzw__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_lzw__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_lzw__decoder__history_retain_length),
(wuffs_base__status(*)(void*, (wuffs_base__status(*)(void*,
uint32_t, uint32_t,
uint64_t))(&wuffs_lzw__decoder__set_quirk), uint64_t))(&wuffs_lzw__decoder__set_quirk),
@@ -50579,18 +50648,18 @@ wuffs_lzw__decoder__set_quirk(
// -------- func lzw.decoder.history_retain_length // -------- func lzw.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_lzw__decoder__history_retain_length( wuffs_lzw__decoder__history_retain_length(
const wuffs_lzw__decoder* self) { const wuffs_lzw__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func lzw.decoder.workbuf_len // -------- func lzw.decoder.workbuf_len
@@ -51053,7 +51122,7 @@ wuffs_netpbm__decoder__func_ptrs_for__wuffs_base__image_decoder = {
(wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_netpbm__decoder__frame_dirty_rect), (wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_netpbm__decoder__frame_dirty_rect),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_netpbm__decoder__get_quirk), uint32_t))(&wuffs_netpbm__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_netpbm__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_netpbm__decoder__history_retain_length),
(uint32_t(*)(const void*))(&wuffs_netpbm__decoder__num_animation_loops), (uint32_t(*)(const void*))(&wuffs_netpbm__decoder__num_animation_loops),
(uint64_t(*)(const void*))(&wuffs_netpbm__decoder__num_decoded_frame_configs), (uint64_t(*)(const void*))(&wuffs_netpbm__decoder__num_decoded_frame_configs),
(uint64_t(*)(const void*))(&wuffs_netpbm__decoder__num_decoded_frames), (uint64_t(*)(const void*))(&wuffs_netpbm__decoder__num_decoded_frames),
@@ -52113,18 +52182,18 @@ wuffs_netpbm__decoder__tell_me_more(
// -------- func netpbm.decoder.history_retain_length // -------- func netpbm.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_netpbm__decoder__history_retain_length( wuffs_netpbm__decoder__history_retain_length(
const wuffs_netpbm__decoder* self) { const wuffs_netpbm__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func netpbm.decoder.workbuf_len // -------- func netpbm.decoder.workbuf_len
@@ -52211,7 +52280,7 @@ wuffs_nie__decoder__func_ptrs_for__wuffs_base__image_decoder = {
(wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_nie__decoder__frame_dirty_rect), (wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_nie__decoder__frame_dirty_rect),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_nie__decoder__get_quirk), uint32_t))(&wuffs_nie__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_nie__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_nie__decoder__history_retain_length),
(uint32_t(*)(const void*))(&wuffs_nie__decoder__num_animation_loops), (uint32_t(*)(const void*))(&wuffs_nie__decoder__num_animation_loops),
(uint64_t(*)(const void*))(&wuffs_nie__decoder__num_decoded_frame_configs), (uint64_t(*)(const void*))(&wuffs_nie__decoder__num_decoded_frame_configs),
(uint64_t(*)(const void*))(&wuffs_nie__decoder__num_decoded_frames), (uint64_t(*)(const void*))(&wuffs_nie__decoder__num_decoded_frames),
@@ -53191,18 +53260,18 @@ wuffs_nie__decoder__tell_me_more(
// -------- func nie.decoder.history_retain_length // -------- func nie.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_nie__decoder__history_retain_length( wuffs_nie__decoder__history_retain_length(
const wuffs_nie__decoder* self) { const wuffs_nie__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func nie.decoder.workbuf_len // -------- func nie.decoder.workbuf_len
@@ -53260,7 +53329,7 @@ const wuffs_base__io_transformer__func_ptrs
wuffs_zlib__decoder__func_ptrs_for__wuffs_base__io_transformer = { wuffs_zlib__decoder__func_ptrs_for__wuffs_base__io_transformer = {
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_zlib__decoder__get_quirk), uint32_t))(&wuffs_zlib__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_zlib__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_zlib__decoder__history_retain_length),
(wuffs_base__status(*)(void*, (wuffs_base__status(*)(void*,
uint32_t, uint32_t,
uint64_t))(&wuffs_zlib__decoder__set_quirk), uint64_t))(&wuffs_zlib__decoder__set_quirk),
@@ -53471,18 +53540,18 @@ wuffs_zlib__decoder__set_quirk(
// -------- func zlib.decoder.history_retain_length // -------- func zlib.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_zlib__decoder__history_retain_length( wuffs_zlib__decoder__history_retain_length(
const wuffs_zlib__decoder* self) { const wuffs_zlib__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func zlib.decoder.workbuf_len // -------- func zlib.decoder.workbuf_len
@@ -54223,7 +54292,7 @@ wuffs_png__decoder__func_ptrs_for__wuffs_base__image_decoder = {
(wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_png__decoder__frame_dirty_rect), (wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_png__decoder__frame_dirty_rect),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_png__decoder__get_quirk), uint32_t))(&wuffs_png__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_png__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_png__decoder__history_retain_length),
(uint32_t(*)(const void*))(&wuffs_png__decoder__num_animation_loops), (uint32_t(*)(const void*))(&wuffs_png__decoder__num_animation_loops),
(uint64_t(*)(const void*))(&wuffs_png__decoder__num_decoded_frame_configs), (uint64_t(*)(const void*))(&wuffs_png__decoder__num_decoded_frame_configs),
(uint64_t(*)(const void*))(&wuffs_png__decoder__num_decoded_frames), (uint64_t(*)(const void*))(&wuffs_png__decoder__num_decoded_frames),
@@ -59951,18 +60020,18 @@ wuffs_png__decoder__do_tell_me_more(
// -------- func png.decoder.history_retain_length // -------- func png.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_png__decoder__history_retain_length( wuffs_png__decoder__history_retain_length(
const wuffs_png__decoder* self) { const wuffs_png__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func png.decoder.workbuf_len // -------- func png.decoder.workbuf_len
@@ -61013,7 +61082,7 @@ wuffs_tga__decoder__func_ptrs_for__wuffs_base__image_decoder = {
(wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_tga__decoder__frame_dirty_rect), (wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_tga__decoder__frame_dirty_rect),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_tga__decoder__get_quirk), uint32_t))(&wuffs_tga__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_tga__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_tga__decoder__history_retain_length),
(uint32_t(*)(const void*))(&wuffs_tga__decoder__num_animation_loops), (uint32_t(*)(const void*))(&wuffs_tga__decoder__num_animation_loops),
(uint64_t(*)(const void*))(&wuffs_tga__decoder__num_decoded_frame_configs), (uint64_t(*)(const void*))(&wuffs_tga__decoder__num_decoded_frame_configs),
(uint64_t(*)(const void*))(&wuffs_tga__decoder__num_decoded_frames), (uint64_t(*)(const void*))(&wuffs_tga__decoder__num_decoded_frames),
@@ -62378,18 +62447,18 @@ wuffs_tga__decoder__tell_me_more(
// -------- func tga.decoder.history_retain_length // -------- func tga.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_tga__decoder__history_retain_length( wuffs_tga__decoder__history_retain_length(
const wuffs_tga__decoder* self) { const wuffs_tga__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func tga.decoder.workbuf_len // -------- func tga.decoder.workbuf_len
@@ -62467,7 +62536,7 @@ wuffs_wbmp__decoder__func_ptrs_for__wuffs_base__image_decoder = {
(wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_wbmp__decoder__frame_dirty_rect), (wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_wbmp__decoder__frame_dirty_rect),
(uint64_t(*)(const void*, (uint64_t(*)(const void*,
uint32_t))(&wuffs_wbmp__decoder__get_quirk), uint32_t))(&wuffs_wbmp__decoder__get_quirk),
(uint64_t(*)(const void*))(&wuffs_wbmp__decoder__history_retain_length), (wuffs_base__optional_u63(*)(const void*))(&wuffs_wbmp__decoder__history_retain_length),
(uint32_t(*)(const void*))(&wuffs_wbmp__decoder__num_animation_loops), (uint32_t(*)(const void*))(&wuffs_wbmp__decoder__num_animation_loops),
(uint64_t(*)(const void*))(&wuffs_wbmp__decoder__num_decoded_frame_configs), (uint64_t(*)(const void*))(&wuffs_wbmp__decoder__num_decoded_frame_configs),
(uint64_t(*)(const void*))(&wuffs_wbmp__decoder__num_decoded_frames), (uint64_t(*)(const void*))(&wuffs_wbmp__decoder__num_decoded_frames),
@@ -63318,18 +63387,18 @@ wuffs_wbmp__decoder__tell_me_more(
// -------- func wbmp.decoder.history_retain_length // -------- func wbmp.decoder.history_retain_length
WUFFS_BASE__GENERATED_C_CODE WUFFS_BASE__GENERATED_C_CODE
WUFFS_BASE__MAYBE_STATIC uint64_t WUFFS_BASE__MAYBE_STATIC wuffs_base__optional_u63
wuffs_wbmp__decoder__history_retain_length( wuffs_wbmp__decoder__history_retain_length(
const wuffs_wbmp__decoder* self) { const wuffs_wbmp__decoder* self) {
if (!self) { if (!self) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
if ((self->private_impl.magic != WUFFS_BASE__MAGIC) && if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
(self->private_impl.magic != WUFFS_BASE__DISABLED)) { (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
return 0; return wuffs_base__utility__make_optional_u63(false, 0u);
} }
return 0u; return wuffs_base__utility__make_optional_u63(true, 0u);
} }
// -------- func wbmp.decoder.workbuf_len // -------- func wbmp.decoder.workbuf_len
@@ -64680,14 +64749,16 @@ DecodeCbor(DecodeCborCallbacks& callbacks,
"wuffs_aux::DecodeCbor: internal error: io_buf is closed"; "wuffs_aux::DecodeCbor: internal error: io_buf is closed";
goto done; goto done;
} }
io_buf->compact_retaining(dec->history_retain_length()); io_buf->compact_retaining(
dec->history_retain_length().value_or(UINT64_MAX));
if (io_buf->meta.wi >= io_buf->data.len) { if (io_buf->meta.wi >= io_buf->data.len) {
ret_error_message = ret_error_message =
"wuffs_aux::DecodeCbor: internal error: io_buf is full"; "wuffs_aux::DecodeCbor: internal error: io_buf is full";
goto done; goto done;
} }
cursor_index = io_buf->meta.ri; cursor_index = io_buf->meta.ri;
io_error_message = input.CopyIn(io_buf, dec->history_retain_length()); io_error_message = input.CopyIn(
io_buf, dec->history_retain_length().value_or(UINT64_MAX));
} else { } else {
ret_error_message = tok_status.message(); ret_error_message = tok_status.message();
goto done; goto done;
@@ -65367,8 +65438,9 @@ redirect:
} else if (io_buf.meta.closed) { } else if (io_buf.meta.closed) {
return DecodeImageResult(DecodeImage_UnexpectedEndOfFile); return DecodeImageResult(DecodeImage_UnexpectedEndOfFile);
} else { } else {
std::string error_message = std::string error_message = input.CopyIn(
input.CopyIn(&io_buf, image_decoder->history_retain_length()); &io_buf,
image_decoder->history_retain_length().value_or(UINT64_MAX));
if (!error_message.empty()) { if (!error_message.empty()) {
return DecodeImageResult(std::move(error_message)); return DecodeImageResult(std::move(error_message));
} }
@@ -65450,8 +65522,8 @@ redirect:
} else if (io_buf.meta.closed) { } else if (io_buf.meta.closed) {
return DecodeImageResult(DecodeImage_UnexpectedEndOfFile); return DecodeImageResult(DecodeImage_UnexpectedEndOfFile);
} else { } else {
std::string error_message = std::string error_message = input.CopyIn(
input.CopyIn(&io_buf, image_decoder->history_retain_length()); &io_buf, image_decoder->history_retain_length().value_or(UINT64_MAX));
if (!error_message.empty()) { if (!error_message.empty()) {
return DecodeImageResult(std::move(error_message)); return DecodeImageResult(std::move(error_message));
} }
@@ -65480,8 +65552,8 @@ redirect:
message = DecodeImage_UnexpectedEndOfFile; message = DecodeImage_UnexpectedEndOfFile;
break; break;
} else { } else {
std::string error_message = std::string error_message = input.CopyIn(
input.CopyIn(&io_buf, image_decoder->history_retain_length()); &io_buf, image_decoder->history_retain_length().value_or(UINT64_MAX));
if (!error_message.empty()) { if (!error_message.empty()) {
message = std::move(error_message); message = std::move(error_message);
break; break;
@@ -65509,8 +65581,9 @@ redirect:
} else if (io_buf.meta.closed) { } else if (io_buf.meta.closed) {
return DecodeImageResult(DecodeImage_UnexpectedEndOfFile); return DecodeImageResult(DecodeImage_UnexpectedEndOfFile);
} else { } else {
std::string error_message = std::string error_message = input.CopyIn(
input.CopyIn(&io_buf, image_decoder->history_retain_length()); &io_buf,
image_decoder->history_retain_length().value_or(UINT64_MAX));
if (!error_message.empty()) { if (!error_message.empty()) {
return DecodeImageResult(std::move(error_message)); return DecodeImageResult(std::move(error_message));
} }
@@ -65603,58 +65676,60 @@ DecodeJsonArgJsonPointer::DefaultValue() {
// -------- // --------
#define WUFFS_AUX__DECODE_JSON__GET_THE_NEXT_TOKEN \ #define WUFFS_AUX__DECODE_JSON__GET_THE_NEXT_TOKEN \
while (tok_buf.meta.ri >= tok_buf.meta.wi) { \ while (tok_buf.meta.ri >= tok_buf.meta.wi) { \
if (tok_status.repr == nullptr) { \ if (tok_status.repr == nullptr) { \
goto done; \ goto done; \
} else if (tok_status.repr == wuffs_base__suspension__short_write) { \ } else if (tok_status.repr == wuffs_base__suspension__short_write) { \
tok_buf.compact(); \ tok_buf.compact(); \
} else if (tok_status.repr == wuffs_base__suspension__short_read) { \ } else if (tok_status.repr == wuffs_base__suspension__short_read) { \
if (!io_error_message.empty()) { \ if (!io_error_message.empty()) { \
ret_error_message = std::move(io_error_message); \ ret_error_message = std::move(io_error_message); \
goto done; \ goto done; \
} else if (cursor_index != io_buf->meta.ri) { \ } else if (cursor_index != io_buf->meta.ri) { \
ret_error_message = \ ret_error_message = \
"wuffs_aux::DecodeJson: internal error: bad cursor_index"; \ "wuffs_aux::DecodeJson: internal error: bad cursor_index"; \
goto done; \ goto done; \
} else if (io_buf->meta.closed) { \ } else if (io_buf->meta.closed) { \
ret_error_message = \ ret_error_message = \
"wuffs_aux::DecodeJson: internal error: io_buf is closed"; \ "wuffs_aux::DecodeJson: internal error: io_buf is closed"; \
goto done; \ goto done; \
} \ } \
io_buf->compact_retaining(dec->history_retain_length()); \ io_buf->compact_retaining( \
if (io_buf->meta.wi >= io_buf->data.len) { \ dec->history_retain_length().value_or(UINT64_MAX)); \
ret_error_message = \ if (io_buf->meta.wi >= io_buf->data.len) { \
"wuffs_aux::DecodeJson: internal error: io_buf is full"; \ ret_error_message = \
goto done; \ "wuffs_aux::DecodeJson: internal error: io_buf is full"; \
} \ goto done; \
cursor_index = io_buf->meta.ri; \ } \
io_error_message = input.CopyIn(io_buf, dec->history_retain_length()); \ cursor_index = io_buf->meta.ri; \
} else { \ io_error_message = input.CopyIn( \
ret_error_message = tok_status.message(); \ io_buf, dec->history_retain_length().value_or(UINT64_MAX)); \
goto done; \ } else { \
} \ ret_error_message = tok_status.message(); \
tok_status = \ goto done; \
dec->decode_tokens(&tok_buf, io_buf, wuffs_base__empty_slice_u8()); \ } \
if ((tok_buf.meta.ri > tok_buf.meta.wi) || \ tok_status = \
(tok_buf.meta.wi > tok_buf.data.len) || \ dec->decode_tokens(&tok_buf, io_buf, wuffs_base__empty_slice_u8()); \
(io_buf->meta.ri > io_buf->meta.wi) || \ if ((tok_buf.meta.ri > tok_buf.meta.wi) || \
(io_buf->meta.wi > io_buf->data.len)) { \ (tok_buf.meta.wi > tok_buf.data.len) || \
ret_error_message = \ (io_buf->meta.ri > io_buf->meta.wi) || \
"wuffs_aux::DecodeJson: internal error: bad buffer indexes"; \ (io_buf->meta.wi > io_buf->data.len)) { \
goto done; \ ret_error_message = \
} \ "wuffs_aux::DecodeJson: internal error: bad buffer indexes"; \
} \ goto done; \
wuffs_base__token token = tok_buf.data.ptr[tok_buf.meta.ri++]; \ } \
uint64_t token_len = token.length(); \ } \
if ((io_buf->meta.ri < cursor_index) || \ wuffs_base__token token = tok_buf.data.ptr[tok_buf.meta.ri++]; \
((io_buf->meta.ri - cursor_index) < token_len)) { \ uint64_t token_len = token.length(); \
ret_error_message = \ if ((io_buf->meta.ri < cursor_index) || \
"wuffs_aux::DecodeJson: internal error: bad token indexes"; \ ((io_buf->meta.ri - cursor_index) < token_len)) { \
goto done; \ ret_error_message = \
} \ "wuffs_aux::DecodeJson: internal error: bad token indexes"; \
uint8_t* token_ptr = io_buf->data.ptr + cursor_index; \ goto done; \
(void)(token_ptr); \ } \
uint8_t* token_ptr = io_buf->data.ptr + cursor_index; \
(void)(token_ptr); \
cursor_index += static_cast<size_t>(token_len) cursor_index += static_cast<size_t>(token_len)
// -------- // --------
+2 -2
View File
@@ -1257,8 +1257,8 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
this.io_redirect_fourcc = 1 this.io_redirect_fourcc = 1
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -118,8 +118,8 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option" return base."#unsupported option"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -121,8 +121,8 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option" return base."#unsupported option"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -205,8 +205,8 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option" return base."#unsupported option"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -333,8 +333,8 @@ pub func decoder.frame_dirty_rect() base.rect_ie_u32 {
max_excl_y: this.dirty_max_excl_y.min(no_more_than: this.height)) max_excl_y: this.dirty_max_excl_y.min(no_more_than: this.height))
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -46,8 +46,8 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option" return base."#unsupported option"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -2107,8 +2107,8 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
return base."#no more information" return base."#no more information"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -82,8 +82,8 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option" return base."#unsupported option"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -86,8 +86,8 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option" return base."#unsupported option"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -429,8 +429,8 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
return base."#no more information" return base."#no more information"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -325,8 +325,8 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
return base."#no more information" return base."#no more information"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -1719,8 +1719,8 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
return ok return ok
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -612,8 +612,8 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
return base."#no more information" return base."#no more information"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -310,8 +310,8 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
return base."#no more information" return base."#no more information"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
+2 -2
View File
@@ -93,8 +93,8 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
return base."#unsupported option" return base."#unsupported option"
} }
pub func decoder.history_retain_length() base.u64 { pub func decoder.history_retain_length() base.optional_u63 {
return 0 return this.util.make_optional_u63(has_value: true, value: 0)
} }
pub func decoder.workbuf_len() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {