mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Rename I/O bounds fields to mark and limit
This commit is contained in:
1 parent
6236e7205f
commit
4e7ef5fb88
7 files changed
+250
-241
No files matched your search
@@ -527,35 +527,38 @@ wuffs_base__io_buffer__is_valid(wuffs_base__io_buffer buf) {
|
||||
// TODO: wuffs_base__io_reader__is_eof is no longer used by Wuffs per se, but
|
||||
// it might be handy to programs that use Wuffs. Either delete it, or promote
|
||||
// it to the public API.
|
||||
//
|
||||
// If making this function public (i.e. moving it to base-header.h), it also
|
||||
// needs to allow NULL (i.e. implicit, callee-calculated) mark/limit.
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__io_reader__is_eof(wuffs_base__io_reader o) {
|
||||
wuffs_base__io_buffer* buf = o.private_impl.buf;
|
||||
return buf && buf->closed && (buf->ptr + buf->wi == o.private_impl.bounds[1]);
|
||||
return buf && buf->closed && (buf->ptr + buf->wi == o.private_impl.limit);
|
||||
}
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__io_reader__is_valid(wuffs_base__io_reader o) {
|
||||
wuffs_base__io_buffer* buf = o.private_impl.buf;
|
||||
// Note: if making this function public (i.e. moving it to base-header.h), it
|
||||
// also needs to allow NULL (i.e. implicit, callee-calculated) bounds.
|
||||
return buf ? ((buf->ptr <= o.private_impl.bounds[0]) &&
|
||||
(o.private_impl.bounds[0] <= o.private_impl.bounds[1]) &&
|
||||
(o.private_impl.bounds[1] <= buf->ptr + buf->len))
|
||||
: ((o.private_impl.bounds[0] == NULL) &&
|
||||
(o.private_impl.bounds[1] == NULL));
|
||||
// also needs to allow NULL (i.e. implicit, callee-calculated) mark/limit.
|
||||
return buf ? ((buf->ptr <= o.private_impl.mark) &&
|
||||
(o.private_impl.mark <= o.private_impl.limit) &&
|
||||
(o.private_impl.limit <= buf->ptr + buf->len))
|
||||
: ((o.private_impl.mark == NULL) &&
|
||||
(o.private_impl.limit == NULL));
|
||||
}
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__io_writer__is_valid(wuffs_base__io_writer o) {
|
||||
wuffs_base__io_buffer* buf = o.private_impl.buf;
|
||||
// Note: if making this function public (i.e. moving it to base-header.h), it
|
||||
// also needs to allow NULL (i.e. implicit, callee-calculated) bounds.
|
||||
return buf ? ((buf->ptr <= o.private_impl.bounds[0]) &&
|
||||
(o.private_impl.bounds[0] <= o.private_impl.bounds[1]) &&
|
||||
(o.private_impl.bounds[1] <= buf->ptr + buf->len))
|
||||
: ((o.private_impl.bounds[0] == NULL) &&
|
||||
(o.private_impl.bounds[1] == NULL));
|
||||
// also needs to allow NULL (i.e. implicit, callee-calculated) mark/limit.
|
||||
return buf ? ((buf->ptr <= o.private_impl.mark) &&
|
||||
(o.private_impl.mark <= o.private_impl.limit) &&
|
||||
(o.private_impl.limit <= buf->ptr + buf->len))
|
||||
: ((o.private_impl.mark == NULL) &&
|
||||
(o.private_impl.limit == NULL));
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
@@ -690,15 +693,15 @@ static inline wuffs_base__empty_struct //
|
||||
wuffs_base__io_reader__set_limit(wuffs_base__io_reader* o,
|
||||
uint8_t* ioptr_r,
|
||||
uint64_t limit) {
|
||||
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
|
||||
o->private_impl.bounds[1] = ioptr_r + limit;
|
||||
if (o && (((size_t)(o->private_impl.limit - ioptr_r)) > limit)) {
|
||||
o->private_impl.limit = ioptr_r + limit;
|
||||
}
|
||||
return ((wuffs_base__empty_struct){});
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct //
|
||||
wuffs_base__io_reader__set_mark(wuffs_base__io_reader* o, uint8_t* mark) {
|
||||
o->private_impl.bounds[0] = mark;
|
||||
o->private_impl.mark = mark;
|
||||
return ((wuffs_base__empty_struct){});
|
||||
}
|
||||
|
||||
@@ -714,8 +717,8 @@ wuffs_base__io_writer__set(wuffs_base__io_writer* o,
|
||||
b->ri = 0;
|
||||
b->closed = false;
|
||||
o->private_impl.buf = b;
|
||||
o->private_impl.bounds[0] = s.ptr;
|
||||
o->private_impl.bounds[1] = s.ptr + s.len;
|
||||
o->private_impl.mark = s.ptr;
|
||||
o->private_impl.limit = s.ptr + s.len;
|
||||
*ioptr1_ptr = s.ptr;
|
||||
*ioptr2_ptr = s.ptr + s.len;
|
||||
return ((wuffs_base__empty_struct){});
|
||||
@@ -723,7 +726,7 @@ wuffs_base__io_writer__set(wuffs_base__io_writer* o,
|
||||
|
||||
static inline wuffs_base__empty_struct //
|
||||
wuffs_base__io_writer__set_mark(wuffs_base__io_writer* o, uint8_t* mark) {
|
||||
o->private_impl.bounds[0] = mark;
|
||||
o->private_impl.mark = mark;
|
||||
return ((wuffs_base__empty_struct){});
|
||||
}
|
||||
|
||||
|
||||
@@ -971,7 +971,8 @@ typedef struct {
|
||||
// The bounds values are typically NULL, when created by the Wuffs public
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
uint8_t* mark;
|
||||
uint8_t* limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -983,7 +984,8 @@ typedef struct {
|
||||
// The bounds values are typically NULL, when created by the Wuffs public
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
uint8_t* mark;
|
||||
uint8_t* limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
|
||||
@@ -133,8 +133,8 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
|
||||
case t.IDSinceMark:
|
||||
b.printf("((wuffs_base__slice_u8){ "+
|
||||
".ptr = %ssrc.private_impl.bounds[0], "+
|
||||
".len = (size_t)(iop_a_src - %ssrc.private_impl.bounds[0]), })",
|
||||
".ptr = %ssrc.private_impl.mark, "+
|
||||
".len = (size_t)(iop_a_src - %ssrc.private_impl.mark), })",
|
||||
aPrefix, aPrefix)
|
||||
return nil
|
||||
|
||||
@@ -172,7 +172,7 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
suffix = "_fast"
|
||||
}
|
||||
b.printf("wuffs_base__io_writer__copy_n_from_history%s("+
|
||||
"&iop_a_dst, %sdst.private_impl.bounds[0], io1_a_dst",
|
||||
"&iop_a_dst, %sdst.private_impl.mark, io1_a_dst",
|
||||
suffix, aPrefix)
|
||||
for _, o := range args {
|
||||
b.writeb(',')
|
||||
@@ -201,7 +201,7 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return g.writeArgs(b, args, rp, depth)
|
||||
|
||||
case t.IDSetMark:
|
||||
// TODO: is a private_impl.bounds[0] the right representation? What
|
||||
// TODO: is a private_impl.mark the right representation? What
|
||||
// if the function is passed a (ptr io_writer) instead of a
|
||||
// (io_writer)? Do we still want to have that mark live outside of
|
||||
// the function scope?
|
||||
@@ -210,8 +210,8 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
|
||||
case t.IDSinceMark:
|
||||
b.printf("((wuffs_base__slice_u8){ "+
|
||||
".ptr = %sdst.private_impl.bounds[0], "+
|
||||
".len = (size_t)(iop_a_dst - %sdst.private_impl.bounds[0]), })",
|
||||
".ptr = %sdst.private_impl.mark, "+
|
||||
".len = (size_t)(iop_a_dst - %sdst.private_impl.mark), })",
|
||||
aPrefix, aPrefix)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ const baseBasePublicH = "" +
|
||||
"e uint32_t //\nwuffs_base__rect_ie_u32__width(wuffs_base__rect_ie_u32* r) {\n return wuffs_base__u32__sat_sub(r->max_excl_x, r->min_incl_x);\n}\n\nstatic inline uint32_t //\nwuffs_base__rect_ie_u32__height(wuffs_base__rect_ie_u32* r) {\n return wuffs_base__u32__sat_sub(r->max_excl_y, r->min_incl_y);\n}\n\n#ifdef __cplusplus\n\ninline bool //\nwuffs_base__rect_ie_u32::is_empty() {\n return wuffs_base__rect_ie_u32__is_empty(this);\n}\n\ninline bool //\nwuffs_base__rect_ie_u32::equals(wuffs_base__rect_ie_u32 s) {\n return wuffs_base__rect_ie_u32__equals(this, s);\n}\n\ninline bool //\nwuffs_base__rect_ie_u32::contains(uint32_t x, uint32_t y) {\n return wuffs_base__rect_ie_u32__contains(this, x, y);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__rect_ie_u32::intersect(wuffs_base__rect_ie_u32 s) {\n return wuffs_base__rect_ie_u32__intersect(this, s);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__rect_ie_u32::unite(wuffs_base__rect_ie_u32 s) {\n return wuffs_base__rect_ie_u32__unite(this, s);\n}\n\ninline uint32_t //\nwuffs_" +
|
||||
"base__rect_ie_u32::width() {\n return wuffs_base__rect_ie_u32__width(this);\n}\n\ninline uint32_t //\nwuffs_base__rect_ie_u32::height() {\n return wuffs_base__rect_ie_u32__height(this);\n}\n\n#endif // __cplusplus\n\n" +
|
||||
"" +
|
||||
"// ---------------- I/O\n\nstruct wuffs_base__io_buffer__struct;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n struct wuffs_base__io_buffer__struct* buf;\n // The bounds values are typically NULL, when created by the Wuffs public\n // API. NULL means that the callee substitutes the implicit bounds derived\n // from buf.\n uint8_t* bounds[2];\n } private_impl;\n} wuffs_base__io_reader;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n struct wuffs_base__io_buffer__struct* buf;\n // The bounds values are typically NULL, when created by the Wuffs public\n // API. NULL means that the callee substitutes the implicit bounds derived\n // from buf.\n uint8_t* bounds[2];\n } private_impl;\n} wuffs_base__io_writer;\n\n// wuffs_base__io_buffer is a 1-dimensional buffer (a pointer and leng" +
|
||||
"th), plus\n// additional indexes into that buffer, plus an opened / closed flag.\n//\n// A value with all fields NULL or zero is a valid, empty buffer.\ntypedef struct wuffs_base__io_buffer__struct {\n uint8_t* ptr; // Pointer.\n size_t len; // Length.\n size_t wi; // Write index. Invariant: wi <= len.\n size_t ri; // Read index. Invariant: ri <= wi.\n bool closed; // No further writes are expected.\n\n#ifdef __cplusplus\n inline void compact();\n inline wuffs_base__io_reader reader();\n inline wuffs_base__io_writer writer();\n#endif // __cplusplus\n\n} wuffs_base__io_buffer;\n\n// wuffs_base__io_buffer__compact moves any written but unread bytes to the\n// start of the buffer.\nstatic inline void //\nwuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) {\n if (!buf || (buf->ri == 0)) {\n return;\n }\n size_t n = buf->wi - buf->ri;\n if (n != 0) {\n memmove(buf->ptr, buf->ptr + buf->ri, n);\n }\n buf->wi = n;\n buf->ri = 0;\n}\n\nstatic inline wuffs_base__io_reader //\nwuffs_base__io_buffer__reader(" +
|
||||
"wuffs_base__io_buffer* buf) {\n wuffs_base__io_reader ret = ((wuffs_base__io_reader){});\n ret.private_impl.buf = buf;\n return ret;\n}\n\nstatic inline wuffs_base__io_writer //\nwuffs_base__io_buffer__writer(wuffs_base__io_buffer* buf) {\n wuffs_base__io_writer ret = ((wuffs_base__io_writer){});\n ret.private_impl.buf = buf;\n return ret;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__io_buffer__struct::compact() {\n wuffs_base__io_buffer__compact(this);\n}\n\ninline wuffs_base__io_reader //\nwuffs_base__io_buffer__struct::reader() {\n return wuffs_base__io_buffer__reader(this);\n}\n\ninline wuffs_base__io_writer //\nwuffs_base__io_buffer__struct::writer() {\n return wuffs_base__io_buffer__writer(this);\n}\n\n#endif // __cplusplus\n\n#ifdef __cplusplus\n} // extern \"C\"\n#endif\n" +
|
||||
"// ---------------- I/O\n\nstruct wuffs_base__io_buffer__struct;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n struct wuffs_base__io_buffer__struct* buf;\n // The bounds values are typically NULL, when created by the Wuffs public\n // API. NULL means that the callee substitutes the implicit bounds derived\n // from buf.\n uint8_t* mark;\n uint8_t* limit;\n } private_impl;\n} wuffs_base__io_reader;\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n struct wuffs_base__io_buffer__struct* buf;\n // The bounds values are typically NULL, when created by the Wuffs public\n // API. NULL means that the callee substitutes the implicit bounds derived\n // from buf.\n uint8_t* mark;\n uint8_t* limit;\n } private_impl;\n} wuffs_base__io_writer;\n\n// wuffs_base__io_buffer is a 1-dimensio" +
|
||||
"nal buffer (a pointer and length), plus\n// additional indexes into that buffer, plus an opened / closed flag.\n//\n// A value with all fields NULL or zero is a valid, empty buffer.\ntypedef struct wuffs_base__io_buffer__struct {\n uint8_t* ptr; // Pointer.\n size_t len; // Length.\n size_t wi; // Write index. Invariant: wi <= len.\n size_t ri; // Read index. Invariant: ri <= wi.\n bool closed; // No further writes are expected.\n\n#ifdef __cplusplus\n inline void compact();\n inline wuffs_base__io_reader reader();\n inline wuffs_base__io_writer writer();\n#endif // __cplusplus\n\n} wuffs_base__io_buffer;\n\n// wuffs_base__io_buffer__compact moves any written but unread bytes to the\n// start of the buffer.\nstatic inline void //\nwuffs_base__io_buffer__compact(wuffs_base__io_buffer* buf) {\n if (!buf || (buf->ri == 0)) {\n return;\n }\n size_t n = buf->wi - buf->ri;\n if (n != 0) {\n memmove(buf->ptr, buf->ptr + buf->ri, n);\n }\n buf->wi = n;\n buf->ri = 0;\n}\n\nstatic inline wuffs_base__io_reader //\n" +
|
||||
"wuffs_base__io_buffer__reader(wuffs_base__io_buffer* buf) {\n wuffs_base__io_reader ret = ((wuffs_base__io_reader){});\n ret.private_impl.buf = buf;\n return ret;\n}\n\nstatic inline wuffs_base__io_writer //\nwuffs_base__io_buffer__writer(wuffs_base__io_buffer* buf) {\n wuffs_base__io_writer ret = ((wuffs_base__io_writer){});\n ret.private_impl.buf = buf;\n return ret;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__io_buffer__struct::compact() {\n wuffs_base__io_buffer__compact(this);\n}\n\ninline wuffs_base__io_reader //\nwuffs_base__io_buffer__struct::reader() {\n return wuffs_base__io_buffer__reader(this);\n}\n\ninline wuffs_base__io_writer //\nwuffs_base__io_buffer__struct::writer() {\n return wuffs_base__io_buffer__writer(this);\n}\n\n#endif // __cplusplus\n\n#ifdef __cplusplus\n} // extern \"C\"\n#endif\n" +
|
||||
""
|
||||
|
||||
const baseBasePrivateH = "" +
|
||||
@@ -97,14 +97,14 @@ const baseBasePrivateH = "" +
|
||||
"\n}\n\nstatic inline wuffs_base__range_ie_u64 //\nwuffs_base__utility__make_range_ie_u64(wuffs_base__utility* ignored,\n uint64_t min_incl,\n uint64_t max_excl) {\n return ((wuffs_base__range_ie_u64){\n .min_incl = min_incl,\n .max_excl = max_excl,\n });\n}\n\nstatic inline wuffs_base__rect_ii_u32 //\nwuffs_base__utility__make_rect_ii_u32(wuffs_base__utility* ignored,\n uint32_t min_incl_x,\n uint32_t min_incl_y,\n uint32_t max_incl_x,\n uint32_t max_incl_y) {\n return ((wuffs_base__rect_ii_u32){\n .min_incl_x = min_incl_x,\n .min_incl_y = min_incl_y,\n .max_incl_x = max_incl_x,\n .max_incl_y = max_incl_y,\n });\n}\n\nstatic inline wuffs_base__rect_ie_u32 //\nwuffs_base__utility__make_rect_ie_u32(wuffs_base__utility* ignored,\n uint32_t min_incl" +
|
||||
"_x,\n uint32_t min_incl_y,\n uint32_t max_excl_x,\n uint32_t max_excl_y) {\n return ((wuffs_base__rect_ie_u32){\n .min_incl_x = min_incl_x,\n .min_incl_y = min_incl_y,\n .max_excl_x = max_excl_x,\n .max_excl_y = max_excl_y,\n });\n}\n\n" +
|
||||
"" +
|
||||
"// ---------------- I/O\n\nstatic inline bool //\nwuffs_base__io_buffer__is_valid(wuffs_base__io_buffer buf) {\n return (buf.ptr || (buf.len == 0)) && (buf.len >= buf.wi) &&\n (buf.wi >= buf.ri);\n}\n\n// TODO: wuffs_base__io_reader__is_eof is no longer used by Wuffs per se, but\n// it might be handy to programs that use Wuffs. Either delete it, or promote\n// it to the public API.\n\nstatic inline bool //\nwuffs_base__io_reader__is_eof(wuffs_base__io_reader o) {\n wuffs_base__io_buffer* buf = o.private_impl.buf;\n return buf && buf->closed && (buf->ptr + buf->wi == o.private_impl.bounds[1]);\n}\n\nstatic inline bool //\nwuffs_base__io_reader__is_valid(wuffs_base__io_reader o) {\n wuffs_base__io_buffer* buf = o.private_impl.buf;\n // Note: if making this function public (i.e. moving it to base-header.h), it\n // also needs to allow NULL (i.e. implicit, callee-calculated) bounds.\n return buf ? ((buf->ptr <= o.private_impl.bounds[0]) &&\n (o.private_impl.bounds[0] <= o.private_impl.bounds[1]) &&\n " +
|
||||
" (o.private_impl.bounds[1] <= buf->ptr + buf->len))\n : ((o.private_impl.bounds[0] == NULL) &&\n (o.private_impl.bounds[1] == NULL));\n}\n\nstatic inline bool //\nwuffs_base__io_writer__is_valid(wuffs_base__io_writer o) {\n wuffs_base__io_buffer* buf = o.private_impl.buf;\n // Note: if making this function public (i.e. moving it to base-header.h), it\n // also needs to allow NULL (i.e. implicit, callee-calculated) bounds.\n return buf ? ((buf->ptr <= o.private_impl.bounds[0]) &&\n (o.private_impl.bounds[0] <= o.private_impl.bounds[1]) &&\n (o.private_impl.bounds[1] <= buf->ptr + buf->len))\n : ((o.private_impl.bounds[0] == NULL) &&\n (o.private_impl.bounds[1] == NULL));\n}\n\nstatic inline uint32_t //\nwuffs_base__io_writer__copy_n_from_history(uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t " +
|
||||
"length,\n uint32_t distance) {\n if (!distance) {\n return 0;\n }\n uint8_t* ptr = *ptr_ptr;\n if ((size_t)(ptr - start) < (size_t)(distance)) {\n return 0;\n }\n start = ptr - distance;\n size_t n = end - ptr;\n if ((size_t)(length) > n) {\n length = n;\n } else {\n n = length;\n }\n // TODO: unrolling by 3 seems best for the std/deflate benchmarks, but that\n // is mostly because 3 is the minimum length for the deflate format. This\n // function implementation shouldn't overfit to that one format. Perhaps the\n // copy_n_from_history Wuffs method should also take an unroll hint argument,\n // and the cgen can look if that argument is the constant expression '3'.\n //\n // See also wuffs_base__io_writer__copy_n_from_history_fast below.\n //\n // Alternatively, or additionally, have a sloppy_copy_n_from_history method\n // that copies 8 bytes at a time, possibly writing more than length bytes?\n for (; n >= 3; n -= 3) {\n *ptr++ = *start++;\n *ptr++ = *star" +
|
||||
"t++;\n *ptr++ = *start++;\n }\n for (; n; n--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\n// wuffs_base__io_writer__copy_n_from_history_fast is like the\n// wuffs_base__io_writer__copy_n_from_history function above, but has stronger\n// pre-conditions. The caller needs to prove that:\n// - distance > 0\n// - distance <= (*ptr_ptr - start)\n// - length <= (end - *ptr_ptr)\nstatic inline uint32_t //\nwuffs_base__io_writer__copy_n_from_history_fast(uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t length,\n uint32_t distance) {\n uint8_t* ptr = *ptr_ptr;\n start = ptr - distance;\n uint32_t n = length;\n for (; n >= 3; n -= 3) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n }\n for (; n; n--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\nstat" +
|
||||
"ic inline uint32_t //\nwuffs_base__io_writer__copy_n_from_reader(uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n uint32_t length,\n uint8_t** ptr_ioptr_r,\n uint8_t* iobounds1_r) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = length;\n if (n > ((size_t)(iobounds1_w - ioptr_w))) {\n n = iobounds1_w - ioptr_w;\n }\n uint8_t* ioptr_r = *ptr_ioptr_r;\n if (n > ((size_t)(iobounds1_r - ioptr_r))) {\n n = iobounds1_r - ioptr_r;\n }\n if (n > 0) {\n memmove(ioptr_w, ioptr_r, n);\n *ptr_ioptr_w += n;\n *ptr_ioptr_r += n;\n }\n return n;\n}\n\nstatic inline uint64_t //\nwuffs_base__io_writer__copy_from_slice(uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n wuffs_base__slice_u8 src) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > ((size_t)(iobounds1_w - ioptr" +
|
||||
"_w))) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline uint32_t //\nwuffs_base__io_writer__copy_n_from_slice(uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n uint32_t length,\n wuffs_base__slice_u8 src) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > length) {\n n = length;\n }\n if (n > ((size_t)(iobounds1_w - ioptr_w))) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__io_reader__set_limit(wuffs_base__io_reader* o,\n uint8_t* ioptr_r,\n uint64_t limit) {\n if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {\n o->private_impl.bounds[1] = ioptr_r + limit;\n }\n return (" +
|
||||
"(wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__io_reader__set_mark(wuffs_base__io_reader* o, uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__io_writer__set(wuffs_base__io_writer* o,\n wuffs_base__io_buffer* b,\n uint8_t** ioptr1_ptr,\n uint8_t** ioptr2_ptr,\n wuffs_base__slice_u8 s) {\n b->ptr = s.ptr;\n b->len = s.len;\n b->wi = 0;\n b->ri = 0;\n b->closed = false;\n o->private_impl.buf = b;\n o->private_impl.bounds[0] = s.ptr;\n o->private_impl.bounds[1] = s.ptr + s.len;\n *ioptr1_ptr = s.ptr;\n *ioptr2_ptr = s.ptr + s.len;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__io_writer__set_mark(wuffs_base__io_writer* o, uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\n#ifd" +
|
||||
"ef __cplusplus\n} // extern \"C\"\n#endif\n\n#endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n" +
|
||||
"// ---------------- I/O\n\nstatic inline bool //\nwuffs_base__io_buffer__is_valid(wuffs_base__io_buffer buf) {\n return (buf.ptr || (buf.len == 0)) && (buf.len >= buf.wi) &&\n (buf.wi >= buf.ri);\n}\n\n// TODO: wuffs_base__io_reader__is_eof is no longer used by Wuffs per se, but\n// it might be handy to programs that use Wuffs. Either delete it, or promote\n// it to the public API.\n//\n// If making this function public (i.e. moving it to base-header.h), it also\n// needs to allow NULL (i.e. implicit, callee-calculated) mark/limit.\n\nstatic inline bool //\nwuffs_base__io_reader__is_eof(wuffs_base__io_reader o) {\n wuffs_base__io_buffer* buf = o.private_impl.buf;\n return buf && buf->closed && (buf->ptr + buf->wi == o.private_impl.limit);\n}\n\nstatic inline bool //\nwuffs_base__io_reader__is_valid(wuffs_base__io_reader o) {\n wuffs_base__io_buffer* buf = o.private_impl.buf;\n // Note: if making this function public (i.e. moving it to base-header.h), it\n // also needs to allow NULL (i.e. implicit, callee-calculated)" +
|
||||
" mark/limit.\n return buf ? ((buf->ptr <= o.private_impl.mark) &&\n (o.private_impl.mark <= o.private_impl.limit) &&\n (o.private_impl.limit <= buf->ptr + buf->len))\n : ((o.private_impl.mark == NULL) &&\n (o.private_impl.limit == NULL));\n}\n\nstatic inline bool //\nwuffs_base__io_writer__is_valid(wuffs_base__io_writer o) {\n wuffs_base__io_buffer* buf = o.private_impl.buf;\n // Note: if making this function public (i.e. moving it to base-header.h), it\n // also needs to allow NULL (i.e. implicit, callee-calculated) mark/limit.\n return buf ? ((buf->ptr <= o.private_impl.mark) &&\n (o.private_impl.mark <= o.private_impl.limit) &&\n (o.private_impl.limit <= buf->ptr + buf->len))\n : ((o.private_impl.mark == NULL) &&\n (o.private_impl.limit == NULL));\n}\n\nstatic inline uint32_t //\nwuffs_base__io_writer__copy_n_from_history(uint8_t** ptr_ptr,\n uint8_t* start,\n " +
|
||||
" uint8_t* end,\n uint32_t length,\n uint32_t distance) {\n if (!distance) {\n return 0;\n }\n uint8_t* ptr = *ptr_ptr;\n if ((size_t)(ptr - start) < (size_t)(distance)) {\n return 0;\n }\n start = ptr - distance;\n size_t n = end - ptr;\n if ((size_t)(length) > n) {\n length = n;\n } else {\n n = length;\n }\n // TODO: unrolling by 3 seems best for the std/deflate benchmarks, but that\n // is mostly because 3 is the minimum length for the deflate format. This\n // function implementation shouldn't overfit to that one format. Perhaps the\n // copy_n_from_history Wuffs method should also take an unroll hint argument,\n // and the cgen can look if that argument is the constant expression '3'.\n //\n // See also wuffs_base__io_writer__copy_n_from_history_fast below.\n //\n // Alternatively, or additionally, have a sloppy_copy_n_from_history method\n // that copies 8 bytes at a time, possibly " +
|
||||
"writing more than length bytes?\n for (; n >= 3; n -= 3) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n }\n for (; n; n--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\n// wuffs_base__io_writer__copy_n_from_history_fast is like the\n// wuffs_base__io_writer__copy_n_from_history function above, but has stronger\n// pre-conditions. The caller needs to prove that:\n// - distance > 0\n// - distance <= (*ptr_ptr - start)\n// - length <= (end - *ptr_ptr)\nstatic inline uint32_t //\nwuffs_base__io_writer__copy_n_from_history_fast(uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t length,\n uint32_t distance) {\n uint8_t* ptr = *ptr_ptr;\n start = ptr - distance;\n uint32_t n = length;\n for (; n >= 3; n -= 3) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *s" +
|
||||
"tart++;\n }\n for (; n; n--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\nstatic inline uint32_t //\nwuffs_base__io_writer__copy_n_from_reader(uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n uint32_t length,\n uint8_t** ptr_ioptr_r,\n uint8_t* iobounds1_r) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = length;\n if (n > ((size_t)(iobounds1_w - ioptr_w))) {\n n = iobounds1_w - ioptr_w;\n }\n uint8_t* ioptr_r = *ptr_ioptr_r;\n if (n > ((size_t)(iobounds1_r - ioptr_r))) {\n n = iobounds1_r - ioptr_r;\n }\n if (n > 0) {\n memmove(ioptr_w, ioptr_r, n);\n *ptr_ioptr_w += n;\n *ptr_ioptr_r += n;\n }\n return n;\n}\n\nstatic inline uint64_t //\nwuffs_base__io_writer__copy_from_slice(uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n wuffs_base__slice_u8 src" +
|
||||
") {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > ((size_t)(iobounds1_w - ioptr_w))) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline uint32_t //\nwuffs_base__io_writer__copy_n_from_slice(uint8_t** ptr_ioptr_w,\n uint8_t* iobounds1_w,\n uint32_t length,\n wuffs_base__slice_u8 src) {\n uint8_t* ioptr_w = *ptr_ioptr_w;\n size_t n = src.len;\n if (n > length) {\n n = length;\n }\n if (n > ((size_t)(iobounds1_w - ioptr_w))) {\n n = iobounds1_w - ioptr_w;\n }\n if (n > 0) {\n memmove(ioptr_w, src.ptr, n);\n *ptr_ioptr_w += n;\n }\n return n;\n}\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__io_reader__set_limit(wuffs_base__io_reader* o,\n uint8_t* ioptr_r,\n uint64_t limit) {\n if (o && (((size_t)(o->private_im" +
|
||||
"pl.limit - ioptr_r)) > limit)) {\n o->private_impl.limit = ioptr_r + limit;\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__io_reader__set_mark(wuffs_base__io_reader* o, uint8_t* mark) {\n o->private_impl.mark = mark;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__io_writer__set(wuffs_base__io_writer* o,\n wuffs_base__io_buffer* b,\n uint8_t** ioptr1_ptr,\n uint8_t** ioptr2_ptr,\n wuffs_base__slice_u8 s) {\n b->ptr = s.ptr;\n b->len = s.len;\n b->wi = 0;\n b->ri = 0;\n b->closed = false;\n o->private_impl.buf = b;\n o->private_impl.mark = s.ptr;\n o->private_impl.limit = s.ptr + s.len;\n *ioptr1_ptr = s.ptr;\n *ioptr2_ptr = s.ptr + s.len;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__io_writer__set_mark(wuffs_base__io_writer* o, uint8_t* mark) {\n o->p" +
|
||||
"rivate_impl.mark = mark;\n return ((wuffs_base__empty_struct){});\n}\n\n#ifdef __cplusplus\n} // extern \"C\"\n#endif\n\n#endif // WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n" +
|
||||
""
|
||||
|
||||
const baseBaseImplC = "" +
|
||||
|
||||
@@ -121,20 +121,20 @@ func (g *gen) writeLoadDerivedVar(b *buffer, hack string, prefix string, name t.
|
||||
iopPrefix, preName, preName, preName, i0)
|
||||
|
||||
if header {
|
||||
b.printf("if (!%s.private_impl.bounds[0]) {", preName)
|
||||
b.printf("%s.private_impl.bounds[0] = %s%s;", preName, iopPrefix, preName)
|
||||
b.printf("%s.private_impl.bounds[1] = %s.private_impl.buf->ptr + %s.private_impl.buf->%s;",
|
||||
b.printf("if (!%s.private_impl.mark) {", preName)
|
||||
b.printf("%s.private_impl.mark = %s%s;", preName, iopPrefix, preName)
|
||||
b.printf("%s.private_impl.limit = %s.private_impl.buf->ptr + %s.private_impl.buf->%s;",
|
||||
preName, preName, preName, i1)
|
||||
b.printf("}\n")
|
||||
|
||||
if typ.QID()[1] == t.IDIOWriter {
|
||||
b.printf("if (%s.private_impl.buf->closed) {", preName)
|
||||
b.printf("%s.private_impl.bounds[1] = %s%s;", preName, iopPrefix, preName)
|
||||
b.printf("%s.private_impl.limit = %s%s;", preName, iopPrefix, preName)
|
||||
b.printf("}\n")
|
||||
}
|
||||
|
||||
b.printf("%s%s = %s.private_impl.bounds[0];", io0Prefix, preName, preName)
|
||||
b.printf("%s%s = %s.private_impl.bounds[1];", io1Prefix, preName, preName)
|
||||
b.printf("%s%s = %s.private_impl.mark;", io0Prefix, preName, preName)
|
||||
b.printf("%s%s = %s.private_impl.limit;", io1Prefix, preName, preName)
|
||||
}
|
||||
|
||||
b.printf("}\n")
|
||||
|
||||
@@ -1006,7 +1006,8 @@ typedef struct {
|
||||
// The bounds values are typically NULL, when created by the Wuffs public
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
uint8_t* mark;
|
||||
uint8_t* limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -1018,7 +1019,8 @@ typedef struct {
|
||||
// The bounds values are typically NULL, when created by the Wuffs public
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
uint8_t* mark;
|
||||
uint8_t* limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
@@ -3453,35 +3455,38 @@ wuffs_base__io_buffer__is_valid(wuffs_base__io_buffer buf) {
|
||||
// TODO: wuffs_base__io_reader__is_eof is no longer used by Wuffs per se, but
|
||||
// it might be handy to programs that use Wuffs. Either delete it, or promote
|
||||
// it to the public API.
|
||||
//
|
||||
// If making this function public (i.e. moving it to base-header.h), it also
|
||||
// needs to allow NULL (i.e. implicit, callee-calculated) mark/limit.
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__io_reader__is_eof(wuffs_base__io_reader o) {
|
||||
wuffs_base__io_buffer* buf = o.private_impl.buf;
|
||||
return buf && buf->closed && (buf->ptr + buf->wi == o.private_impl.bounds[1]);
|
||||
return buf && buf->closed && (buf->ptr + buf->wi == o.private_impl.limit);
|
||||
}
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__io_reader__is_valid(wuffs_base__io_reader o) {
|
||||
wuffs_base__io_buffer* buf = o.private_impl.buf;
|
||||
// Note: if making this function public (i.e. moving it to base-header.h), it
|
||||
// also needs to allow NULL (i.e. implicit, callee-calculated) bounds.
|
||||
return buf ? ((buf->ptr <= o.private_impl.bounds[0]) &&
|
||||
(o.private_impl.bounds[0] <= o.private_impl.bounds[1]) &&
|
||||
(o.private_impl.bounds[1] <= buf->ptr + buf->len))
|
||||
: ((o.private_impl.bounds[0] == NULL) &&
|
||||
(o.private_impl.bounds[1] == NULL));
|
||||
// also needs to allow NULL (i.e. implicit, callee-calculated) mark/limit.
|
||||
return buf ? ((buf->ptr <= o.private_impl.mark) &&
|
||||
(o.private_impl.mark <= o.private_impl.limit) &&
|
||||
(o.private_impl.limit <= buf->ptr + buf->len))
|
||||
: ((o.private_impl.mark == NULL) &&
|
||||
(o.private_impl.limit == NULL));
|
||||
}
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__io_writer__is_valid(wuffs_base__io_writer o) {
|
||||
wuffs_base__io_buffer* buf = o.private_impl.buf;
|
||||
// Note: if making this function public (i.e. moving it to base-header.h), it
|
||||
// also needs to allow NULL (i.e. implicit, callee-calculated) bounds.
|
||||
return buf ? ((buf->ptr <= o.private_impl.bounds[0]) &&
|
||||
(o.private_impl.bounds[0] <= o.private_impl.bounds[1]) &&
|
||||
(o.private_impl.bounds[1] <= buf->ptr + buf->len))
|
||||
: ((o.private_impl.bounds[0] == NULL) &&
|
||||
(o.private_impl.bounds[1] == NULL));
|
||||
// also needs to allow NULL (i.e. implicit, callee-calculated) mark/limit.
|
||||
return buf ? ((buf->ptr <= o.private_impl.mark) &&
|
||||
(o.private_impl.mark <= o.private_impl.limit) &&
|
||||
(o.private_impl.limit <= buf->ptr + buf->len))
|
||||
: ((o.private_impl.mark == NULL) &&
|
||||
(o.private_impl.limit == NULL));
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
@@ -3616,15 +3621,15 @@ static inline wuffs_base__empty_struct //
|
||||
wuffs_base__io_reader__set_limit(wuffs_base__io_reader* o,
|
||||
uint8_t* ioptr_r,
|
||||
uint64_t limit) {
|
||||
if (o && (((size_t)(o->private_impl.bounds[1] - ioptr_r)) > limit)) {
|
||||
o->private_impl.bounds[1] = ioptr_r + limit;
|
||||
if (o && (((size_t)(o->private_impl.limit - ioptr_r)) > limit)) {
|
||||
o->private_impl.limit = ioptr_r + limit;
|
||||
}
|
||||
return ((wuffs_base__empty_struct){});
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct //
|
||||
wuffs_base__io_reader__set_mark(wuffs_base__io_reader* o, uint8_t* mark) {
|
||||
o->private_impl.bounds[0] = mark;
|
||||
o->private_impl.mark = mark;
|
||||
return ((wuffs_base__empty_struct){});
|
||||
}
|
||||
|
||||
@@ -3640,8 +3645,8 @@ wuffs_base__io_writer__set(wuffs_base__io_writer* o,
|
||||
b->ri = 0;
|
||||
b->closed = false;
|
||||
o->private_impl.buf = b;
|
||||
o->private_impl.bounds[0] = s.ptr;
|
||||
o->private_impl.bounds[1] = s.ptr + s.len;
|
||||
o->private_impl.mark = s.ptr;
|
||||
o->private_impl.limit = s.ptr + s.len;
|
||||
*ioptr1_ptr = s.ptr;
|
||||
*ioptr2_ptr = s.ptr + s.len;
|
||||
return ((wuffs_base__empty_struct){});
|
||||
@@ -3649,7 +3654,7 @@ wuffs_base__io_writer__set(wuffs_base__io_writer* o,
|
||||
|
||||
static inline wuffs_base__empty_struct //
|
||||
wuffs_base__io_writer__set_mark(wuffs_base__io_writer* o, uint8_t* mark) {
|
||||
o->private_impl.bounds[0] = mark;
|
||||
o->private_impl.mark = mark;
|
||||
return ((wuffs_base__empty_struct){});
|
||||
}
|
||||
|
||||
@@ -4524,16 +4529,16 @@ wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_dst);
|
||||
if (a_dst.private_impl.buf) {
|
||||
iop_a_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = iop_a_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
if (!a_dst.private_impl.mark) {
|
||||
a_dst.private_impl.mark = iop_a_dst;
|
||||
a_dst.private_impl.limit =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = iop_a_dst;
|
||||
a_dst.private_impl.limit = iop_a_dst;
|
||||
}
|
||||
io0_a_dst = a_dst.private_impl.bounds[0];
|
||||
io1_a_dst = a_dst.private_impl.bounds[1];
|
||||
io0_a_dst = a_dst.private_impl.mark;
|
||||
io1_a_dst = a_dst.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode[0].coro_susp_point;
|
||||
@@ -4571,8 +4576,8 @@ wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self,
|
||||
goto exit;
|
||||
}
|
||||
v_written = ((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.bounds[0]),
|
||||
.ptr = a_dst.private_impl.mark,
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.mark),
|
||||
});
|
||||
if (((uint64_t)(v_written.len)) >= 32768) {
|
||||
v_written = wuffs_base__slice_u8__suffix(v_written, 32768);
|
||||
@@ -4651,13 +4656,13 @@ wuffs_deflate__decoder__decode_blocks(wuffs_deflate__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -4799,16 +4804,16 @@ wuffs_deflate__decoder__decode_uncompressed(wuffs_deflate__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_dst);
|
||||
if (a_dst.private_impl.buf) {
|
||||
iop_a_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = iop_a_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
if (!a_dst.private_impl.mark) {
|
||||
a_dst.private_impl.mark = iop_a_dst;
|
||||
a_dst.private_impl.limit =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = iop_a_dst;
|
||||
a_dst.private_impl.limit = iop_a_dst;
|
||||
}
|
||||
io0_a_dst = a_dst.private_impl.bounds[0];
|
||||
io1_a_dst = a_dst.private_impl.bounds[1];
|
||||
io0_a_dst = a_dst.private_impl.mark;
|
||||
io1_a_dst = a_dst.private_impl.limit;
|
||||
}
|
||||
uint8_t* iop_a_src = NULL;
|
||||
uint8_t* io0_a_src = NULL;
|
||||
@@ -4817,13 +4822,13 @@ wuffs_deflate__decoder__decode_uncompressed(wuffs_deflate__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -5012,13 +5017,13 @@ wuffs_deflate__decoder__init_dynamic_huffman(wuffs_deflate__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -5551,16 +5556,16 @@ wuffs_deflate__decoder__decode_huffman_fast(wuffs_deflate__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_dst);
|
||||
if (a_dst.private_impl.buf) {
|
||||
iop_a_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = iop_a_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
if (!a_dst.private_impl.mark) {
|
||||
a_dst.private_impl.mark = iop_a_dst;
|
||||
a_dst.private_impl.limit =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = iop_a_dst;
|
||||
a_dst.private_impl.limit = iop_a_dst;
|
||||
}
|
||||
io0_a_dst = a_dst.private_impl.bounds[0];
|
||||
io1_a_dst = a_dst.private_impl.bounds[1];
|
||||
io0_a_dst = a_dst.private_impl.mark;
|
||||
io1_a_dst = a_dst.private_impl.limit;
|
||||
}
|
||||
uint8_t* iop_a_src = NULL;
|
||||
uint8_t* io0_a_src = NULL;
|
||||
@@ -5569,13 +5574,13 @@ wuffs_deflate__decoder__decode_huffman_fast(wuffs_deflate__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
if ((self->private_impl.f_n_bits >= 8) ||
|
||||
@@ -5755,19 +5760,18 @@ label_0_continue:;
|
||||
v_n_copied = 0;
|
||||
while (true) {
|
||||
if (((uint64_t)((v_dist_minus_1 + 1))) >
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len))) {
|
||||
((uint64_t)(((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.mark,
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.mark),
|
||||
})
|
||||
.len))) {
|
||||
v_hlen = 0;
|
||||
v_hdist = ((uint32_t)(
|
||||
(((uint64_t)((v_dist_minus_1 + 1))) -
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.bounds[0]),
|
||||
.ptr = a_dst.private_impl.mark,
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.mark),
|
||||
})
|
||||
.len)))));
|
||||
if (v_length > v_hdist) {
|
||||
@@ -5811,8 +5815,8 @@ label_0_continue:;
|
||||
if (((uint64_t)((v_dist_minus_1 + 1))) >
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.bounds[0]),
|
||||
.ptr = a_dst.private_impl.mark,
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.mark),
|
||||
})
|
||||
.len))) {
|
||||
status = wuffs_deflate__error__internal_error_inconsistent_distance;
|
||||
@@ -5820,7 +5824,7 @@ label_0_continue:;
|
||||
}
|
||||
}
|
||||
wuffs_base__io_writer__copy_n_from_history_fast(
|
||||
&iop_a_dst, a_dst.private_impl.bounds[0], io1_a_dst, v_length,
|
||||
&iop_a_dst, a_dst.private_impl.mark, io1_a_dst, v_length,
|
||||
(v_dist_minus_1 + 1));
|
||||
goto label_2_break;
|
||||
}
|
||||
@@ -5884,16 +5888,16 @@ wuffs_deflate__decoder__decode_huffman_slow(wuffs_deflate__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_dst);
|
||||
if (a_dst.private_impl.buf) {
|
||||
iop_a_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = iop_a_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
if (!a_dst.private_impl.mark) {
|
||||
a_dst.private_impl.mark = iop_a_dst;
|
||||
a_dst.private_impl.limit =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = iop_a_dst;
|
||||
a_dst.private_impl.limit = iop_a_dst;
|
||||
}
|
||||
io0_a_dst = a_dst.private_impl.bounds[0];
|
||||
io1_a_dst = a_dst.private_impl.bounds[1];
|
||||
io0_a_dst = a_dst.private_impl.mark;
|
||||
io1_a_dst = a_dst.private_impl.limit;
|
||||
}
|
||||
uint8_t* iop_a_src = NULL;
|
||||
uint8_t* io0_a_src = NULL;
|
||||
@@ -5902,13 +5906,13 @@ wuffs_deflate__decoder__decode_huffman_slow(wuffs_deflate__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -6147,19 +6151,19 @@ wuffs_deflate__decoder__decode_huffman_slow(wuffs_deflate__decoder* self,
|
||||
if (((uint64_t)((v_dist_minus_1 + 1))) >
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.bounds[0]),
|
||||
.ptr = a_dst.private_impl.mark,
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.mark),
|
||||
})
|
||||
.len))) {
|
||||
v_hlen = 0;
|
||||
v_hdist = ((uint32_t)(
|
||||
(((uint64_t)((v_dist_minus_1 + 1))) -
|
||||
((uint64_t)(((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_dst -
|
||||
a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len)))));
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.mark,
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.mark),
|
||||
})
|
||||
.len)))));
|
||||
if (v_length > v_hdist) {
|
||||
v_length -= v_hdist;
|
||||
v_hlen = v_hdist;
|
||||
@@ -6218,7 +6222,7 @@ wuffs_deflate__decoder__decode_huffman_slow(wuffs_deflate__decoder* self,
|
||||
}
|
||||
}
|
||||
v_n_copied = wuffs_base__io_writer__copy_n_from_history(
|
||||
&iop_a_dst, a_dst.private_impl.bounds[0], io1_a_dst, v_length,
|
||||
&iop_a_dst, a_dst.private_impl.mark, io1_a_dst, v_length,
|
||||
(v_dist_minus_1 + 1));
|
||||
if (v_length <= v_n_copied) {
|
||||
v_length = 0;
|
||||
@@ -6643,13 +6647,13 @@ wuffs_gif__decoder__skip_frame(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_skip_frame[0].coro_susp_point;
|
||||
@@ -6794,13 +6798,13 @@ wuffs_gif__decoder__decode_up_to_id_part1(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -6895,13 +6899,13 @@ wuffs_gif__decoder__decode_header(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -6974,13 +6978,13 @@ wuffs_gif__decoder__decode_lsd(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode_lsd[0].coro_susp_point;
|
||||
@@ -7166,13 +7170,13 @@ wuffs_gif__decoder__decode_extension(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -7270,13 +7274,13 @@ wuffs_gif__decoder__skip_blocks(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -7354,13 +7358,13 @@ wuffs_gif__decoder__decode_ae(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode_ae[0].coro_susp_point;
|
||||
@@ -7562,13 +7566,13 @@ wuffs_gif__decoder__decode_gc(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode_gc[0].coro_susp_point;
|
||||
@@ -7708,13 +7712,13 @@ wuffs_gif__decoder__decode_id_part0(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -7977,13 +7981,13 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -8099,12 +8103,12 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
|
||||
((uint64_t)(io1_v_w - iop_v_w)), 4096))));
|
||||
wuffs_base__u64__sat_sub_indirect(
|
||||
&v_block_size,
|
||||
((uint64_t)(((wuffs_base__slice_u8){
|
||||
.ptr = a_src.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_src -
|
||||
a_src.private_impl.bounds[0]),
|
||||
})
|
||||
.len)));
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_src.private_impl.mark,
|
||||
.len = (size_t)(iop_a_src - a_src.private_impl.mark),
|
||||
})
|
||||
.len)));
|
||||
v_w = o_0_v_w;
|
||||
iop_v_w = o_0_iop_v_w;
|
||||
io1_v_w = o_0_io1_v_w;
|
||||
@@ -8386,16 +8390,16 @@ wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_dst);
|
||||
if (a_dst.private_impl.buf) {
|
||||
iop_a_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = iop_a_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
if (!a_dst.private_impl.mark) {
|
||||
a_dst.private_impl.mark = iop_a_dst;
|
||||
a_dst.private_impl.limit =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = iop_a_dst;
|
||||
a_dst.private_impl.limit = iop_a_dst;
|
||||
}
|
||||
io0_a_dst = a_dst.private_impl.bounds[0];
|
||||
io1_a_dst = a_dst.private_impl.bounds[1];
|
||||
io0_a_dst = a_dst.private_impl.mark;
|
||||
io1_a_dst = a_dst.private_impl.limit;
|
||||
}
|
||||
uint8_t* iop_a_src = NULL;
|
||||
uint8_t* io0_a_src = NULL;
|
||||
@@ -8404,13 +8408,13 @@ wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode[0].coro_susp_point;
|
||||
@@ -8606,14 +8610,14 @@ wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
v_checksum_got = wuffs_crc32__ieee_hasher__update(
|
||||
&self->private_impl.f_checksum,
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.bounds[0]),
|
||||
.ptr = a_dst.private_impl.mark,
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.mark),
|
||||
}));
|
||||
v_decoded_length_got += ((uint32_t)(
|
||||
(((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.bounds[0]),
|
||||
.ptr = a_dst.private_impl.mark,
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.mark),
|
||||
})
|
||||
.len)) &
|
||||
4294967295)));
|
||||
@@ -8822,16 +8826,16 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_dst);
|
||||
if (a_dst.private_impl.buf) {
|
||||
iop_a_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = iop_a_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
if (!a_dst.private_impl.mark) {
|
||||
a_dst.private_impl.mark = iop_a_dst;
|
||||
a_dst.private_impl.limit =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = iop_a_dst;
|
||||
a_dst.private_impl.limit = iop_a_dst;
|
||||
}
|
||||
io0_a_dst = a_dst.private_impl.bounds[0];
|
||||
io1_a_dst = a_dst.private_impl.bounds[1];
|
||||
io0_a_dst = a_dst.private_impl.mark;
|
||||
io1_a_dst = a_dst.private_impl.limit;
|
||||
}
|
||||
uint8_t* iop_a_src = NULL;
|
||||
uint8_t* io0_a_src = NULL;
|
||||
@@ -8840,13 +8844,13 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode[0].coro_susp_point;
|
||||
@@ -9116,16 +9120,16 @@ wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_dst);
|
||||
if (a_dst.private_impl.buf) {
|
||||
iop_a_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = iop_a_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
if (!a_dst.private_impl.mark) {
|
||||
a_dst.private_impl.mark = iop_a_dst;
|
||||
a_dst.private_impl.limit =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = iop_a_dst;
|
||||
a_dst.private_impl.limit = iop_a_dst;
|
||||
}
|
||||
io0_a_dst = a_dst.private_impl.bounds[0];
|
||||
io1_a_dst = a_dst.private_impl.bounds[1];
|
||||
io0_a_dst = a_dst.private_impl.mark;
|
||||
io1_a_dst = a_dst.private_impl.limit;
|
||||
}
|
||||
uint8_t* iop_a_src = NULL;
|
||||
uint8_t* io0_a_src = NULL;
|
||||
@@ -9134,13 +9138,13 @@ wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(io1_a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
iop_a_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = iop_a_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
if (!a_src.private_impl.mark) {
|
||||
a_src.private_impl.mark = iop_a_src;
|
||||
a_src.private_impl.limit =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
io0_a_src = a_src.private_impl.bounds[0];
|
||||
io1_a_src = a_src.private_impl.bounds[1];
|
||||
io0_a_src = a_src.private_impl.mark;
|
||||
io1_a_src = a_src.private_impl.limit;
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode[0].coro_susp_point;
|
||||
@@ -9223,8 +9227,8 @@ wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
v_checksum_got = wuffs_adler32__hasher__update(
|
||||
&self->private_impl.f_checksum,
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.bounds[0]),
|
||||
.ptr = a_dst.private_impl.mark,
|
||||
.len = (size_t)(iop_a_dst - a_dst.private_impl.mark),
|
||||
}));
|
||||
}
|
||||
if (wuffs_base__status__is_ok(v_z)) {
|
||||
|
||||
+10
-10
@@ -307,12 +307,12 @@ void set_reader_limit(wuffs_base__io_reader* o, uint64_t limit) {
|
||||
if (o && o->private_impl.buf) {
|
||||
uint8_t* p = o->private_impl.buf->ptr + o->private_impl.buf->ri;
|
||||
uint8_t* q = o->private_impl.buf->ptr + o->private_impl.buf->wi;
|
||||
if (!o->private_impl.bounds[0]) {
|
||||
o->private_impl.bounds[0] = p;
|
||||
o->private_impl.bounds[1] = q;
|
||||
if (!o->private_impl.mark) {
|
||||
o->private_impl.mark = p;
|
||||
o->private_impl.limit = q;
|
||||
}
|
||||
if ((o->private_impl.bounds[1] - p) > limit) {
|
||||
o->private_impl.bounds[1] = p + limit;
|
||||
if ((o->private_impl.limit - p) > limit) {
|
||||
o->private_impl.limit = p + limit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,12 +321,12 @@ void set_writer_limit(wuffs_base__io_writer* o, uint64_t limit) {
|
||||
if (o && o->private_impl.buf) {
|
||||
uint8_t* p = o->private_impl.buf->ptr + o->private_impl.buf->wi;
|
||||
uint8_t* q = o->private_impl.buf->ptr + o->private_impl.buf->len;
|
||||
if (!o->private_impl.bounds[0]) {
|
||||
o->private_impl.bounds[0] = p;
|
||||
o->private_impl.bounds[1] = q;
|
||||
if (!o->private_impl.mark) {
|
||||
o->private_impl.mark = p;
|
||||
o->private_impl.limit = q;
|
||||
}
|
||||
if ((o->private_impl.bounds[1] - p) > limit) {
|
||||
o->private_impl.bounds[1] = p + limit;
|
||||
if ((o->private_impl.limit - p) > limit) {
|
||||
o->private_impl.limit = p + limit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user