mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 16:32:11 +01:00
Remove obsolete limit implementation
This commit is contained in:
1 parent
86157ba363
commit
b9b398dc9a
19 files changed
+9
-284
No files matched your search
@@ -552,17 +552,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -572,7 +561,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -585,7 +573,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
|
||||
@@ -392,16 +392,6 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
|
||||
return n;
|
||||
}
|
||||
|
||||
// TODO: delete.
|
||||
static inline wuffs_base__io_reader wuffs_base__io_reader__limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t* ptr_to_len) {
|
||||
wuffs_base__io_reader ret = *o;
|
||||
ret.private_impl.limit.ptr_to_len = ptr_to_len;
|
||||
ret.private_impl.limit.next = &o->private_impl.limit;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t limit) {
|
||||
|
||||
@@ -50,9 +50,8 @@ const baseHeader = "" +
|
||||
"_t x,\n uint32_t y) {\n return (r.min_inclusive_x <= x) && (x < r.max_exclusive_x) &&\n (r.min_inclusive_y <= y) && (y < r.max_exclusive_y);\n}\n\nstatic inline wuffs_base__rect_ie_u32 wuffs_base__rect_ie_u32__intersection(\n wuffs_base__rect_ie_u32 r,\n wuffs_base__rect_ie_u32 s) {\n r.min_inclusive_x =\n wuffs_base__u32__max(r.min_inclusive_x, s.min_inclusive_x);\n r.min_inclusive_y =\n wuffs_base__u32__max(r.min_inclusive_y, s.min_inclusive_y);\n r.max_exclusive_x =\n wuffs_base__u32__min(r.max_exclusive_x, s.max_exclusive_x);\n r.max_exclusive_y =\n wuffs_base__u32__min(r.max_exclusive_y, s.max_exclusive_y);\n return r;\n}\n\nstatic inline wuffs_base__rect_ie_u32 wuffs_base__rect_ie_u32__union(\n wuffs_base__rect_ie_u32 r,\n wuffs_base__rect_ie_u32 s) {\n if (wuffs_base__rect_ie_u32__is_empty(r)) {\n return s;\n }\n if (wuffs_base__rect_ie_u32__is_empty(s)) {\n return r;\n }\n r.min_inclusive_x =\n wuffs_base__u32__min(r.m" +
|
||||
"in_inclusive_x, s.min_inclusive_x);\n r.min_inclusive_y =\n wuffs_base__u32__min(r.min_inclusive_y, s.min_inclusive_y);\n r.max_exclusive_x =\n wuffs_base__u32__max(r.max_exclusive_x, s.max_exclusive_x);\n r.max_exclusive_y =\n wuffs_base__u32__max(r.max_exclusive_y, s.max_exclusive_y);\n return r;\n}\n\nstatic inline uint32_t wuffs_base__rect_ie_u32__width(\n wuffs_base__rect_ie_u32 r) {\n return wuffs_base__u32__sat_sub(r.max_exclusive_x, r.min_inclusive_x);\n}\n\nstatic inline uint32_t wuffs_base__rect_ie_u32__height(\n wuffs_base__rect_ie_u32 r) {\n return wuffs_base__u32__sat_sub(r.max_exclusive_y, r.min_inclusive_y);\n}\n\n" +
|
||||
"" +
|
||||
"// ---------------- I/O\n\n// wuffs_base__io_buffer is a 1-dimensional 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 {\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} wuffs_base__io_buffer;\n\n// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:\n// its first N bytes. That N can be greater than a buffer's current read or\n// write capacity. N decreases naturally over time as bytes are read from or\n// written to the stream.\n//\n// A value with all fields NULL or zero is a valid, unlimited view.\ntypedef struct wuffs_base__io_limit {\n uint64_t* ptr_to_len; // Pointer to N.\n struct wuffs_base__io_limit* next; // Linked list of limits.\n} wuffs_base__io_limit;\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 wuffs_base__io_buffer* 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 wuffs_base__io_limit 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 wuffs_base__io_buffer* 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 wuffs_base__io_limit limit;\n } private_impl;\n} wuffs_base__io_writer;\n\nstatic inline wuffs_base__io_reader wuffs_base__io_buffer__reader(\n wuffs_base__io_buffer* buf) {\n wuff" +
|
||||
"s_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 wuffs_base__io_buffer__writer(\n 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" +
|
||||
"// ---------------- I/O\n\n// wuffs_base__io_buffer is a 1-dimensional 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 {\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} wuffs_base__io_buffer;\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 wuffs_base__io_buffer* 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/A" +
|
||||
"BI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__io_buffer* 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\nstatic inline wuffs_base__io_reader wuffs_base__io_buffer__reader(\n 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 wuffs_base__io_buffer__writer(\n 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" +
|
||||
"" +
|
||||
"// ---------------- Images\n\n// wuffs_base__pixel_format encodes the format of the bytes that constitute an\n// image frame's pixel data. Its bits:\n// - bit 31 is reserved.\n// - bits 30 .. 28 encodes color (and channel order, in terms of memory).\n// - bits 27 .. 26 are reserved.\n// - bits 25 .. 24 encodes transparency.\n// - bit 23 indicates big-endian/MSB-first (as opposed to little/LSB).\n// - bit 22 indicates floating point (as opposed to integer).\n// - bits 21 .. 20 are the number of planes, minus 1. Zero means packed.\n// - bits 19 .. 16 encodes the number of bits (depth) in an index value.\n// Zero means direct, not palette-indexed.\n// - bits 15 .. 12 encodes the number of bits (depth) in the 3rd channel.\n// - bits 11 .. 8 encodes the number of bits (depth) in the 2nd channel.\n// - bits 7 .. 4 encodes the number of bits (depth) in the 1st channel.\n// - bits 3 .. 0 encodes the number of bits (depth) in the 0th channel.\n//\n// The bit fields of a wuffs_base" +
|
||||
"__pixel_format are not independent. For\n// example, the number of planes should not be greater than the number of\n// channels. Similarly, bits 15..4 are unused (and should be zero) if bits\n// 31..24 (color and transparency) together imply only 1 channel (gray, no\n// alpha) and floating point samples should mean a bit depth of 16, 32 or 64.\n//\n// Formats hold between 1 and 4 channels. For example: Y (1 channel: gray), YA\n// (2 channels: gray and alpha), BGR (3 channels: blue, green, red) or CMYK (4\n// channels: cyan, magenta, yellow, black).\n//\n// For direct formats with N > 1 channels, those channels can be laid out in\n// either 1 (packed) or N (planar) planes. For example, RGBA data is usually\n// packed, but YUV data is usually planar, due to chroma subsampling (for\n// details, see the wuffs_base__pixel_subsampling type). For indexed formats,\n// the palette (always 256 × 4 bytes) holds up to 4 packed bytes of color data\n// per index value, and there is only 1 plane (for the index). The distance\n// between s" +
|
||||
@@ -96,9 +95,9 @@ const baseImpl = "" +
|
||||
"fs_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 wuffs_base__io_writer__copy_from_history32(\n uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t distance,\n uint32_t length) {\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_from_history32 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_from_history32__bco below.\n //\n // Alternatively, or additionally, have a sloppy_copy_from_history32 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_from_history32__bco is a Bounds Check Optimized\n// version of the wuffs_base__io_writer__copy_from_history32 function above.\n// The caller needs to prove that:\n// - distance > 0\n// - distance <= (*ptr_pt" +
|
||||
"r - start)\n// - length <= (end - *ptr_ptr)\nstatic inline uint32_t wuffs_base__io_writer__copy_from_history32__bco(\n uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t distance,\n uint32_t length) {\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\nstatic inline uint32_t wuffs_base__io_writer__copy_from_reader32(\n uint8_t** ptr_wptr,\n uint8_t* wend,\n uint8_t** ptr_rptr,\n uint8_t* rend,\n uint32_t length) {\n uint8_t* wptr = *ptr_wptr;\n size_t n = length;\n if (n > wend - wptr) {\n n = wend - wptr;\n }\n uint8_t* rptr = *ptr_rptr;\n if (n > rend - rptr) {\n n = rend - rptr;\n }\n if (n > 0) {\n memmove(wptr, rptr, n);\n *ptr_wptr += n;\n *ptr_rptr += n;\n }\n return n;\n}\n\nstatic inline uint64_t wuffs_base__io_writer__copy_from_slice(\n uint8_t** p" +
|
||||
"tr_wptr,\n uint8_t* wend,\n wuffs_base__slice_u8 src) {\n uint8_t* wptr = *ptr_wptr;\n size_t n = src.len;\n if (n > wend - wptr) {\n n = wend - wptr;\n }\n if (n > 0) {\n memmove(wptr, src.ptr, n);\n *ptr_wptr += n;\n }\n return n;\n}\n\nstatic inline uint32_t wuffs_base__io_writer__copy_from_slice32(\n uint8_t** ptr_wptr,\n uint8_t* wend,\n wuffs_base__slice_u8 src,\n uint32_t length) {\n uint8_t* wptr = *ptr_wptr;\n size_t n = src.len;\n if (n > length) {\n n = length;\n }\n if (n > wend - wptr) {\n n = wend - wptr;\n }\n if (n > 0) {\n memmove(wptr, src.ptr, n);\n *ptr_wptr += n;\n }\n return n;\n}\n\n// TODO: delete.\nstatic inline wuffs_base__io_reader wuffs_base__io_reader__limit(\n wuffs_base__io_reader* o,\n uint64_t* ptr_to_len) {\n wuffs_base__io_reader ret = *o;\n ret.private_impl.limit.ptr_to_len = ptr_to_len;\n ret.private_impl.limit.next = &o->private_impl.limit;\n return ret;\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(\n wuffs_base__io_r" +
|
||||
"eader* o,\n uint64_t limit) {\n if (o && o->private_impl.buf) {\n uint8_t* p = o->private_impl.buf->ptr + o->private_impl.buf->ri;\n uint8_t* q = o->private_impl.buf->ptr + o->private_impl.buf->wi;\n if (!o->private_impl.bounds[0]) {\n o->private_impl.bounds[0] = p;\n o->private_impl.bounds[1] = q;\n }\n if ((o->private_impl.bounds[1] - p) > limit) {\n o->private_impl.bounds[1] = p + limit;\n }\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct\nwuffs_base__io_reader__set_limit_internal(wuffs_base__io_reader* o,\n uint64_t limit,\n size_t ri_override) {\n if (o && o->private_impl.buf) {\n uint8_t* p = o->private_impl.buf->ptr + ri_override;\n if ((o->private_impl.bounds[1] - p) > limit) {\n o->private_impl.bounds[1] = p + limit;\n }\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__mark(\n wuffs_base" +
|
||||
"__io_reader* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set_limit(\n wuffs_base__io_writer* o,\n uint64_t limit) {\n if (o && o->private_impl.buf) {\n uint8_t* p = o->private_impl.buf->ptr + o->private_impl.buf->wi;\n uint8_t* q = o->private_impl.buf->ptr + o->private_impl.buf->len;\n if (!o->private_impl.bounds[0]) {\n o->private_impl.bounds[0] = p;\n o->private_impl.bounds[1] = q;\n }\n if ((o->private_impl.bounds[1] - p) > limit) {\n o->private_impl.bounds[1] = p + limit;\n }\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__mark(\n wuffs_base__io_writer* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n" +
|
||||
"tr_wptr,\n uint8_t* wend,\n wuffs_base__slice_u8 src) {\n uint8_t* wptr = *ptr_wptr;\n size_t n = src.len;\n if (n > wend - wptr) {\n n = wend - wptr;\n }\n if (n > 0) {\n memmove(wptr, src.ptr, n);\n *ptr_wptr += n;\n }\n return n;\n}\n\nstatic inline uint32_t wuffs_base__io_writer__copy_from_slice32(\n uint8_t** ptr_wptr,\n uint8_t* wend,\n wuffs_base__slice_u8 src,\n uint32_t length) {\n uint8_t* wptr = *ptr_wptr;\n size_t n = src.len;\n if (n > length) {\n n = length;\n }\n if (n > wend - wptr) {\n n = wend - wptr;\n }\n if (n > 0) {\n memmove(wptr, src.ptr, n);\n *ptr_wptr += n;\n }\n return n;\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(\n wuffs_base__io_reader* o,\n uint64_t limit) {\n if (o && o->private_impl.buf) {\n uint8_t* p = o->private_impl.buf->ptr + o->private_impl.buf->ri;\n uint8_t* q = o->private_impl.buf->ptr + o->private_impl.buf->wi;\n if (!o->private_impl.bounds[0]) {\n o->private_impl.bounds[0] = p;\n o->private_im" +
|
||||
"pl.bounds[1] = q;\n }\n if ((o->private_impl.bounds[1] - p) > limit) {\n o->private_impl.bounds[1] = p + limit;\n }\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct\nwuffs_base__io_reader__set_limit_internal(wuffs_base__io_reader* o,\n uint64_t limit,\n size_t ri_override) {\n if (o && o->private_impl.buf) {\n uint8_t* p = o->private_impl.buf->ptr + ri_override;\n if ((o->private_impl.bounds[1] - p) > limit) {\n o->private_impl.bounds[1] = p + limit;\n }\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_reader__mark(\n wuffs_base__io_reader* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__set_limit(\n wuffs_base__io_writer* o,\n uint64_t limit) {\n if (o && o->private_impl.buf) {\n uint8_t* p = o->pr" +
|
||||
"ivate_impl.buf->ptr + o->private_impl.buf->wi;\n uint8_t* q = o->private_impl.buf->ptr + o->private_impl.buf->len;\n if (!o->private_impl.bounds[0]) {\n o->private_impl.bounds[0] = p;\n o->private_impl.bounds[1] = q;\n }\n if ((o->private_impl.bounds[1] - p) > limit) {\n o->private_impl.bounds[1] = p + limit;\n }\n }\n return ((wuffs_base__empty_struct){});\n}\n\nstatic inline wuffs_base__empty_struct wuffs_base__io_writer__mark(\n wuffs_base__io_writer* o,\n uint8_t* mark) {\n o->private_impl.bounds[0] = mark;\n return ((wuffs_base__empty_struct){});\n}\n" +
|
||||
""
|
||||
|
||||
type template_args_short_read struct {
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
@@ -1517,16 +1504,6 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
|
||||
return n;
|
||||
}
|
||||
|
||||
// TODO: delete.
|
||||
static inline wuffs_base__io_reader wuffs_base__io_reader__limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t* ptr_to_len) {
|
||||
wuffs_base__io_reader ret = *o;
|
||||
ret.private_impl.limit.ptr_to_len = ptr_to_len;
|
||||
ret.private_impl.limit.next = &o->private_impl.limit;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t limit) {
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
@@ -1516,16 +1503,6 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
|
||||
return n;
|
||||
}
|
||||
|
||||
// TODO: delete.
|
||||
static inline wuffs_base__io_reader wuffs_base__io_reader__limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t* ptr_to_len) {
|
||||
wuffs_base__io_reader ret = *o;
|
||||
ret.private_impl.limit.ptr_to_len = ptr_to_len;
|
||||
ret.private_impl.limit.next = &o->private_impl.limit;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t limit) {
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
@@ -1608,16 +1595,6 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
|
||||
return n;
|
||||
}
|
||||
|
||||
// TODO: delete.
|
||||
static inline wuffs_base__io_reader wuffs_base__io_reader__limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t* ptr_to_len) {
|
||||
wuffs_base__io_reader ret = *o;
|
||||
ret.private_impl.limit.ptr_to_len = ptr_to_len;
|
||||
ret.private_impl.limit.next = &o->private_impl.limit;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t limit) {
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
@@ -1624,16 +1611,6 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
|
||||
return n;
|
||||
}
|
||||
|
||||
// TODO: delete.
|
||||
static inline wuffs_base__io_reader wuffs_base__io_reader__limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t* ptr_to_len) {
|
||||
wuffs_base__io_reader ret = *o;
|
||||
ret.private_impl.limit.ptr_to_len = ptr_to_len;
|
||||
ret.private_impl.limit.next = &o->private_impl.limit;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t limit) {
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
@@ -1812,16 +1799,6 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
|
||||
return n;
|
||||
}
|
||||
|
||||
// TODO: delete.
|
||||
static inline wuffs_base__io_reader wuffs_base__io_reader__limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t* ptr_to_len) {
|
||||
wuffs_base__io_reader ret = *o;
|
||||
ret.private_impl.limit.ptr_to_len = ptr_to_len;
|
||||
ret.private_impl.limit.next = &o->private_impl.limit;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t limit) {
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
@@ -1812,16 +1799,6 @@ static inline uint32_t wuffs_base__io_writer__copy_from_slice32(
|
||||
return n;
|
||||
}
|
||||
|
||||
// TODO: delete.
|
||||
static inline wuffs_base__io_reader wuffs_base__io_reader__limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t* ptr_to_len) {
|
||||
wuffs_base__io_reader ret = *o;
|
||||
ret.private_impl.limit.ptr_to_len = ptr_to_len;
|
||||
ret.private_impl.limit.next = &o->private_impl.limit;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline wuffs_base__empty_struct wuffs_base__io_reader__set_limit(
|
||||
wuffs_base__io_reader* o,
|
||||
uint64_t limit) {
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
|
||||
@@ -555,17 +555,6 @@ typedef struct {
|
||||
bool closed; // No further writes are expected.
|
||||
} wuffs_base__io_buffer;
|
||||
|
||||
// wuffs_base__io_limit provides a limited view of a 1-dimensional byte stream:
|
||||
// its first N bytes. That N can be greater than a buffer's current read or
|
||||
// write capacity. N decreases naturally over time as bytes are read from or
|
||||
// written to the stream.
|
||||
//
|
||||
// A value with all fields NULL or zero is a valid, unlimited view.
|
||||
typedef struct wuffs_base__io_limit {
|
||||
uint64_t* ptr_to_len; // Pointer to N.
|
||||
struct wuffs_base__io_limit* next; // Linked list of limits.
|
||||
} wuffs_base__io_limit;
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -575,7 +564,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_reader;
|
||||
|
||||
@@ -588,7 +576,6 @@ typedef struct {
|
||||
// API. NULL means that the callee substitutes the implicit bounds derived
|
||||
// from buf.
|
||||
uint8_t* bounds[2];
|
||||
wuffs_base__io_limit limit;
|
||||
} private_impl;
|
||||
} wuffs_base__io_writer;
|
||||
|
||||
|
||||
@@ -113,20 +113,14 @@ const char* wuffs_deflate_decode(wuffs_base__io_buffer* dst,
|
||||
uint64_t rlimit) {
|
||||
wuffs_deflate__decoder dec;
|
||||
wuffs_deflate__decoder__initialize(&dec, WUFFS_VERSION, 0);
|
||||
uint64_t wlim = 0;
|
||||
uint64_t rlim = 0;
|
||||
while (true) {
|
||||
wuffs_base__io_writer dst_writer = wuffs_base__io_buffer__writer(dst);
|
||||
if (wlimit) {
|
||||
wuffs_base__io_writer__set_limit(&dst_writer, wlimit);
|
||||
wlim = wlimit;
|
||||
dst_writer.private_impl.limit.ptr_to_len = &wlim;
|
||||
}
|
||||
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(src);
|
||||
if (rlimit) {
|
||||
wuffs_base__io_reader__set_limit(&src_reader, rlimit);
|
||||
rlim = rlimit;
|
||||
src_reader.private_impl.limit.ptr_to_len = &rlim;
|
||||
}
|
||||
|
||||
wuffs_deflate__status s =
|
||||
@@ -280,7 +274,6 @@ bool do_test_wuffs_deflate_history(int i,
|
||||
dec->private_impl.f_history_index = starting_history_index;
|
||||
|
||||
wuffs_base__io_writer__set_limit(&dst_writer, limit);
|
||||
dst_writer.private_impl.limit.ptr_to_len = &limit;
|
||||
|
||||
wuffs_deflate__status got_s =
|
||||
wuffs_deflate__decoder__decode(dec, dst_writer, src_reader);
|
||||
|
||||
@@ -208,21 +208,15 @@ bool do_test_wuffs_lzw_decode(const char* src_filename,
|
||||
wuffs_gif__lzw_decoder__initialize(&dec, WUFFS_VERSION, 0);
|
||||
wuffs_gif__lzw_decoder__set_literal_width(&dec, literal_width);
|
||||
int num_iters = 0;
|
||||
uint64_t wlim = 0;
|
||||
uint64_t rlim = 0;
|
||||
while (true) {
|
||||
num_iters++;
|
||||
wuffs_base__io_writer got_writer = wuffs_base__io_buffer__writer(&got);
|
||||
if (wlimit) {
|
||||
wuffs_base__io_writer__set_limit(&got_writer, wlimit);
|
||||
wlim = wlimit;
|
||||
got_writer.private_impl.limit.ptr_to_len = &wlim;
|
||||
}
|
||||
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(&src);
|
||||
if (rlimit) {
|
||||
wuffs_base__io_reader__set_limit(&src_reader, rlimit);
|
||||
rlim = rlimit;
|
||||
src_reader.private_impl.limit.ptr_to_len = &rlim;
|
||||
}
|
||||
size_t old_wi = got.wi;
|
||||
size_t old_ri = src.ri;
|
||||
@@ -431,21 +425,15 @@ bool do_test_wuffs_gif_decode(const char* filename,
|
||||
}
|
||||
|
||||
int num_iters = 0;
|
||||
uint64_t wlim = 0;
|
||||
uint64_t rlim = 0;
|
||||
while (true) {
|
||||
num_iters++;
|
||||
wuffs_base__io_writer got_writer = wuffs_base__io_buffer__writer(&got);
|
||||
if (wlimit) {
|
||||
wuffs_base__io_writer__set_limit(&got_writer, wlimit);
|
||||
wlim = wlimit;
|
||||
got_writer.private_impl.limit.ptr_to_len = &wlim;
|
||||
}
|
||||
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(&src);
|
||||
if (rlimit) {
|
||||
wuffs_base__io_reader__set_limit(&src_reader, rlimit);
|
||||
rlim = rlimit;
|
||||
src_reader.private_impl.limit.ptr_to_len = &rlim;
|
||||
}
|
||||
size_t old_wi = got.wi;
|
||||
size_t old_ri = src.ri;
|
||||
|
||||
+2
-10
@@ -69,20 +69,14 @@ const char* wuffs_gzip_decode(wuffs_base__io_buffer* dst,
|
||||
wuffs_gzip__decoder dec;
|
||||
wuffs_gzip__decoder__initialize(&dec, WUFFS_VERSION, 0);
|
||||
|
||||
uint64_t wlim = 0;
|
||||
uint64_t rlim = 0;
|
||||
while (true) {
|
||||
wuffs_base__io_writer dst_writer = wuffs_base__io_buffer__writer(dst);
|
||||
if (wlimit) {
|
||||
wuffs_base__io_writer__set_limit(&dst_writer, wlimit);
|
||||
wlim = wlimit;
|
||||
dst_writer.private_impl.limit.ptr_to_len = &wlim;
|
||||
}
|
||||
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(src);
|
||||
if (rlimit) {
|
||||
wuffs_base__io_reader__set_limit(&src_reader, rlimit);
|
||||
rlim = rlimit;
|
||||
src_reader.private_impl.limit.ptr_to_len = &rlim;
|
||||
}
|
||||
|
||||
wuffs_gzip__status s =
|
||||
@@ -139,12 +133,10 @@ bool do_test_wuffs_gzip_checksum(bool ignore_checksum, uint32_t bad_checksum) {
|
||||
FAIL("end_limit=%d: not enough source data", end_limit);
|
||||
return false;
|
||||
}
|
||||
uint64_t rlim = src.wi - (uint64_t)(end_limit);
|
||||
wuffs_base__io_reader__set_limit(&src_reader, rlim);
|
||||
src_reader.private_impl.limit.ptr_to_len = &rlim;
|
||||
wuffs_base__io_reader__set_limit(&src_reader,
|
||||
src.wi - (uint64_t)(end_limit));
|
||||
want = WUFFS_GZIP__SUSPENSION_SHORT_READ;
|
||||
} else {
|
||||
src_reader.private_impl.limit.ptr_to_len = NULL;
|
||||
want = (bad_checksum && !ignore_checksum)
|
||||
? WUFFS_GZIP__ERROR_CHECKSUM_MISMATCH
|
||||
: WUFFS_GZIP__STATUS_OK;
|
||||
|
||||
+2
-10
@@ -84,20 +84,14 @@ const char* wuffs_zlib_decode(wuffs_base__io_buffer* dst,
|
||||
wuffs_zlib__decoder dec;
|
||||
wuffs_zlib__decoder__initialize(&dec, WUFFS_VERSION, 0);
|
||||
|
||||
uint64_t wlim = 0;
|
||||
uint64_t rlim = 0;
|
||||
while (true) {
|
||||
wuffs_base__io_writer dst_writer = wuffs_base__io_buffer__writer(dst);
|
||||
if (wlimit) {
|
||||
wuffs_base__io_writer__set_limit(&dst_writer, wlimit);
|
||||
wlim = wlimit;
|
||||
dst_writer.private_impl.limit.ptr_to_len = &wlim;
|
||||
}
|
||||
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(src);
|
||||
if (rlimit) {
|
||||
wuffs_base__io_reader__set_limit(&src_reader, rlimit);
|
||||
rlim = rlimit;
|
||||
src_reader.private_impl.limit.ptr_to_len = &rlim;
|
||||
}
|
||||
|
||||
wuffs_zlib__status s =
|
||||
@@ -153,12 +147,10 @@ bool do_test_wuffs_zlib_checksum(bool ignore_checksum, bool bad_checksum) {
|
||||
FAIL("end_limit=%d: not enough source data", end_limit);
|
||||
return false;
|
||||
}
|
||||
uint64_t rlim = src.wi - (uint64_t)(end_limit);
|
||||
wuffs_base__io_reader__set_limit(&src_reader, rlim);
|
||||
src_reader.private_impl.limit.ptr_to_len = &rlim;
|
||||
wuffs_base__io_reader__set_limit(&src_reader,
|
||||
src.wi - (uint64_t)(end_limit));
|
||||
want = WUFFS_ZLIB__SUSPENSION_SHORT_READ;
|
||||
} else {
|
||||
src_reader.private_impl.limit.ptr_to_len = NULL;
|
||||
want = (bad_checksum && !ignore_checksum)
|
||||
? WUFFS_ZLIB__ERROR_CHECKSUM_MISMATCH
|
||||
: WUFFS_ZLIB__STATUS_OK;
|
||||
|
||||
Reference in new issue
Block a user