Redo the encoding of error codes

This commit is contained in:
Nigel Tao committed 2018-06-10 21:22:41 +10:00
1 parent 2ac2424e77
commit 43bb14e886
29 files changed
+1069 -1021

No files matched your search

+8 -1
View File
@@ -55,7 +55,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
// !! INSERT wuffs_base__status names. // !! INSERT wuffs_base__status names.
+36 -60
View File
@@ -122,29 +122,6 @@ func Do(args []string) error {
}) })
} }
const (
maxNamespacedStatusCode = 255
statusCodeNamespaceMask = 1<<base38.MaxBits - 1
statusCodeNamespaceShift = 10
statusCodeCodeBits = 8
statusCodeDescription = "" +
"// Status codes are int32_t values. Its bits:\n" +
"// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.\n" +
"// - bits 30 .. 10 are the packageid: a namespace.\n" +
"// - bits 9 .. 8 are reserved.\n" +
"// - bits 7 .. 0 are a package-namespaced numeric code.\n"
)
func init() {
// The +1 is for the error bit (the sign bit).
if statusCodeNamespaceShift+base38.MaxBits+1 != 32 {
panic("inconsistent status code namespace shift")
}
if len(builtin.StatusList) > maxNamespacedStatusCode {
panic("too many built-in statuses")
}
}
type replacementPolicy bool type replacementPolicy bool
const ( const (
@@ -168,6 +145,7 @@ const (
type status struct { type status struct {
name string name string
value int8
msg string msg string
keyword t.ID keyword t.ID
} }
@@ -225,7 +203,7 @@ func insertBasePublicH(buf *buffer) error {
for _, z := range builtin.StatusList { for _, z := range builtin.StatusList {
code := int32(z.Value) << 24 code := int32(z.Value) << 24
b.printf("#define %s %d // 0x%08X\n", b.printf("#define %s %d // 0x%08X\n",
strings.ToUpper(cName(z.String(), "wuffs_base__")), code, uint32(code)) strings.ToUpper(cName(z.String(), "WUFFS_BASE__")), code, uint32(code))
} }
b.writes("\n") b.writes("\n")
return nil return nil
@@ -346,34 +324,29 @@ func (g *gen) genHeader(b *buffer) error {
b.writes("\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n") b.writes("\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n")
b.writes("// ---------------- Status Codes\n\n") b.writes("// ---------------- Status Codes\n\n")
b.writes(statusCodeDescription)
b.printf("//\n// Do not manipulate these bits directly; they are private implementation\n"+
"// details. Use methods such as %sstatus__is_error instead.\n", g.pkgPrefix)
b.printf("typedef int32_t %sstatus;\n\n", g.pkgPrefix) b.printf("typedef int32_t %sstatus;\n\n", g.pkgPrefix)
pkgID := g.checker.PackageID() pkgID := g.checker.PackageID()
b.printf("#define %spackageid %d // 0x%08X\n\n", g.pkgPrefix, pkgID, pkgID) b.printf("#define %spackageid %d // 0x%08X\n\n", g.pkgPrefix, pkgID, pkgID)
for i, z := range builtin.StatusList { for _, z := range builtin.StatusList {
code := uint32(0) name := z.Message
if z.Keyword == t.IDError { if z.Keyword == t.IDError {
code |= 1 << 31 name = "error " + name
} else if z.Keyword == t.IDSuspension {
name = "suspension " + name
} else {
name = "status " + name
} }
code |= uint32(i) code := int32(z.Value) << 24
b.printf("#define %s %d // 0x%08X\n", strings.ToUpper(g.cName(z.String())), int32(code), code) b.printf("#define %s %d // 0x%08X\n",
strings.ToUpper(cName(name, g.PKGPREFIX)), code, uint32(code))
} }
b.writes("\n") b.writes("\n")
if len(g.statusList) > maxNamespacedStatusCode { for _, s := range g.statusList {
return fmt.Errorf("too many status codes") code := (int32(s.value) << 24) | int32(pkgID)
} b.printf("#define %s %d // 0x%08X\n", s.name, code, uint32(code))
for i, s := range g.statusList {
code := pkgID << statusCodeNamespaceShift
if s.keyword == t.IDError {
code |= 1 << 31
}
code |= uint32(i)
b.printf("#define %s %d // 0x%08X\n", s.name, int32(code), code)
} }
b.writes("\n") b.writes("\n")
@@ -414,30 +387,28 @@ func (g *gen) genHeader(b *buffer) error {
func (g *gen) genImpl(b *buffer) error { func (g *gen) genImpl(b *buffer) error {
b.writes("#ifndef WUFFS_BASE_PRIVATE_H\n#define WUFFS_BASE_PRIVATE_H\n\n") b.writes("#ifndef WUFFS_BASE_PRIVATE_H\n#define WUFFS_BASE_PRIVATE_H\n\n")
b.writes(basePrivateH) b.writes(basePrivateH)
b.writes("\n")
b.printf("static const char* wuffs_base__status__strings[%d] = {\n", len(builtin.StatusList))
for _, z := range builtin.StatusList {
b.printf("%q,", z.Message)
}
b.writes("};\n\n")
b.writes("#endif // WUFFS_BASE_PRIVATE_H\n\n") b.writes("#endif // WUFFS_BASE_PRIVATE_H\n\n")
b.writes("// ---------------- Status Codes Implementations\n\n") b.writes("// ---------------- Status Codes Implementations\n\n")
b.printf("bool %sstatus__is_error(%sstatus s) { return s < 0; }\n\n", g.pkgPrefix, g.pkgPrefix) b.printf("bool %sstatus__is_error(%sstatus s) { return s < 0; }\n\n", g.pkgPrefix, g.pkgPrefix)
b.printf("const char* %sstatus__strings[%d] = {\n", g.pkgPrefix, len(g.statusList)) {
for _, s := range g.statusList { messages := [256]string{}
b.printf("%q,", g.pkgName+": "+s.msg) for _, s := range g.statusList {
messages[uint8(s.value)] = g.pkgName + ": " + s.msg
}
if err := genStatusStringData(b, g.pkgPrefix, &messages); err != nil {
return err
}
} }
b.writes("};\n\n")
b.printf("const char* %sstatus__string(%sstatus s) {\n", g.pkgPrefix, g.pkgPrefix) b.printf("const char* %sstatus__string(%sstatus s) {\n", g.pkgPrefix, g.pkgPrefix)
b.printf("const char** a = NULL;\n") b.printf("uint16_t o;")
b.printf("uint32_t n = 0;\n") b.printf("switch (s & 0x%X) {\n", (1<<base38.MaxBits)-1)
b.printf("switch ((s >> %d) & 0x%X) {\n", statusCodeNamespaceShift, statusCodeNamespaceMask) b.printf("case 0: return wuffs_base__status__string(s);\n")
b.printf("case 0: a = wuffs_base__status__strings; n = %d; break;\n", len(builtin.StatusList)) b.printf("case %spackageid:\n", g.pkgPrefix)
b.printf("case %spackageid: a = %sstatus__strings; n = %d; break;\n", b.printf("o = %sstatus__string_offsets[(uint8_t)(s >> 24)];\n", g.pkgPrefix)
g.pkgPrefix, g.pkgPrefix, len(g.statusList)) b.printf("if (o) { return %sstatus__string_data + o; } break;\n", g.pkgPrefix)
for _, u := range g.usesList { for _, u := range g.usesList {
// TODO: is path.Base always correct? Should we check // TODO: is path.Base always correct? Should we check
// validName(packageName)? // validName(packageName)?
@@ -445,8 +416,8 @@ func (g *gen) genImpl(b *buffer) error {
b.printf("case wuffs_%s__packageid: return wuffs_%s__status__string(s);\n", useePkgName, useePkgName) b.printf("case wuffs_%s__packageid: return wuffs_%s__status__string(s);\n", useePkgName, useePkgName)
} }
b.printf("}\n") b.printf("}\n")
b.printf("uint32_t i = s & 0x%X;\n", 1<<statusCodeCodeBits-1) b.printf("return \"unknown status\";\n")
b.printf("return i < n ? a[i] : \"unknown status\";\n")
b.writes("}\n\n") b.writes("}\n\n")
b.writes("// ---------------- Private Consts\n\n") b.writes("// ---------------- Private Consts\n\n")
@@ -605,8 +576,13 @@ func (g *gen) gatherStatuses(b *buffer, n *a.Status) error {
if n.Keyword() == t.IDError { if n.Keyword() == t.IDError {
prefix = "ERROR_" prefix = "ERROR_"
} }
value := int8(n.Value().ConstValue().Int64())
if n.Keyword() == t.IDError {
value = -value
}
s := status{ s := status{
name: strings.ToUpper(g.cName(prefix + msg)), name: strings.ToUpper(g.cName(prefix + msg)),
value: value,
msg: msg, msg: msg,
keyword: n.Keyword(), keyword: n.Keyword(),
} }
+1 -1
View File
@@ -21,7 +21,7 @@ const basePublicH = "" +
"as per https://semver.org/,\n// as a uint64_t. The major number is the high 32 bits. The minor number is the\n// middle 16 bits. The patch number is the low 16 bits. The version extension\n// (such as \"\", \"beta\" or \"rc.1\") is part of the string representation (such as\n// \"1.2.3-beta\") but not the uint64_t representation.\n//\n// All three of major, minor and patch being zero means that this is a\n// work-in-progress version, not a release version, and has no backwards or\n// forwards compatibility guarantees.\n//\n// !! Some code generation programs can override WUFFS_VERSION.\n#define WUFFS_VERSION ((uint64_t)0)\n#define WUFFS_VERSION_MAJOR ((uint64_t)0)\n#define WUFFS_VERSION_MINOR ((uint64_t)0)\n#define WUFFS_VERSION_PATCH ((uint64_t)0)\n#define WUFFS_VERSION_EXTENSION \"\"\n#define WUFFS_VERSION_STRING \"0.0.0\"\n\n// wuffs_base__empty_struct is used when a Wuffs function returns an empty\n// struct. In C, if a function f returns void, you can't say \"x = f()\", but in\n// Wuffs, if a function g returns empty, you can say \"y = g(" + "as per https://semver.org/,\n// as a uint64_t. The major number is the high 32 bits. The minor number is the\n// middle 16 bits. The patch number is the low 16 bits. The version extension\n// (such as \"\", \"beta\" or \"rc.1\") is part of the string representation (such as\n// \"1.2.3-beta\") but not the uint64_t representation.\n//\n// All three of major, minor and patch being zero means that this is a\n// work-in-progress version, not a release version, and has no backwards or\n// forwards compatibility guarantees.\n//\n// !! Some code generation programs can override WUFFS_VERSION.\n#define WUFFS_VERSION ((uint64_t)0)\n#define WUFFS_VERSION_MAJOR ((uint64_t)0)\n#define WUFFS_VERSION_MINOR ((uint64_t)0)\n#define WUFFS_VERSION_PATCH ((uint64_t)0)\n#define WUFFS_VERSION_EXTENSION \"\"\n#define WUFFS_VERSION_STRING \"0.0.0\"\n\n// wuffs_base__empty_struct is used when a Wuffs function returns an empty\n// struct. In C, if a function f returns void, you can't say \"x = f()\", but in\n// Wuffs, if a function g returns empty, you can say \"y = g(" +
")\".\ntypedef struct {\n} wuffs_base__empty_struct;\n\n" + ")\".\ntypedef struct {\n} wuffs_base__empty_struct;\n\n" +
"" + "" +
"// --------\n\n// A status code is either zero (OK), positive (a recoverable suspension or\n// pause in processing) or negative (a non-recoverable error).\ntypedef int32_t wuffs_base__status;\n\n// !! INSERT wuffs_base__status names.\n\nstatic inline bool wuffs_base__status__is_error(wuffs_base__status s) {\n return s < 0;\n}\n\nstatic inline bool wuffs_base__status__is_ok(wuffs_base__status s) {\n return s == 0;\n}\n\nstatic inline bool wuffs_base__status__is_suspension(wuffs_base__status s) {\n return s > 0;\n}\n\nconst char* wuffs_base__status__string(wuffs_base__status s);\n\n" + "// --------\n\n// A status code is either zero (OK), positive (a recoverable suspension or\n// pause in processing) or negative (a non-recoverable error). Its bits:\n// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.\n// - bits 30 .. 24 are a package-namespaced numeric code\n// - bits 23 .. 21 are reserved.\n// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.\n//\n// Do not manipulate these bits directly; they are private implementation\n// details. Use methods such as wuffs_base__status__is_error instead.\ntypedef int32_t wuffs_base__status;\n\n// !! INSERT wuffs_base__status names.\n\nstatic inline bool wuffs_base__status__is_error(wuffs_base__status s) {\n return s < 0;\n}\n\nstatic inline bool wuffs_base__status__is_ok(wuffs_base__status s) {\n return s == 0;\n}\n\nstatic inline bool wuffs_base__status__is_suspension(wuffs_base__status s) {\n return s > 0;\n}\n\nconst char* wuffs_base__status__string(wuffs_base__status s);\n\n" +
"" + "" +
"// --------\n\n// Flicks are a unit of time. One flick (frame-tick) is 1 / 705_600_000 of a\n// second. See https://github.com/OculusVR/Flicks\ntypedef int64_t wuffs_base__flicks;\n\n#define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000)\n#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600)\n\n" + "// --------\n\n// Flicks are a unit of time. One flick (frame-tick) is 1 / 705_600_000 of a\n// second. See https://github.com/OculusVR/Flicks\ntypedef int64_t wuffs_base__flicks;\n\n#define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000)\n#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600)\n\n" +
"" + "" +
+1
View File
@@ -56,6 +56,7 @@ uint64_t micros_since_start(struct timespec* now) {
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../gen/c/base.c"
#include "../../gen/c/std/gif.c" #include "../../gen/c/std/gif.c"
#include "../../gen/c/std/lzw.c" #include "../../gen/c/std/lzw.c"
+1
View File
@@ -28,6 +28,7 @@ for a C compiler $cc, such as clang or gcc.
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../gen/c/base.c"
#include "../../gen/c/std/crc32.c" #include "../../gen/c/std/crc32.c"
#include "../../gen/c/std/deflate.c" #include "../../gen/c/std/deflate.c"
#include "../../gen/c/std/gzip.c" #include "../../gen/c/std/gzip.c"
+1
View File
@@ -35,6 +35,7 @@ It should print "PASS", amongst other information, and exit(0).
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../../gen/c/base.c"
#include "../../../gen/c/std/gif.c" #include "../../../gen/c/std/gif.c"
#include "../../../gen/c/std/lzw.c" #include "../../../gen/c/std/lzw.c"
#include "../fuzzlib/fuzzlib.c" #include "../fuzzlib/fuzzlib.c"
+1
View File
@@ -35,6 +35,7 @@ It should print "PASS", amongst other information, and exit(0).
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../../gen/c/base.c"
#include "../../../gen/c/std/adler32.c" #include "../../../gen/c/std/adler32.c"
#include "../../../gen/c/std/deflate.c" #include "../../../gen/c/std/deflate.c"
#include "../../../gen/c/std/zlib.c" #include "../../../gen/c/std/zlib.c"
+8 -1
View File
@@ -69,7 +69,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
+66 -54
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1262,36 +1269,28 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_adler32__status__is_error instead.
typedef int32_t wuffs_adler32__status; typedef int32_t wuffs_adler32__status;
#define wuffs_adler32__packageid 681002 // 0x000A642A #define wuffs_adler32__packageid 681002 // 0x000A642A
#define WUFFS_ADLER32__STATUS_OK 0 // 0x00000000 #define WUFFS_ADLER32__STATUS_OK 0 // 0x00000000
#define WUFFS_ADLER32__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_ADLER32__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_ADLER32__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_ADLER32__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_ADLER32__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_ADLER32__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_ADLER32__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_ADLER32__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_ADLER32__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_ADLER32__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_ADLER32__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_ADLER32__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_ADLER32__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_ADLER32__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_ADLER32__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_ADLER32__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_ADLER32__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_ADLER32__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_ADLER32__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_ADLER32__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_ADLER32__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_ADLER32__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_ADLER32__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_ADLER32__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
bool wuffs_adler32__status__is_error(wuffs_adler32__status s); bool wuffs_adler32__status__is_error(wuffs_adler32__status s);
@@ -1890,25 +1889,6 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(
o->private_impl.bounds[0] = mark; o->private_impl.bounds[0] = mark;
return ((wuffs_base__empty_struct){}); return ((wuffs_base__empty_struct){});
} }
static const char* wuffs_base__status__strings[15] = {
"ok",
"bad wuffs version",
"bad sizeof receiver",
"bad receiver",
"bad argument",
"check_wuffs_version not called",
"check_wuffs_version called twice",
"invalid I/O operation",
"closed for writes",
"unexpected EOF",
"short read",
"short write",
"cannot return a suspension",
"invalid call sequence",
"end of data",
};
#endif // WUFFS_BASE_PRIVATE_H #endif // WUFFS_BASE_PRIVATE_H
// ---------------- Status Codes Implementations // ---------------- Status Codes Implementations
@@ -1917,23 +1897,55 @@ bool wuffs_adler32__status__is_error(wuffs_adler32__status s) {
return s < 0; return s < 0;
} }
const char* wuffs_adler32__status__strings[0] = {}; static const char wuffs_adler32__status__string_data[] = {
0x00,
};
static const uint16_t wuffs_adler32__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,
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,
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,
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,
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,
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,
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,
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,
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,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000,
};
const char* wuffs_adler32__status__string(wuffs_adler32__status s) { const char* wuffs_adler32__status__string(wuffs_adler32__status s) {
const char** a = NULL; uint16_t o;
uint32_t n = 0; switch (s & 0x1FFFFF) {
switch ((s >> 10) & 0x1FFFFF) {
case 0: case 0:
a = wuffs_base__status__strings; return wuffs_base__status__string(s);
n = 15;
break;
case wuffs_adler32__packageid: case wuffs_adler32__packageid:
a = wuffs_adler32__status__strings; o = wuffs_adler32__status__string_offsets[(uint8_t)(s >> 24)];
n = 0; if (o) {
return wuffs_adler32__status__string_data + o;
}
break; break;
} }
uint32_t i = s & 0xFF; return "unknown status";
return i < n ? a[i] : "unknown status";
} }
// ---------------- Private Consts // ---------------- Private Consts
+66 -54
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1262,35 +1269,27 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_crc32__status__is_error instead.
typedef int32_t wuffs_crc32__status; typedef int32_t wuffs_crc32__status;
#define wuffs_crc32__packageid 810620 // 0x000C5E7C #define wuffs_crc32__packageid 810620 // 0x000C5E7C
#define WUFFS_CRC32__STATUS_OK 0 // 0x00000000 #define WUFFS_CRC32__STATUS_OK 0 // 0x00000000
#define WUFFS_CRC32__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_CRC32__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_CRC32__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_CRC32__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_CRC32__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_CRC32__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_CRC32__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_CRC32__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_CRC32__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_CRC32__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_CRC32__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_CRC32__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_CRC32__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_CRC32__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_CRC32__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_CRC32__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_CRC32__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_CRC32__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_CRC32__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_CRC32__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_CRC32__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_CRC32__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_CRC32__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_CRC32__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
bool wuffs_crc32__status__is_error(wuffs_crc32__status s); bool wuffs_crc32__status__is_error(wuffs_crc32__status s);
@@ -1889,25 +1888,6 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(
o->private_impl.bounds[0] = mark; o->private_impl.bounds[0] = mark;
return ((wuffs_base__empty_struct){}); return ((wuffs_base__empty_struct){});
} }
static const char* wuffs_base__status__strings[15] = {
"ok",
"bad wuffs version",
"bad sizeof receiver",
"bad receiver",
"bad argument",
"check_wuffs_version not called",
"check_wuffs_version called twice",
"invalid I/O operation",
"closed for writes",
"unexpected EOF",
"short read",
"short write",
"cannot return a suspension",
"invalid call sequence",
"end of data",
};
#endif // WUFFS_BASE_PRIVATE_H #endif // WUFFS_BASE_PRIVATE_H
// ---------------- Status Codes Implementations // ---------------- Status Codes Implementations
@@ -1916,23 +1896,55 @@ bool wuffs_crc32__status__is_error(wuffs_crc32__status s) {
return s < 0; return s < 0;
} }
const char* wuffs_crc32__status__strings[0] = {}; static const char wuffs_crc32__status__string_data[] = {
0x00,
};
static const uint16_t wuffs_crc32__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,
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,
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,
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,
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,
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,
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,
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,
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,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000,
};
const char* wuffs_crc32__status__string(wuffs_crc32__status s) { const char* wuffs_crc32__status__string(wuffs_crc32__status s) {
const char** a = NULL; uint16_t o;
uint32_t n = 0; switch (s & 0x1FFFFF) {
switch ((s >> 10) & 0x1FFFFF) {
case 0: case 0:
a = wuffs_base__status__strings; return wuffs_base__status__string(s);
n = 15;
break;
case wuffs_crc32__packageid: case wuffs_crc32__packageid:
a = wuffs_crc32__status__strings; o = wuffs_crc32__status__string_offsets[(uint8_t)(s >> 24)];
n = 0; if (o) {
return wuffs_crc32__status__string_data + o;
}
break; break;
} }
uint32_t i = s & 0xFF; return "unknown status";
return i < n ? a[i] : "unknown status";
} }
// ---------------- Private Consts // ---------------- Private Consts
+137 -89
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1262,66 +1269,57 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_deflate__status__is_error instead.
typedef int32_t wuffs_deflate__status; typedef int32_t wuffs_deflate__status;
#define wuffs_deflate__packageid 848533 // 0x000CF295 #define wuffs_deflate__packageid 848533 // 0x000CF295
#define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000 #define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000
#define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \
-1278585856 // 0xB3CA5400 -15928683 // 0xFF0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \
-1278585855 // 0xB3CA5401 -32705899 // 0xFE0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \
-1278585854 // 0xB3CA5402 -49483115 // 0xFD0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \
-1278585853 // 0xB3CA5403 -66260331 // 0xFC0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404 #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -83037547 // 0xFB0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
-1278585851 // 0xB3CA5405 -99814763 // 0xFA0CF295
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406 #define WUFFS_DEFLATE__ERROR_BAD_BLOCK -116591979 // 0xF90CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -133369195 // 0xF80CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -150146411 // 0xF70CF295
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
-1278585847 // 0xB3CA5409 -166923627 // 0xF60CF295
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \ #define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
-1278585846 // 0xB3CA540A -183700843 // 0xF50CF295
#define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE \ #define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE -200478059 // 0xF40CF295
-1278585845 // 0xB3CA540B #define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -217255275 // 0xF30CF295
#define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -1278585844 // 0xB3CA540C
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \
-1278585843 // 0xB3CA540D -1072893291 // 0xC00CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \
-1278585842 // 0xB3CA540E -1089670507 // 0xBF0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \
-1278585841 // 0xB3CA540F -1106447723 // 0xBE0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \
-1278585840 // 0xB3CA5410 -1123224939 // 0xBD0CF295
bool wuffs_deflate__status__is_error(wuffs_deflate__status s); bool wuffs_deflate__status__is_error(wuffs_deflate__status s);
@@ -1980,25 +1978,6 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(
o->private_impl.bounds[0] = mark; o->private_impl.bounds[0] = mark;
return ((wuffs_base__empty_struct){}); return ((wuffs_base__empty_struct){});
} }
static const char* wuffs_base__status__strings[15] = {
"ok",
"bad wuffs version",
"bad sizeof receiver",
"bad receiver",
"bad argument",
"check_wuffs_version not called",
"check_wuffs_version called twice",
"invalid I/O operation",
"closed for writes",
"unexpected EOF",
"short read",
"short write",
"cannot return a suspension",
"invalid call sequence",
"end of data",
};
#endif // WUFFS_BASE_PRIVATE_H #endif // WUFFS_BASE_PRIVATE_H
// ---------------- Status Codes Implementations // ---------------- Status Codes Implementations
@@ -2007,41 +1986,110 @@ bool wuffs_deflate__status__is_error(wuffs_deflate__status s) {
return s < 0; return s < 0;
} }
const char* wuffs_deflate__status__strings[17] = { static const char wuffs_deflate__status__string_data[] = {
"deflate: bad Huffman code (over-subscribed)", 0x00, 0x64, 0x65, 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x69, 0x6E,
"deflate: bad Huffman code (under-subscribed)", 0x74, 0x65, 0x72, 0x6E, 0x61, 0x6C, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72,
"deflate: bad Huffman code length count", 0x3A, 0x20, 0x69, 0x6E, 0x63, 0x6F, 0x6E, 0x73, 0x69, 0x73, 0x74, 0x65,
"deflate: bad Huffman code length repetition", 0x6E, 0x74, 0x20, 0x6E, 0x5F, 0x62, 0x69, 0x74, 0x73, 0x00, 0x64, 0x65,
"deflate: bad Huffman code", 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72,
"deflate: bad Huffman minimum code length", 0x6E, 0x61, 0x6C, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x3A, 0x20, 0x69,
"deflate: bad block", 0x6E, 0x63, 0x6F, 0x6E, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6E, 0x74, 0x20,
"deflate: bad distance", 0x64, 0x69, 0x73, 0x74, 0x61, 0x6E, 0x63, 0x65, 0x00, 0x64, 0x65, 0x66,
"deflate: bad distance code count", 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x6E,
"deflate: bad literal/length code count", 0x61, 0x6C, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x3A, 0x20, 0x69, 0x6E,
"deflate: inconsistent stored block length", 0x63, 0x6F, 0x6E, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6E, 0x74, 0x20, 0x48,
"deflate: missing end-of-block code", 0x75, 0x66, 0x66, 0x6D, 0x61, 0x6E, 0x20, 0x65, 0x6E, 0x64, 0x5F, 0x6F,
"deflate: no Huffman codes", 0x66, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x00, 0x64, 0x65, 0x66, 0x6C,
"deflate: internal error: inconsistent Huffman decoder state", 0x61, 0x74, 0x65, 0x3A, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x61,
"deflate: internal error: inconsistent Huffman end_of_block", 0x6C, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x3A, 0x20, 0x69, 0x6E, 0x63,
"deflate: internal error: inconsistent distance", 0x6F, 0x6E, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6E, 0x74, 0x20, 0x48, 0x75,
"deflate: internal error: inconsistent n_bits", 0x66, 0x66, 0x6D, 0x61, 0x6E, 0x20, 0x64, 0x65, 0x63, 0x6F, 0x64, 0x65,
0x72, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x64, 0x65, 0x66, 0x6C,
0x61, 0x74, 0x65, 0x3A, 0x20, 0x6E, 0x6F, 0x20, 0x48, 0x75, 0x66, 0x66,
0x6D, 0x61, 0x6E, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x73, 0x00, 0x64, 0x65,
0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x6D, 0x69, 0x73, 0x73, 0x69,
0x6E, 0x67, 0x20, 0x65, 0x6E, 0x64, 0x2D, 0x6F, 0x66, 0x2D, 0x62, 0x6C,
0x6F, 0x63, 0x6B, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x00, 0x64, 0x65, 0x66,
0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x69, 0x6E, 0x63, 0x6F, 0x6E, 0x73,
0x69, 0x73, 0x74, 0x65, 0x6E, 0x74, 0x20, 0x73, 0x74, 0x6F, 0x72, 0x65,
0x64, 0x20, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x6C, 0x65, 0x6E, 0x67,
0x74, 0x68, 0x00, 0x64, 0x65, 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20,
0x62, 0x61, 0x64, 0x20, 0x6C, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6C, 0x2F,
0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x20,
0x63, 0x6F, 0x75, 0x6E, 0x74, 0x00, 0x64, 0x65, 0x66, 0x6C, 0x61, 0x74,
0x65, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20, 0x64, 0x69, 0x73, 0x74, 0x61,
0x6E, 0x63, 0x65, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x20, 0x63, 0x6F, 0x75,
0x6E, 0x74, 0x00, 0x64, 0x65, 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20,
0x62, 0x61, 0x64, 0x20, 0x64, 0x69, 0x73, 0x74, 0x61, 0x6E, 0x63, 0x65,
0x00, 0x64, 0x65, 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x62, 0x61,
0x64, 0x20, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x00, 0x64, 0x65, 0x66, 0x6C,
0x61, 0x74, 0x65, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20, 0x48, 0x75, 0x66,
0x66, 0x6D, 0x61, 0x6E, 0x20, 0x6D, 0x69, 0x6E, 0x69, 0x6D, 0x75, 0x6D,
0x20, 0x63, 0x6F, 0x64, 0x65, 0x20, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68,
0x00, 0x64, 0x65, 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x62, 0x61,
0x64, 0x20, 0x48, 0x75, 0x66, 0x66, 0x6D, 0x61, 0x6E, 0x20, 0x63, 0x6F,
0x64, 0x65, 0x00, 0x64, 0x65, 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20,
0x62, 0x61, 0x64, 0x20, 0x48, 0x75, 0x66, 0x66, 0x6D, 0x61, 0x6E, 0x20,
0x63, 0x6F, 0x64, 0x65, 0x20, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x20,
0x72, 0x65, 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x64,
0x65, 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20,
0x48, 0x75, 0x66, 0x66, 0x6D, 0x61, 0x6E, 0x20, 0x63, 0x6F, 0x64, 0x65,
0x20, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x20, 0x63, 0x6F, 0x75, 0x6E,
0x74, 0x00, 0x64, 0x65, 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x62,
0x61, 0x64, 0x20, 0x48, 0x75, 0x66, 0x66, 0x6D, 0x61, 0x6E, 0x20, 0x63,
0x6F, 0x64, 0x65, 0x20, 0x28, 0x75, 0x6E, 0x64, 0x65, 0x72, 0x2D, 0x73,
0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x29, 0x00, 0x64,
0x65, 0x66, 0x6C, 0x61, 0x74, 0x65, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20,
0x48, 0x75, 0x66, 0x66, 0x6D, 0x61, 0x6E, 0x20, 0x63, 0x6F, 0x64, 0x65,
0x20, 0x28, 0x6F, 0x76, 0x65, 0x72, 0x2D, 0x73, 0x75, 0x62, 0x73, 0x63,
0x72, 0x69, 0x62, 0x65, 0x64, 0x29, 0x00,
};
static const uint16_t wuffs_deflate__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,
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,
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,
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,
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,
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,
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,
0x0001, 0x002E, 0x005D, 0x0098, 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, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x00D4, 0x00EE, 0x0111, 0x013B, 0x0162, 0x0183, 0x0199, 0x01AC, 0x01D5,
0x01EF, 0x021B, 0x0242, 0x026F,
}; };
const char* wuffs_deflate__status__string(wuffs_deflate__status s) { const char* wuffs_deflate__status__string(wuffs_deflate__status s) {
const char** a = NULL; uint16_t o;
uint32_t n = 0; switch (s & 0x1FFFFF) {
switch ((s >> 10) & 0x1FFFFF) {
case 0: case 0:
a = wuffs_base__status__strings; return wuffs_base__status__string(s);
n = 15;
break;
case wuffs_deflate__packageid: case wuffs_deflate__packageid:
a = wuffs_deflate__status__strings; o = wuffs_deflate__status__string_offsets[(uint8_t)(s >> 24)];
n = 17; if (o) {
return wuffs_deflate__status__string_data + o;
}
break; break;
} }
uint32_t i = s & 0xFF; return "unknown status";
return i < n ? a[i] : "unknown status";
} }
// ---------------- Private Consts // ---------------- Private Consts
+106 -91
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1271,38 +1278,30 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_lzw__status__is_error instead.
typedef int32_t wuffs_lzw__status; typedef int32_t wuffs_lzw__status;
#define wuffs_lzw__packageid 1316776 // 0x001417A8 #define wuffs_lzw__packageid 1316776 // 0x001417A8
#define WUFFS_LZW__STATUS_OK 0 // 0x00000000 #define WUFFS_LZW__STATUS_OK 0 // 0x00000000
#define WUFFS_LZW__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_LZW__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_LZW__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_LZW__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_LZW__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_LZW__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_LZW__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_LZW__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_LZW__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_LZW__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_LZW__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_LZW__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_LZW__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_LZW__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_LZW__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_LZW__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_LZW__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_LZW__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_LZW__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_LZW__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_LZW__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_LZW__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_LZW__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_LZW__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_LZW__ERROR_BAD_CODE -799105024 // 0xD05EA000 #define WUFFS_LZW__ERROR_BAD_CODE -15460440 // 0xFF1417A8
#define WUFFS_LZW__ERROR_CYCLICAL_PREFIX_CHAIN -799105023 // 0xD05EA001 #define WUFFS_LZW__ERROR_CYCLICAL_PREFIX_CHAIN -32237656 // 0xFE1417A8
bool wuffs_lzw__status__is_error(wuffs_lzw__status s); bool wuffs_lzw__status__is_error(wuffs_lzw__status s);
@@ -1381,45 +1380,37 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_gif__status__is_error instead.
typedef int32_t wuffs_gif__status; typedef int32_t wuffs_gif__status;
#define wuffs_gif__packageid 1017222 // 0x000F8586 #define wuffs_gif__packageid 1017222 // 0x000F8586
#define WUFFS_GIF__STATUS_OK 0 // 0x00000000 #define WUFFS_GIF__STATUS_OK 0 // 0x00000000
#define WUFFS_GIF__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_GIF__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_GIF__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_GIF__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_GIF__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_GIF__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_GIF__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_GIF__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_GIF__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_GIF__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_GIF__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_GIF__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_GIF__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_GIF__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_GIF__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_GIF__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_GIF__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_GIF__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_GIF__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_GIF__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_GIF__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_GIF__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_GIF__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_GIF__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_GIF__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_GIF__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_GIF__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_GIF__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_GIF__ERROR_BAD_BLOCK -1105848320 // 0xBE161800 #define WUFFS_GIF__ERROR_BAD_BLOCK -15759994 // 0xFF0F8586
#define WUFFS_GIF__ERROR_BAD_EXTENSION_LABEL -1105848319 // 0xBE161801 #define WUFFS_GIF__ERROR_BAD_EXTENSION_LABEL -32537210 // 0xFE0F8586
#define WUFFS_GIF__ERROR_BAD_GRAPHIC_CONTROL -1105848318 // 0xBE161802 #define WUFFS_GIF__ERROR_BAD_GRAPHIC_CONTROL -49314426 // 0xFD0F8586
#define WUFFS_GIF__ERROR_BAD_HEADER -1105848317 // 0xBE161803 #define WUFFS_GIF__ERROR_BAD_HEADER -66091642 // 0xFC0F8586
#define WUFFS_GIF__ERROR_BAD_LITERAL_WIDTH -1105848316 // 0xBE161804 #define WUFFS_GIF__ERROR_BAD_LITERAL_WIDTH -82868858 // 0xFB0F8586
#define WUFFS_GIF__ERROR_NOT_ENOUGH_PIXEL_DATA -1105848315 // 0xBE161805 #define WUFFS_GIF__ERROR_NOT_ENOUGH_PIXEL_DATA -99646074 // 0xFA0F8586
#define WUFFS_GIF__ERROR_TOO_MUCH_PIXEL_DATA -1105848314 // 0xBE161806 #define WUFFS_GIF__ERROR_TOO_MUCH_PIXEL_DATA -116423290 // 0xF90F8586
#define WUFFS_GIF__ERROR_INTERNAL_ERROR_INCONSISTENT_RI_WI \ #define WUFFS_GIF__ERROR_INTERNAL_ERROR_INCONSISTENT_RI_WI \
-1105848313 // 0xBE161807 -1072724602 // 0xC00F8586
bool wuffs_gif__status__is_error(wuffs_gif__status s); bool wuffs_gif__status__is_error(wuffs_gif__status s);
@@ -2119,25 +2110,6 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(
o->private_impl.bounds[0] = mark; o->private_impl.bounds[0] = mark;
return ((wuffs_base__empty_struct){}); return ((wuffs_base__empty_struct){});
} }
static const char* wuffs_base__status__strings[15] = {
"ok",
"bad wuffs version",
"bad sizeof receiver",
"bad receiver",
"bad argument",
"check_wuffs_version not called",
"check_wuffs_version called twice",
"invalid I/O operation",
"closed for writes",
"unexpected EOF",
"short read",
"short write",
"cannot return a suspension",
"invalid call sequence",
"end of data",
};
#endif // WUFFS_BASE_PRIVATE_H #endif // WUFFS_BASE_PRIVATE_H
// ---------------- Status Codes Implementations // ---------------- Status Codes Implementations
@@ -2146,30 +2118,73 @@ bool wuffs_gif__status__is_error(wuffs_gif__status s) {
return s < 0; return s < 0;
} }
const char* wuffs_gif__status__strings[8] = { static const char wuffs_gif__status__string_data[] = {
"gif: bad block", "gif: bad extension label", 0x00, 0x67, 0x69, 0x66, 0x3A, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x6E,
"gif: bad graphic control", "gif: bad header", 0x61, 0x6C, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x3A, 0x20, 0x69, 0x6E,
"gif: bad literal width", "gif: not enough pixel data", 0x63, 0x6F, 0x6E, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6E, 0x74, 0x20, 0x72,
"gif: too much pixel data", "gif: internal error: inconsistent ri/wi", 0x69, 0x2F, 0x77, 0x69, 0x00, 0x67, 0x69, 0x66, 0x3A, 0x20, 0x74, 0x6F,
0x6F, 0x20, 0x6D, 0x75, 0x63, 0x68, 0x20, 0x70, 0x69, 0x78, 0x65, 0x6C,
0x20, 0x64, 0x61, 0x74, 0x61, 0x00, 0x67, 0x69, 0x66, 0x3A, 0x20, 0x6E,
0x6F, 0x74, 0x20, 0x65, 0x6E, 0x6F, 0x75, 0x67, 0x68, 0x20, 0x70, 0x69,
0x78, 0x65, 0x6C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x00, 0x67, 0x69, 0x66,
0x3A, 0x20, 0x62, 0x61, 0x64, 0x20, 0x6C, 0x69, 0x74, 0x65, 0x72, 0x61,
0x6C, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x00, 0x67, 0x69, 0x66, 0x3A,
0x20, 0x62, 0x61, 0x64, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00,
0x67, 0x69, 0x66, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20, 0x67, 0x72, 0x61,
0x70, 0x68, 0x69, 0x63, 0x20, 0x63, 0x6F, 0x6E, 0x74, 0x72, 0x6F, 0x6C,
0x00, 0x67, 0x69, 0x66, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20, 0x65, 0x78,
0x74, 0x65, 0x6E, 0x73, 0x69, 0x6F, 0x6E, 0x20, 0x6C, 0x61, 0x62, 0x65,
0x6C, 0x00, 0x67, 0x69, 0x66, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20, 0x62,
0x6C, 0x6F, 0x63, 0x6B, 0x00,
};
static const uint16_t wuffs_gif__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,
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,
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,
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,
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,
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,
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,
0x0000, 0x0000, 0x0000, 0x0001, 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, 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, 0x0000, 0x0000, 0x0029, 0x0042, 0x005D,
0x0074, 0x0084, 0x009D, 0x00B6,
}; };
const char* wuffs_gif__status__string(wuffs_gif__status s) { const char* wuffs_gif__status__string(wuffs_gif__status s) {
const char** a = NULL; uint16_t o;
uint32_t n = 0; switch (s & 0x1FFFFF) {
switch ((s >> 10) & 0x1FFFFF) {
case 0: case 0:
a = wuffs_base__status__strings; return wuffs_base__status__string(s);
n = 15;
break;
case wuffs_gif__packageid: case wuffs_gif__packageid:
a = wuffs_gif__status__strings; o = wuffs_gif__status__string_offsets[(uint8_t)(s >> 24)];
n = 8; if (o) {
return wuffs_gif__status__string_data + o;
}
break; break;
case wuffs_lzw__packageid: case wuffs_lzw__packageid:
return wuffs_lzw__status__string(s); return wuffs_lzw__status__string(s);
} }
uint32_t i = s & 0xFF; return "unknown status";
return i < n ? a[i] : "unknown status";
} }
// ---------------- Private Consts // ---------------- Private Consts
+123 -126
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1271,35 +1278,27 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_crc32__status__is_error instead.
typedef int32_t wuffs_crc32__status; typedef int32_t wuffs_crc32__status;
#define wuffs_crc32__packageid 810620 // 0x000C5E7C #define wuffs_crc32__packageid 810620 // 0x000C5E7C
#define WUFFS_CRC32__STATUS_OK 0 // 0x00000000 #define WUFFS_CRC32__STATUS_OK 0 // 0x00000000
#define WUFFS_CRC32__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_CRC32__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_CRC32__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_CRC32__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_CRC32__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_CRC32__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_CRC32__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_CRC32__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_CRC32__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_CRC32__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_CRC32__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_CRC32__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_CRC32__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_CRC32__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_CRC32__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_CRC32__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_CRC32__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_CRC32__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_CRC32__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_CRC32__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_CRC32__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_CRC32__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_CRC32__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_CRC32__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
bool wuffs_crc32__status__is_error(wuffs_crc32__status s); bool wuffs_crc32__status__is_error(wuffs_crc32__status s);
@@ -1366,66 +1365,57 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_deflate__status__is_error instead.
typedef int32_t wuffs_deflate__status; typedef int32_t wuffs_deflate__status;
#define wuffs_deflate__packageid 848533 // 0x000CF295 #define wuffs_deflate__packageid 848533 // 0x000CF295
#define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000 #define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000
#define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \
-1278585856 // 0xB3CA5400 -15928683 // 0xFF0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \
-1278585855 // 0xB3CA5401 -32705899 // 0xFE0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \
-1278585854 // 0xB3CA5402 -49483115 // 0xFD0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \
-1278585853 // 0xB3CA5403 -66260331 // 0xFC0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404 #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -83037547 // 0xFB0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
-1278585851 // 0xB3CA5405 -99814763 // 0xFA0CF295
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406 #define WUFFS_DEFLATE__ERROR_BAD_BLOCK -116591979 // 0xF90CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -133369195 // 0xF80CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -150146411 // 0xF70CF295
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
-1278585847 // 0xB3CA5409 -166923627 // 0xF60CF295
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \ #define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
-1278585846 // 0xB3CA540A -183700843 // 0xF50CF295
#define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE \ #define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE -200478059 // 0xF40CF295
-1278585845 // 0xB3CA540B #define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -217255275 // 0xF30CF295
#define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -1278585844 // 0xB3CA540C
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \
-1278585843 // 0xB3CA540D -1072893291 // 0xC00CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \
-1278585842 // 0xB3CA540E -1089670507 // 0xBF0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \
-1278585841 // 0xB3CA540F -1106447723 // 0xBE0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \
-1278585840 // 0xB3CA5410 -1123224939 // 0xBD0CF295
bool wuffs_deflate__status__is_error(wuffs_deflate__status s); bool wuffs_deflate__status__is_error(wuffs_deflate__status s);
@@ -1543,40 +1533,32 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_gzip__status__is_error instead.
typedef int32_t wuffs_gzip__status; typedef int32_t wuffs_gzip__status;
#define wuffs_gzip__packageid 1041911 // 0x000FE5F7 #define wuffs_gzip__packageid 1041911 // 0x000FE5F7
#define WUFFS_GZIP__STATUS_OK 0 // 0x00000000 #define WUFFS_GZIP__STATUS_OK 0 // 0x00000000
#define WUFFS_GZIP__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_GZIP__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_GZIP__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_GZIP__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_GZIP__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_GZIP__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_GZIP__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_GZIP__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_GZIP__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_GZIP__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_GZIP__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_GZIP__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_GZIP__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_GZIP__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_GZIP__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_GZIP__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_GZIP__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_GZIP__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_GZIP__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_GZIP__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_GZIP__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_GZIP__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_GZIP__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_GZIP__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_GZIP__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_GZIP__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_GZIP__ERROR_BAD_CHECKSUM -1080566784 // 0xBF97DC00 #define WUFFS_GZIP__ERROR_BAD_CHECKSUM -15735305 // 0xFF0FE5F7
#define WUFFS_GZIP__ERROR_BAD_COMPRESSION_METHOD -1080566783 // 0xBF97DC01 #define WUFFS_GZIP__ERROR_BAD_COMPRESSION_METHOD -32512521 // 0xFE0FE5F7
#define WUFFS_GZIP__ERROR_BAD_ENCODING_FLAGS -1080566782 // 0xBF97DC02 #define WUFFS_GZIP__ERROR_BAD_ENCODING_FLAGS -49289737 // 0xFD0FE5F7
#define WUFFS_GZIP__ERROR_BAD_HEADER -1080566781 // 0xBF97DC03 #define WUFFS_GZIP__ERROR_BAD_HEADER -66066953 // 0xFC0FE5F7
bool wuffs_gzip__status__is_error(wuffs_gzip__status s); bool wuffs_gzip__status__is_error(wuffs_gzip__status s);
@@ -2192,25 +2174,6 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(
o->private_impl.bounds[0] = mark; o->private_impl.bounds[0] = mark;
return ((wuffs_base__empty_struct){}); return ((wuffs_base__empty_struct){});
} }
static const char* wuffs_base__status__strings[15] = {
"ok",
"bad wuffs version",
"bad sizeof receiver",
"bad receiver",
"bad argument",
"check_wuffs_version not called",
"check_wuffs_version called twice",
"invalid I/O operation",
"closed for writes",
"unexpected EOF",
"short read",
"short write",
"cannot return a suspension",
"invalid call sequence",
"end of data",
};
#endif // WUFFS_BASE_PRIVATE_H #endif // WUFFS_BASE_PRIVATE_H
// ---------------- Status Codes Implementations // ---------------- Status Codes Implementations
@@ -2219,32 +2182,66 @@ bool wuffs_gzip__status__is_error(wuffs_gzip__status s) {
return s < 0; return s < 0;
} }
const char* wuffs_gzip__status__strings[4] = { static const char wuffs_gzip__status__string_data[] = {
"gzip: bad checksum", 0x00, 0x67, 0x7A, 0x69, 0x70, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20, 0x68,
"gzip: bad compression method", 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x67, 0x7A, 0x69, 0x70, 0x3A, 0x20,
"gzip: bad encoding flags", 0x62, 0x61, 0x64, 0x20, 0x65, 0x6E, 0x63, 0x6F, 0x64, 0x69, 0x6E, 0x67,
"gzip: bad header", 0x20, 0x66, 0x6C, 0x61, 0x67, 0x73, 0x00, 0x67, 0x7A, 0x69, 0x70, 0x3A,
0x20, 0x62, 0x61, 0x64, 0x20, 0x63, 0x6F, 0x6D, 0x70, 0x72, 0x65, 0x73,
0x73, 0x69, 0x6F, 0x6E, 0x20, 0x6D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x00,
0x67, 0x7A, 0x69, 0x70, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20, 0x63, 0x68,
0x65, 0x63, 0x6B, 0x73, 0x75, 0x6D, 0x00,
};
static const uint16_t wuffs_gzip__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,
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,
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,
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,
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,
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,
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,
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,
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,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0001, 0x0012, 0x002B, 0x0048,
}; };
const char* wuffs_gzip__status__string(wuffs_gzip__status s) { const char* wuffs_gzip__status__string(wuffs_gzip__status s) {
const char** a = NULL; uint16_t o;
uint32_t n = 0; switch (s & 0x1FFFFF) {
switch ((s >> 10) & 0x1FFFFF) {
case 0: case 0:
a = wuffs_base__status__strings; return wuffs_base__status__string(s);
n = 15;
break;
case wuffs_gzip__packageid: case wuffs_gzip__packageid:
a = wuffs_gzip__status__strings; o = wuffs_gzip__status__string_offsets[(uint8_t)(s >> 24)];
n = 4; if (o) {
return wuffs_gzip__status__string_data + o;
}
break; break;
case wuffs_crc32__packageid: case wuffs_crc32__packageid:
return wuffs_crc32__status__string(s); return wuffs_crc32__status__string(s);
case wuffs_deflate__packageid: case wuffs_deflate__packageid:
return wuffs_deflate__status__string(s); return wuffs_deflate__status__string(s);
} }
uint32_t i = s & 0xFF; return "unknown status";
return i < n ? a[i] : "unknown status";
} }
// ---------------- Private Consts // ---------------- Private Consts
+70 -58
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1262,38 +1269,30 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_lzw__status__is_error instead.
typedef int32_t wuffs_lzw__status; typedef int32_t wuffs_lzw__status;
#define wuffs_lzw__packageid 1316776 // 0x001417A8 #define wuffs_lzw__packageid 1316776 // 0x001417A8
#define WUFFS_LZW__STATUS_OK 0 // 0x00000000 #define WUFFS_LZW__STATUS_OK 0 // 0x00000000
#define WUFFS_LZW__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_LZW__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_LZW__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_LZW__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_LZW__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_LZW__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_LZW__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_LZW__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_LZW__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_LZW__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_LZW__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_LZW__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_LZW__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_LZW__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_LZW__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_LZW__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_LZW__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_LZW__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_LZW__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_LZW__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_LZW__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_LZW__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_LZW__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_LZW__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_LZW__ERROR_BAD_CODE -799105024 // 0xD05EA000 #define WUFFS_LZW__ERROR_BAD_CODE -15460440 // 0xFF1417A8
#define WUFFS_LZW__ERROR_CYCLICAL_PREFIX_CHAIN -799105023 // 0xD05EA001 #define WUFFS_LZW__ERROR_CYCLICAL_PREFIX_CHAIN -32237656 // 0xFE1417A8
bool wuffs_lzw__status__is_error(wuffs_lzw__status s); bool wuffs_lzw__status__is_error(wuffs_lzw__status s);
@@ -1913,25 +1912,6 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(
o->private_impl.bounds[0] = mark; o->private_impl.bounds[0] = mark;
return ((wuffs_base__empty_struct){}); return ((wuffs_base__empty_struct){});
} }
static const char* wuffs_base__status__strings[15] = {
"ok",
"bad wuffs version",
"bad sizeof receiver",
"bad receiver",
"bad argument",
"check_wuffs_version not called",
"check_wuffs_version called twice",
"invalid I/O operation",
"closed for writes",
"unexpected EOF",
"short read",
"short write",
"cannot return a suspension",
"invalid call sequence",
"end of data",
};
#endif // WUFFS_BASE_PRIVATE_H #endif // WUFFS_BASE_PRIVATE_H
// ---------------- Status Codes Implementations // ---------------- Status Codes Implementations
@@ -1940,26 +1920,58 @@ bool wuffs_lzw__status__is_error(wuffs_lzw__status s) {
return s < 0; return s < 0;
} }
const char* wuffs_lzw__status__strings[2] = { static const char wuffs_lzw__status__string_data[] = {
"lzw: bad code", 0x00, 0x6C, 0x7A, 0x77, 0x3A, 0x20, 0x63, 0x79, 0x63, 0x6C, 0x69,
"lzw: cyclical prefix chain", 0x63, 0x61, 0x6C, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x20,
0x63, 0x68, 0x61, 0x69, 0x6E, 0x00, 0x6C, 0x7A, 0x77, 0x3A, 0x20,
0x62, 0x61, 0x64, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x00,
};
static const uint16_t wuffs_lzw__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,
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,
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,
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,
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,
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,
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,
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,
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,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0001, 0x001C,
}; };
const char* wuffs_lzw__status__string(wuffs_lzw__status s) { const char* wuffs_lzw__status__string(wuffs_lzw__status s) {
const char** a = NULL; uint16_t o;
uint32_t n = 0; switch (s & 0x1FFFFF) {
switch ((s >> 10) & 0x1FFFFF) {
case 0: case 0:
a = wuffs_base__status__strings; return wuffs_base__status__string(s);
n = 15;
break;
case wuffs_lzw__packageid: case wuffs_lzw__packageid:
a = wuffs_lzw__status__strings; o = wuffs_lzw__status__string_offsets[(uint8_t)(s >> 24)];
n = 2; if (o) {
return wuffs_lzw__status__string_data + o;
}
break; break;
} }
uint32_t i = s & 0xFF; return "unknown status";
return i < n ? a[i] : "unknown status";
} }
// ---------------- Private Consts // ---------------- Private Consts
+129 -128
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1271,36 +1278,28 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_adler32__status__is_error instead.
typedef int32_t wuffs_adler32__status; typedef int32_t wuffs_adler32__status;
#define wuffs_adler32__packageid 681002 // 0x000A642A #define wuffs_adler32__packageid 681002 // 0x000A642A
#define WUFFS_ADLER32__STATUS_OK 0 // 0x00000000 #define WUFFS_ADLER32__STATUS_OK 0 // 0x00000000
#define WUFFS_ADLER32__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_ADLER32__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_ADLER32__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_ADLER32__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_ADLER32__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_ADLER32__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_ADLER32__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_ADLER32__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_ADLER32__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_ADLER32__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_ADLER32__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_ADLER32__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_ADLER32__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_ADLER32__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_ADLER32__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_ADLER32__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_ADLER32__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_ADLER32__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_ADLER32__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_ADLER32__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_ADLER32__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_ADLER32__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_ADLER32__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_ADLER32__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
bool wuffs_adler32__status__is_error(wuffs_adler32__status s); bool wuffs_adler32__status__is_error(wuffs_adler32__status s);
@@ -1367,66 +1366,57 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_deflate__status__is_error instead.
typedef int32_t wuffs_deflate__status; typedef int32_t wuffs_deflate__status;
#define wuffs_deflate__packageid 848533 // 0x000CF295 #define wuffs_deflate__packageid 848533 // 0x000CF295
#define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000 #define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000
#define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \
-1278585856 // 0xB3CA5400 -15928683 // 0xFF0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \
-1278585855 // 0xB3CA5401 -32705899 // 0xFE0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \
-1278585854 // 0xB3CA5402 -49483115 // 0xFD0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \
-1278585853 // 0xB3CA5403 -66260331 // 0xFC0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404 #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -83037547 // 0xFB0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
-1278585851 // 0xB3CA5405 -99814763 // 0xFA0CF295
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406 #define WUFFS_DEFLATE__ERROR_BAD_BLOCK -116591979 // 0xF90CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -133369195 // 0xF80CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -150146411 // 0xF70CF295
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
-1278585847 // 0xB3CA5409 -166923627 // 0xF60CF295
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \ #define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
-1278585846 // 0xB3CA540A -183700843 // 0xF50CF295
#define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE \ #define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE -200478059 // 0xF40CF295
-1278585845 // 0xB3CA540B #define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -217255275 // 0xF30CF295
#define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -1278585844 // 0xB3CA540C
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \
-1278585843 // 0xB3CA540D -1072893291 // 0xC00CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \
-1278585842 // 0xB3CA540E -1089670507 // 0xBF0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \
-1278585841 // 0xB3CA540F -1106447723 // 0xBE0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \
-1278585840 // 0xB3CA5410 -1123224939 // 0xBD0CF295
bool wuffs_deflate__status__is_error(wuffs_deflate__status s); bool wuffs_deflate__status__is_error(wuffs_deflate__status s);
@@ -1544,42 +1534,34 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_zlib__status__is_error instead.
typedef int32_t wuffs_zlib__status; typedef int32_t wuffs_zlib__status;
#define wuffs_zlib__packageid 2064249 // 0x001F7F79 #define wuffs_zlib__packageid 2064249 // 0x001F7F79
#define WUFFS_ZLIB__STATUS_OK 0 // 0x00000000 #define WUFFS_ZLIB__STATUS_OK 0 // 0x00000000
#define WUFFS_ZLIB__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_ZLIB__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_ZLIB__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_ZLIB__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_ZLIB__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_ZLIB__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_ZLIB__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_ZLIB__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_ZLIB__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_ZLIB__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_ZLIB__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_ZLIB__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_ZLIB__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_ZLIB__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_ZLIB__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_ZLIB__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_ZLIB__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_ZLIB__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_ZLIB__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_ZLIB__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_ZLIB__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_ZLIB__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_ZLIB__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_ZLIB__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_ZLIB__ERROR_BAD_CHECKSUM -33692672 // 0xFDFDE400 #define WUFFS_ZLIB__ERROR_BAD_CHECKSUM -14712967 // 0xFF1F7F79
#define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_METHOD -33692671 // 0xFDFDE401 #define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_METHOD -31490183 // 0xFE1F7F79
#define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_WINDOW_SIZE -33692670 // 0xFDFDE402 #define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_WINDOW_SIZE -48267399 // 0xFD1F7F79
#define WUFFS_ZLIB__ERROR_BAD_PARITY_CHECK -33692669 // 0xFDFDE403 #define WUFFS_ZLIB__ERROR_BAD_PARITY_CHECK -65044615 // 0xFC1F7F79
#define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \ #define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \
-33692668 // 0xFDFDE404 -1071677575 // 0xC01F7F79
bool wuffs_zlib__status__is_error(wuffs_zlib__status s); bool wuffs_zlib__status__is_error(wuffs_zlib__status s);
@@ -2191,25 +2173,6 @@ static inline wuffs_base__empty_struct wuffs_base__io_writer__set_mark(
o->private_impl.bounds[0] = mark; o->private_impl.bounds[0] = mark;
return ((wuffs_base__empty_struct){}); return ((wuffs_base__empty_struct){});
} }
static const char* wuffs_base__status__strings[15] = {
"ok",
"bad wuffs version",
"bad sizeof receiver",
"bad receiver",
"bad argument",
"check_wuffs_version not called",
"check_wuffs_version called twice",
"invalid I/O operation",
"closed for writes",
"unexpected EOF",
"short read",
"short write",
"cannot return a suspension",
"invalid call sequence",
"end of data",
};
#endif // WUFFS_BASE_PRIVATE_H #endif // WUFFS_BASE_PRIVATE_H
// ---------------- Status Codes Implementations // ---------------- Status Codes Implementations
@@ -2218,33 +2181,71 @@ bool wuffs_zlib__status__is_error(wuffs_zlib__status s) {
return s < 0; return s < 0;
} }
const char* wuffs_zlib__status__strings[5] = { static const char wuffs_zlib__status__string_data[] = {
"zlib: bad checksum", 0x00, 0x7A, 0x6C, 0x69, 0x62, 0x3A, 0x20, 0x54, 0x4F, 0x44, 0x4F, 0x3A,
"zlib: bad compression method", 0x20, 0x75, 0x6E, 0x73, 0x75, 0x70, 0x70, 0x6F, 0x72, 0x74, 0x65, 0x64,
"zlib: bad compression window size", 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x74, 0x20, 0x64, 0x69, 0x63, 0x74,
"zlib: bad parity check", 0x69, 0x6F, 0x6E, 0x61, 0x72, 0x79, 0x00, 0x7A, 0x6C, 0x69, 0x62, 0x3A,
"zlib: TODO: unsupported preset dictionary", 0x20, 0x62, 0x61, 0x64, 0x20, 0x70, 0x61, 0x72, 0x69, 0x74, 0x79, 0x20,
0x63, 0x68, 0x65, 0x63, 0x6B, 0x00, 0x7A, 0x6C, 0x69, 0x62, 0x3A, 0x20,
0x62, 0x61, 0x64, 0x20, 0x63, 0x6F, 0x6D, 0x70, 0x72, 0x65, 0x73, 0x73,
0x69, 0x6F, 0x6E, 0x20, 0x77, 0x69, 0x6E, 0x64, 0x6F, 0x77, 0x20, 0x73,
0x69, 0x7A, 0x65, 0x00, 0x7A, 0x6C, 0x69, 0x62, 0x3A, 0x20, 0x62, 0x61,
0x64, 0x20, 0x63, 0x6F, 0x6D, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6F,
0x6E, 0x20, 0x6D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x00, 0x7A, 0x6C, 0x69,
0x62, 0x3A, 0x20, 0x62, 0x61, 0x64, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6B,
0x73, 0x75, 0x6D, 0x00,
};
static const uint16_t wuffs_zlib__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,
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,
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,
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,
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,
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,
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,
0x0000, 0x0000, 0x0000, 0x0001, 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, 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, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x002B, 0x0042, 0x0064, 0x0081,
}; };
const char* wuffs_zlib__status__string(wuffs_zlib__status s) { const char* wuffs_zlib__status__string(wuffs_zlib__status s) {
const char** a = NULL; uint16_t o;
uint32_t n = 0; switch (s & 0x1FFFFF) {
switch ((s >> 10) & 0x1FFFFF) {
case 0: case 0:
a = wuffs_base__status__strings; return wuffs_base__status__string(s);
n = 15;
break;
case wuffs_zlib__packageid: case wuffs_zlib__packageid:
a = wuffs_zlib__status__strings; o = wuffs_zlib__status__string_offsets[(uint8_t)(s >> 24)];
n = 5; if (o) {
return wuffs_zlib__status__string_data + o;
}
break; break;
case wuffs_adler32__packageid: case wuffs_adler32__packageid:
return wuffs_adler32__status__string(s); return wuffs_adler32__status__string(s);
case wuffs_deflate__packageid: case wuffs_deflate__packageid:
return wuffs_deflate__status__string(s); return wuffs_deflate__status__string(s);
} }
uint32_t i = s & 0xFF; return "unknown status";
return i < n ? a[i] : "unknown status";
} }
// ---------------- Private Consts // ---------------- Private Consts
+23 -24
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1262,36 +1269,28 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_adler32__status__is_error instead.
typedef int32_t wuffs_adler32__status; typedef int32_t wuffs_adler32__status;
#define wuffs_adler32__packageid 681002 // 0x000A642A #define wuffs_adler32__packageid 681002 // 0x000A642A
#define WUFFS_ADLER32__STATUS_OK 0 // 0x00000000 #define WUFFS_ADLER32__STATUS_OK 0 // 0x00000000
#define WUFFS_ADLER32__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_ADLER32__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_ADLER32__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_ADLER32__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_ADLER32__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_ADLER32__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_ADLER32__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_ADLER32__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_ADLER32__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_ADLER32__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_ADLER32__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_ADLER32__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_ADLER32__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_ADLER32__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_ADLER32__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_ADLER32__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_ADLER32__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_ADLER32__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_ADLER32__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_ADLER32__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_ADLER32__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_ADLER32__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_ADLER32__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_ADLER32__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
bool wuffs_adler32__status__is_error(wuffs_adler32__status s); bool wuffs_adler32__status__is_error(wuffs_adler32__status s);
+23 -24
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1262,35 +1269,27 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_crc32__status__is_error instead.
typedef int32_t wuffs_crc32__status; typedef int32_t wuffs_crc32__status;
#define wuffs_crc32__packageid 810620 // 0x000C5E7C #define wuffs_crc32__packageid 810620 // 0x000C5E7C
#define WUFFS_CRC32__STATUS_OK 0 // 0x00000000 #define WUFFS_CRC32__STATUS_OK 0 // 0x00000000
#define WUFFS_CRC32__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_CRC32__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_CRC32__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_CRC32__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_CRC32__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_CRC32__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_CRC32__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_CRC32__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_CRC32__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_CRC32__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_CRC32__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_CRC32__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_CRC32__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_CRC32__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_CRC32__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_CRC32__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_CRC32__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_CRC32__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_CRC32__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_CRC32__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_CRC32__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_CRC32__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_CRC32__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_CRC32__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
bool wuffs_crc32__status__is_error(wuffs_crc32__status s); bool wuffs_crc32__status__is_error(wuffs_crc32__status s);
+40 -42
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1262,66 +1269,57 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_deflate__status__is_error instead.
typedef int32_t wuffs_deflate__status; typedef int32_t wuffs_deflate__status;
#define wuffs_deflate__packageid 848533 // 0x000CF295 #define wuffs_deflate__packageid 848533 // 0x000CF295
#define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000 #define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000
#define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \
-1278585856 // 0xB3CA5400 -15928683 // 0xFF0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \
-1278585855 // 0xB3CA5401 -32705899 // 0xFE0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \
-1278585854 // 0xB3CA5402 -49483115 // 0xFD0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \
-1278585853 // 0xB3CA5403 -66260331 // 0xFC0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404 #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -83037547 // 0xFB0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
-1278585851 // 0xB3CA5405 -99814763 // 0xFA0CF295
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406 #define WUFFS_DEFLATE__ERROR_BAD_BLOCK -116591979 // 0xF90CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -133369195 // 0xF80CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -150146411 // 0xF70CF295
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
-1278585847 // 0xB3CA5409 -166923627 // 0xF60CF295
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \ #define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
-1278585846 // 0xB3CA540A -183700843 // 0xF50CF295
#define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE \ #define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE -200478059 // 0xF40CF295
-1278585845 // 0xB3CA540B #define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -217255275 // 0xF30CF295
#define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -1278585844 // 0xB3CA540C
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \
-1278585843 // 0xB3CA540D -1072893291 // 0xC00CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \
-1278585842 // 0xB3CA540E -1089670507 // 0xBF0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \
-1278585841 // 0xB3CA540F -1106447723 // 0xBE0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \
-1278585840 // 0xB3CA5410 -1123224939 // 0xBD0CF295
bool wuffs_deflate__status__is_error(wuffs_deflate__status s); bool wuffs_deflate__status__is_error(wuffs_deflate__status s);
+48 -57
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1271,38 +1278,30 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_lzw__status__is_error instead.
typedef int32_t wuffs_lzw__status; typedef int32_t wuffs_lzw__status;
#define wuffs_lzw__packageid 1316776 // 0x001417A8 #define wuffs_lzw__packageid 1316776 // 0x001417A8
#define WUFFS_LZW__STATUS_OK 0 // 0x00000000 #define WUFFS_LZW__STATUS_OK 0 // 0x00000000
#define WUFFS_LZW__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_LZW__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_LZW__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_LZW__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_LZW__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_LZW__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_LZW__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_LZW__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_LZW__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_LZW__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_LZW__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_LZW__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_LZW__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_LZW__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_LZW__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_LZW__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_LZW__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_LZW__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_LZW__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_LZW__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_LZW__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_LZW__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_LZW__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_LZW__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_LZW__ERROR_BAD_CODE -799105024 // 0xD05EA000 #define WUFFS_LZW__ERROR_BAD_CODE -15460440 // 0xFF1417A8
#define WUFFS_LZW__ERROR_CYCLICAL_PREFIX_CHAIN -799105023 // 0xD05EA001 #define WUFFS_LZW__ERROR_CYCLICAL_PREFIX_CHAIN -32237656 // 0xFE1417A8
bool wuffs_lzw__status__is_error(wuffs_lzw__status s); bool wuffs_lzw__status__is_error(wuffs_lzw__status s);
@@ -1381,45 +1380,37 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_gif__status__is_error instead.
typedef int32_t wuffs_gif__status; typedef int32_t wuffs_gif__status;
#define wuffs_gif__packageid 1017222 // 0x000F8586 #define wuffs_gif__packageid 1017222 // 0x000F8586
#define WUFFS_GIF__STATUS_OK 0 // 0x00000000 #define WUFFS_GIF__STATUS_OK 0 // 0x00000000
#define WUFFS_GIF__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_GIF__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_GIF__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_GIF__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_GIF__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_GIF__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_GIF__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_GIF__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_GIF__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_GIF__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_GIF__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_GIF__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_GIF__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_GIF__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_GIF__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_GIF__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_GIF__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_GIF__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_GIF__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_GIF__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_GIF__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_GIF__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_GIF__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_GIF__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_GIF__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_GIF__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_GIF__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_GIF__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_GIF__ERROR_BAD_BLOCK -1105848320 // 0xBE161800 #define WUFFS_GIF__ERROR_BAD_BLOCK -15759994 // 0xFF0F8586
#define WUFFS_GIF__ERROR_BAD_EXTENSION_LABEL -1105848319 // 0xBE161801 #define WUFFS_GIF__ERROR_BAD_EXTENSION_LABEL -32537210 // 0xFE0F8586
#define WUFFS_GIF__ERROR_BAD_GRAPHIC_CONTROL -1105848318 // 0xBE161802 #define WUFFS_GIF__ERROR_BAD_GRAPHIC_CONTROL -49314426 // 0xFD0F8586
#define WUFFS_GIF__ERROR_BAD_HEADER -1105848317 // 0xBE161803 #define WUFFS_GIF__ERROR_BAD_HEADER -66091642 // 0xFC0F8586
#define WUFFS_GIF__ERROR_BAD_LITERAL_WIDTH -1105848316 // 0xBE161804 #define WUFFS_GIF__ERROR_BAD_LITERAL_WIDTH -82868858 // 0xFB0F8586
#define WUFFS_GIF__ERROR_NOT_ENOUGH_PIXEL_DATA -1105848315 // 0xBE161805 #define WUFFS_GIF__ERROR_NOT_ENOUGH_PIXEL_DATA -99646074 // 0xFA0F8586
#define WUFFS_GIF__ERROR_TOO_MUCH_PIXEL_DATA -1105848314 // 0xBE161806 #define WUFFS_GIF__ERROR_TOO_MUCH_PIXEL_DATA -116423290 // 0xF90F8586
#define WUFFS_GIF__ERROR_INTERNAL_ERROR_INCONSISTENT_RI_WI \ #define WUFFS_GIF__ERROR_INTERNAL_ERROR_INCONSISTENT_RI_WI \
-1105848313 // 0xBE161807 -1072724602 // 0xC00F8586
bool wuffs_gif__status__is_error(wuffs_gif__status s); bool wuffs_gif__status__is_error(wuffs_gif__status s);
+74 -92
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1271,35 +1278,27 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_crc32__status__is_error instead.
typedef int32_t wuffs_crc32__status; typedef int32_t wuffs_crc32__status;
#define wuffs_crc32__packageid 810620 // 0x000C5E7C #define wuffs_crc32__packageid 810620 // 0x000C5E7C
#define WUFFS_CRC32__STATUS_OK 0 // 0x00000000 #define WUFFS_CRC32__STATUS_OK 0 // 0x00000000
#define WUFFS_CRC32__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_CRC32__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_CRC32__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_CRC32__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_CRC32__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_CRC32__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_CRC32__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_CRC32__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_CRC32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_CRC32__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_CRC32__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_CRC32__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_CRC32__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_CRC32__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_CRC32__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_CRC32__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_CRC32__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_CRC32__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_CRC32__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_CRC32__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_CRC32__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_CRC32__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_CRC32__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_CRC32__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_CRC32__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
bool wuffs_crc32__status__is_error(wuffs_crc32__status s); bool wuffs_crc32__status__is_error(wuffs_crc32__status s);
@@ -1366,66 +1365,57 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_deflate__status__is_error instead.
typedef int32_t wuffs_deflate__status; typedef int32_t wuffs_deflate__status;
#define wuffs_deflate__packageid 848533 // 0x000CF295 #define wuffs_deflate__packageid 848533 // 0x000CF295
#define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000 #define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000
#define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \
-1278585856 // 0xB3CA5400 -15928683 // 0xFF0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \
-1278585855 // 0xB3CA5401 -32705899 // 0xFE0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \
-1278585854 // 0xB3CA5402 -49483115 // 0xFD0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \
-1278585853 // 0xB3CA5403 -66260331 // 0xFC0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404 #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -83037547 // 0xFB0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
-1278585851 // 0xB3CA5405 -99814763 // 0xFA0CF295
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406 #define WUFFS_DEFLATE__ERROR_BAD_BLOCK -116591979 // 0xF90CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -133369195 // 0xF80CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -150146411 // 0xF70CF295
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
-1278585847 // 0xB3CA5409 -166923627 // 0xF60CF295
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \ #define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
-1278585846 // 0xB3CA540A -183700843 // 0xF50CF295
#define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE \ #define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE -200478059 // 0xF40CF295
-1278585845 // 0xB3CA540B #define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -217255275 // 0xF30CF295
#define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -1278585844 // 0xB3CA540C
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \
-1278585843 // 0xB3CA540D -1072893291 // 0xC00CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \
-1278585842 // 0xB3CA540E -1089670507 // 0xBF0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \
-1278585841 // 0xB3CA540F -1106447723 // 0xBE0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \
-1278585840 // 0xB3CA5410 -1123224939 // 0xBD0CF295
bool wuffs_deflate__status__is_error(wuffs_deflate__status s); bool wuffs_deflate__status__is_error(wuffs_deflate__status s);
@@ -1543,40 +1533,32 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_gzip__status__is_error instead.
typedef int32_t wuffs_gzip__status; typedef int32_t wuffs_gzip__status;
#define wuffs_gzip__packageid 1041911 // 0x000FE5F7 #define wuffs_gzip__packageid 1041911 // 0x000FE5F7
#define WUFFS_GZIP__STATUS_OK 0 // 0x00000000 #define WUFFS_GZIP__STATUS_OK 0 // 0x00000000
#define WUFFS_GZIP__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_GZIP__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_GZIP__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_GZIP__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_GZIP__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_GZIP__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_GZIP__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_GZIP__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_GZIP__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_GZIP__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_GZIP__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_GZIP__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_GZIP__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_GZIP__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_GZIP__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_GZIP__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_GZIP__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_GZIP__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_GZIP__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_GZIP__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_GZIP__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_GZIP__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_GZIP__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_GZIP__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_GZIP__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_GZIP__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_GZIP__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_GZIP__ERROR_BAD_CHECKSUM -1080566784 // 0xBF97DC00 #define WUFFS_GZIP__ERROR_BAD_CHECKSUM -15735305 // 0xFF0FE5F7
#define WUFFS_GZIP__ERROR_BAD_COMPRESSION_METHOD -1080566783 // 0xBF97DC01 #define WUFFS_GZIP__ERROR_BAD_COMPRESSION_METHOD -32512521 // 0xFE0FE5F7
#define WUFFS_GZIP__ERROR_BAD_ENCODING_FLAGS -1080566782 // 0xBF97DC02 #define WUFFS_GZIP__ERROR_BAD_ENCODING_FLAGS -49289737 // 0xFD0FE5F7
#define WUFFS_GZIP__ERROR_BAD_HEADER -1080566781 // 0xBF97DC03 #define WUFFS_GZIP__ERROR_BAD_HEADER -66066953 // 0xFC0FE5F7
bool wuffs_gzip__status__is_error(wuffs_gzip__status s); bool wuffs_gzip__status__is_error(wuffs_gzip__status s);
+25 -26
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1262,38 +1269,30 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_lzw__status__is_error instead.
typedef int32_t wuffs_lzw__status; typedef int32_t wuffs_lzw__status;
#define wuffs_lzw__packageid 1316776 // 0x001417A8 #define wuffs_lzw__packageid 1316776 // 0x001417A8
#define WUFFS_LZW__STATUS_OK 0 // 0x00000000 #define WUFFS_LZW__STATUS_OK 0 // 0x00000000
#define WUFFS_LZW__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_LZW__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_LZW__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_LZW__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_LZW__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_LZW__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_LZW__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_LZW__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_LZW__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_LZW__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_LZW__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_LZW__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_LZW__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_LZW__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_LZW__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_LZW__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_LZW__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_LZW__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_LZW__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_LZW__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_LZW__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_LZW__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_LZW__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_LZW__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_LZW__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_LZW__ERROR_BAD_CODE -799105024 // 0xD05EA000 #define WUFFS_LZW__ERROR_BAD_CODE -15460440 // 0xFF1417A8
#define WUFFS_LZW__ERROR_CYCLICAL_PREFIX_CHAIN -799105023 // 0xD05EA001 #define WUFFS_LZW__ERROR_CYCLICAL_PREFIX_CHAIN -32237656 // 0xFE1417A8
bool wuffs_lzw__status__is_error(wuffs_lzw__status s); bool wuffs_lzw__status__is_error(wuffs_lzw__status s);
+75 -93
View File
@@ -58,7 +58,14 @@ typedef struct {
// -------- // --------
// A status code is either zero (OK), positive (a recoverable suspension or // A status code is either zero (OK), positive (a recoverable suspension or
// pause in processing) or negative (a non-recoverable error). // pause in processing) or negative (a non-recoverable error). Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 24 are a package-namespaced numeric code
// - bits 23 .. 21 are reserved.
// - bits 20 .. 0 are the packageid (a namespace) as a base38 value.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_base__status__is_error instead.
typedef int32_t wuffs_base__status; typedef int32_t wuffs_base__status;
#define WUFFS_BASE__STATUS_OK 0 // 0x00000000 #define WUFFS_BASE__STATUS_OK 0 // 0x00000000
@@ -1271,36 +1278,28 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_adler32__status__is_error instead.
typedef int32_t wuffs_adler32__status; typedef int32_t wuffs_adler32__status;
#define wuffs_adler32__packageid 681002 // 0x000A642A #define wuffs_adler32__packageid 681002 // 0x000A642A
#define WUFFS_ADLER32__STATUS_OK 0 // 0x00000000 #define WUFFS_ADLER32__STATUS_OK 0 // 0x00000000
#define WUFFS_ADLER32__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_ADLER32__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_ADLER32__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_ADLER32__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_ADLER32__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_ADLER32__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_ADLER32__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_ADLER32__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_ADLER32__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_ADLER32__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_ADLER32__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_ADLER32__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_ADLER32__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_ADLER32__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_ADLER32__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_ADLER32__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_ADLER32__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_ADLER32__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_ADLER32__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_ADLER32__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_ADLER32__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_ADLER32__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_ADLER32__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_ADLER32__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_ADLER32__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
bool wuffs_adler32__status__is_error(wuffs_adler32__status s); bool wuffs_adler32__status__is_error(wuffs_adler32__status s);
@@ -1367,66 +1366,57 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_deflate__status__is_error instead.
typedef int32_t wuffs_deflate__status; typedef int32_t wuffs_deflate__status;
#define wuffs_deflate__packageid 848533 // 0x000CF295 #define wuffs_deflate__packageid 848533 // 0x000CF295
#define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000 #define WUFFS_DEFLATE__STATUS_OK 0 // 0x00000000
#define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_DEFLATE__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_DEFLATE__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_DEFLATE__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_DEFLATE__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_DEFLATE__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_DEFLATE__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_DEFLATE__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_DEFLATE__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \ #define WUFFS_DEFLATE__ERROR_CANNOT_RETURN_A_SUSPENSION \
-2147483636 // 0x8000000C -536870912 // 0xE0000000
#define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_DEFLATE__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_DEFLATE__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_OVER_SUBSCRIBED \
-1278585856 // 0xB3CA5400 -15928683 // 0xFF0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_UNDER_SUBSCRIBED \
-1278585855 // 0xB3CA5401 -32705899 // 0xFE0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_COUNT \
-1278585854 // 0xB3CA5402 -49483115 // 0xFD0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE_LENGTH_REPETITION \
-1278585853 // 0xB3CA5403 -66260331 // 0xFC0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -1278585852 // 0xB3CA5404 #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_CODE -83037547 // 0xFB0CF295
#define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \ #define WUFFS_DEFLATE__ERROR_BAD_HUFFMAN_MINIMUM_CODE_LENGTH \
-1278585851 // 0xB3CA5405 -99814763 // 0xFA0CF295
#define WUFFS_DEFLATE__ERROR_BAD_BLOCK -1278585850 // 0xB3CA5406 #define WUFFS_DEFLATE__ERROR_BAD_BLOCK -116591979 // 0xF90CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -1278585849 // 0xB3CA5407 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE -133369195 // 0xF80CF295
#define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -1278585848 // 0xB3CA5408 #define WUFFS_DEFLATE__ERROR_BAD_DISTANCE_CODE_COUNT -150146411 // 0xF70CF295
#define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \ #define WUFFS_DEFLATE__ERROR_BAD_LITERAL_LENGTH_CODE_COUNT \
-1278585847 // 0xB3CA5409 -166923627 // 0xF60CF295
#define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \ #define WUFFS_DEFLATE__ERROR_INCONSISTENT_STORED_BLOCK_LENGTH \
-1278585846 // 0xB3CA540A -183700843 // 0xF50CF295
#define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE \ #define WUFFS_DEFLATE__ERROR_MISSING_END_OF_BLOCK_CODE -200478059 // 0xF40CF295
-1278585845 // 0xB3CA540B #define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -217255275 // 0xF30CF295
#define WUFFS_DEFLATE__ERROR_NO_HUFFMAN_CODES -1278585844 // 0xB3CA540C
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_DECODER_STATE \
-1278585843 // 0xB3CA540D -1072893291 // 0xC00CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_HUFFMAN_END_OF_BLOCK \
-1278585842 // 0xB3CA540E -1089670507 // 0xBF0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE \
-1278585841 // 0xB3CA540F -1106447723 // 0xBE0CF295
#define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \ #define WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_N_BITS \
-1278585840 // 0xB3CA5410 -1123224939 // 0xBD0CF295
bool wuffs_deflate__status__is_error(wuffs_deflate__status s); bool wuffs_deflate__status__is_error(wuffs_deflate__status s);
@@ -1544,42 +1534,34 @@ extern "C" {
// ---------------- Status Codes // ---------------- Status Codes
// Status codes are int32_t values. Its bits:
// - bit 31 (the sign bit) indicates unrecoverable-ness: an error.
// - bits 30 .. 10 are the packageid: a namespace.
// - bits 9 .. 8 are reserved.
// - bits 7 .. 0 are a package-namespaced numeric code.
//
// Do not manipulate these bits directly; they are private implementation
// details. Use methods such as wuffs_zlib__status__is_error instead.
typedef int32_t wuffs_zlib__status; typedef int32_t wuffs_zlib__status;
#define wuffs_zlib__packageid 2064249 // 0x001F7F79 #define wuffs_zlib__packageid 2064249 // 0x001F7F79
#define WUFFS_ZLIB__STATUS_OK 0 // 0x00000000 #define WUFFS_ZLIB__STATUS_OK 0 // 0x00000000
#define WUFFS_ZLIB__ERROR_BAD_WUFFS_VERSION -2147483647 // 0x80000001 #define WUFFS_ZLIB__ERROR_BAD_WUFFS_VERSION -16777216 // 0xFF000000
#define WUFFS_ZLIB__ERROR_BAD_SIZEOF_RECEIVER -2147483646 // 0x80000002 #define WUFFS_ZLIB__ERROR_BAD_SIZEOF_RECEIVER -33554432 // 0xFE000000
#define WUFFS_ZLIB__ERROR_BAD_RECEIVER -2147483645 // 0x80000003 #define WUFFS_ZLIB__ERROR_BAD_RECEIVER -50331648 // 0xFD000000
#define WUFFS_ZLIB__ERROR_BAD_ARGUMENT -2147483644 // 0x80000004 #define WUFFS_ZLIB__ERROR_BAD_ARGUMENT -67108864 // 0xFC000000
#define WUFFS_ZLIB__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \ #define WUFFS_ZLIB__ERROR_CHECK_WUFFS_VERSION_NOT_CALLED \
-2147483643 // 0x80000005 -268435456 // 0xF0000000
#define WUFFS_ZLIB__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \ #define WUFFS_ZLIB__ERROR_CHECK_WUFFS_VERSION_CALLED_TWICE \
-2147483642 // 0x80000006 -285212672 // 0xEF000000
#define WUFFS_ZLIB__ERROR_INVALID_I_O_OPERATION -2147483641 // 0x80000007 #define WUFFS_ZLIB__ERROR_INVALID_I_O_OPERATION -805306368 // 0xD0000000
#define WUFFS_ZLIB__ERROR_CLOSED_FOR_WRITES -2147483640 // 0x80000008 #define WUFFS_ZLIB__ERROR_CLOSED_FOR_WRITES -1073741824 // 0xC0000000
#define WUFFS_ZLIB__ERROR_UNEXPECTED_EOF -2147483639 // 0x80000009 #define WUFFS_ZLIB__ERROR_UNEXPECTED_EOF -822083584 // 0xCF000000
#define WUFFS_ZLIB__SUSPENSION_SHORT_READ 10 // 0x0000000A #define WUFFS_ZLIB__SUSPENSION_SHORT_READ 33554432 // 0x02000000
#define WUFFS_ZLIB__SUSPENSION_SHORT_WRITE 11 // 0x0000000B #define WUFFS_ZLIB__SUSPENSION_SHORT_WRITE 50331648 // 0x03000000
#define WUFFS_ZLIB__ERROR_CANNOT_RETURN_A_SUSPENSION -2147483636 // 0x8000000C #define WUFFS_ZLIB__ERROR_CANNOT_RETURN_A_SUSPENSION -536870912 // 0xE0000000
#define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -2147483635 // 0x8000000D #define WUFFS_ZLIB__ERROR_INVALID_CALL_SEQUENCE -301989888 // 0xEE000000
#define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 14 // 0x0000000E #define WUFFS_ZLIB__SUSPENSION_END_OF_DATA 16777216 // 0x01000000
#define WUFFS_ZLIB__ERROR_BAD_CHECKSUM -33692672 // 0xFDFDE400 #define WUFFS_ZLIB__ERROR_BAD_CHECKSUM -14712967 // 0xFF1F7F79
#define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_METHOD -33692671 // 0xFDFDE401 #define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_METHOD -31490183 // 0xFE1F7F79
#define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_WINDOW_SIZE -33692670 // 0xFDFDE402 #define WUFFS_ZLIB__ERROR_BAD_COMPRESSION_WINDOW_SIZE -48267399 // 0xFD1F7F79
#define WUFFS_ZLIB__ERROR_BAD_PARITY_CHECK -33692669 // 0xFDFDE403 #define WUFFS_ZLIB__ERROR_BAD_PARITY_CHECK -65044615 // 0xFC1F7F79
#define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \ #define WUFFS_ZLIB__ERROR_TODO_UNSUPPORTED_PRESET_DICTIONARY \
-33692668 // 0xFDFDE404 -1071677575 // 0xC01F7F79
bool wuffs_zlib__status__is_error(wuffs_zlib__status s); bool wuffs_zlib__status__is_error(wuffs_zlib__status s);
+1
View File
@@ -40,6 +40,7 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../../gen/c/base.c"
#include "../../../gen/c/std/adler32.c" #include "../../../gen/c/std/adler32.c"
#include "../testlib/testlib.c" #include "../testlib/testlib.c"
#ifdef WUFFS_MIMIC #ifdef WUFFS_MIMIC
+1
View File
@@ -40,6 +40,7 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../../gen/c/base.c"
#include "../../../gen/c/std/crc32.c" #include "../../../gen/c/std/crc32.c"
#include "../testlib/testlib.c" #include "../testlib/testlib.c"
#ifdef WUFFS_MIMIC #ifdef WUFFS_MIMIC
+1
View File
@@ -40,6 +40,7 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../../gen/c/base.c"
#include "../../../gen/c/std/deflate.c" #include "../../../gen/c/std/deflate.c"
#include "../testlib/testlib.c" #include "../testlib/testlib.c"
#ifdef WUFFS_MIMIC #ifdef WUFFS_MIMIC
+1
View File
@@ -40,6 +40,7 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../../gen/c/base.c"
#include "../../../gen/c/std/gif.c" #include "../../../gen/c/std/gif.c"
#include "../../../gen/c/std/lzw.c" #include "../../../gen/c/std/lzw.c"
#include "../testlib/testlib.c" #include "../testlib/testlib.c"
+1
View File
@@ -40,6 +40,7 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../../gen/c/base.c"
#include "../../../gen/c/std/crc32.c" #include "../../../gen/c/std/crc32.c"
#include "../../../gen/c/std/deflate.c" #include "../../../gen/c/std/deflate.c"
#include "../../../gen/c/std/gzip.c" #include "../../../gen/c/std/gzip.c"
+1
View File
@@ -40,6 +40,7 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../../gen/c/base.c"
#include "../../../gen/c/std/lzw.c" #include "../../../gen/c/std/lzw.c"
#include "../testlib/testlib.c" #include "../testlib/testlib.c"
+1
View File
@@ -40,6 +40,7 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// If building this program in an environment that doesn't easily accomodate // If building this program in an environment that doesn't easily accomodate
// relative includes, you can use the script/inline-c-relative-includes.go // relative includes, you can use the script/inline-c-relative-includes.go
// program to generate a stand-alone C file. // program to generate a stand-alone C file.
#include "../../../gen/c/base.c"
#include "../../../gen/c/std/adler32.c" #include "../../../gen/c/std/adler32.c"
#include "../../../gen/c/std/deflate.c" #include "../../../gen/c/std/deflate.c"
#include "../../../gen/c/std/zlib.c" #include "../../../gen/c/std/zlib.c"