Rename work_buffer_size to workbuf_len

This commit is contained in:
Nigel Tao committed 2018-09-08 09:06:56 +10:00
1 parent ca940b0c56
commit fbbdc412d1
8 files changed
+95 -104

No files matched your search

+15 -15
View File
@@ -445,7 +445,7 @@ typedef struct {
// Do not access the private_impl's fields directly. There is no API/ABI // Do not access the private_impl's fields directly. There is no API/ABI
// compatibility or safety guarantee if you do so. // compatibility or safety guarantee if you do so.
struct { struct {
wuffs_base__range_ii_u64 work_buffer_size; wuffs_base__range_ii_u64 workbuf_len;
uint64_t first_frame_io_position; uint64_t first_frame_io_position;
uint32_t num_loops; uint32_t num_loops;
bool first_frame_is_opaque; bool first_frame_is_opaque;
@@ -456,14 +456,14 @@ typedef struct {
wuffs_base__pixel_subsampling pixsub, wuffs_base__pixel_subsampling pixsub,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint64_t work_buffer_size0, uint64_t workbuf_len0,
uint64_t work_buffer_size1, uint64_t workbuf_len1,
uint32_t num_loops, uint32_t num_loops,
uint64_t first_frame_io_position, uint64_t first_frame_io_position,
bool first_frame_is_opaque); bool first_frame_is_opaque);
inline void invalidate(); inline void invalidate();
inline bool is_valid(); inline bool is_valid();
inline wuffs_base__range_ii_u64 work_buffer_size(); inline wuffs_base__range_ii_u64 workbuf_len();
inline uint32_t num_loops(); inline uint32_t num_loops();
inline uint64_t first_frame_io_position(); inline uint64_t first_frame_io_position();
inline bool first_frame_is_opaque(); inline bool first_frame_is_opaque();
@@ -478,8 +478,8 @@ wuffs_base__image_config__initialize(wuffs_base__image_config* c,
wuffs_base__pixel_subsampling pixsub, wuffs_base__pixel_subsampling pixsub,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint64_t work_buffer_size0, uint64_t workbuf_len0,
uint64_t work_buffer_size1, uint64_t workbuf_len1,
uint32_t num_loops, uint32_t num_loops,
uint64_t first_frame_io_position, uint64_t first_frame_io_position,
bool first_frame_is_opaque) { bool first_frame_is_opaque) {
@@ -491,8 +491,8 @@ wuffs_base__image_config__initialize(wuffs_base__image_config* c,
c->pixcfg.private_impl.pixsub = pixsub; c->pixcfg.private_impl.pixsub = pixsub;
c->pixcfg.private_impl.width = width; c->pixcfg.private_impl.width = width;
c->pixcfg.private_impl.height = height; c->pixcfg.private_impl.height = height;
c->private_impl.work_buffer_size.min_incl = work_buffer_size0; c->private_impl.workbuf_len.min_incl = workbuf_len0;
c->private_impl.work_buffer_size.max_incl = work_buffer_size1; c->private_impl.workbuf_len.max_incl = workbuf_len1;
c->private_impl.first_frame_io_position = first_frame_io_position; c->private_impl.first_frame_io_position = first_frame_io_position;
c->private_impl.num_loops = num_loops; c->private_impl.num_loops = num_loops;
c->private_impl.first_frame_is_opaque = first_frame_is_opaque; c->private_impl.first_frame_is_opaque = first_frame_is_opaque;
@@ -514,8 +514,8 @@ wuffs_base__image_config__is_valid(wuffs_base__image_config* c) {
} }
static inline wuffs_base__range_ii_u64 // static inline wuffs_base__range_ii_u64 //
wuffs_base__image_config__work_buffer_size(wuffs_base__image_config* c) { wuffs_base__image_config__workbuf_len(wuffs_base__image_config* c) {
return c ? c->private_impl.work_buffer_size : ((wuffs_base__range_ii_u64){}); return c ? c->private_impl.workbuf_len : ((wuffs_base__range_ii_u64){});
} }
static inline uint32_t // static inline uint32_t //
@@ -540,13 +540,13 @@ wuffs_base__image_config::initialize(wuffs_base__pixel_format pixfmt,
wuffs_base__pixel_subsampling pixsub, wuffs_base__pixel_subsampling pixsub,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint64_t work_buffer_size0, uint64_t workbuf_len0,
uint64_t work_buffer_size1, uint64_t workbuf_len1,
uint32_t num_loops, uint32_t num_loops,
uint64_t first_frame_io_position, uint64_t first_frame_io_position,
bool first_frame_is_opaque) { bool first_frame_is_opaque) {
wuffs_base__image_config__initialize( wuffs_base__image_config__initialize(
this, pixfmt, pixsub, width, height, work_buffer_size0, work_buffer_size1, this, pixfmt, pixsub, width, height, workbuf_len0, workbuf_len1,
num_loops, first_frame_io_position, first_frame_is_opaque); num_loops, first_frame_io_position, first_frame_is_opaque);
} }
@@ -561,8 +561,8 @@ wuffs_base__image_config::is_valid() {
} }
inline wuffs_base__range_ii_u64 // inline wuffs_base__range_ii_u64 //
wuffs_base__image_config::work_buffer_size() { wuffs_base__image_config::workbuf_len() {
return wuffs_base__image_config__work_buffer_size(this); return wuffs_base__image_config__workbuf_len(this);
} }
inline uint32_t // inline uint32_t //
+5 -5
View File
@@ -138,11 +138,11 @@ const baseImagePublicH = "" +
"t from the format's intrinsic one? For\n// example, decoding a JPEG image straight to RGBA instead of to YCbCr?\nstatic inline size_t //\nwuffs_base__pixel_config__pixbuf_len(wuffs_base__pixel_config* c) {\n if (c) {\n uint64_t wh =\n ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height);\n // TODO: handle things other than 1 byte per pixel.\n return (size_t)wh;\n }\n return 0;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__pixel_config::initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height) {\n wuffs_base__pixel_config__initialize(this, pixfmt, pixsub, width, height);\n}\n\ninline void //\nwuffs_base__pixel_config::invalidate() {\n wuffs_base__pixel_config__invalidate(this);\n}\n\ninline bool //\nwuffs_base__pixel_config::is_valid() {\n return wuffs_base__pixel_config__is_valid(this);\n}\n\ninline wuffs_base__pixel_for" + "t from the format's intrinsic one? For\n// example, decoding a JPEG image straight to RGBA instead of to YCbCr?\nstatic inline size_t //\nwuffs_base__pixel_config__pixbuf_len(wuffs_base__pixel_config* c) {\n if (c) {\n uint64_t wh =\n ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height);\n // TODO: handle things other than 1 byte per pixel.\n return (size_t)wh;\n }\n return 0;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__pixel_config::initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height) {\n wuffs_base__pixel_config__initialize(this, pixfmt, pixsub, width, height);\n}\n\ninline void //\nwuffs_base__pixel_config::invalidate() {\n wuffs_base__pixel_config__invalidate(this);\n}\n\ninline bool //\nwuffs_base__pixel_config::is_valid() {\n return wuffs_base__pixel_config__is_valid(this);\n}\n\ninline wuffs_base__pixel_for" +
"mat //\nwuffs_base__pixel_config::pixel_format() {\n return wuffs_base__pixel_config__pixel_format(this);\n}\n\ninline wuffs_base__pixel_subsampling //\nwuffs_base__pixel_config::pixel_subsampling() {\n return wuffs_base__pixel_config__pixel_subsampling(this);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__pixel_config::bounds() {\n return wuffs_base__pixel_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::width() {\n return wuffs_base__pixel_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::height() {\n return wuffs_base__pixel_config__height(this);\n}\n\ninline size_t //\nwuffs_base__pixel_config::pixbuf_len() {\n return wuffs_base__pixel_config__pixbuf_len(this);\n}\n\n#endif // __cplusplus\n\n" + "mat //\nwuffs_base__pixel_config::pixel_format() {\n return wuffs_base__pixel_config__pixel_format(this);\n}\n\ninline wuffs_base__pixel_subsampling //\nwuffs_base__pixel_config::pixel_subsampling() {\n return wuffs_base__pixel_config__pixel_subsampling(this);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__pixel_config::bounds() {\n return wuffs_base__pixel_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::width() {\n return wuffs_base__pixel_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::height() {\n return wuffs_base__pixel_config__height(this);\n}\n\ninline size_t //\nwuffs_base__pixel_config::pixbuf_len() {\n return wuffs_base__pixel_config__pixbuf_len(this);\n}\n\n#endif // __cplusplus\n\n" +
"" + "" +
"// --------\n\ntypedef struct {\n wuffs_base__pixel_config pixcfg;\n\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__range_ii_u64 work_buffer_size;\n uint64_t first_frame_io_position;\n uint32_t num_loops;\n bool first_frame_is_opaque;\n } private_impl;\n\n#ifdef __cplusplus\n inline void initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t work_buffer_size0,\n uint64_t work_buffer_size1,\n uint32_t num_loops,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque);\n inline void invalidate();\n inline bool is_valid();\n inline wuffs_base__range_ii_u64 work_buffer_size();\n inline uint32_t num_loops();\n inline uint64_t first_frame_io_" + "// --------\n\ntypedef struct {\n wuffs_base__pixel_config pixcfg;\n\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__range_ii_u64 workbuf_len;\n uint64_t first_frame_io_position;\n uint32_t num_loops;\n bool first_frame_is_opaque;\n } private_impl;\n\n#ifdef __cplusplus\n inline void initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t workbuf_len0,\n uint64_t workbuf_len1,\n uint32_t num_loops,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque);\n inline void invalidate();\n inline bool is_valid();\n inline wuffs_base__range_ii_u64 workbuf_len();\n inline uint32_t num_loops();\n inline uint64_t first_frame_io_position();\n inline" +
"position();\n inline bool first_frame_is_opaque();\n#endif // __cplusplus\n\n} wuffs_base__image_config;\n\n// TODO: Should this function return bool? An error type?\nstatic inline void //\nwuffs_base__image_config__initialize(wuffs_base__image_config* c,\n wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t work_buffer_size0,\n uint64_t work_buffer_size1,\n uint32_t num_loops,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque) {\n if (!c) {\n return;\n }\n if (wuffs_base__pixel_format__is_valid(pixfmt)) {\n c->pixcfg.private_impl.pixfmt = pixfmt;\n c->pixcfg.private_impl.pixsub = pixsub;\n c->pixcfg.private_impl.w" + " bool first_frame_is_opaque();\n#endif // __cplusplus\n\n} wuffs_base__image_config;\n\n// TODO: Should this function return bool? An error type?\nstatic inline void //\nwuffs_base__image_config__initialize(wuffs_base__image_config* c,\n wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t workbuf_len0,\n uint64_t workbuf_len1,\n uint32_t num_loops,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque) {\n if (!c) {\n return;\n }\n if (wuffs_base__pixel_format__is_valid(pixfmt)) {\n c->pixcfg.private_impl.pixfmt = pixfmt;\n c->pixcfg.private_impl.pixsub = pixsub;\n c->pixcfg.private_impl.width = width;\n c->pixcfg.pr" +
"idth = width;\n c->pixcfg.private_impl.height = height;\n c->private_impl.work_buffer_size.min_incl = work_buffer_size0;\n c->private_impl.work_buffer_size.max_incl = work_buffer_size1;\n c->private_impl.first_frame_io_position = first_frame_io_position;\n c->private_impl.num_loops = num_loops;\n c->private_impl.first_frame_is_opaque = first_frame_is_opaque;\n return;\n }\n *c = ((wuffs_base__image_config){});\n}\n\nstatic inline void //\nwuffs_base__image_config__invalidate(wuffs_base__image_config* c) {\n if (c) {\n *c = ((wuffs_base__image_config){});\n }\n}\n\nstatic inline bool //\nwuffs_base__image_config__is_valid(wuffs_base__image_config* c) {\n return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg));\n}\n\nstatic inline wuffs_base__range_ii_u64 //\nwuffs_base__image_config__work_buffer_size(wuffs_base__image_config* c) {\n return c ? c->private_impl.work_buffer_size : ((wuffs_base__range_ii_u64){});\n}\n\nstatic inline uint32_t //\nwuffs_base__image_config__num_loops(wuffs_base__image_config" + "ivate_impl.height = height;\n c->private_impl.workbuf_len.min_incl = workbuf_len0;\n c->private_impl.workbuf_len.max_incl = workbuf_len1;\n c->private_impl.first_frame_io_position = first_frame_io_position;\n c->private_impl.num_loops = num_loops;\n c->private_impl.first_frame_is_opaque = first_frame_is_opaque;\n return;\n }\n *c = ((wuffs_base__image_config){});\n}\n\nstatic inline void //\nwuffs_base__image_config__invalidate(wuffs_base__image_config* c) {\n if (c) {\n *c = ((wuffs_base__image_config){});\n }\n}\n\nstatic inline bool //\nwuffs_base__image_config__is_valid(wuffs_base__image_config* c) {\n return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg));\n}\n\nstatic inline wuffs_base__range_ii_u64 //\nwuffs_base__image_config__workbuf_len(wuffs_base__image_config* c) {\n return c ? c->private_impl.workbuf_len : ((wuffs_base__range_ii_u64){});\n}\n\nstatic inline uint32_t //\nwuffs_base__image_config__num_loops(wuffs_base__image_config* c) {\n return c ? c->private_impl.num_loops : 0;\n}\n\nstatic" +
"* c) {\n return c ? c->private_impl.num_loops : 0;\n}\n\nstatic inline uint64_t //\nwuffs_base__image_config__first_frame_io_position(wuffs_base__image_config* c) {\n return c ? c->private_impl.first_frame_io_position : 0;\n}\n\nstatic inline bool //\nwuffs_base__image_config__first_frame_is_opaque(wuffs_base__image_config* c) {\n return c ? c->private_impl.first_frame_is_opaque : false;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__image_config::initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t work_buffer_size0,\n uint64_t work_buffer_size1,\n uint32_t num_loops,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque) {\n wuffs_base__image_con" + " inline uint64_t //\nwuffs_base__image_config__first_frame_io_position(wuffs_base__image_config* c) {\n return c ? c->private_impl.first_frame_io_position : 0;\n}\n\nstatic inline bool //\nwuffs_base__image_config__first_frame_is_opaque(wuffs_base__image_config* c) {\n return c ? c->private_impl.first_frame_is_opaque : false;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__image_config::initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t workbuf_len0,\n uint64_t workbuf_len1,\n uint32_t num_loops,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque) {\n wuffs_base__image_config__initialize(\n this, pixfmt, pixsub, width, height, workbuf_le" +
"fig__initialize(\n this, pixfmt, pixsub, width, height, work_buffer_size0, work_buffer_size1,\n num_loops, first_frame_io_position, first_frame_is_opaque);\n}\n\ninline void //\nwuffs_base__image_config::invalidate() {\n wuffs_base__image_config__invalidate(this);\n}\n\ninline bool //\nwuffs_base__image_config::is_valid() {\n return wuffs_base__image_config__is_valid(this);\n}\n\ninline wuffs_base__range_ii_u64 //\nwuffs_base__image_config::work_buffer_size() {\n return wuffs_base__image_config__work_buffer_size(this);\n}\n\ninline uint32_t //\nwuffs_base__image_config::num_loops() {\n return wuffs_base__image_config__num_loops(this);\n}\n\ninline uint64_t //\nwuffs_base__image_config::first_frame_io_position() {\n return wuffs_base__image_config__first_frame_io_position(this);\n}\n\ninline bool //\nwuffs_base__image_config::first_frame_is_opaque() {\n return wuffs_base__image_config__first_frame_is_opaque(this);\n}\n\n#endif // __cplusplus\n\n" + "n0, workbuf_len1,\n num_loops, first_frame_io_position, first_frame_is_opaque);\n}\n\ninline void //\nwuffs_base__image_config::invalidate() {\n wuffs_base__image_config__invalidate(this);\n}\n\ninline bool //\nwuffs_base__image_config::is_valid() {\n return wuffs_base__image_config__is_valid(this);\n}\n\ninline wuffs_base__range_ii_u64 //\nwuffs_base__image_config::workbuf_len() {\n return wuffs_base__image_config__workbuf_len(this);\n}\n\ninline uint32_t //\nwuffs_base__image_config::num_loops() {\n return wuffs_base__image_config__num_loops(this);\n}\n\ninline uint64_t //\nwuffs_base__image_config::first_frame_io_position() {\n return wuffs_base__image_config__first_frame_io_position(this);\n}\n\ninline bool //\nwuffs_base__image_config::first_frame_is_opaque() {\n return wuffs_base__image_config__first_frame_is_opaque(this);\n}\n\n#endif // __cplusplus\n\n" +
"" + "" +
"// --------\n\n// wuffs_base__animation_blend encodes, for an animated image, how to blend the\n// transparent pixels of this frame with the existing canvas. In Porter-Duff\n// compositing operator terminology:\n// - 0 means the frame may be transparent, and should be blended \"src over\n// dst\", also known as just \"over\".\n// - 1 means the frame may be transparent, and should be blended \"src\".\n// - 2 means the frame is completely opaque, so that \"src over dst\" and \"src\"\n// are equivalent.\n//\n// These semantics are conservative. It is valid for a completely opaque frame\n// to have a blend value other than 2.\ntypedef uint8_t wuffs_base__animation_blend;\n\n#define WUFFS_BASE__ANIMATION_BLEND__SRC_OVER_DST \\\n ((wuffs_base__animation_blend)0)\n#define WUFFS_BASE__ANIMATION_BLEND__SRC ((wuffs_base__animation_blend)1)\n#define WUFFS_BASE__ANIMATION_BLEND__OPAQUE ((wuffs_base__animation_blend)2)\n\n" + "// --------\n\n// wuffs_base__animation_blend encodes, for an animated image, how to blend the\n// transparent pixels of this frame with the existing canvas. In Porter-Duff\n// compositing operator terminology:\n// - 0 means the frame may be transparent, and should be blended \"src over\n// dst\", also known as just \"over\".\n// - 1 means the frame may be transparent, and should be blended \"src\".\n// - 2 means the frame is completely opaque, so that \"src over dst\" and \"src\"\n// are equivalent.\n//\n// These semantics are conservative. It is valid for a completely opaque frame\n// to have a blend value other than 2.\ntypedef uint8_t wuffs_base__animation_blend;\n\n#define WUFFS_BASE__ANIMATION_BLEND__SRC_OVER_DST \\\n ((wuffs_base__animation_blend)0)\n#define WUFFS_BASE__ANIMATION_BLEND__SRC ((wuffs_base__animation_blend)1)\n#define WUFFS_BASE__ANIMATION_BLEND__OPAQUE ((wuffs_base__animation_blend)2)\n\n" +
"" + "" +
+1 -2
View File
@@ -252,8 +252,7 @@ const char* allocate(wuffs_base__image_config* ic) {
return "could not allocate image buffer"; return "could not allocate image buffer";
} }
uint64_t work_len_u64 = uint64_t work_len_u64 = wuffs_base__image_config__workbuf_len(ic).max_incl;
wuffs_base__image_config__work_buffer_size(ic).max_incl;
if (work_len_u64 <= SIZE_MAX) { if (work_len_u64 <= SIZE_MAX) {
work_buffer = malloc(work_len_u64); work_buffer = malloc(work_len_u64);
work_len = work_len_u64; work_len = work_len_u64;
+9 -10
View File
@@ -49,7 +49,7 @@ It should print "PASS", amongst other information, and exit(0).
const char* fuzz(wuffs_base__io_reader src_reader, uint32_t hash) { const char* fuzz(wuffs_base__io_reader src_reader, uint32_t hash) {
const char* ret = NULL; const char* ret = NULL;
void* pixbuf_ptr = NULL; void* pixbuf_ptr = NULL;
void* workbuf = NULL; void* workbuf_ptr = NULL;
// Use a {} code block so that "goto exit" doesn't trigger "jump bypasses // Use a {} code block so that "goto exit" doesn't trigger "jump bypasses
// variable initialization" warnings. // variable initialization" warnings.
@@ -73,15 +73,14 @@ const char* fuzz(wuffs_base__io_reader src_reader, uint32_t hash) {
goto exit; goto exit;
} }
uint64_t workbuf_size = uint64_t workbuf_len = wuffs_base__image_config__workbuf_len(&ic).max_incl;
wuffs_base__image_config__work_buffer_size(&ic).max_incl;
// Don't try to allocate more than 64 MiB. // Don't try to allocate more than 64 MiB.
if ((workbuf_size > 64 * 1024 * 1024) || (workbuf_size > SIZE_MAX)) { if ((workbuf_len > 64 * 1024 * 1024) || (workbuf_len > SIZE_MAX)) {
ret = "image too large"; ret = "image too large";
goto exit; goto exit;
} }
workbuf = malloc(workbuf_size); workbuf_ptr = malloc(workbuf_len);
if (!workbuf) { if (!workbuf_ptr) {
ret = "out of memory"; ret = "out of memory";
goto exit; goto exit;
} }
@@ -113,8 +112,8 @@ const char* fuzz(wuffs_base__io_reader src_reader, uint32_t hash) {
while (true) { while (true) {
z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader,
((wuffs_base__slice_u8){ ((wuffs_base__slice_u8){
.ptr = workbuf, .ptr = workbuf_ptr,
.len = workbuf_size, .len = workbuf_len,
}), }),
NULL); NULL);
if (z) { if (z) {
@@ -128,8 +127,8 @@ const char* fuzz(wuffs_base__io_reader src_reader, uint32_t hash) {
} }
exit: exit:
if (workbuf) { if (workbuf_ptr) {
free(workbuf); free(workbuf_ptr);
} }
if (pixbuf_ptr) { if (pixbuf_ptr) {
free(pixbuf_ptr); free(pixbuf_ptr);
+3 -3
View File
@@ -29,7 +29,7 @@ var StatusList = [...]string{
"?bad receiver", "?bad receiver",
"?bad restart", "?bad restart",
"?bad sizeof receiver", "?bad sizeof receiver",
"?bad work buffer length", "?bad workbuf length",
"?bad wuffs version", "?bad wuffs version",
"?cannot return a suspension", "?cannot return a suspension",
"?check_wuffs_version not applicable", "?check_wuffs_version not applicable",
@@ -246,8 +246,8 @@ var Funcs = []string{
// ---- image_config // ---- image_config
"image_config.initialize!(pixfmt u32, pixsub u32, width u32, height u32, " + "image_config.initialize!(pixfmt u32, pixsub u32, width u32, height u32, " +
"work_buffer_size0 u64, work_buffer_size1 u64, " + "workbuf_len0 u64, workbuf_len1 u64, num_loops u32, " +
"num_loops u32, first_frame_io_position u64, first_frame_is_opaque bool)", "first_frame_io_position u64, first_frame_is_opaque bool)",
// ---- pixel_buffer // ---- pixel_buffer
+30 -31
View File
@@ -141,7 +141,7 @@ extern const char* wuffs_base__error__bad_call_sequence;
extern const char* wuffs_base__error__bad_receiver; extern const char* wuffs_base__error__bad_receiver;
extern const char* wuffs_base__error__bad_restart; extern const char* wuffs_base__error__bad_restart;
extern const char* wuffs_base__error__bad_sizeof_receiver; extern const char* wuffs_base__error__bad_sizeof_receiver;
extern const char* wuffs_base__error__bad_work_buffer_length; extern const char* wuffs_base__error__bad_workbuf_length;
extern const char* wuffs_base__error__bad_wuffs_version; extern const char* wuffs_base__error__bad_wuffs_version;
extern const char* wuffs_base__error__cannot_return_a_suspension; extern const char* wuffs_base__error__cannot_return_a_suspension;
extern const char* wuffs_base__error__check_wuffs_version_not_applicable; extern const char* wuffs_base__error__check_wuffs_version_not_applicable;
@@ -1573,7 +1573,7 @@ typedef struct {
// Do not access the private_impl's fields directly. There is no API/ABI // Do not access the private_impl's fields directly. There is no API/ABI
// compatibility or safety guarantee if you do so. // compatibility or safety guarantee if you do so.
struct { struct {
wuffs_base__range_ii_u64 work_buffer_size; wuffs_base__range_ii_u64 workbuf_len;
uint64_t first_frame_io_position; uint64_t first_frame_io_position;
uint32_t num_loops; uint32_t num_loops;
bool first_frame_is_opaque; bool first_frame_is_opaque;
@@ -1584,14 +1584,14 @@ typedef struct {
wuffs_base__pixel_subsampling pixsub, wuffs_base__pixel_subsampling pixsub,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint64_t work_buffer_size0, uint64_t workbuf_len0,
uint64_t work_buffer_size1, uint64_t workbuf_len1,
uint32_t num_loops, uint32_t num_loops,
uint64_t first_frame_io_position, uint64_t first_frame_io_position,
bool first_frame_is_opaque); bool first_frame_is_opaque);
inline void invalidate(); inline void invalidate();
inline bool is_valid(); inline bool is_valid();
inline wuffs_base__range_ii_u64 work_buffer_size(); inline wuffs_base__range_ii_u64 workbuf_len();
inline uint32_t num_loops(); inline uint32_t num_loops();
inline uint64_t first_frame_io_position(); inline uint64_t first_frame_io_position();
inline bool first_frame_is_opaque(); inline bool first_frame_is_opaque();
@@ -1606,8 +1606,8 @@ wuffs_base__image_config__initialize(wuffs_base__image_config* c,
wuffs_base__pixel_subsampling pixsub, wuffs_base__pixel_subsampling pixsub,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint64_t work_buffer_size0, uint64_t workbuf_len0,
uint64_t work_buffer_size1, uint64_t workbuf_len1,
uint32_t num_loops, uint32_t num_loops,
uint64_t first_frame_io_position, uint64_t first_frame_io_position,
bool first_frame_is_opaque) { bool first_frame_is_opaque) {
@@ -1619,8 +1619,8 @@ wuffs_base__image_config__initialize(wuffs_base__image_config* c,
c->pixcfg.private_impl.pixsub = pixsub; c->pixcfg.private_impl.pixsub = pixsub;
c->pixcfg.private_impl.width = width; c->pixcfg.private_impl.width = width;
c->pixcfg.private_impl.height = height; c->pixcfg.private_impl.height = height;
c->private_impl.work_buffer_size.min_incl = work_buffer_size0; c->private_impl.workbuf_len.min_incl = workbuf_len0;
c->private_impl.work_buffer_size.max_incl = work_buffer_size1; c->private_impl.workbuf_len.max_incl = workbuf_len1;
c->private_impl.first_frame_io_position = first_frame_io_position; c->private_impl.first_frame_io_position = first_frame_io_position;
c->private_impl.num_loops = num_loops; c->private_impl.num_loops = num_loops;
c->private_impl.first_frame_is_opaque = first_frame_is_opaque; c->private_impl.first_frame_is_opaque = first_frame_is_opaque;
@@ -1642,8 +1642,8 @@ wuffs_base__image_config__is_valid(wuffs_base__image_config* c) {
} }
static inline wuffs_base__range_ii_u64 // static inline wuffs_base__range_ii_u64 //
wuffs_base__image_config__work_buffer_size(wuffs_base__image_config* c) { wuffs_base__image_config__workbuf_len(wuffs_base__image_config* c) {
return c ? c->private_impl.work_buffer_size : ((wuffs_base__range_ii_u64){}); return c ? c->private_impl.workbuf_len : ((wuffs_base__range_ii_u64){});
} }
static inline uint32_t // static inline uint32_t //
@@ -1668,13 +1668,13 @@ wuffs_base__image_config::initialize(wuffs_base__pixel_format pixfmt,
wuffs_base__pixel_subsampling pixsub, wuffs_base__pixel_subsampling pixsub,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint64_t work_buffer_size0, uint64_t workbuf_len0,
uint64_t work_buffer_size1, uint64_t workbuf_len1,
uint32_t num_loops, uint32_t num_loops,
uint64_t first_frame_io_position, uint64_t first_frame_io_position,
bool first_frame_is_opaque) { bool first_frame_is_opaque) {
wuffs_base__image_config__initialize( wuffs_base__image_config__initialize(
this, pixfmt, pixsub, width, height, work_buffer_size0, work_buffer_size1, this, pixfmt, pixsub, width, height, workbuf_len0, workbuf_len1,
num_loops, first_frame_io_position, first_frame_is_opaque); num_loops, first_frame_io_position, first_frame_is_opaque);
} }
@@ -1689,8 +1689,8 @@ wuffs_base__image_config::is_valid() {
} }
inline wuffs_base__range_ii_u64 // inline wuffs_base__range_ii_u64 //
wuffs_base__image_config::work_buffer_size() { wuffs_base__image_config::workbuf_len() {
return wuffs_base__image_config__work_buffer_size(this); return wuffs_base__image_config__workbuf_len(this);
} }
inline uint32_t // inline uint32_t //
@@ -2595,7 +2595,7 @@ typedef struct {
wuffs_base__io_reader a_src); wuffs_base__io_reader a_src);
inline uint64_t num_decoded_frame_configs(); inline uint64_t num_decoded_frame_configs();
inline uint64_t num_decoded_frames(); inline uint64_t num_decoded_frames();
inline wuffs_base__range_ii_u64 work_buffer_size(); inline wuffs_base__range_ii_u64 workbuf_len();
inline wuffs_base__status restart_frame(uint64_t a_index, inline wuffs_base__status restart_frame(uint64_t a_index,
uint64_t a_io_position); uint64_t a_io_position);
inline wuffs_base__status decode_frame_config(wuffs_base__frame_config* a_dst, inline wuffs_base__status decode_frame_config(wuffs_base__frame_config* a_dst,
@@ -2603,7 +2603,7 @@ typedef struct {
inline wuffs_base__status decode_frame( inline wuffs_base__status decode_frame(
wuffs_base__pixel_buffer* a_dst, wuffs_base__pixel_buffer* a_dst,
wuffs_base__io_reader a_src, wuffs_base__io_reader a_src,
wuffs_base__slice_u8 a_work_buffer, wuffs_base__slice_u8 a_workbuf,
wuffs_base__decode_frame_options* a_opts); wuffs_base__decode_frame_options* a_opts);
#endif // __cplusplus #endif // __cplusplus
@@ -2635,7 +2635,7 @@ WUFFS_BASE__MAYBE_STATIC uint64_t //
wuffs_gif__decoder__num_decoded_frames(wuffs_gif__decoder* self); wuffs_gif__decoder__num_decoded_frames(wuffs_gif__decoder* self);
WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 // WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 //
wuffs_gif__decoder__work_buffer_size(wuffs_gif__decoder* self); wuffs_gif__decoder__workbuf_len(wuffs_gif__decoder* self);
WUFFS_BASE__MAYBE_STATIC wuffs_base__status // WUFFS_BASE__MAYBE_STATIC wuffs_base__status //
wuffs_gif__decoder__restart_frame(wuffs_gif__decoder* self, wuffs_gif__decoder__restart_frame(wuffs_gif__decoder* self,
@@ -2651,7 +2651,7 @@ WUFFS_BASE__MAYBE_STATIC wuffs_base__status //
wuffs_gif__decoder__decode_frame(wuffs_gif__decoder* self, wuffs_gif__decoder__decode_frame(wuffs_gif__decoder* self,
wuffs_base__pixel_buffer* a_dst, wuffs_base__pixel_buffer* a_dst,
wuffs_base__io_reader a_src, wuffs_base__io_reader a_src,
wuffs_base__slice_u8 a_work_buffer, wuffs_base__slice_u8 a_workbuf,
wuffs_base__decode_frame_options* a_opts); wuffs_base__decode_frame_options* a_opts);
// ---------------- C++ Convenience Methods // ---------------- C++ Convenience Methods
@@ -2682,8 +2682,8 @@ wuffs_gif__decoder::num_decoded_frames() {
} }
inline wuffs_base__range_ii_u64 // inline wuffs_base__range_ii_u64 //
wuffs_gif__decoder::work_buffer_size() { wuffs_gif__decoder::workbuf_len() {
return wuffs_gif__decoder__work_buffer_size(this); return wuffs_gif__decoder__workbuf_len(this);
} }
inline wuffs_base__status // inline wuffs_base__status //
@@ -2700,9 +2700,9 @@ wuffs_gif__decoder::decode_frame_config(wuffs_base__frame_config* a_dst,
inline wuffs_base__status // inline wuffs_base__status //
wuffs_gif__decoder::decode_frame(wuffs_base__pixel_buffer* a_dst, wuffs_gif__decoder::decode_frame(wuffs_base__pixel_buffer* a_dst,
wuffs_base__io_reader a_src, wuffs_base__io_reader a_src,
wuffs_base__slice_u8 a_work_buffer, wuffs_base__slice_u8 a_workbuf,
wuffs_base__decode_frame_options* a_opts) { wuffs_base__decode_frame_options* a_opts) {
return wuffs_gif__decoder__decode_frame(this, a_dst, a_src, a_work_buffer, return wuffs_gif__decoder__decode_frame(this, a_dst, a_src, a_workbuf,
a_opts); a_opts);
} }
@@ -3692,8 +3692,7 @@ const char* wuffs_base__error__bad_receiver = "?base: bad receiver";
const char* wuffs_base__error__bad_restart = "?base: bad restart"; const char* wuffs_base__error__bad_restart = "?base: bad restart";
const char* wuffs_base__error__bad_sizeof_receiver = const char* wuffs_base__error__bad_sizeof_receiver =
"?base: bad sizeof receiver"; "?base: bad sizeof receiver";
const char* wuffs_base__error__bad_work_buffer_length = const char* wuffs_base__error__bad_workbuf_length = "?base: bad workbuf length";
"?base: bad work buffer length";
const char* wuffs_base__error__bad_wuffs_version = "?base: bad wuffs version"; const char* wuffs_base__error__bad_wuffs_version = "?base: bad wuffs version";
const char* wuffs_base__error__cannot_return_a_suspension = const char* wuffs_base__error__cannot_return_a_suspension =
"?base: cannot return a suspension"; "?base: cannot return a suspension";
@@ -6533,10 +6532,10 @@ wuffs_gif__decoder__num_decoded_frames(wuffs_gif__decoder* self) {
return self->private_impl.f_num_decoded_frames_value; return self->private_impl.f_num_decoded_frames_value;
} }
// -------- func gif.decoder.work_buffer_size // -------- func gif.decoder.workbuf_len
WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 // WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64 //
wuffs_gif__decoder__work_buffer_size(wuffs_gif__decoder* self) { wuffs_gif__decoder__workbuf_len(wuffs_gif__decoder* self) {
if (!self) { if (!self) {
return ((wuffs_base__range_ii_u64){}); return ((wuffs_base__range_ii_u64){});
} }
@@ -6789,7 +6788,7 @@ WUFFS_BASE__MAYBE_STATIC wuffs_base__status //
wuffs_gif__decoder__decode_frame(wuffs_gif__decoder* self, wuffs_gif__decoder__decode_frame(wuffs_gif__decoder* self,
wuffs_base__pixel_buffer* a_dst, wuffs_base__pixel_buffer* a_dst,
wuffs_base__io_reader a_src, wuffs_base__io_reader a_src,
wuffs_base__slice_u8 a_work_buffer, wuffs_base__slice_u8 a_workbuf,
wuffs_base__decode_frame_options* a_opts) { wuffs_base__decode_frame_options* a_opts) {
if (!self) { if (!self) {
return wuffs_base__error__bad_receiver; return wuffs_base__error__bad_receiver;
@@ -6813,9 +6812,9 @@ wuffs_gif__decoder__decode_frame(wuffs_gif__decoder* self,
switch (coro_susp_point) { switch (coro_susp_point) {
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0; WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
if (((uint64_t)(a_work_buffer.len)) != if (((uint64_t)(a_workbuf.len)) !=
((uint64_t)(self->private_impl.f_width))) { ((uint64_t)(self->private_impl.f_width))) {
status = wuffs_base__error__bad_work_buffer_length; status = wuffs_base__error__bad_workbuf_length;
goto exit; goto exit;
} }
if (self->private_impl.f_call_sequence != 2) { if (self->private_impl.f_call_sequence != 2) {
+6 -6
View File
@@ -148,8 +148,8 @@ pub func decoder.decode_image_config!??(dst nptr base.image_config, src base.io_
pixsub:0, pixsub:0,
width:this.width, width:this.width,
height:this.height, height:this.height,
work_buffer_size0:this.width as base.u64, workbuf_len0:this.width as base.u64,
work_buffer_size1:this.width as base.u64, workbuf_len1:this.width as base.u64,
num_loops:num_loops, num_loops:num_loops,
first_frame_io_position:this.frame_config_io_position, first_frame_io_position:this.frame_config_io_position,
first_frame_is_opaque:ffio) first_frame_is_opaque:ffio)
@@ -166,7 +166,7 @@ pub func decoder.num_decoded_frames() base.u64 {
return this.num_decoded_frames_value return this.num_decoded_frames_value
} }
pub func decoder.work_buffer_size() base.range_ii_u64 { pub func decoder.workbuf_len() base.range_ii_u64 {
return this.util.make_range_ii_u64(min_incl:0, max_incl:0) return this.util.make_range_ii_u64(min_incl:0, max_incl:0)
} }
@@ -236,9 +236,9 @@ pri func decoder.skip_frame!??(src base.io_reader) {
} }
// TODO: honor args.opts. // TODO: honor args.opts.
pub func decoder.decode_frame!??(dst ptr base.pixel_buffer, src base.io_reader, work_buffer slice base.u8, opts nptr base.decode_frame_options) { pub func decoder.decode_frame!??(dst ptr base.pixel_buffer, src base.io_reader, workbuf slice base.u8, opts nptr base.decode_frame_options) {
if args.work_buffer.length() != (this.width as base.u64) { if args.workbuf.length() != (this.width as base.u64) {
return status "?bad work buffer length" return status "?bad workbuf length"
} }
if this.call_sequence != 2 { if this.call_sequence != 2 {
this.decode_frame_config!??(dst:nullptr, src:args.src) this.decode_frame_config!??(dst:nullptr, src:args.src)
+26 -32
View File
@@ -222,14 +222,13 @@ const char* wuffs_gif_decode(wuffs_base__io_buffer* dst,
return z; return z;
} }
uint64_t work_buffer_size = uint64_t workbuf_len = wuffs_base__image_config__workbuf_len(&ic).max_incl;
wuffs_base__image_config__work_buffer_size(&ic).max_incl; if (workbuf_len > BUFFER_SIZE) {
if (work_buffer_size > BUFFER_SIZE) {
return "work buffer size is too large"; return "work buffer size is too large";
} }
wuffs_base__slice_u8 work_buffer = ((wuffs_base__slice_u8){ wuffs_base__slice_u8 workbuf = ((wuffs_base__slice_u8){
.ptr = global_work_buffer, .ptr = global_work_buffer,
.len = work_buffer_size, .len = workbuf_len,
}); });
while (true) { while (true) {
@@ -241,8 +240,7 @@ const char* wuffs_gif_decode(wuffs_base__io_buffer* dst,
return z; return z;
} }
z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, work_buffer, z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, workbuf, NULL);
NULL);
if (z) { if (z) {
return z; return z;
} }
@@ -307,9 +305,9 @@ bool do_test_wuffs_gif_decode(const char* filename,
wuffs_base__pixel_config__height(&ic.pixcfg)); wuffs_base__pixel_config__height(&ic.pixcfg));
return false; return false;
} }
if (wuffs_base__image_config__work_buffer_size(&ic).max_incl != 160) { if (wuffs_base__image_config__workbuf_len(&ic).max_incl != 160) {
FAIL("work_buffer_size: got %" PRIu64 ", want 160", FAIL("workbuf_len: got %" PRIu64 ", want 160",
wuffs_base__image_config__work_buffer_size(&ic).max_incl); wuffs_base__image_config__workbuf_len(&ic).max_incl);
return false; return false;
} }
if (wuffs_base__image_config__num_loops(&ic) != 1) { if (wuffs_base__image_config__num_loops(&ic) != 1) {
@@ -333,7 +331,7 @@ bool do_test_wuffs_gif_decode(const char* filename,
} }
} }
wuffs_base__slice_u8 work_buffer = ((wuffs_base__slice_u8){ wuffs_base__slice_u8 workbuf = ((wuffs_base__slice_u8){
.ptr = global_work_buffer, .ptr = global_work_buffer,
.len = 160, .len = 160,
}); });
@@ -377,8 +375,8 @@ bool do_test_wuffs_gif_decode(const char* filename,
} }
size_t old_ri = src.ri; size_t old_ri = src.ri;
wuffs_base__status z = wuffs_gif__decoder__decode_frame( wuffs_base__status z =
&dec, &pb, src_reader, work_buffer, NULL); wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, workbuf, NULL);
if (!z) { if (!z) {
break; break;
@@ -448,8 +446,8 @@ bool do_test_wuffs_gif_decode(const char* filename,
return false; return false;
} }
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(&src); wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(&src);
wuffs_base__status z = wuffs_gif__decoder__decode_frame( wuffs_base__status z =
&dec, &pb, src_reader, work_buffer, NULL); wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, workbuf, NULL);
if (z != wuffs_base__warning__end_of_data) { if (z != wuffs_base__warning__end_of_data) {
FAIL("decode_frame: got \"%s\", want \"%s\"", z, FAIL("decode_frame: got \"%s\", want \"%s\"", z,
wuffs_base__warning__end_of_data); wuffs_base__warning__end_of_data);
@@ -526,14 +524,13 @@ bool do_test_wuffs_gif_decode_animated(
return false; return false;
} }
uint64_t work_buffer_size = uint64_t workbuf_len = wuffs_base__image_config__workbuf_len(&ic).max_incl;
wuffs_base__image_config__work_buffer_size(&ic).max_incl; if (workbuf_len > BUFFER_SIZE) {
if (work_buffer_size > BUFFER_SIZE) {
return "work buffer size is too large"; return "work buffer size is too large";
} }
wuffs_base__slice_u8 work_buffer = ((wuffs_base__slice_u8){ wuffs_base__slice_u8 workbuf = ((wuffs_base__slice_u8){
.ptr = global_work_buffer, .ptr = global_work_buffer,
.len = work_buffer_size, .len = workbuf_len,
}); });
if (wuffs_base__image_config__num_loops(&ic) != want_num_loops) { if (wuffs_base__image_config__num_loops(&ic) != want_num_loops) {
@@ -577,8 +574,7 @@ bool do_test_wuffs_gif_decode_animated(
} }
} }
z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, work_buffer, z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, workbuf, NULL);
NULL);
if (z) { if (z) {
FAIL("decode_frame #%" PRIu32 ": got \"%s\"", i, z); FAIL("decode_frame #%" PRIu32 ": got \"%s\"", i, z);
return false; return false;
@@ -588,8 +584,7 @@ bool do_test_wuffs_gif_decode_animated(
// There should be no more frames, no matter how many times we call // There should be no more frames, no matter how many times we call
// decode_frame. // decode_frame.
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, work_buffer, z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, workbuf, NULL);
NULL);
if (z != wuffs_base__warning__end_of_data) { if (z != wuffs_base__warning__end_of_data) {
FAIL("decode_frame: got \"%s\", want \"%s\"", z, FAIL("decode_frame: got \"%s\", want \"%s\"", z,
wuffs_base__warning__end_of_data); wuffs_base__warning__end_of_data);
@@ -691,15 +686,14 @@ void test_wuffs_gif_decode_frame_out_of_bounds() {
return; return;
} }
uint64_t work_buffer_size = uint64_t workbuf_len = wuffs_base__image_config__workbuf_len(&ic).max_incl;
wuffs_base__image_config__work_buffer_size(&ic).max_incl; if (workbuf_len > BUFFER_SIZE) {
if (work_buffer_size > BUFFER_SIZE) {
FAIL("work buffer size is too large"); FAIL("work buffer size is too large");
return; return;
} }
wuffs_base__slice_u8 work_buffer = ((wuffs_base__slice_u8){ wuffs_base__slice_u8 workbuf = ((wuffs_base__slice_u8){
.ptr = global_work_buffer, .ptr = global_work_buffer,
.len = work_buffer_size, .len = workbuf_len,
}); });
// See test/data/artificial/gif-frame-out-of-bounds.gif.make-artificial.txt // See test/data/artificial/gif-frame-out-of-bounds.gif.make-artificial.txt
@@ -758,7 +752,7 @@ void test_wuffs_gif_decode_frame_out_of_bounds() {
} }
} }
z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, work_buffer, z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, workbuf,
NULL); NULL);
if (z) { if (z) {
FAIL("decode_frame #%" PRIu32 ": got \"%s\"", i, z); FAIL("decode_frame #%" PRIu32 ": got \"%s\"", i, z);
@@ -882,7 +876,7 @@ bool do_test_wuffs_gif_num_decoded(bool frame_config) {
} }
} }
wuffs_base__slice_u8 work_buffer = ((wuffs_base__slice_u8){ wuffs_base__slice_u8 workbuf = ((wuffs_base__slice_u8){
.ptr = global_work_buffer, .ptr = global_work_buffer,
.len = 64, .len = 64,
}); });
@@ -908,7 +902,7 @@ bool do_test_wuffs_gif_num_decoded(bool frame_config) {
if (frame_config) { if (frame_config) {
z = wuffs_gif__decoder__decode_frame_config(&dec, NULL, src_reader); z = wuffs_gif__decoder__decode_frame_config(&dec, NULL, src_reader);
} else { } else {
z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, work_buffer, z = wuffs_gif__decoder__decode_frame(&dec, &pb, src_reader, workbuf,
NULL); NULL);
} }