diff --git a/cmd/wuffs-c/internal/cgen/base/base-private.h b/cmd/wuffs-c/internal/cgen/base/base-private.h index 9025de77..43fd2a55 100644 --- a/cmd/wuffs-c/internal/cgen/base/base-private.h +++ b/cmd/wuffs-c/internal/cgen/base/base-private.h @@ -521,6 +521,10 @@ wuffs_base__io_buffer__is_valid(wuffs_base__io_buffer buf) { (buf.wi >= buf.ri); } +// 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. + static inline bool // wuffs_base__io_reader__is_eof(wuffs_base__io_reader o) { wuffs_base__io_buffer* buf = o.private_impl.buf; diff --git a/cmd/wuffs-c/internal/cgen/data.go b/cmd/wuffs-c/internal/cgen/data.go index 496e91a1..d9f0e215 100644 --- a/cmd/wuffs-c/internal/cgen/data.go +++ b/cmd/wuffs-c/internal/cgen/data.go @@ -97,13 +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\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 inl" + - "ine 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)(distanc" + - "e)) {\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++ = *start++;\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_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#ifdef __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\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" + "" const baseBaseImplC = "" + @@ -164,8 +165,7 @@ type template_args_short_read struct { } func template_short_read(b *buffer, args template_args_short_read) error { - b.printf("short_read_%s:\nif (wuffs_base__io_reader__is_eof(a_%s)) {\nstatus = WUFFS_BASE__ERROR_UNEXPECTED_EOF;\ngoto exit;\n}\nstatus = WUFFS_BASE__SUSPENSION_SHORT_READ;\ngoto suspend;\n", - args.name, + b.printf("short_read_%s:\nstatus = WUFFS_BASE__SUSPENSION_SHORT_READ;\ngoto suspend;\n", args.name, ) return nil diff --git a/cmd/wuffs-c/internal/cgen/templates.h b/cmd/wuffs-c/internal/cgen/templates.h index 41e19477..bf99a38f 100644 --- a/cmd/wuffs-c/internal/cgen/templates.h +++ b/cmd/wuffs-c/internal/cgen/templates.h @@ -23,10 +23,6 @@ template short_read(string qnameq) { short_read_qnameq: - if (wuffs_base__io_reader__is_eof(a_qnameq)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } diff --git a/doc/changelog.md b/doc/changelog.md index 9ca1b3a4..025f2688 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -32,6 +32,7 @@ - Supported animated (not just single frame) and interlaced GIFs. - Marked the `std/gif` LZW decoder as private. - Marked some internal status codes as private. +- Removed closed-for-read/write built-in status codes. - Changed the string messages for built-in status codes. - Made a packageid declaration mandatory. - Disallowed certain packageid's like `base` or `config`. diff --git a/lang/builtin/builtin.go b/lang/builtin/builtin.go index 915db13d..68de391f 100644 --- a/lang/builtin/builtin.go +++ b/lang/builtin/builtin.go @@ -51,11 +51,8 @@ var StatusList = [...]Status{ {t.IDError, -0x20, "cannot return a suspension"}, - {t.IDError, -0x30, "unexpected EOF"}, // Used if reading when closed == true. - {t.IDError, -0x31, "closed for writes"}, // TODO: is this unused? Should callee or caller check closed-ness? - {t.IDSuspension, +0x01, "end of data"}, - {t.IDSuspension, +0x02, "short read"}, // Used if reading when closed == false. + {t.IDSuspension, +0x02, "short read"}, {t.IDSuspension, +0x03, "short write"}, } diff --git a/release/c/wuffs-unsupported-snapshot.h b/release/c/wuffs-unsupported-snapshot.h index b3839976..0c243acb 100644 --- a/release/c/wuffs-unsupported-snapshot.h +++ b/release/c/wuffs-unsupported-snapshot.h @@ -139,8 +139,6 @@ typedef int32_t wuffs_base__status; -285212672 // 0xEF000000 #define WUFFS_BASE__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000 #define WUFFS_BASE__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000 -#define WUFFS_BASE__ERROR_UNEXPECTED_EOF -805306368 // 0xD0000000 -#define WUFFS_BASE__ERROR_CLOSED_FOR_WRITES -822083584 // 0xCF000000 #define WUFFS_BASE__SUSPENSION_END_OF_DATA 16777216 // 0x01000000 #define WUFFS_BASE__SUSPENSION_SHORT_READ 33554432 // 0x02000000 #define WUFFS_BASE__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000 @@ -3493,6 +3491,10 @@ wuffs_base__io_buffer__is_valid(wuffs_base__io_buffer buf) { (buf.wi >= buf.ri); } +// 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. + static inline bool // wuffs_base__io_reader__is_eof(wuffs_base__io_reader o) { wuffs_base__io_buffer* buf = o.private_impl.buf; @@ -3702,26 +3704,23 @@ static const char wuffs_base__status__string_data[] = { 0x00, 0x6F, 0x6B, 0x00, 0x65, 0x6E, 0x64, 0x20, 0x6F, 0x66, 0x20, 0x64, 0x61, 0x74, 0x61, 0x00, 0x73, 0x68, 0x6F, 0x72, 0x74, 0x20, 0x72, 0x65, 0x61, 0x64, 0x00, 0x73, 0x68, 0x6F, 0x72, 0x74, 0x20, 0x77, 0x72, 0x69, - 0x74, 0x65, 0x00, 0x63, 0x6C, 0x6F, 0x73, 0x65, 0x64, 0x20, 0x66, 0x6F, - 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65, 0x73, 0x00, 0x75, 0x6E, 0x65, - 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x45, 0x4F, 0x46, 0x00, - 0x63, 0x61, 0x6E, 0x6E, 0x6F, 0x74, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6E, 0x20, 0x61, 0x20, 0x73, 0x75, 0x73, 0x70, 0x65, 0x6E, 0x73, 0x69, - 0x6F, 0x6E, 0x00, 0x69, 0x6E, 0x76, 0x61, 0x6C, 0x69, 0x64, 0x20, 0x63, - 0x61, 0x6C, 0x6C, 0x20, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6E, 0x63, 0x65, + 0x74, 0x65, 0x00, 0x63, 0x61, 0x6E, 0x6E, 0x6F, 0x74, 0x20, 0x72, 0x65, + 0x74, 0x75, 0x72, 0x6E, 0x20, 0x61, 0x20, 0x73, 0x75, 0x73, 0x70, 0x65, + 0x6E, 0x73, 0x69, 0x6F, 0x6E, 0x00, 0x69, 0x6E, 0x76, 0x61, 0x6C, 0x69, + 0x64, 0x20, 0x63, 0x61, 0x6C, 0x6C, 0x20, 0x73, 0x65, 0x71, 0x75, 0x65, + 0x6E, 0x63, 0x65, 0x00, 0x63, 0x68, 0x65, 0x63, 0x6B, 0x5F, 0x77, 0x75, + 0x66, 0x66, 0x73, 0x5F, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x20, + 0x63, 0x61, 0x6C, 0x6C, 0x65, 0x64, 0x20, 0x74, 0x77, 0x69, 0x63, 0x65, 0x00, 0x63, 0x68, 0x65, 0x63, 0x6B, 0x5F, 0x77, 0x75, 0x66, 0x66, 0x73, - 0x5F, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x20, 0x63, 0x61, 0x6C, - 0x6C, 0x65, 0x64, 0x20, 0x74, 0x77, 0x69, 0x63, 0x65, 0x00, 0x63, 0x68, - 0x65, 0x63, 0x6B, 0x5F, 0x77, 0x75, 0x66, 0x66, 0x73, 0x5F, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x20, 0x6E, 0x6F, 0x74, 0x20, 0x63, 0x61, - 0x6C, 0x6C, 0x65, 0x64, 0x00, 0x62, 0x61, 0x64, 0x20, 0x61, 0x72, 0x67, - 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x20, 0x28, 0x6C, 0x65, 0x6E, 0x67, 0x74, - 0x68, 0x20, 0x74, 0x6F, 0x6F, 0x20, 0x73, 0x68, 0x6F, 0x72, 0x74, 0x29, - 0x00, 0x62, 0x61, 0x64, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x72, 0x00, 0x62, 0x61, 0x64, 0x20, 0x73, 0x69, 0x7A, 0x65, 0x6F, 0x66, - 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x00, 0x62, 0x61, - 0x64, 0x20, 0x77, 0x75, 0x66, 0x66, 0x73, 0x20, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6F, 0x6E, 0x00, + 0x5F, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x20, 0x6E, 0x6F, 0x74, + 0x20, 0x63, 0x61, 0x6C, 0x6C, 0x65, 0x64, 0x00, 0x62, 0x61, 0x64, 0x20, + 0x61, 0x72, 0x67, 0x75, 0x6D, 0x65, 0x6E, 0x74, 0x20, 0x28, 0x6C, 0x65, + 0x6E, 0x67, 0x74, 0x68, 0x20, 0x74, 0x6F, 0x6F, 0x20, 0x73, 0x68, 0x6F, + 0x72, 0x74, 0x29, 0x00, 0x62, 0x61, 0x64, 0x20, 0x72, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x72, 0x00, 0x62, 0x61, 0x64, 0x20, 0x73, 0x69, 0x7A, + 0x65, 0x6F, 0x66, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, + 0x00, 0x62, 0x61, 0x64, 0x20, 0x77, 0x75, 0x66, 0x66, 0x73, 0x20, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x00, }; static const uint16_t wuffs_base__status__string_offsets[] = { @@ -3748,12 +3747,12 @@ static const uint16_t wuffs_base__status__string_offsets[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0027, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0048, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0063, 0x0079, 0x009A, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0027, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x00B9, 0x00D9, 0x00E6, 0x00FA, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0042, 0x0058, 0x0079, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0098, 0x00B8, 0x00C5, 0x00D9, }; const char* // @@ -5049,10 +5048,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -5195,10 +5190,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -5520,10 +5511,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -6556,10 +6543,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -7057,10 +7040,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -7234,10 +7213,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -7318,10 +7293,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -7516,10 +7487,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -7627,10 +7594,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -7715,10 +7678,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -7928,10 +7887,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -8075,10 +8030,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -8339,10 +8290,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -8555,10 +8502,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -9158,10 +9101,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -9506,10 +9445,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } @@ -9852,10 +9787,6 @@ exit: return status; short_read_src: - if (wuffs_base__io_reader__is_eof(a_src)) { - status = WUFFS_BASE__ERROR_UNEXPECTED_EOF; - goto exit; - } status = WUFFS_BASE__SUSPENSION_SHORT_READ; goto suspend; } diff --git a/std/deflate/decode_deflate.wuffs b/std/deflate/decode_deflate.wuffs index fde5ba90..0eebfbba 100644 --- a/std/deflate/decode_deflate.wuffs +++ b/std/deflate/decode_deflate.wuffs @@ -237,7 +237,6 @@ pri func decoder.decode_uncompressed!??(dst base.io_writer, src base.io_reader) } length -= n_copied if args.dst.available() == 0 { - // TODO: "closed for writes" instead? yield suspension "short write" } else { yield suspension "short read" diff --git a/std/deflate/decode_huffman_slow.wuffs b/std/deflate/decode_huffman_slow.wuffs index af2387c6..eb06be6c 100644 --- a/std/deflate/decode_huffman_slow.wuffs +++ b/std/deflate/decode_huffman_slow.wuffs @@ -220,7 +220,6 @@ pri func decoder.decode_huffman_slow!??(dst base.io_writer, src base.io_reader) break } } - // TODO: "closed for writes" instead? yield suspension "short write" } // Copy from the start of this.history, if we wrapped around. @@ -234,7 +233,6 @@ pri func decoder.decode_huffman_slow!??(dst base.io_writer, src base.io_reader) } hlen -= n_copied hdist ~mod+= n_copied - // TODO: "closed for writes" instead? yield suspension "short write" } } @@ -252,7 +250,6 @@ pri func decoder.decode_huffman_slow!??(dst base.io_writer, src base.io_reader) break } length -= n_copied - // TODO: "closed for writes" instead? yield suspension "short write" } } diff --git a/std/lzw/decode_lzw.wuffs b/std/lzw/decode_lzw.wuffs index aaf19a94..de79cc63 100644 --- a/std/lzw/decode_lzw.wuffs +++ b/std/lzw/decode_lzw.wuffs @@ -123,7 +123,6 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) { break } s = (s + ((n_copied & 4095) as base.u32)) & 4095 - // TODO: "closed for writes" instead? yield suspension "short write" }