mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Remove the (pointer-typed) private_impl.status
This commit is contained in:
1 parent
49c047ed1e
commit
9367cd800b
6 files changed
+73
-86
No files matched your search
@@ -33,6 +33,12 @@ static inline void wuffs_base__ignore_check_wuffs_version_status(
|
||||
// Its (non-zero) value is arbitrary, based on md5sum("wuffs").
|
||||
#define WUFFS_BASE__MAGIC ((uint32_t)0x3CCB6C71)
|
||||
|
||||
// WUFFS_BASE__DISABLED is a magic number to indicate that a non-recoverable
|
||||
// error was previously encountered.
|
||||
//
|
||||
// Its (non-zero) value is arbitrary, based on md5sum("disabled").
|
||||
#define WUFFS_BASE__DISABLED ((uint32_t)0x075AE3D2)
|
||||
|
||||
// Denote intentional fallthroughs for -Wimplicit-fallthrough.
|
||||
//
|
||||
// The order matters here. Clang also defines "__GNUC__".
|
||||
|
||||
@@ -613,11 +613,6 @@ func (g *gen) writeConstList(b *buffer, n *a.Expr) error {
|
||||
}
|
||||
|
||||
func (g *gen) writeStruct(b *buffer, n *a.Struct) error {
|
||||
// For API/ABI compatibility, the very first field in the struct's
|
||||
// private_impl must be the status code. This lets the initializer callee
|
||||
// set "self->private_impl.status = wuffs_base__error__bad_wuffs_version;"
|
||||
// regardless of the sizeof(*self) struct reserved by the caller and even
|
||||
// if the caller and callee were built with different versions.
|
||||
structName := n.QID().Str(g.tm)
|
||||
b.writes("typedef struct {\n")
|
||||
b.writes("// Do not access the private_impl's fields directly. There is no API/ABI\n")
|
||||
@@ -629,7 +624,6 @@ func (g *gen) writeStruct(b *buffer, n *a.Struct) error {
|
||||
b.writes("// It is a struct, not a struct*, so that it can be stack allocated.\n")
|
||||
b.writes("struct {\n")
|
||||
if n.Classy() {
|
||||
b.printf("wuffs_base__status status;\n")
|
||||
b.writes("uint32_t magic;\n")
|
||||
b.writes("\n")
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ const baseBasePublicH = "" +
|
||||
|
||||
const baseBasePrivateH = "" +
|
||||
"#ifndef WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n#define WUFFS_INCLUDE_GUARD__BASE_PRIVATE\n\n// Copyright 2017 The Wuffs Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x)\n\nstatic inline void wuffs_base__ignore_check_wuffs_version_status(\n wuffs_base__status z) {}\n\n// WUFFS_BASE__MAGIC is a magic number to check that initializers are called.\n// It's not foolproof, given C doesn't automatically zero me" +
|
||||
"mory before use,\n// but it should catch 99.99% of cases.\n//\n// Its (non-zero) value is arbitrary, based on md5sum(\"wuffs\").\n#define WUFFS_BASE__MAGIC ((uint32_t)0x3CCB6C71)\n\n// Denote intentional fallthroughs for -Wimplicit-fallthrough.\n//\n// The order matters here. Clang also defines \"__GNUC__\".\n#if defined(__clang__) && __cplusplus >= 201103L\n#define WUFFS_BASE__FALLTHROUGH [[clang::fallthrough]]\n#elif !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 7)\n#define WUFFS_BASE__FALLTHROUGH __attribute__((fallthrough))\n#else\n#define WUFFS_BASE__FALLTHROUGH\n#endif\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use trivial macros instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0 case 0:;\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; " +
|
||||
" \\\n WUFFS_BASE__FALLTHROUGH; \\\n case n:;\n\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \\\n if (!status) { \\\n goto ok; \\\n } else if (*status != '$') { \\\n goto exit; \\\n } \\\n coro_susp_point = n; \\\n goto suspend; \\\n case n:;\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define WUFFS_BASE__LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define WUFFS_BASE__UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n#else\n#define WUFFS_BASE__LIKELY(expr) (expr)\n#define WUFFS_BASE__UNLIKELY(expr) (expr)\n#endif\n\n// The helpers below are functions, instead of macros, because their arguments\n// can be an expression that we shouldn't evaluat" +
|
||||
"e more than once.\n//\n// They are static, so that linking multiple wuffs .o files won't complain about\n// duplicate function definitions.\n//\n// They are explicitly marked inline, even if modern compilers don't use the\n// inline attribute to guide optimizations such as inlining, to avoid the\n// -Wunused-function warning, and we like to compile with -Wall -Werror.\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__return_empty_struct() {\n return ((wuffs_base__empty_struct){});\n}\n\n" +
|
||||
"mory before use,\n// but it should catch 99.99% of cases.\n//\n// Its (non-zero) value is arbitrary, based on md5sum(\"wuffs\").\n#define WUFFS_BASE__MAGIC ((uint32_t)0x3CCB6C71)\n\n// WUFFS_BASE__DISABLED is a magic number to indicate that a non-recoverable\n// error was previously encountered.\n//\n// Its (non-zero) value is arbitrary, based on md5sum(\"disabled\").\n#define WUFFS_BASE__DISABLED ((uint32_t)0x075AE3D2)\n\n// Denote intentional fallthroughs for -Wimplicit-fallthrough.\n//\n// The order matters here. Clang also defines \"__GNUC__\".\n#if defined(__clang__) && __cplusplus >= 201103L\n#define WUFFS_BASE__FALLTHROUGH [[clang::fallthrough]]\n#elif !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 7)\n#define WUFFS_BASE__FALLTHROUGH __attribute__((fallthrough))\n#else\n#define WUFFS_BASE__FALLTHROUGH\n#endif\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use trivial macros instead of an explicit assignment and c" +
|
||||
"ase statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0 case 0:;\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; \\\n WUFFS_BASE__FALLTHROUGH; \\\n case n:;\n\n#define WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \\\n if (!status) { \\\n goto ok; \\\n } else if (*status != '$') { \\\n goto exit; \\\n } \\\n coro_susp_point = n; \\\n goto suspend; \\\n case n:;\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define WUFFS_BASE__LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define WUFFS_BASE__UNLIKELY(expr) (__builtin_expect(!" +
|
||||
"!(expr), 0))\n#else\n#define WUFFS_BASE__LIKELY(expr) (expr)\n#define WUFFS_BASE__UNLIKELY(expr) (expr)\n#endif\n\n// The helpers below are functions, instead of macros, because their arguments\n// can be an expression that we shouldn't evaluate more than once.\n//\n// They are static, so that linking multiple wuffs .o files won't complain about\n// duplicate function definitions.\n//\n// They are explicitly marked inline, even if modern compilers don't use the\n// inline attribute to guide optimizations such as inlining, to avoid the\n// -Wunused-function warning, and we like to compile with -Wall -Werror.\n\nstatic inline wuffs_base__empty_struct //\nwuffs_base__return_empty_struct() {\n return ((wuffs_base__empty_struct){});\n}\n\n" +
|
||||
"" +
|
||||
"// ---------------- Numeric Types\n\nstatic inline uint8_t //\nwuffs_base__load_u8be(uint8_t* p) {\n return p[0];\n}\n\nstatic inline uint16_t //\nwuffs_base__load_u16be(uint8_t* p) {\n return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);\n}\n\nstatic inline uint16_t //\nwuffs_base__load_u16le(uint8_t* p) {\n return ((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8);\n}\n\nstatic inline uint32_t //\nwuffs_base__load_u24be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 16) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 0);\n}\n\nstatic inline uint32_t //\nwuffs_base__load_u24le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16);\n}\n\nstatic inline uint32_t //\nwuffs_base__load_u32be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |\n ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0);\n}\n\nstatic inline uint32_t //\nwuffs_base__load_u32le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uin" +
|
||||
"t32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24);\n}\n\nstatic inline uint64_t //\nwuffs_base__load_u40be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 32) | ((uint64_t)(p[1]) << 24) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 8) |\n ((uint64_t)(p[4]) << 0);\n}\n\nstatic inline uint64_t //\nwuffs_base__load_u40le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32);\n}\n\nstatic inline uint64_t //\nwuffs_base__load_u48be(uint8_t* p) {\n return ((uint64_t)(p[0]) << 40) | ((uint64_t)(p[1]) << 32) |\n ((uint64_t)(p[2]) << 24) | ((uint64_t)(p[3]) << 16) |\n ((uint64_t)(p[4]) << 8) | ((uint64_t)(p[5]) << 0);\n}\n\nstatic inline uint64_t //\nwuffs_base__load_u48le(uint8_t* p) {\n return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |\n ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |\n ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40);\n}\n\nstatic inline u" +
|
||||
|
||||
@@ -217,7 +217,7 @@ func (g *gen) writeOutParamZeroValue(b *buffer, typ *a.TypeExpr) error {
|
||||
}
|
||||
|
||||
func (g *gen) writeFuncImplHeader(b *buffer) error {
|
||||
// Check the previous status and the "self" arg.
|
||||
// Check the initialized/disabled state and the "self" arg.
|
||||
if g.currFunk.public && !g.currFunk.astFunc.Receiver().IsZero() {
|
||||
out := g.currFunk.astFunc.Out()
|
||||
|
||||
@@ -229,15 +229,15 @@ func (g *gen) writeFuncImplHeader(b *buffer) error {
|
||||
}
|
||||
b.writes(";}")
|
||||
|
||||
b.writes("if (self->private_impl.magic != WUFFS_BASE__MAGIC) {" +
|
||||
"self->private_impl.status = wuffs_base__error__check_wuffs_version_missing; }")
|
||||
|
||||
b.writes("if (wuffs_base__status__is_error(self->private_impl.status)) { return ")
|
||||
b.writes("if (self->private_impl.magic != WUFFS_BASE__MAGIC) { return ")
|
||||
if g.currFunk.suspendible {
|
||||
b.writes("self->private_impl.status")
|
||||
b.writes("(self->private_impl.magic == WUFFS_BASE__DISABLED) " +
|
||||
"? wuffs_base__error__disabled_by_previous_error " +
|
||||
": wuffs_base__error__check_wuffs_version_missing")
|
||||
} else if err := g.writeOutParamZeroValue(b, out); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
b.writes(";}\n")
|
||||
}
|
||||
|
||||
@@ -340,7 +340,8 @@ func (g *gen) writeFuncImplFooter(b *buffer) error {
|
||||
b.writes("\n")
|
||||
|
||||
if g.currFunk.public {
|
||||
b.writes("self->private_impl.status = status;\n")
|
||||
b.writes("if (wuffs_base__status__is_error(status)) { " +
|
||||
"self->private_impl.magic = WUFFS_BASE__DISABLED; }\n")
|
||||
}
|
||||
b.writes("return status;\n\n")
|
||||
}
|
||||
@@ -408,12 +409,12 @@ func (g *gen) writeFuncImplArgChecks(b *buffer, n *a.Func) error {
|
||||
b.writes(") {")
|
||||
if g.currFunk.suspendible {
|
||||
if g.currFunk.public {
|
||||
b.writes("self->private_impl.status = wuffs_base__error__bad_argument;\n")
|
||||
b.writes("self->private_impl.magic = WUFFS_BASE__DISABLED;\n")
|
||||
}
|
||||
b.writes("return wuffs_base__error__bad_argument;\n\n")
|
||||
} else if !n.Receiver().IsZero() {
|
||||
// TODO: unused code path??
|
||||
b.writes("self->private_impl.status = wuffs_base__error__bad_argument; return;")
|
||||
b.writes("self->private_impl.magic = WUFFS_BASE__DISABLED; return;")
|
||||
} else {
|
||||
b.printf("return;")
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ var StatusList = [...]string{
|
||||
"?cannot return a suspension",
|
||||
"?check_wuffs_version called twice",
|
||||
"?check_wuffs_version missing",
|
||||
"?disabled by previous error",
|
||||
"?invalid call sequence",
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,7 @@ 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__check_wuffs_version_called_twice;
|
||||
extern const char* wuffs_base__error__check_wuffs_version_missing;
|
||||
extern const char* wuffs_base__error__disabled_by_previous_error;
|
||||
extern const char* wuffs_base__error__invalid_call_sequence;
|
||||
|
||||
static inline bool //
|
||||
@@ -1928,7 +1929,6 @@ typedef struct {
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_base__status status;
|
||||
uint32_t magic;
|
||||
|
||||
uint32_t f_state;
|
||||
@@ -2007,7 +2007,6 @@ typedef struct {
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_base__status status;
|
||||
uint32_t magic;
|
||||
|
||||
uint32_t f_state;
|
||||
@@ -2099,7 +2098,6 @@ typedef struct {
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_base__status status;
|
||||
uint32_t magic;
|
||||
|
||||
uint32_t f_bits;
|
||||
@@ -2248,7 +2246,6 @@ typedef struct {
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_base__status status;
|
||||
uint32_t magic;
|
||||
|
||||
uint32_t f_literal_width;
|
||||
@@ -2362,7 +2359,6 @@ typedef struct {
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_base__status status;
|
||||
uint32_t magic;
|
||||
|
||||
uint32_t f_width;
|
||||
@@ -2619,7 +2615,6 @@ typedef struct {
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_base__status status;
|
||||
uint32_t magic;
|
||||
|
||||
wuffs_deflate__decoder f_flate;
|
||||
@@ -2736,7 +2731,6 @@ typedef struct {
|
||||
//
|
||||
// It is a struct, not a struct*, so that it can be stack allocated.
|
||||
struct {
|
||||
wuffs_base__status status;
|
||||
uint32_t magic;
|
||||
|
||||
wuffs_deflate__decoder f_flate;
|
||||
@@ -2845,6 +2839,12 @@ static inline void wuffs_base__ignore_check_wuffs_version_status(
|
||||
// Its (non-zero) value is arbitrary, based on md5sum("wuffs").
|
||||
#define WUFFS_BASE__MAGIC ((uint32_t)0x3CCB6C71)
|
||||
|
||||
// WUFFS_BASE__DISABLED is a magic number to indicate that a non-recoverable
|
||||
// error was previously encountered.
|
||||
//
|
||||
// Its (non-zero) value is arbitrary, based on md5sum("disabled").
|
||||
#define WUFFS_BASE__DISABLED ((uint32_t)0x075AE3D2)
|
||||
|
||||
// Denote intentional fallthroughs for -Wimplicit-fallthrough.
|
||||
//
|
||||
// The order matters here. Clang also defines "__GNUC__".
|
||||
@@ -3564,6 +3564,8 @@ const char* wuffs_base__error__check_wuffs_version_called_twice =
|
||||
"?base: check_wuffs_version called twice";
|
||||
const char* wuffs_base__error__check_wuffs_version_missing =
|
||||
"?base: check_wuffs_version missing";
|
||||
const char* wuffs_base__error__disabled_by_previous_error =
|
||||
"?base: disabled by previous error";
|
||||
const char* wuffs_base__error__invalid_call_sequence =
|
||||
"?base: invalid call sequence";
|
||||
|
||||
@@ -3614,9 +3616,6 @@ wuffs_adler32__hasher__update(wuffs_adler32__hasher* self,
|
||||
return 0;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4093,9 +4092,6 @@ wuffs_crc32__ieee_hasher__update(wuffs_crc32__ieee_hasher* self,
|
||||
return 0;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4394,10 +4390,9 @@ wuffs_deflate__decoder__decode(wuffs_deflate__decoder* self,
|
||||
return wuffs_base__error__bad_receiver;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return self->private_impl.status;
|
||||
return (self->private_impl.magic == WUFFS_BASE__DISABLED)
|
||||
? wuffs_base__error__disabled_by_previous_error
|
||||
: wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
wuffs_base__status status = NULL;
|
||||
|
||||
@@ -4518,7 +4513,9 @@ exit:
|
||||
a_dst.private_impl.buf->wi = iop_a_dst - a_dst.private_impl.buf->ptr;
|
||||
}
|
||||
|
||||
self->private_impl.status = status;
|
||||
if (wuffs_base__status__is_error(status)) {
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -6291,10 +6288,9 @@ wuffs_gif__decoder__decode_image_config(wuffs_gif__decoder* self,
|
||||
return wuffs_base__error__bad_receiver;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return self->private_impl.status;
|
||||
return (self->private_impl.magic == WUFFS_BASE__DISABLED)
|
||||
? wuffs_base__error__disabled_by_previous_error
|
||||
: wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
wuffs_base__status status = NULL;
|
||||
|
||||
@@ -6363,7 +6359,9 @@ suspend:
|
||||
|
||||
goto exit;
|
||||
exit:
|
||||
self->private_impl.status = status;
|
||||
if (wuffs_base__status__is_error(status)) {
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -6375,9 +6373,6 @@ wuffs_gif__decoder__num_decoded_frame_configs(wuffs_gif__decoder* self) {
|
||||
return 0;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6392,9 +6387,6 @@ wuffs_gif__decoder__num_decoded_frames(wuffs_gif__decoder* self) {
|
||||
return 0;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6409,9 +6401,6 @@ wuffs_gif__decoder__work_buffer_size(wuffs_gif__decoder* self) {
|
||||
return ((wuffs_base__range_ii_u64){});
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return ((wuffs_base__range_ii_u64){});
|
||||
}
|
||||
|
||||
@@ -6429,10 +6418,9 @@ wuffs_gif__decoder__decode_frame_config(wuffs_gif__decoder* self,
|
||||
return wuffs_base__error__bad_receiver;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return self->private_impl.status;
|
||||
return (self->private_impl.magic == WUFFS_BASE__DISABLED)
|
||||
? wuffs_base__error__disabled_by_previous_error
|
||||
: wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
wuffs_base__status status = NULL;
|
||||
|
||||
@@ -6511,7 +6499,9 @@ suspend:
|
||||
|
||||
goto exit;
|
||||
exit:
|
||||
self->private_impl.status = status;
|
||||
if (wuffs_base__status__is_error(status)) {
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -6610,13 +6600,12 @@ wuffs_gif__decoder__decode_frame(wuffs_gif__decoder* self,
|
||||
return wuffs_base__error__bad_receiver;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return self->private_impl.status;
|
||||
return (self->private_impl.magic == WUFFS_BASE__DISABLED)
|
||||
? wuffs_base__error__disabled_by_previous_error
|
||||
: wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (!a_dst) {
|
||||
self->private_impl.status = wuffs_base__error__bad_argument;
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
return wuffs_base__error__bad_argument;
|
||||
}
|
||||
wuffs_base__status status = NULL;
|
||||
@@ -6662,7 +6651,9 @@ suspend:
|
||||
|
||||
goto exit;
|
||||
exit:
|
||||
self->private_impl.status = status;
|
||||
if (wuffs_base__status__is_error(status)) {
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -8232,9 +8223,6 @@ wuffs_gzip__decoder__set_ignore_checksum(wuffs_gzip__decoder* self, bool a_ic) {
|
||||
return;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8251,10 +8239,9 @@ wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
return wuffs_base__error__bad_receiver;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return self->private_impl.status;
|
||||
return (self->private_impl.magic == WUFFS_BASE__DISABLED)
|
||||
? wuffs_base__error__disabled_by_previous_error
|
||||
: wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
wuffs_base__status status = NULL;
|
||||
|
||||
@@ -8605,7 +8592,9 @@ exit:
|
||||
a_src.private_impl.buf->ri = iop_a_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
|
||||
self->private_impl.status = status;
|
||||
if (wuffs_base__status__is_error(status)) {
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -8659,13 +8648,10 @@ wuffs_lzw__decoder__set_literal_width(wuffs_lzw__decoder* self, uint32_t a_lw) {
|
||||
return;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return;
|
||||
}
|
||||
if (a_lw < 2 || a_lw > 8) {
|
||||
self->private_impl.status = wuffs_base__error__bad_argument;
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8682,10 +8668,9 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
||||
return wuffs_base__error__bad_receiver;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return self->private_impl.status;
|
||||
return (self->private_impl.magic == WUFFS_BASE__DISABLED)
|
||||
? wuffs_base__error__disabled_by_previous_error
|
||||
: wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
wuffs_base__status status = NULL;
|
||||
|
||||
@@ -8892,7 +8877,9 @@ exit:
|
||||
a_src.private_impl.buf->ri = iop_a_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
|
||||
self->private_impl.status = status;
|
||||
if (wuffs_base__status__is_error(status)) {
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -8966,9 +8953,6 @@ wuffs_zlib__decoder__set_ignore_checksum(wuffs_zlib__decoder* self, bool a_ic) {
|
||||
return;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8985,10 +8969,9 @@ wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
return wuffs_base__error__bad_receiver;
|
||||
}
|
||||
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||
self->private_impl.status = wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
if (wuffs_base__status__is_error(self->private_impl.status)) {
|
||||
return self->private_impl.status;
|
||||
return (self->private_impl.magic == WUFFS_BASE__DISABLED)
|
||||
? wuffs_base__error__disabled_by_previous_error
|
||||
: wuffs_base__error__check_wuffs_version_missing;
|
||||
}
|
||||
wuffs_base__status status = NULL;
|
||||
|
||||
@@ -9180,7 +9163,9 @@ exit:
|
||||
a_src.private_impl.buf->ri = iop_a_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
|
||||
self->private_impl.status = status;
|
||||
if (wuffs_base__status__is_error(status)) {
|
||||
self->private_impl.magic = WUFFS_BASE__DISABLED;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user