mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Rename b_rptr_foo as ioptr_foo
This commit is contained in:
1 parent
2448b2ae7a
commit
7452ec8035
8 files changed
+609
-608
No files matched your search
@@ -83,14 +83,14 @@ func (g *gen) writeBuiltinIO(b *buffer, recv *a.Expr, method t.ID, args []*a.Nod
|
||||
// TODO: don't hard-code these.
|
||||
switch recv.Str(g.tm) {
|
||||
case "in.dst":
|
||||
p0 = bPrefix + "wend_dst"
|
||||
p1 = bPrefix + "wptr_dst"
|
||||
p0 = "iobounds1_dst"
|
||||
p1 = "ioptr_dst"
|
||||
case "in.src":
|
||||
p0 = bPrefix + "rend_src"
|
||||
p1 = bPrefix + "rptr_src"
|
||||
p0 = "iobounds1_src"
|
||||
p1 = "ioptr_src"
|
||||
case "w":
|
||||
p0 = bPrefix + "wend_w"
|
||||
p1 = bPrefix + "wptr_w"
|
||||
p0 = "iobounds1_w"
|
||||
p1 = "ioptr_w"
|
||||
}
|
||||
if p0 == "" {
|
||||
return fmt.Errorf(`TODO: cgen a "foo.available" expression`)
|
||||
@@ -103,8 +103,8 @@ func (g *gen) writeBuiltinIO(b *buffer, recv *a.Expr, method t.ID, args []*a.Nod
|
||||
if len(args) == 1 {
|
||||
typ = "writer"
|
||||
}
|
||||
// TODO: don't hard-code v_w and u_w, and wptr vs rptr.
|
||||
b.printf("wuffs_base__io_%s__set(&v_w, &u_w, &b_wptr_w, &b_wend_w,", typ)
|
||||
// TODO: don't hard-code v_w and u_w.
|
||||
b.printf("wuffs_base__io_%s__set(&v_w, &u_w, &ioptr_w, &iobounds1_w,", typ)
|
||||
return g.writeArgs(b, args, rp, depth)
|
||||
|
||||
}
|
||||
@@ -115,19 +115,19 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
// TODO: don't hard-code the recv being a_src.
|
||||
switch method {
|
||||
case t.IDSetLimit:
|
||||
b.printf("wuffs_base__io_reader__set_limit(&%ssrc, %srptr_src,", aPrefix, bPrefix)
|
||||
// TODO: update the bPrefix variables?
|
||||
b.printf("wuffs_base__io_reader__set_limit(&%ssrc, ioptr_src,", aPrefix)
|
||||
// TODO: update the ioptr variables?
|
||||
return g.writeArgs(b, args, rp, depth)
|
||||
|
||||
case t.IDSetMark:
|
||||
b.printf("wuffs_base__io_reader__set_mark(&%ssrc, %srptr_src)", aPrefix, bPrefix)
|
||||
b.printf("wuffs_base__io_reader__set_mark(&%ssrc, ioptr_src)", aPrefix)
|
||||
return nil
|
||||
|
||||
case t.IDSinceMark:
|
||||
b.printf("((wuffs_base__slice_u8){ "+
|
||||
".ptr = %ssrc.private_impl.bounds[0], "+
|
||||
".len = (size_t)(%srptr_src - %ssrc.private_impl.bounds[0]), })",
|
||||
aPrefix, bPrefix, aPrefix)
|
||||
".len = (size_t)(ioptr_src - %ssrc.private_impl.bounds[0]), })",
|
||||
aPrefix, aPrefix)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -144,8 +144,8 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
bco = "__bco"
|
||||
}
|
||||
b.printf("wuffs_base__io_writer__copy_from_history32%s("+
|
||||
"&%swptr_dst, %sdst.private_impl.bounds[0] , %swend_dst",
|
||||
bco, bPrefix, aPrefix, bPrefix)
|
||||
"&ioptr_dst, %sdst.private_impl.bounds[0], iobounds1_dst",
|
||||
bco, aPrefix)
|
||||
for _, o := range args {
|
||||
b.writeb(',')
|
||||
if err := g.writeExpr(b, o.Arg().Value(), rp, depth); err != nil {
|
||||
@@ -156,19 +156,17 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
return nil
|
||||
|
||||
case t.IDCopyFromReader32:
|
||||
b.printf("wuffs_base__io_writer__copy_from_reader32(&%swptr_dst, %swend_dst,",
|
||||
bPrefix, bPrefix)
|
||||
b.printf("wuffs_base__io_writer__copy_from_reader32(&ioptr_dst, iobounds1_dst,")
|
||||
// TODO: don't assume that the first argument is "in.src".
|
||||
b.printf("&%srptr_src, %srend_src,", bPrefix, bPrefix)
|
||||
b.printf("&ioptr_src, iobounds1_src,")
|
||||
return g.writeArgs(b, args[1:], rp, depth)
|
||||
|
||||
case t.IDCopyFromSlice:
|
||||
b.printf("wuffs_base__io_writer__copy_from_slice(&%swptr_dst, %swend_dst,", bPrefix, bPrefix)
|
||||
b.printf("wuffs_base__io_writer__copy_from_slice(&ioptr_dst, iobounds1_dst,")
|
||||
return g.writeArgs(b, args, rp, depth)
|
||||
|
||||
case t.IDCopyFromSlice32:
|
||||
b.printf("wuffs_base__io_writer__copy_from_slice32("+
|
||||
"&%swptr_dst, %swend_dst,", bPrefix, bPrefix)
|
||||
b.printf("wuffs_base__io_writer__copy_from_slice32(&ioptr_dst, iobounds1_dst,")
|
||||
return g.writeArgs(b, args, rp, depth)
|
||||
|
||||
case t.IDSetMark:
|
||||
@@ -176,14 +174,14 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
// if the function is passed a (ptr io_writer) instead of a
|
||||
// (io_writer)? Do we still want to have that mark live outside of
|
||||
// the function scope?
|
||||
b.printf("wuffs_base__io_writer__set_mark(&%sdst, %swptr_dst)", aPrefix, bPrefix)
|
||||
b.printf("wuffs_base__io_writer__set_mark(&%sdst, ioptr_dst)", aPrefix)
|
||||
return nil
|
||||
|
||||
case t.IDSinceMark:
|
||||
b.printf("((wuffs_base__slice_u8){ "+
|
||||
".ptr = %sdst.private_impl.bounds[0], "+
|
||||
".len = (size_t)(%swptr_dst - %sdst.private_impl.bounds[0]), })",
|
||||
aPrefix, bPrefix, aPrefix)
|
||||
".len = (size_t)(ioptr_dst - %sdst.private_impl.bounds[0]), })",
|
||||
aPrefix, aPrefix)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -341,11 +339,11 @@ func (g *gen) writeBuiltinCallSuspendibles(b *buffer, n *a.Expr, depth uint32) e
|
||||
if recvTyp.QID()[1] == t.IDIOReader {
|
||||
switch method.Ident() {
|
||||
case t.IDUnreadU8:
|
||||
b.printf("if (%srptr_src == %srstart_src) { status = %sERROR_INVALID_I_O_OPERATION;",
|
||||
bPrefix, bPrefix, g.PKGPREFIX)
|
||||
b.printf("if (ioptr_src == iobounds0orig_src) { status = %sERROR_INVALID_I_O_OPERATION;",
|
||||
g.PKGPREFIX)
|
||||
b.writes("goto exit;")
|
||||
b.writes("}\n")
|
||||
b.printf("%srptr_src--;\n", bPrefix)
|
||||
b.printf("ioptr_src--;\n")
|
||||
return nil
|
||||
|
||||
case t.IDReadU8:
|
||||
@@ -356,8 +354,7 @@ func (g *gen) writeBuiltinCallSuspendibles(b *buffer, n *a.Expr, depth uint32) e
|
||||
g.currFunk.tempW++
|
||||
|
||||
if !n.ProvenNotToSuspend() {
|
||||
b.printf("if (WUFFS_BASE__UNLIKELY(%srptr_src == %srend_src)) { goto short_read_src; }",
|
||||
bPrefix, bPrefix)
|
||||
b.printf("if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) { goto short_read_src; }")
|
||||
g.currFunk.shortReads = append(g.currFunk.shortReads, "src")
|
||||
}
|
||||
|
||||
@@ -366,7 +363,7 @@ func (g *gen) writeBuiltinCallSuspendibles(b *buffer, n *a.Expr, depth uint32) e
|
||||
if err := g.writeCTypeName(b, n.MType(), tPrefix, fmt.Sprint(temp)); err != nil {
|
||||
return err
|
||||
}
|
||||
b.printf(" = *%srptr_src++;\n", bPrefix)
|
||||
b.printf(" = *ioptr_src++;\n")
|
||||
return nil
|
||||
|
||||
case t.IDReadU16BE:
|
||||
@@ -396,13 +393,13 @@ func (g *gen) writeBuiltinCallSuspendibles(b *buffer, n *a.Expr, depth uint32) e
|
||||
return err
|
||||
}
|
||||
|
||||
b.printf("if (%s > %srend_src - %srptr_src) {\n", scratchName, bPrefix, bPrefix)
|
||||
b.printf("%s -= %srend_src - %srptr_src;\n", scratchName, bPrefix, bPrefix)
|
||||
b.printf("%srptr_src = %srend_src;\n", bPrefix, bPrefix)
|
||||
b.printf("if (%s > iobounds1_src - ioptr_src) {\n", scratchName)
|
||||
b.printf("%s -= iobounds1_src - ioptr_src;\n", scratchName)
|
||||
b.printf("ioptr_src = iobounds1_src;\n")
|
||||
|
||||
b.writes("goto short_read_src; }\n")
|
||||
g.currFunk.shortReads = append(g.currFunk.shortReads, "src")
|
||||
b.printf("%srptr_src += %s;\n", bPrefix, scratchName)
|
||||
b.printf("ioptr_src += %s;\n", scratchName)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -410,13 +407,13 @@ func (g *gen) writeBuiltinCallSuspendibles(b *buffer, n *a.Expr, depth uint32) e
|
||||
switch method.Ident() {
|
||||
case t.IDWriteU8:
|
||||
if !n.ProvenNotToSuspend() {
|
||||
b.printf("if (%swptr_dst == %swend_dst) { status = %sSUSPENSION_SHORT_WRITE;",
|
||||
bPrefix, bPrefix, g.PKGPREFIX)
|
||||
b.printf("if (ioptr_dst == iobounds1_dst) { status = %sSUSPENSION_SHORT_WRITE;",
|
||||
g.PKGPREFIX)
|
||||
b.writes("goto suspend;")
|
||||
b.writes("}\n")
|
||||
}
|
||||
|
||||
b.printf("*%swptr_dst++ = ", bPrefix)
|
||||
b.printf("*ioptr_dst++ = ")
|
||||
x := n.Args()[0].Arg().Value()
|
||||
if err := g.writeExpr(b, x, replaceCallSuspendibles, depth); err != nil {
|
||||
return err
|
||||
|
||||
@@ -48,7 +48,6 @@ var (
|
||||
// "double" being a valid Wuffs variable name but not a valid C one.
|
||||
const (
|
||||
aPrefix = "a_" // Function argument.
|
||||
bPrefix = "b_" // Derived from a function argument.
|
||||
cPrefix = "c_" // Coroutine state.
|
||||
fPrefix = "f_" // Struct field.
|
||||
iPrefix = "i_" // Iterate variable.
|
||||
|
||||
@@ -177,15 +177,16 @@ func (g *gen) writeStatementIOBind(b *buffer, n *a.IOBind, depth uint32) error {
|
||||
b.printf("wuffs_base__io_%s %s%d_%s%s = %s%s;\n",
|
||||
cTyp, oPrefix, ioBindNum, prefix, name, prefix, name)
|
||||
|
||||
// TODO: save / restore all bPrefix vars, not just for local IO vars?
|
||||
// How does this work if the io_bind body advances these pointers,
|
||||
// either directly or by calling other funcs?
|
||||
// TODO: save / restore all ioptr vars, not just for local IO vars? How
|
||||
// does this work if the io_bind body advances these pointers, either
|
||||
// directly or by calling other funcs?
|
||||
//
|
||||
// TODO: rename ioptr1 to ioptr, etc.
|
||||
if e.Operator() == 0 {
|
||||
// TODO: don't hard-code wptr vs rptr.
|
||||
b.printf("uint8_t *%s%d_ioptr1_%s%s = %swptr_%s;\n",
|
||||
oPrefix, ioBindNum, prefix, name, bPrefix, name)
|
||||
b.printf("uint8_t *%s%d_ioptr2_%s%s = %swend_%s;\n",
|
||||
oPrefix, ioBindNum, prefix, name, bPrefix, name)
|
||||
b.printf("uint8_t *%s%d_ioptr1_%s%s = ioptr_%s;\n",
|
||||
oPrefix, ioBindNum, prefix, name, name)
|
||||
b.printf("uint8_t *%s%d_ioptr2_%s%s = iobounds1_%s;\n",
|
||||
oPrefix, ioBindNum, prefix, name, name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,10 +206,10 @@ func (g *gen) writeStatementIOBind(b *buffer, n *a.IOBind, depth uint32) error {
|
||||
b.printf("%s%s = %s%d_%s%s;\n",
|
||||
prefix, name, oPrefix, ioBindNum, prefix, name)
|
||||
if e.Operator() == 0 {
|
||||
b.printf("%swptr_%s = %s%d_ioptr1_%s%s;\n",
|
||||
bPrefix, name, oPrefix, ioBindNum, prefix, name)
|
||||
b.printf("%swend_%s = %s%d_ioptr2_%s%s;\n",
|
||||
bPrefix, name, oPrefix, ioBindNum, prefix, name)
|
||||
b.printf("ioptr_%s = %s%d_ioptr1_%s%s;\n",
|
||||
name, oPrefix, ioBindNum, prefix, name)
|
||||
b.printf("iobounds1_%s = %s%d_ioptr2_%s%s;\n",
|
||||
name, oPrefix, ioBindNum, prefix, name)
|
||||
}
|
||||
}
|
||||
b.writes("}\n")
|
||||
@@ -624,9 +625,9 @@ func (g *gen) writeReadUXX(b *buffer, n *a.Expr, name string, size uint32, endia
|
||||
scratchName := fmt.Sprintf("self->private_impl.%s%s[0].scratch",
|
||||
cPrefix, g.currFunk.astFunc.FuncName().Str(g.tm))
|
||||
|
||||
b.printf("if (WUFFS_BASE__LIKELY(%srend_src - %srptr_src >= %d)) {", bPrefix, bPrefix, size/8)
|
||||
b.printf("%s%d = wuffs_base__load_u%d%s(%srptr_src);\n", tPrefix, temp1, size, endianness, bPrefix)
|
||||
b.printf("%srptr_src += %d;\n", bPrefix, size/8)
|
||||
b.printf("if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= %d)) {", size/8)
|
||||
b.printf("%s%d = wuffs_base__load_u%d%s(ioptr_src);\n", tPrefix, temp1, size, endianness)
|
||||
b.printf("ioptr_src += %d;\n", size/8)
|
||||
b.printf("} else {")
|
||||
b.printf("%s = 0;\n", scratchName)
|
||||
if err := g.writeCoroSuspPoint(b, false); err != nil {
|
||||
@@ -634,8 +635,8 @@ func (g *gen) writeReadUXX(b *buffer, n *a.Expr, name string, size uint32, endia
|
||||
}
|
||||
b.printf("while (true) {")
|
||||
|
||||
b.printf("if (WUFFS_BASE__UNLIKELY(%srptr_%s == %srend_%s)) { goto short_read_%s; }",
|
||||
bPrefix, name, bPrefix, name, name)
|
||||
b.printf("if (WUFFS_BASE__UNLIKELY(ioptr_%s == iobounds1_%s)) { goto short_read_%s; }",
|
||||
name, name, name)
|
||||
g.currFunk.shortReads = append(g.currFunk.shortReads, name)
|
||||
|
||||
b.printf("uint32_t %s%d = %s", tPrefix, temp0, scratchName)
|
||||
@@ -644,14 +645,14 @@ func (g *gen) writeReadUXX(b *buffer, n *a.Expr, name string, size uint32, endia
|
||||
b.printf("& 0xFF;")
|
||||
b.printf("%s >>= 8;", scratchName)
|
||||
b.printf("%s <<= 8;", scratchName)
|
||||
b.printf("%s |= ((uint64_t)(*%srptr_%s++)) << (56 - %s%d);",
|
||||
scratchName, bPrefix, name, tPrefix, temp0)
|
||||
b.printf("%s |= ((uint64_t)(*ioptr_%s++)) << (56 - %s%d);",
|
||||
scratchName, name, tPrefix, temp0)
|
||||
case "le":
|
||||
b.printf(">> 56;")
|
||||
b.printf("%s <<= 8;", scratchName)
|
||||
b.printf("%s >>= 8;", scratchName)
|
||||
b.printf("%s |= ((uint64_t)(*%srptr_%s++)) << %s%d;",
|
||||
scratchName, bPrefix, name, tPrefix, temp0)
|
||||
b.printf("%s |= ((uint64_t)(*ioptr_%s++)) << %s%d;",
|
||||
scratchName, name, tPrefix, temp0)
|
||||
}
|
||||
|
||||
b.printf("if (%s%d == %d) {", tPrefix, temp0, size-8)
|
||||
|
||||
@@ -87,7 +87,7 @@ func (g *gen) writeLoadDerivedVar(b *buffer, hack string, name t.ID, typ *a.Type
|
||||
}
|
||||
// TODO: also remove this hack.
|
||||
if hack == "w" {
|
||||
b.printf("%swptr_w = %sw.ptr + %sw.wi;\n", bPrefix, uPrefix, uPrefix)
|
||||
b.printf("ioptr_w = %sw.ptr + %sw.wi;\n", uPrefix, uPrefix)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -101,52 +101,52 @@ func (g *gen) writeLoadDerivedVar(b *buffer, hack string, name t.ID, typ *a.Type
|
||||
switch typ.QID() {
|
||||
case t.QID{t.IDBase, t.IDIOReader}:
|
||||
if header {
|
||||
b.printf("uint8_t* %srptr_%s = NULL;", bPrefix, nameStr)
|
||||
b.printf("uint8_t* %srstart_%s = NULL;", bPrefix, nameStr)
|
||||
b.printf("uint8_t* %srend_%s = NULL;", bPrefix, nameStr)
|
||||
b.printf("uint8_t* ioptr_%s = NULL;", nameStr)
|
||||
b.printf("uint8_t* iobounds0orig_%s = NULL;", nameStr)
|
||||
b.printf("uint8_t* iobounds1_%s = NULL;", nameStr)
|
||||
}
|
||||
b.printf("if (%s%s.private_impl.buf) {", aPrefix, nameStr)
|
||||
|
||||
b.printf("%srptr_%s = %s%s.private_impl.buf->ptr + %s%s.private_impl.buf->ri;",
|
||||
bPrefix, nameStr, aPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("ioptr_%s = %s%s.private_impl.buf->ptr + %s%s.private_impl.buf->ri;",
|
||||
nameStr, aPrefix, nameStr, aPrefix, nameStr)
|
||||
|
||||
if header {
|
||||
b.printf("if (!%s%s.private_impl.bounds[0]) {", aPrefix, nameStr)
|
||||
b.printf("%s%s.private_impl.bounds[0] = %srptr_%s;", aPrefix, nameStr, bPrefix, nameStr)
|
||||
b.printf("%s%s.private_impl.bounds[0] = ioptr_%s;", aPrefix, nameStr, nameStr)
|
||||
b.printf("%s%s.private_impl.bounds[1] = %s%s.private_impl.buf->ptr + %s%s.private_impl.buf->wi;",
|
||||
aPrefix, nameStr, aPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("}\n")
|
||||
|
||||
b.printf("%srstart_%s = %s%s.private_impl.bounds[0];", bPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("%srend_%s = %s%s.private_impl.bounds[1];", bPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("iobounds0orig_%s = %s%s.private_impl.bounds[0];", nameStr, aPrefix, nameStr)
|
||||
b.printf("iobounds1_%s = %s%s.private_impl.bounds[1];", nameStr, aPrefix, nameStr)
|
||||
}
|
||||
|
||||
b.printf("}\n")
|
||||
|
||||
case t.QID{t.IDBase, t.IDIOWriter}:
|
||||
if header {
|
||||
b.printf("uint8_t* %swptr_%s = NULL;", bPrefix, nameStr)
|
||||
b.printf("uint8_t* %swstart_%s = NULL;", bPrefix, nameStr)
|
||||
b.printf("uint8_t* %swend_%s = NULL;", bPrefix, nameStr)
|
||||
b.printf("uint8_t* ioptr_%s = NULL;", nameStr)
|
||||
b.printf("uint8_t* iobounds0orig_%s = NULL;", nameStr)
|
||||
b.printf("uint8_t* iobounds1_%s = NULL;", nameStr)
|
||||
}
|
||||
b.printf("if (%s%s.private_impl.buf) {", aPrefix, nameStr)
|
||||
|
||||
b.printf("%swptr_%s = %s%s.private_impl.buf->ptr + %s%s.private_impl.buf->wi;",
|
||||
bPrefix, nameStr, aPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("ioptr_%s = %s%s.private_impl.buf->ptr + %s%s.private_impl.buf->wi;",
|
||||
nameStr, aPrefix, nameStr, aPrefix, nameStr)
|
||||
|
||||
if header {
|
||||
b.printf("if (!%s%s.private_impl.bounds[0]) {", aPrefix, nameStr)
|
||||
b.printf("%s%s.private_impl.bounds[0] = %swptr_%s;", aPrefix, nameStr, bPrefix, nameStr)
|
||||
b.printf("%s%s.private_impl.bounds[0] = ioptr_%s;", aPrefix, nameStr, nameStr)
|
||||
b.printf("%s%s.private_impl.bounds[1] = %s%s.private_impl.buf->ptr + %s%s.private_impl.buf->len;",
|
||||
aPrefix, nameStr, aPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("}\n")
|
||||
|
||||
b.printf("if (%s%s.private_impl.buf->closed) {", aPrefix, nameStr)
|
||||
b.printf("%s%s.private_impl.bounds[1] = %swptr_%s;", aPrefix, nameStr, bPrefix, nameStr)
|
||||
b.printf("%s%s.private_impl.bounds[1] = ioptr_%s;", aPrefix, nameStr, nameStr)
|
||||
b.printf("}\n")
|
||||
|
||||
b.printf("%swstart_%s = %s%s.private_impl.bounds[0];", bPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("%swend_%s = %s%s.private_impl.bounds[1];", bPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("iobounds0orig_%s = %s%s.private_impl.bounds[0];", nameStr, aPrefix, nameStr)
|
||||
b.printf("iobounds1_%s = %s%s.private_impl.bounds[1];", nameStr, aPrefix, nameStr)
|
||||
}
|
||||
|
||||
b.printf("}\n")
|
||||
@@ -162,7 +162,7 @@ func (g *gen) writeSaveDerivedVar(b *buffer, hack string, name t.ID, typ *a.Type
|
||||
}
|
||||
// TODO: also remove this hack.
|
||||
if hack == "w" {
|
||||
b.printf("%sw.wi = %swptr_w - %sw.ptr;\n", uPrefix, bPrefix, uPrefix)
|
||||
b.printf("%sw.wi = ioptr_w - %sw.ptr;\n", uPrefix, uPrefix)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -177,12 +177,12 @@ func (g *gen) writeSaveDerivedVar(b *buffer, hack string, name t.ID, typ *a.Type
|
||||
case t.QID{t.IDBase, t.IDIOReader}:
|
||||
b.printf("if (%s%s.private_impl.buf) {", aPrefix, nameStr)
|
||||
|
||||
b.printf("%s%s.private_impl.buf->ri = %srptr_%s - %s%s.private_impl.buf->ptr;",
|
||||
aPrefix, nameStr, bPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("%s%s.private_impl.buf->ri = ioptr_%s - %s%s.private_impl.buf->ptr;",
|
||||
aPrefix, nameStr, nameStr, aPrefix, nameStr)
|
||||
|
||||
if footer {
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(%srstart_%s);", bPrefix, nameStr)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(%srend_%s);", bPrefix, nameStr)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_%s);", nameStr)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_%s);", nameStr)
|
||||
}
|
||||
|
||||
b.printf("}\n")
|
||||
@@ -190,12 +190,12 @@ func (g *gen) writeSaveDerivedVar(b *buffer, hack string, name t.ID, typ *a.Type
|
||||
case t.QID{t.IDBase, t.IDIOWriter}:
|
||||
b.printf("if (%s%s.private_impl.buf) {", aPrefix, nameStr)
|
||||
|
||||
b.printf("%s%s.private_impl.buf->wi = %swptr_%s - %s%s.private_impl.buf->ptr;",
|
||||
aPrefix, nameStr, bPrefix, nameStr, aPrefix, nameStr)
|
||||
b.printf("%s%s.private_impl.buf->wi = ioptr_%s - %s%s.private_impl.buf->ptr;",
|
||||
aPrefix, nameStr, nameStr, aPrefix, nameStr)
|
||||
|
||||
if footer {
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(%swstart_%s);", bPrefix, nameStr)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(%swend_%s);", bPrefix, nameStr)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_%s);", nameStr)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_%s);", nameStr)
|
||||
}
|
||||
|
||||
b.printf("}\n")
|
||||
@@ -405,12 +405,12 @@ func (g *gen) writeVars(b *buffer, block []*a.Node, skipPointerTypes bool, skipI
|
||||
b.writes(";\n")
|
||||
if typ.IsIOType() {
|
||||
b.printf("wuffs_base__io_buffer %s%s;\n", uPrefix, name)
|
||||
// TODO: don't hard code wptr instead of rptr.
|
||||
b.printf("uint8_t* %swptr_%s = NULL;\n", bPrefix, name)
|
||||
b.printf("uint8_t* %swend_%s = NULL;\n", bPrefix, name)
|
||||
// TODO: iobounds0_%s or iobounds0orig_%s variables?
|
||||
b.printf("uint8_t* ioptr_%s = NULL;\n", name)
|
||||
b.printf("uint8_t* iobounds1_%s = NULL;\n", name)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(%s%s);\n", uPrefix, name)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(%swptr_%s);\n", bPrefix, name)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(%swend_%s);\n", bPrefix, name)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(ioptr_%s);\n", name)
|
||||
b.printf("WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_%s);\n", name)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
+175
-175
@@ -1834,21 +1834,21 @@ wuffs_deflate__status wuffs_deflate__decoder__decode(
|
||||
uint64_t v_n_copied;
|
||||
uint32_t v_already_full;
|
||||
|
||||
uint8_t* b_wptr_dst = NULL;
|
||||
uint8_t* b_wstart_dst = NULL;
|
||||
uint8_t* b_wend_dst = NULL;
|
||||
uint8_t* ioptr_dst = NULL;
|
||||
uint8_t* iobounds0orig_dst = NULL;
|
||||
uint8_t* iobounds1_dst = NULL;
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[0] = ioptr_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[1] = ioptr_dst;
|
||||
}
|
||||
b_wstart_dst = a_dst.private_impl.bounds[0];
|
||||
b_wend_dst = a_dst.private_impl.bounds[1];
|
||||
iobounds0orig_dst = a_dst.private_impl.bounds[0];
|
||||
iobounds1_dst = a_dst.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode[0].coro_susp_point;
|
||||
@@ -1864,15 +1864,15 @@ wuffs_deflate__status wuffs_deflate__decoder__decode(
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
|
||||
|
||||
while (true) {
|
||||
wuffs_base__io_writer__set_mark(&a_dst, b_wptr_dst);
|
||||
wuffs_base__io_writer__set_mark(&a_dst, ioptr_dst);
|
||||
{
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
}
|
||||
wuffs_deflate__status t_0 =
|
||||
wuffs_deflate__decoder__decode_blocks(self, a_dst, a_src);
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
}
|
||||
v_z = t_0;
|
||||
}
|
||||
@@ -1887,7 +1887,7 @@ wuffs_deflate__status wuffs_deflate__decoder__decode(
|
||||
}
|
||||
v_written = ((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(b_wptr_dst - a_dst.private_impl.bounds[0]),
|
||||
.len = (size_t)(ioptr_dst - a_dst.private_impl.bounds[0]),
|
||||
});
|
||||
if (((uint64_t)(v_written.len)) >= 32768) {
|
||||
v_written = wuffs_base__slice_u8__suffix(v_written, 32768);
|
||||
@@ -1941,9 +1941,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wstart_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wend_dst);
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_dst);
|
||||
}
|
||||
|
||||
self->private_impl.status = status;
|
||||
@@ -1961,18 +1961,18 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_blocks(
|
||||
uint32_t v_final;
|
||||
uint32_t v_type;
|
||||
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -1991,10 +1991,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_blocks(
|
||||
while (self->private_impl.f_n_bits < 3) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
self->private_impl.f_bits |=
|
||||
(((uint32_t)(t_0)) << self->private_impl.f_n_bits);
|
||||
}
|
||||
@@ -2007,12 +2007,12 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_blocks(
|
||||
if (v_type == 0) {
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status =
|
||||
wuffs_deflate__decoder__decode_uncompressed(self, a_dst, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -2027,11 +2027,11 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_blocks(
|
||||
} else if (v_type == 2) {
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_deflate__decoder__init_dynamic_huffman(self, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -2043,11 +2043,11 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_blocks(
|
||||
self->private_impl.f_end_of_block = false;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_deflate__decoder__decode_huffman_fast(self, a_dst, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -2057,11 +2057,11 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_blocks(
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_deflate__decoder__decode_huffman_slow(self, a_dst, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -2089,9 +2089,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2116,34 +2116,34 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_uncompressed(
|
||||
uint32_t v_length;
|
||||
uint32_t v_n_copied;
|
||||
|
||||
uint8_t* b_wptr_dst = NULL;
|
||||
uint8_t* b_wstart_dst = NULL;
|
||||
uint8_t* b_wend_dst = NULL;
|
||||
uint8_t* ioptr_dst = NULL;
|
||||
uint8_t* iobounds0orig_dst = NULL;
|
||||
uint8_t* iobounds1_dst = NULL;
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[0] = ioptr_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[1] = ioptr_dst;
|
||||
}
|
||||
b_wstart_dst = a_dst.private_impl.bounds[0];
|
||||
b_wend_dst = a_dst.private_impl.bounds[1];
|
||||
iobounds0orig_dst = a_dst.private_impl.bounds[0];
|
||||
iobounds1_dst = a_dst.private_impl.bounds[1];
|
||||
}
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -2166,14 +2166,14 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_uncompressed(
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
uint32_t t_1;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 4)) {
|
||||
t_1 = wuffs_base__load_u32le(b_rptr_src);
|
||||
b_rptr_src += 4;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 4)) {
|
||||
t_1 = wuffs_base__load_u32le(ioptr_src);
|
||||
ioptr_src += 4;
|
||||
} else {
|
||||
self->private_impl.c_decode_uncompressed[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_0 =
|
||||
@@ -2181,7 +2181,7 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_uncompressed(
|
||||
self->private_impl.c_decode_uncompressed[0].scratch <<= 8;
|
||||
self->private_impl.c_decode_uncompressed[0].scratch >>= 8;
|
||||
self->private_impl.c_decode_uncompressed[0].scratch |=
|
||||
((uint64_t)(*b_rptr_src++)) << t_0;
|
||||
((uint64_t)(*ioptr_src++)) << t_0;
|
||||
if (t_0 == 24) {
|
||||
t_1 = self->private_impl.c_decode_uncompressed[0].scratch;
|
||||
break;
|
||||
@@ -2201,13 +2201,13 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_uncompressed(
|
||||
v_length = ((v_length) & ((1 << (16)) - 1));
|
||||
while (true) {
|
||||
v_n_copied = wuffs_base__io_writer__copy_from_reader32(
|
||||
&b_wptr_dst, b_wend_dst, &b_rptr_src, b_rend_src, v_length);
|
||||
&ioptr_dst, iobounds1_dst, &ioptr_src, iobounds1_src, v_length);
|
||||
if (v_length <= v_n_copied) {
|
||||
status = WUFFS_DEFLATE__STATUS_OK;
|
||||
goto ok;
|
||||
}
|
||||
v_length -= v_n_copied;
|
||||
if (((uint64_t)(b_wend_dst - b_wptr_dst)) == 0) {
|
||||
if (((uint64_t)(iobounds1_dst - ioptr_dst)) == 0) {
|
||||
status = WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(3);
|
||||
} else {
|
||||
@@ -2231,14 +2231,14 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wstart_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wend_dst);
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_dst);
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2337,18 +2337,18 @@ static wuffs_deflate__status wuffs_deflate__decoder__init_dynamic_huffman(
|
||||
uint8_t v_rep_symbol;
|
||||
uint32_t v_rep_count;
|
||||
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -2378,10 +2378,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__init_dynamic_huffman(
|
||||
while (v_n_bits < 14) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_0)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -2406,10 +2406,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__init_dynamic_huffman(
|
||||
while (v_n_bits < 3) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_1 = *b_rptr_src++;
|
||||
uint8_t t_1 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_1)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -2444,10 +2444,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__init_dynamic_huffman(
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_2 = *b_rptr_src++;
|
||||
uint8_t t_2 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_2)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -2491,10 +2491,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__init_dynamic_huffman(
|
||||
while (v_n_bits < v_n_extra_bits) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_3 = *b_rptr_src++;
|
||||
uint8_t t_3 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_3)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -2561,9 +2561,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2880,34 +2880,34 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_fast(
|
||||
uint32_t v_hlen;
|
||||
uint32_t v_hdist;
|
||||
|
||||
uint8_t* b_wptr_dst = NULL;
|
||||
uint8_t* b_wstart_dst = NULL;
|
||||
uint8_t* b_wend_dst = NULL;
|
||||
uint8_t* ioptr_dst = NULL;
|
||||
uint8_t* iobounds0orig_dst = NULL;
|
||||
uint8_t* iobounds1_dst = NULL;
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[0] = ioptr_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[1] = ioptr_dst;
|
||||
}
|
||||
b_wstart_dst = a_dst.private_impl.bounds[0];
|
||||
b_wend_dst = a_dst.private_impl.bounds[1];
|
||||
iobounds0orig_dst = a_dst.private_impl.bounds[0];
|
||||
iobounds1_dst = a_dst.private_impl.bounds[1];
|
||||
}
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
if ((self->private_impl.f_n_bits >= 8) ||
|
||||
@@ -2922,16 +2922,16 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_fast(
|
||||
v_lmask = ((((uint32_t)(1)) << self->private_impl.f_n_huffs_bits[0]) - 1);
|
||||
v_dmask = ((((uint32_t)(1)) << self->private_impl.f_n_huffs_bits[1]) - 1);
|
||||
label_0_continue:;
|
||||
while ((((uint64_t)(b_wend_dst - b_wptr_dst)) >= 258) &&
|
||||
(((uint64_t)(b_rend_src - b_rptr_src)) >= 12)) {
|
||||
while ((((uint64_t)(iobounds1_dst - ioptr_dst)) >= 258) &&
|
||||
(((uint64_t)(iobounds1_src - ioptr_src)) >= 12)) {
|
||||
if (v_n_bits < 15) {
|
||||
{
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_0)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
{
|
||||
uint8_t t_1 = *b_rptr_src++;
|
||||
uint8_t t_1 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_1)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -2942,7 +2942,7 @@ label_0_continue:;
|
||||
v_bits >>= v_table_entry_n_bits;
|
||||
v_n_bits -= v_table_entry_n_bits;
|
||||
if ((v_table_entry >> 31) != 0) {
|
||||
*b_wptr_dst++ = ((uint8_t)(((v_table_entry >> 8) & 255)));
|
||||
*ioptr_dst++ = ((uint8_t)(((v_table_entry >> 8) & 255)));
|
||||
goto label_0_continue;
|
||||
} else if ((v_table_entry >> 30) != 0) {
|
||||
} else if ((v_table_entry >> 29) != 0) {
|
||||
@@ -2951,12 +2951,12 @@ label_0_continue:;
|
||||
} else if ((v_table_entry >> 28) != 0) {
|
||||
if (v_n_bits < 15) {
|
||||
{
|
||||
uint8_t t_2 = *b_rptr_src++;
|
||||
uint8_t t_2 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_2)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
{
|
||||
uint8_t t_3 = *b_rptr_src++;
|
||||
uint8_t t_3 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_3)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -2975,7 +2975,7 @@ label_0_continue:;
|
||||
v_bits >>= v_table_entry_n_bits;
|
||||
v_n_bits -= v_table_entry_n_bits;
|
||||
if ((v_table_entry >> 31) != 0) {
|
||||
*b_wptr_dst++ = ((uint8_t)(((v_table_entry >> 8) & 255)));
|
||||
*ioptr_dst++ = ((uint8_t)(((v_table_entry >> 8) & 255)));
|
||||
goto label_0_continue;
|
||||
} else if ((v_table_entry >> 30) != 0) {
|
||||
} else if ((v_table_entry >> 29) != 0) {
|
||||
@@ -3006,12 +3006,12 @@ label_0_continue:;
|
||||
if (v_table_entry_n_bits > 0) {
|
||||
if (v_n_bits < 15) {
|
||||
{
|
||||
uint8_t t_4 = *b_rptr_src++;
|
||||
uint8_t t_4 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_4)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
{
|
||||
uint8_t t_5 = *b_rptr_src++;
|
||||
uint8_t t_5 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_5)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3031,12 +3031,12 @@ label_0_continue:;
|
||||
}
|
||||
if (v_n_bits < 15) {
|
||||
{
|
||||
uint8_t t_6 = *b_rptr_src++;
|
||||
uint8_t t_6 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_6)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
{
|
||||
uint8_t t_7 = *b_rptr_src++;
|
||||
uint8_t t_7 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_7)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3049,12 +3049,12 @@ label_0_continue:;
|
||||
if ((v_table_entry >> 28) == 1) {
|
||||
if (v_n_bits < 15) {
|
||||
{
|
||||
uint8_t t_8 = *b_rptr_src++;
|
||||
uint8_t t_8 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_8)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
{
|
||||
uint8_t t_9 = *b_rptr_src++;
|
||||
uint8_t t_9 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_9)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3088,12 +3088,12 @@ label_0_continue:;
|
||||
if (v_table_entry_n_bits > 0) {
|
||||
if (v_n_bits < 15) {
|
||||
{
|
||||
uint8_t t_10 = *b_rptr_src++;
|
||||
uint8_t t_10 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_10)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
{
|
||||
uint8_t t_11 = *b_rptr_src++;
|
||||
uint8_t t_11 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_11)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3110,18 +3110,18 @@ label_0_continue:;
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(b_wptr_dst - a_dst.private_impl.bounds[0]),
|
||||
.len = (size_t)(ioptr_dst - a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len))) {
|
||||
v_hlen = 0;
|
||||
v_hdist = ((uint32_t)((
|
||||
((uint64_t)((v_dist_minus_1 + 1))) -
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(b_wptr_dst - a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len)))));
|
||||
v_hdist = ((uint32_t)(
|
||||
(((uint64_t)((v_dist_minus_1 + 1))) -
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(ioptr_dst - a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len)))));
|
||||
if (v_length > v_hdist) {
|
||||
v_length -= v_hdist;
|
||||
v_hlen = v_hdist;
|
||||
@@ -3141,7 +3141,7 @@ label_0_continue:;
|
||||
v_hdist = (self->private_impl.f_history_index - v_hdist);
|
||||
while (true) {
|
||||
v_n_copied = wuffs_base__io_writer__copy_from_slice32(
|
||||
&b_wptr_dst, b_wend_dst,
|
||||
&ioptr_dst, iobounds1_dst,
|
||||
wuffs_base__slice_u8__subslice_i(
|
||||
((wuffs_base__slice_u8){.ptr = self->private_impl.f_history,
|
||||
.len = 32768}),
|
||||
@@ -3152,7 +3152,7 @@ label_0_continue:;
|
||||
}
|
||||
v_hlen -= v_n_copied;
|
||||
wuffs_base__io_writer__copy_from_slice32(
|
||||
&b_wptr_dst, b_wend_dst,
|
||||
&ioptr_dst, iobounds1_dst,
|
||||
((wuffs_base__slice_u8){.ptr = self->private_impl.f_history,
|
||||
.len = 32768}),
|
||||
v_hlen);
|
||||
@@ -3166,7 +3166,7 @@ label_0_continue:;
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(b_wptr_dst - a_dst.private_impl.bounds[0]),
|
||||
.len = (size_t)(ioptr_dst - a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len))) {
|
||||
status = WUFFS_DEFLATE__ERROR_INTERNAL_ERROR_INCONSISTENT_DISTANCE;
|
||||
@@ -3174,7 +3174,7 @@ label_0_continue:;
|
||||
}
|
||||
}
|
||||
wuffs_base__io_writer__copy_from_history32__bco(
|
||||
&b_wptr_dst, a_dst.private_impl.bounds[0], b_wend_dst,
|
||||
&ioptr_dst, a_dst.private_impl.bounds[0], iobounds1_dst,
|
||||
(v_dist_minus_1 + 1), v_length);
|
||||
goto label_2_break;
|
||||
}
|
||||
@@ -3183,11 +3183,11 @@ label_0_continue:;
|
||||
label_0_break:;
|
||||
while (v_n_bits >= 8) {
|
||||
v_n_bits -= 8;
|
||||
if (b_rptr_src == b_rstart_src) {
|
||||
if (ioptr_src == iobounds0orig_src) {
|
||||
status = WUFFS_DEFLATE__ERROR_INVALID_I_O_OPERATION;
|
||||
goto exit;
|
||||
}
|
||||
b_rptr_src--;
|
||||
ioptr_src--;
|
||||
}
|
||||
self->private_impl.f_bits = (v_bits & ((((uint32_t)(1)) << v_n_bits) - 1));
|
||||
self->private_impl.f_n_bits = v_n_bits;
|
||||
@@ -3199,14 +3199,14 @@ label_0_break:;
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wstart_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wend_dst);
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_dst);
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -3234,34 +3234,34 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
uint32_t v_hlen;
|
||||
uint32_t v_hdist;
|
||||
|
||||
uint8_t* b_wptr_dst = NULL;
|
||||
uint8_t* b_wstart_dst = NULL;
|
||||
uint8_t* b_wend_dst = NULL;
|
||||
uint8_t* ioptr_dst = NULL;
|
||||
uint8_t* iobounds0orig_dst = NULL;
|
||||
uint8_t* iobounds1_dst = NULL;
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[0] = ioptr_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[1] = ioptr_dst;
|
||||
}
|
||||
b_wstart_dst = a_dst.private_impl.bounds[0];
|
||||
b_wend_dst = a_dst.private_impl.bounds[1];
|
||||
iobounds0orig_dst = a_dst.private_impl.bounds[0];
|
||||
iobounds1_dst = a_dst.private_impl.bounds[1];
|
||||
}
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -3309,10 +3309,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_0)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3320,11 +3320,11 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
label_1_break:;
|
||||
if ((v_table_entry >> 31) != 0) {
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
if (b_wptr_dst == b_wend_dst) {
|
||||
if (ioptr_dst == iobounds1_dst) {
|
||||
status = WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE;
|
||||
goto suspend;
|
||||
}
|
||||
*b_wptr_dst++ = ((uint8_t)(((v_table_entry >> 8) & 255)));
|
||||
*ioptr_dst++ = ((uint8_t)(((v_table_entry >> 8) & 255)));
|
||||
goto label_0_continue;
|
||||
} else if ((v_table_entry >> 30) != 0) {
|
||||
} else if ((v_table_entry >> 29) != 0) {
|
||||
@@ -3350,10 +3350,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_1 = *b_rptr_src++;
|
||||
uint8_t t_1 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_1)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3361,11 +3361,11 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
label_2_break:;
|
||||
if ((v_table_entry >> 31) != 0) {
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||
if (b_wptr_dst == b_wend_dst) {
|
||||
if (ioptr_dst == iobounds1_dst) {
|
||||
status = WUFFS_DEFLATE__SUSPENSION_SHORT_WRITE;
|
||||
goto suspend;
|
||||
}
|
||||
*b_wptr_dst++ = ((uint8_t)(((v_table_entry >> 8) & 255)));
|
||||
*ioptr_dst++ = ((uint8_t)(((v_table_entry >> 8) & 255)));
|
||||
goto label_0_continue;
|
||||
} else if ((v_table_entry >> 30) != 0) {
|
||||
} else if ((v_table_entry >> 29) != 0) {
|
||||
@@ -3397,10 +3397,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
while (v_n_bits < v_table_entry_n_bits) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_2 = *b_rptr_src++;
|
||||
uint8_t t_2 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_2)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3421,10 +3421,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_3 = *b_rptr_src++;
|
||||
uint8_t t_3 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_3)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3450,10 +3450,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_4 = *b_rptr_src++;
|
||||
uint8_t t_4 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_4)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3475,10 +3475,10 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
while (v_n_bits < v_table_entry_n_bits) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(8);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_5 = *b_rptr_src++;
|
||||
uint8_t t_5 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_5)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3495,7 +3495,7 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(b_wptr_dst - a_dst.private_impl.bounds[0]),
|
||||
.len = (size_t)(ioptr_dst - a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len))) {
|
||||
v_hlen = 0;
|
||||
@@ -3503,7 +3503,7 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
(((uint64_t)((v_dist_minus_1 + 1))) -
|
||||
((uint64_t)(((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(b_wptr_dst -
|
||||
.len = (size_t)(ioptr_dst -
|
||||
a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len)))));
|
||||
@@ -3521,7 +3521,7 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
v_hdist = (self->private_impl.f_history_index - v_hdist);
|
||||
while (true) {
|
||||
v_n_copied = wuffs_base__io_writer__copy_from_slice32(
|
||||
&b_wptr_dst, b_wend_dst,
|
||||
&ioptr_dst, iobounds1_dst,
|
||||
wuffs_base__slice_u8__subslice_i(
|
||||
((wuffs_base__slice_u8){.ptr = self->private_impl.f_history,
|
||||
.len = 32768}),
|
||||
@@ -3545,7 +3545,7 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
if (v_hlen > 0) {
|
||||
while (true) {
|
||||
v_n_copied = wuffs_base__io_writer__copy_from_slice32(
|
||||
&b_wptr_dst, b_wend_dst,
|
||||
&ioptr_dst, iobounds1_dst,
|
||||
wuffs_base__slice_u8__subslice_i(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = self->private_impl.f_history, .len = 32768}),
|
||||
@@ -3567,7 +3567,7 @@ static wuffs_deflate__status wuffs_deflate__decoder__decode_huffman_slow(
|
||||
}
|
||||
}
|
||||
v_n_copied = wuffs_base__io_writer__copy_from_history32(
|
||||
&b_wptr_dst, a_dst.private_impl.bounds[0], b_wend_dst,
|
||||
&ioptr_dst, a_dst.private_impl.bounds[0], iobounds1_dst,
|
||||
(v_dist_minus_1 + 1), v_length);
|
||||
if (v_length <= v_n_copied) {
|
||||
v_length = 0;
|
||||
@@ -3615,14 +3615,14 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wstart_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wend_dst);
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_dst);
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
+234
-230
@@ -1835,18 +1835,18 @@ wuffs_gif__status wuffs_gif__decoder__decode_config(
|
||||
}
|
||||
wuffs_gif__status status = WUFFS_GIF__STATUS_OK;
|
||||
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -1863,22 +1863,22 @@ wuffs_gif__status wuffs_gif__decoder__decode_config(
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_gif__decoder__decode_header(self, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_gif__decoder__decode_lsd(self, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -1887,10 +1887,10 @@ wuffs_gif__status wuffs_gif__decoder__decode_config(
|
||||
self->private_impl.f_peek_block_type = true;
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
self->private_impl.f_block_type = t_0;
|
||||
}
|
||||
if (self->private_impl.f_seen_num_loops ||
|
||||
@@ -1899,11 +1899,11 @@ wuffs_gif__status wuffs_gif__decoder__decode_config(
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_gif__decoder__decode_extension(self, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -1928,9 +1928,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
self->private_impl.status = status;
|
||||
@@ -1962,18 +1962,18 @@ wuffs_gif__status wuffs_gif__decoder__decode_frame(
|
||||
}
|
||||
wuffs_gif__status status = WUFFS_GIF__STATUS_OK;
|
||||
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -1994,21 +1994,21 @@ wuffs_gif__status wuffs_gif__decoder__decode_frame(
|
||||
} else {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
self->private_impl.f_block_type = t_0;
|
||||
}
|
||||
}
|
||||
if (self->private_impl.f_block_type == 33) {
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_gif__decoder__decode_extension(self, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -2016,11 +2016,11 @@ wuffs_gif__status wuffs_gif__decoder__decode_frame(
|
||||
} else if (self->private_impl.f_block_type == 44) {
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_gif__decoder__decode_id(self, a_dst, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -2053,9 +2053,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
self->private_impl.status = status;
|
||||
@@ -2080,18 +2080,18 @@ static wuffs_gif__status wuffs_gif__decoder__decode_header(
|
||||
uint8_t v_c[6];
|
||||
uint32_t v_i;
|
||||
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -2109,10 +2109,10 @@ static wuffs_gif__status wuffs_gif__decoder__decode_header(
|
||||
while (v_i < 6) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
v_c[v_i] = t_0;
|
||||
}
|
||||
v_i += 1;
|
||||
@@ -2138,9 +2138,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2165,18 +2165,18 @@ static wuffs_gif__status wuffs_gif__decoder__decode_lsd(
|
||||
uint32_t v_i;
|
||||
uint32_t v_gct_size;
|
||||
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode_lsd[0].coro_susp_point;
|
||||
@@ -2194,10 +2194,10 @@ static wuffs_gif__status wuffs_gif__decoder__decode_lsd(
|
||||
while (v_i < 7) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
v_c[v_i] = t_0;
|
||||
}
|
||||
v_i += 1;
|
||||
@@ -2214,26 +2214,26 @@ static wuffs_gif__status wuffs_gif__decoder__decode_lsd(
|
||||
while (v_i < v_gct_size) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_1 = *b_rptr_src++;
|
||||
uint8_t t_1 = *ioptr_src++;
|
||||
self->private_impl.f_gct[((3 * v_i) + 0)] = t_1;
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_2 = *b_rptr_src++;
|
||||
uint8_t t_2 = *ioptr_src++;
|
||||
self->private_impl.f_gct[((3 * v_i) + 1)] = t_2;
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_3 = *b_rptr_src++;
|
||||
uint8_t t_3 = *ioptr_src++;
|
||||
self->private_impl.f_gct[((3 * v_i) + 2)] = t_3;
|
||||
}
|
||||
v_i += 1;
|
||||
@@ -2256,9 +2256,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2281,18 +2281,18 @@ static wuffs_gif__status wuffs_gif__decoder__decode_extension(
|
||||
|
||||
uint8_t v_label;
|
||||
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -2306,21 +2306,21 @@ static wuffs_gif__status wuffs_gif__decoder__decode_extension(
|
||||
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
v_label = t_0;
|
||||
}
|
||||
if (v_label == 249) {
|
||||
} else if (v_label == 255) {
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_gif__decoder__decode_ae(self, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -2330,11 +2330,11 @@ static wuffs_gif__status wuffs_gif__decoder__decode_extension(
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_gif__decoder__skip_blocks(self, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -2354,9 +2354,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2379,18 +2379,18 @@ static wuffs_gif__status wuffs_gif__decoder__skip_blocks(
|
||||
|
||||
uint8_t v_block_size;
|
||||
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point =
|
||||
@@ -2405,10 +2405,10 @@ static wuffs_gif__status wuffs_gif__decoder__skip_blocks(
|
||||
while (true) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
v_block_size = t_0;
|
||||
}
|
||||
if (v_block_size == 0) {
|
||||
@@ -2419,12 +2419,13 @@ static wuffs_gif__status wuffs_gif__decoder__skip_blocks(
|
||||
self->private_impl.c_skip_blocks[0].scratch = ((uint32_t)(v_block_size));
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
if (self->private_impl.c_skip_blocks[0].scratch >
|
||||
b_rend_src - b_rptr_src) {
|
||||
self->private_impl.c_skip_blocks[0].scratch -= b_rend_src - b_rptr_src;
|
||||
b_rptr_src = b_rend_src;
|
||||
iobounds1_src - ioptr_src) {
|
||||
self->private_impl.c_skip_blocks[0].scratch -=
|
||||
iobounds1_src - ioptr_src;
|
||||
ioptr_src = iobounds1_src;
|
||||
goto short_read_src;
|
||||
}
|
||||
b_rptr_src += self->private_impl.c_skip_blocks[0].scratch;
|
||||
ioptr_src += self->private_impl.c_skip_blocks[0].scratch;
|
||||
}
|
||||
|
||||
goto ok;
|
||||
@@ -2441,9 +2442,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2469,18 +2470,18 @@ static wuffs_gif__status wuffs_gif__decoder__decode_ae(
|
||||
bool v_not_animexts;
|
||||
bool v_not_netscape;
|
||||
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode_ae[0].coro_susp_point;
|
||||
@@ -2500,10 +2501,10 @@ static wuffs_gif__status wuffs_gif__decoder__decode_ae(
|
||||
v_c = 0;
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
v_block_size = t_0;
|
||||
}
|
||||
if (v_block_size == 0) {
|
||||
@@ -2515,12 +2516,13 @@ static wuffs_gif__status wuffs_gif__decoder__decode_ae(
|
||||
self->private_impl.c_decode_ae[0].scratch = ((uint32_t)(v_block_size));
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
if (self->private_impl.c_decode_ae[0].scratch >
|
||||
b_rend_src - b_rptr_src) {
|
||||
self->private_impl.c_decode_ae[0].scratch -= b_rend_src - b_rptr_src;
|
||||
b_rptr_src = b_rend_src;
|
||||
iobounds1_src - ioptr_src) {
|
||||
self->private_impl.c_decode_ae[0].scratch -=
|
||||
iobounds1_src - ioptr_src;
|
||||
ioptr_src = iobounds1_src;
|
||||
goto short_read_src;
|
||||
}
|
||||
b_rptr_src += self->private_impl.c_decode_ae[0].scratch;
|
||||
ioptr_src += self->private_impl.c_decode_ae[0].scratch;
|
||||
goto label_0_break;
|
||||
}
|
||||
v_not_animexts = 0;
|
||||
@@ -2529,10 +2531,10 @@ static wuffs_gif__status wuffs_gif__decoder__decode_ae(
|
||||
while (v_block_size < 11) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_1 = *b_rptr_src++;
|
||||
uint8_t t_1 = *ioptr_src++;
|
||||
v_c = t_1;
|
||||
}
|
||||
v_not_animexts =
|
||||
@@ -2546,10 +2548,10 @@ static wuffs_gif__status wuffs_gif__decoder__decode_ae(
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_2 = *b_rptr_src++;
|
||||
uint8_t t_2 = *ioptr_src++;
|
||||
v_block_size = t_2;
|
||||
}
|
||||
if (v_block_size != 3) {
|
||||
@@ -2557,20 +2559,21 @@ static wuffs_gif__status wuffs_gif__decoder__decode_ae(
|
||||
self->private_impl.c_decode_ae[0].scratch = ((uint32_t)(v_block_size));
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7);
|
||||
if (self->private_impl.c_decode_ae[0].scratch >
|
||||
b_rend_src - b_rptr_src) {
|
||||
self->private_impl.c_decode_ae[0].scratch -= b_rend_src - b_rptr_src;
|
||||
b_rptr_src = b_rend_src;
|
||||
iobounds1_src - ioptr_src) {
|
||||
self->private_impl.c_decode_ae[0].scratch -=
|
||||
iobounds1_src - ioptr_src;
|
||||
ioptr_src = iobounds1_src;
|
||||
goto short_read_src;
|
||||
}
|
||||
b_rptr_src += self->private_impl.c_decode_ae[0].scratch;
|
||||
ioptr_src += self->private_impl.c_decode_ae[0].scratch;
|
||||
goto label_0_break;
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(8);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_3 = *b_rptr_src++;
|
||||
uint8_t t_3 = *ioptr_src++;
|
||||
v_c = t_3;
|
||||
}
|
||||
if (v_c != 1) {
|
||||
@@ -2578,32 +2581,33 @@ static wuffs_gif__status wuffs_gif__decoder__decode_ae(
|
||||
self->private_impl.c_decode_ae[0].scratch = 2;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(10);
|
||||
if (self->private_impl.c_decode_ae[0].scratch >
|
||||
b_rend_src - b_rptr_src) {
|
||||
self->private_impl.c_decode_ae[0].scratch -= b_rend_src - b_rptr_src;
|
||||
b_rptr_src = b_rend_src;
|
||||
iobounds1_src - ioptr_src) {
|
||||
self->private_impl.c_decode_ae[0].scratch -=
|
||||
iobounds1_src - ioptr_src;
|
||||
ioptr_src = iobounds1_src;
|
||||
goto short_read_src;
|
||||
}
|
||||
b_rptr_src += self->private_impl.c_decode_ae[0].scratch;
|
||||
ioptr_src += self->private_impl.c_decode_ae[0].scratch;
|
||||
goto label_0_break;
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(11);
|
||||
uint16_t t_5;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 2)) {
|
||||
t_5 = wuffs_base__load_u16le(b_rptr_src);
|
||||
b_rptr_src += 2;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 2)) {
|
||||
t_5 = wuffs_base__load_u16le(ioptr_src);
|
||||
ioptr_src += 2;
|
||||
} else {
|
||||
self->private_impl.c_decode_ae[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(12);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_4 = self->private_impl.c_decode_ae[0].scratch >> 56;
|
||||
self->private_impl.c_decode_ae[0].scratch <<= 8;
|
||||
self->private_impl.c_decode_ae[0].scratch >>= 8;
|
||||
self->private_impl.c_decode_ae[0].scratch |=
|
||||
((uint64_t)(*b_rptr_src++)) << t_4;
|
||||
((uint64_t)(*ioptr_src++)) << t_4;
|
||||
if (t_4 == 8) {
|
||||
t_5 = self->private_impl.c_decode_ae[0].scratch;
|
||||
break;
|
||||
@@ -2625,11 +2629,11 @@ static wuffs_gif__status wuffs_gif__decoder__decode_ae(
|
||||
label_0_break:;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(13);
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
status = wuffs_gif__decoder__skip_blocks(self, a_src);
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
if (status) {
|
||||
goto suspend;
|
||||
@@ -2652,9 +2656,9 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2683,43 +2687,43 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
uint64_t v_block_size;
|
||||
wuffs_base__io_writer v_w;
|
||||
wuffs_base__io_buffer u_w;
|
||||
uint8_t* b_wptr_w = NULL;
|
||||
uint8_t* b_wend_w = NULL;
|
||||
uint8_t* ioptr_w = NULL;
|
||||
uint8_t* iobounds1_w = NULL;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(u_w);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wptr_w);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wend_w);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(ioptr_w);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_w);
|
||||
wuffs_gif__status v_z;
|
||||
wuffs_base__slice_u8 v_pass_through;
|
||||
uint64_t v_n_copied;
|
||||
|
||||
uint8_t* b_wptr_dst = NULL;
|
||||
uint8_t* b_wstart_dst = NULL;
|
||||
uint8_t* b_wend_dst = NULL;
|
||||
uint8_t* ioptr_dst = NULL;
|
||||
uint8_t* iobounds0orig_dst = NULL;
|
||||
uint8_t* iobounds1_dst = NULL;
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[0] = ioptr_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[1] = ioptr_dst;
|
||||
}
|
||||
b_wstart_dst = a_dst.private_impl.bounds[0];
|
||||
b_wend_dst = a_dst.private_impl.bounds[1];
|
||||
iobounds0orig_dst = a_dst.private_impl.bounds[0];
|
||||
iobounds1_dst = a_dst.private_impl.bounds[1];
|
||||
}
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode_id[0].coro_susp_point;
|
||||
@@ -2743,21 +2747,21 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
uint16_t t_1;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 2)) {
|
||||
t_1 = wuffs_base__load_u16le(b_rptr_src);
|
||||
b_rptr_src += 2;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 2)) {
|
||||
t_1 = wuffs_base__load_u16le(ioptr_src);
|
||||
ioptr_src += 2;
|
||||
} else {
|
||||
self->private_impl.c_decode_id[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_0 = self->private_impl.c_decode_id[0].scratch >> 56;
|
||||
self->private_impl.c_decode_id[0].scratch <<= 8;
|
||||
self->private_impl.c_decode_id[0].scratch >>= 8;
|
||||
self->private_impl.c_decode_id[0].scratch |=
|
||||
((uint64_t)(*b_rptr_src++)) << t_0;
|
||||
((uint64_t)(*ioptr_src++)) << t_0;
|
||||
if (t_0 == 8) {
|
||||
t_1 = self->private_impl.c_decode_id[0].scratch;
|
||||
break;
|
||||
@@ -2771,21 +2775,21 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
uint16_t t_3;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 2)) {
|
||||
t_3 = wuffs_base__load_u16le(b_rptr_src);
|
||||
b_rptr_src += 2;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 2)) {
|
||||
t_3 = wuffs_base__load_u16le(ioptr_src);
|
||||
ioptr_src += 2;
|
||||
} else {
|
||||
self->private_impl.c_decode_id[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_2 = self->private_impl.c_decode_id[0].scratch >> 56;
|
||||
self->private_impl.c_decode_id[0].scratch <<= 8;
|
||||
self->private_impl.c_decode_id[0].scratch >>= 8;
|
||||
self->private_impl.c_decode_id[0].scratch |=
|
||||
((uint64_t)(*b_rptr_src++)) << t_2;
|
||||
((uint64_t)(*ioptr_src++)) << t_2;
|
||||
if (t_2 == 8) {
|
||||
t_3 = self->private_impl.c_decode_id[0].scratch;
|
||||
break;
|
||||
@@ -2799,21 +2803,21 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||
uint16_t t_5;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 2)) {
|
||||
t_5 = wuffs_base__load_u16le(b_rptr_src);
|
||||
b_rptr_src += 2;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 2)) {
|
||||
t_5 = wuffs_base__load_u16le(ioptr_src);
|
||||
ioptr_src += 2;
|
||||
} else {
|
||||
self->private_impl.c_decode_id[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_4 = self->private_impl.c_decode_id[0].scratch >> 56;
|
||||
self->private_impl.c_decode_id[0].scratch <<= 8;
|
||||
self->private_impl.c_decode_id[0].scratch >>= 8;
|
||||
self->private_impl.c_decode_id[0].scratch |=
|
||||
((uint64_t)(*b_rptr_src++)) << t_4;
|
||||
((uint64_t)(*ioptr_src++)) << t_4;
|
||||
if (t_4 == 8) {
|
||||
t_5 = self->private_impl.c_decode_id[0].scratch;
|
||||
break;
|
||||
@@ -2827,21 +2831,21 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7);
|
||||
uint16_t t_7;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 2)) {
|
||||
t_7 = wuffs_base__load_u16le(b_rptr_src);
|
||||
b_rptr_src += 2;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 2)) {
|
||||
t_7 = wuffs_base__load_u16le(ioptr_src);
|
||||
ioptr_src += 2;
|
||||
} else {
|
||||
self->private_impl.c_decode_id[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(8);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_6 = self->private_impl.c_decode_id[0].scratch >> 56;
|
||||
self->private_impl.c_decode_id[0].scratch <<= 8;
|
||||
self->private_impl.c_decode_id[0].scratch >>= 8;
|
||||
self->private_impl.c_decode_id[0].scratch |=
|
||||
((uint64_t)(*b_rptr_src++)) << t_6;
|
||||
((uint64_t)(*ioptr_src++)) << t_6;
|
||||
if (t_6 == 8) {
|
||||
t_7 = self->private_impl.c_decode_id[0].scratch;
|
||||
break;
|
||||
@@ -2854,10 +2858,10 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(9);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_8 = *b_rptr_src++;
|
||||
uint8_t t_8 = *ioptr_src++;
|
||||
v_flags = t_8;
|
||||
}
|
||||
self->private_impl.f_interlace = ((v_flags & 64) != 0);
|
||||
@@ -2868,26 +2872,26 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
while (v_i < v_lct_size) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(10);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_9 = *b_rptr_src++;
|
||||
uint8_t t_9 = *ioptr_src++;
|
||||
self->private_impl.f_lct[((3 * v_i) + 0)] = t_9;
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(11);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_10 = *b_rptr_src++;
|
||||
uint8_t t_10 = *ioptr_src++;
|
||||
self->private_impl.f_lct[((3 * v_i) + 1)] = t_10;
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(12);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_11 = *b_rptr_src++;
|
||||
uint8_t t_11 = *ioptr_src++;
|
||||
self->private_impl.f_lct[((3 * v_i) + 2)] = t_11;
|
||||
}
|
||||
v_i += 1;
|
||||
@@ -2899,10 +2903,10 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(13);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_12 = *b_rptr_src++;
|
||||
uint8_t t_12 = *ioptr_src++;
|
||||
v_lw = t_12;
|
||||
}
|
||||
if ((v_lw < 2) || (8 < v_lw)) {
|
||||
@@ -2915,10 +2919,10 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
while (true) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(14);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_13 = *b_rptr_src++;
|
||||
uint8_t t_13 = *ioptr_src++;
|
||||
v_block_size = ((uint64_t)(t_13));
|
||||
}
|
||||
if (v_block_size == 0) {
|
||||
@@ -2931,45 +2935,45 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
{
|
||||
wuffs_base__io_reader o_0_a_src = a_src;
|
||||
wuffs_base__io_writer o_0_v_w = v_w;
|
||||
uint8_t* o_0_ioptr1_v_w = b_wptr_w;
|
||||
uint8_t* o_0_ioptr2_v_w = b_wend_w;
|
||||
uint8_t* o_0_ioptr1_v_w = ioptr_w;
|
||||
uint8_t* o_0_ioptr2_v_w = iobounds1_w;
|
||||
wuffs_base__io_writer__set(
|
||||
&v_w, &u_w, &b_wptr_w, &b_wend_w,
|
||||
&v_w, &u_w, &ioptr_w, &iobounds1_w,
|
||||
wuffs_base__slice_u8__subslice_i(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = self->private_impl.f_uncompressed, .len = 4096}),
|
||||
self->private_impl.f_uncompressed_wi));
|
||||
wuffs_base__io_reader__set_limit(&a_src, b_rptr_src, v_block_size);
|
||||
wuffs_base__io_reader__set_mark(&a_src, b_rptr_src);
|
||||
wuffs_base__io_reader__set_limit(&a_src, ioptr_src, v_block_size);
|
||||
wuffs_base__io_reader__set_mark(&a_src, ioptr_src);
|
||||
{
|
||||
u_w.wi = b_wptr_w - u_w.ptr;
|
||||
u_w.wi = ioptr_w - u_w.ptr;
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri =
|
||||
b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
wuffs_gif__status t_14 = wuffs_gif__lzw_decoder__decode(
|
||||
&self->private_impl.f_lzw, v_w, a_src);
|
||||
b_wptr_w = u_w.ptr + u_w.wi;
|
||||
ioptr_w = u_w.ptr + u_w.wi;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src =
|
||||
ioptr_src =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
v_z = t_14;
|
||||
}
|
||||
self->private_impl.f_uncompressed_wi =
|
||||
(4096 - ((uint32_t)(wuffs_base__u64__min(
|
||||
((uint64_t)(b_wend_w - b_wptr_w)), 4096))));
|
||||
((uint64_t)(iobounds1_w - ioptr_w)), 4096))));
|
||||
wuffs_base__u64__sat_sub_indirect(
|
||||
&v_block_size,
|
||||
((uint64_t)(((wuffs_base__slice_u8){
|
||||
.ptr = a_src.private_impl.bounds[0],
|
||||
.len = (size_t)(b_rptr_src -
|
||||
.len = (size_t)(ioptr_src -
|
||||
a_src.private_impl.bounds[0]),
|
||||
})
|
||||
.len)));
|
||||
v_w = o_0_v_w;
|
||||
b_wptr_w = o_0_ioptr1_v_w;
|
||||
b_wend_w = o_0_ioptr2_v_w;
|
||||
ioptr_w = o_0_ioptr1_v_w;
|
||||
iobounds1_w = o_0_ioptr2_v_w;
|
||||
a_src = o_0_a_src;
|
||||
}
|
||||
if ((v_z == 0) || (v_z == WUFFS_GIF__SUSPENSION_SHORT_WRITE)) {
|
||||
@@ -2981,7 +2985,7 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id(
|
||||
self->private_impl.f_uncompressed_ri,
|
||||
self->private_impl.f_uncompressed_wi);
|
||||
v_n_copied = wuffs_base__io_writer__copy_from_slice(
|
||||
&b_wptr_dst, b_wend_dst, v_pass_through);
|
||||
&ioptr_dst, iobounds1_dst, v_pass_through);
|
||||
if (v_n_copied == ((uint64_t)(v_pass_through.len))) {
|
||||
self->private_impl.f_uncompressed_ri = 0;
|
||||
self->private_impl.f_uncompressed_wi = 0;
|
||||
@@ -3031,14 +3035,14 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wstart_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wend_dst);
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_dst);
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -3082,34 +3086,34 @@ static wuffs_gif__status wuffs_gif__lzw_decoder__decode(
|
||||
wuffs_base__slice_u8 v_expansion;
|
||||
uint64_t v_n_copied;
|
||||
|
||||
uint8_t* b_wptr_dst = NULL;
|
||||
uint8_t* b_wstart_dst = NULL;
|
||||
uint8_t* b_wend_dst = NULL;
|
||||
uint8_t* ioptr_dst = NULL;
|
||||
uint8_t* iobounds0orig_dst = NULL;
|
||||
uint8_t* iobounds1_dst = NULL;
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[0] = ioptr_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[1] = ioptr_dst;
|
||||
}
|
||||
b_wstart_dst = a_dst.private_impl.bounds[0];
|
||||
b_wend_dst = a_dst.private_impl.bounds[1];
|
||||
iobounds0orig_dst = a_dst.private_impl.bounds[0];
|
||||
iobounds1_dst = a_dst.private_impl.bounds[1];
|
||||
}
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode[0].coro_susp_point;
|
||||
@@ -3146,10 +3150,10 @@ static wuffs_gif__status wuffs_gif__lzw_decoder__decode(
|
||||
while (v_n_bits < v_width) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
v_bits |= (((uint32_t)(t_0)) << v_n_bits);
|
||||
}
|
||||
v_n_bits += 8;
|
||||
@@ -3159,11 +3163,11 @@ static wuffs_gif__status wuffs_gif__lzw_decoder__decode(
|
||||
v_n_bits -= v_width;
|
||||
if (v_code < v_clear_code) {
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
if (b_wptr_dst == b_wend_dst) {
|
||||
if (ioptr_dst == iobounds1_dst) {
|
||||
status = WUFFS_GIF__SUSPENSION_SHORT_WRITE;
|
||||
goto suspend;
|
||||
}
|
||||
*b_wptr_dst++ = ((uint8_t)(v_code));
|
||||
*ioptr_dst++ = ((uint8_t)(v_code));
|
||||
if (v_save_code <= 4095) {
|
||||
self->private_impl.f_suffixes[v_save_code] = ((uint8_t)(v_code));
|
||||
self->private_impl.f_prefixes[v_save_code] =
|
||||
@@ -3203,7 +3207,7 @@ static wuffs_gif__status wuffs_gif__lzw_decoder__decode(
|
||||
.len = 4096}),
|
||||
v_s);
|
||||
v_n_copied = wuffs_base__io_writer__copy_from_slice(
|
||||
&b_wptr_dst, b_wend_dst, v_expansion);
|
||||
&ioptr_dst, iobounds1_dst, v_expansion);
|
||||
if (v_n_copied == ((uint64_t)(v_expansion.len))) {
|
||||
goto label_1_break;
|
||||
}
|
||||
@@ -3255,14 +3259,14 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wstart_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wend_dst);
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_dst);
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
+75
-75
@@ -1978,34 +1978,34 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
uint32_t v_checksum_want;
|
||||
uint32_t v_decoded_length_want;
|
||||
|
||||
uint8_t* b_wptr_dst = NULL;
|
||||
uint8_t* b_wstart_dst = NULL;
|
||||
uint8_t* b_wend_dst = NULL;
|
||||
uint8_t* ioptr_dst = NULL;
|
||||
uint8_t* iobounds0orig_dst = NULL;
|
||||
uint8_t* iobounds1_dst = NULL;
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[0] = ioptr_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[1] = ioptr_dst;
|
||||
}
|
||||
b_wstart_dst = a_dst.private_impl.bounds[0];
|
||||
b_wend_dst = a_dst.private_impl.bounds[1];
|
||||
iobounds0orig_dst = a_dst.private_impl.bounds[0];
|
||||
iobounds1_dst = a_dst.private_impl.bounds[1];
|
||||
}
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode[0].coro_susp_point;
|
||||
@@ -2025,69 +2025,69 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
|
||||
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_0 = *b_rptr_src++;
|
||||
uint8_t t_0 = *ioptr_src++;
|
||||
if (t_0 != 31) {
|
||||
status = WUFFS_GZIP__ERROR_BAD_HEADER;
|
||||
goto exit;
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_1 = *b_rptr_src++;
|
||||
uint8_t t_1 = *ioptr_src++;
|
||||
if (t_1 != 139) {
|
||||
status = WUFFS_GZIP__ERROR_BAD_HEADER;
|
||||
goto exit;
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_2 = *b_rptr_src++;
|
||||
uint8_t t_2 = *ioptr_src++;
|
||||
if (t_2 != 8) {
|
||||
status = WUFFS_GZIP__ERROR_INVALID_COMPRESSION_METHOD;
|
||||
goto exit;
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_3 = *b_rptr_src++;
|
||||
uint8_t t_3 = *ioptr_src++;
|
||||
v_flags = t_3;
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||
self->private_impl.c_decode[0].scratch = 6;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
|
||||
if (self->private_impl.c_decode[0].scratch > b_rend_src - b_rptr_src) {
|
||||
self->private_impl.c_decode[0].scratch -= b_rend_src - b_rptr_src;
|
||||
b_rptr_src = b_rend_src;
|
||||
if (self->private_impl.c_decode[0].scratch > iobounds1_src - ioptr_src) {
|
||||
self->private_impl.c_decode[0].scratch -= iobounds1_src - ioptr_src;
|
||||
ioptr_src = iobounds1_src;
|
||||
goto short_read_src;
|
||||
}
|
||||
b_rptr_src += self->private_impl.c_decode[0].scratch;
|
||||
ioptr_src += self->private_impl.c_decode[0].scratch;
|
||||
v_c = 0;
|
||||
if ((v_flags & 4) != 0) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7);
|
||||
uint16_t t_5;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 2)) {
|
||||
t_5 = wuffs_base__load_u16le(b_rptr_src);
|
||||
b_rptr_src += 2;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 2)) {
|
||||
t_5 = wuffs_base__load_u16le(ioptr_src);
|
||||
ioptr_src += 2;
|
||||
} else {
|
||||
self->private_impl.c_decode[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(8);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_4 = self->private_impl.c_decode[0].scratch >> 56;
|
||||
self->private_impl.c_decode[0].scratch <<= 8;
|
||||
self->private_impl.c_decode[0].scratch >>= 8;
|
||||
self->private_impl.c_decode[0].scratch |=
|
||||
((uint64_t)(*b_rptr_src++)) << t_4;
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*ioptr_src++))
|
||||
<< t_4;
|
||||
if (t_4 == 8) {
|
||||
t_5 = self->private_impl.c_decode[0].scratch;
|
||||
break;
|
||||
@@ -2101,21 +2101,21 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(9);
|
||||
self->private_impl.c_decode[0].scratch = ((uint32_t)(v_xlen));
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(10);
|
||||
if (self->private_impl.c_decode[0].scratch > b_rend_src - b_rptr_src) {
|
||||
self->private_impl.c_decode[0].scratch -= b_rend_src - b_rptr_src;
|
||||
b_rptr_src = b_rend_src;
|
||||
if (self->private_impl.c_decode[0].scratch > iobounds1_src - ioptr_src) {
|
||||
self->private_impl.c_decode[0].scratch -= iobounds1_src - ioptr_src;
|
||||
ioptr_src = iobounds1_src;
|
||||
goto short_read_src;
|
||||
}
|
||||
b_rptr_src += self->private_impl.c_decode[0].scratch;
|
||||
ioptr_src += self->private_impl.c_decode[0].scratch;
|
||||
}
|
||||
if ((v_flags & 8) != 0) {
|
||||
while (true) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(11);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_6 = *b_rptr_src++;
|
||||
uint8_t t_6 = *ioptr_src++;
|
||||
v_c = t_6;
|
||||
}
|
||||
if (v_c == 0) {
|
||||
@@ -2128,10 +2128,10 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
while (true) {
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(12);
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint8_t t_7 = *b_rptr_src++;
|
||||
uint8_t t_7 = *ioptr_src++;
|
||||
v_c = t_7;
|
||||
}
|
||||
if (v_c == 0) {
|
||||
@@ -2144,12 +2144,12 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(13);
|
||||
self->private_impl.c_decode[0].scratch = 2;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(14);
|
||||
if (self->private_impl.c_decode[0].scratch > b_rend_src - b_rptr_src) {
|
||||
self->private_impl.c_decode[0].scratch -= b_rend_src - b_rptr_src;
|
||||
b_rptr_src = b_rend_src;
|
||||
if (self->private_impl.c_decode[0].scratch > iobounds1_src - ioptr_src) {
|
||||
self->private_impl.c_decode[0].scratch -= iobounds1_src - ioptr_src;
|
||||
ioptr_src = iobounds1_src;
|
||||
goto short_read_src;
|
||||
}
|
||||
b_rptr_src += self->private_impl.c_decode[0].scratch;
|
||||
ioptr_src += self->private_impl.c_decode[0].scratch;
|
||||
}
|
||||
if ((v_flags & 224) != 0) {
|
||||
status = WUFFS_GZIP__ERROR_INVALID_ENCODING_FLAGS;
|
||||
@@ -2158,21 +2158,21 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
v_checksum_got = 0;
|
||||
v_decoded_length_got = 0;
|
||||
while (true) {
|
||||
wuffs_base__io_writer__set_mark(&a_dst, b_wptr_dst);
|
||||
wuffs_base__io_writer__set_mark(&a_dst, ioptr_dst);
|
||||
{
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
wuffs_gzip__status t_8 = wuffs_deflate__decoder__decode(
|
||||
&self->private_impl.f_flate, a_dst, a_src);
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
v_z = t_8;
|
||||
}
|
||||
@@ -2181,16 +2181,16 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
&self->private_impl.f_checksum,
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(b_wptr_dst - a_dst.private_impl.bounds[0]),
|
||||
.len = (size_t)(ioptr_dst - a_dst.private_impl.bounds[0]),
|
||||
}));
|
||||
v_decoded_length_got += ((uint32_t)((
|
||||
((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(b_wptr_dst - a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len)) &
|
||||
4294967295)));
|
||||
v_decoded_length_got += ((uint32_t)(
|
||||
(((uint64_t)(
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(ioptr_dst - a_dst.private_impl.bounds[0]),
|
||||
})
|
||||
.len)) &
|
||||
4294967295)));
|
||||
}
|
||||
if (v_z == 0) {
|
||||
goto label_2_break;
|
||||
@@ -2202,20 +2202,20 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(16);
|
||||
uint32_t t_10;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 4)) {
|
||||
t_10 = wuffs_base__load_u32le(b_rptr_src);
|
||||
b_rptr_src += 4;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 4)) {
|
||||
t_10 = wuffs_base__load_u32le(ioptr_src);
|
||||
ioptr_src += 4;
|
||||
} else {
|
||||
self->private_impl.c_decode[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(17);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_9 = self->private_impl.c_decode[0].scratch >> 56;
|
||||
self->private_impl.c_decode[0].scratch <<= 8;
|
||||
self->private_impl.c_decode[0].scratch >>= 8;
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++))
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*ioptr_src++))
|
||||
<< t_9;
|
||||
if (t_9 == 24) {
|
||||
t_10 = self->private_impl.c_decode[0].scratch;
|
||||
@@ -2230,20 +2230,20 @@ wuffs_gzip__status wuffs_gzip__decoder__decode(wuffs_gzip__decoder* self,
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(18);
|
||||
uint32_t t_12;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 4)) {
|
||||
t_12 = wuffs_base__load_u32le(b_rptr_src);
|
||||
b_rptr_src += 4;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 4)) {
|
||||
t_12 = wuffs_base__load_u32le(ioptr_src);
|
||||
ioptr_src += 4;
|
||||
} else {
|
||||
self->private_impl.c_decode[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(19);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_11 = self->private_impl.c_decode[0].scratch >> 56;
|
||||
self->private_impl.c_decode[0].scratch <<= 8;
|
||||
self->private_impl.c_decode[0].scratch >>= 8;
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++))
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*ioptr_src++))
|
||||
<< t_11;
|
||||
if (t_11 == 24) {
|
||||
t_12 = self->private_impl.c_decode[0].scratch;
|
||||
@@ -2283,14 +2283,14 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wstart_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wend_dst);
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_dst);
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
self->private_impl.status = status;
|
||||
|
||||
+37
-37
@@ -1974,34 +1974,34 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
wuffs_zlib__status v_z;
|
||||
uint32_t v_checksum_want;
|
||||
|
||||
uint8_t* b_wptr_dst = NULL;
|
||||
uint8_t* b_wstart_dst = NULL;
|
||||
uint8_t* b_wend_dst = NULL;
|
||||
uint8_t* ioptr_dst = NULL;
|
||||
uint8_t* iobounds0orig_dst = NULL;
|
||||
uint8_t* iobounds1_dst = NULL;
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
if (!a_dst.private_impl.bounds[0]) {
|
||||
a_dst.private_impl.bounds[0] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[0] = ioptr_dst;
|
||||
a_dst.private_impl.bounds[1] =
|
||||
a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->len;
|
||||
}
|
||||
if (a_dst.private_impl.buf->closed) {
|
||||
a_dst.private_impl.bounds[1] = b_wptr_dst;
|
||||
a_dst.private_impl.bounds[1] = ioptr_dst;
|
||||
}
|
||||
b_wstart_dst = a_dst.private_impl.bounds[0];
|
||||
b_wend_dst = a_dst.private_impl.bounds[1];
|
||||
iobounds0orig_dst = a_dst.private_impl.bounds[0];
|
||||
iobounds1_dst = a_dst.private_impl.bounds[1];
|
||||
}
|
||||
uint8_t* b_rptr_src = NULL;
|
||||
uint8_t* b_rstart_src = NULL;
|
||||
uint8_t* b_rend_src = NULL;
|
||||
uint8_t* ioptr_src = NULL;
|
||||
uint8_t* iobounds0orig_src = NULL;
|
||||
uint8_t* iobounds1_src = NULL;
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
if (!a_src.private_impl.bounds[0]) {
|
||||
a_src.private_impl.bounds[0] = b_rptr_src;
|
||||
a_src.private_impl.bounds[0] = ioptr_src;
|
||||
a_src.private_impl.bounds[1] =
|
||||
a_src.private_impl.buf->ptr + a_src.private_impl.buf->wi;
|
||||
}
|
||||
b_rstart_src = a_src.private_impl.bounds[0];
|
||||
b_rend_src = a_src.private_impl.bounds[1];
|
||||
iobounds0orig_src = a_src.private_impl.bounds[0];
|
||||
iobounds1_src = a_src.private_impl.bounds[1];
|
||||
}
|
||||
|
||||
uint32_t coro_susp_point = self->private_impl.c_decode[0].coro_susp_point;
|
||||
@@ -2018,20 +2018,20 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
uint16_t t_1;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 2)) {
|
||||
t_1 = wuffs_base__load_u16be(b_rptr_src);
|
||||
b_rptr_src += 2;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 2)) {
|
||||
t_1 = wuffs_base__load_u16be(ioptr_src);
|
||||
ioptr_src += 2;
|
||||
} else {
|
||||
self->private_impl.c_decode[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_0 = self->private_impl.c_decode[0].scratch & 0xFF;
|
||||
self->private_impl.c_decode[0].scratch >>= 8;
|
||||
self->private_impl.c_decode[0].scratch <<= 8;
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++))
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*ioptr_src++))
|
||||
<< (56 - t_0);
|
||||
if (t_0 == 8) {
|
||||
t_1 = self->private_impl.c_decode[0].scratch >> (64 - 16);
|
||||
@@ -2061,21 +2061,21 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
}
|
||||
v_checksum_got = 0;
|
||||
while (true) {
|
||||
wuffs_base__io_writer__set_mark(&a_dst, b_wptr_dst);
|
||||
wuffs_base__io_writer__set_mark(&a_dst, ioptr_dst);
|
||||
{
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
}
|
||||
wuffs_zlib__status t_2 = wuffs_deflate__decoder__decode(
|
||||
&self->private_impl.f_flate, a_dst, a_src);
|
||||
if (a_dst.private_impl.buf) {
|
||||
b_wptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
ioptr_dst = a_dst.private_impl.buf->ptr + a_dst.private_impl.buf->wi;
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
ioptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri;
|
||||
}
|
||||
v_z = t_2;
|
||||
}
|
||||
@@ -2084,7 +2084,7 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
&self->private_impl.f_checksum,
|
||||
((wuffs_base__slice_u8){
|
||||
.ptr = a_dst.private_impl.bounds[0],
|
||||
.len = (size_t)(b_wptr_dst - a_dst.private_impl.bounds[0]),
|
||||
.len = (size_t)(ioptr_dst - a_dst.private_impl.bounds[0]),
|
||||
}));
|
||||
}
|
||||
if (v_z == 0) {
|
||||
@@ -2097,20 +2097,20 @@ wuffs_zlib__status wuffs_zlib__decoder__decode(wuffs_zlib__decoder* self,
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||
uint32_t t_4;
|
||||
if (WUFFS_BASE__LIKELY(b_rend_src - b_rptr_src >= 4)) {
|
||||
t_4 = wuffs_base__load_u32be(b_rptr_src);
|
||||
b_rptr_src += 4;
|
||||
if (WUFFS_BASE__LIKELY(iobounds1_src - ioptr_src >= 4)) {
|
||||
t_4 = wuffs_base__load_u32be(ioptr_src);
|
||||
ioptr_src += 4;
|
||||
} else {
|
||||
self->private_impl.c_decode[0].scratch = 0;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||
while (true) {
|
||||
if (WUFFS_BASE__UNLIKELY(b_rptr_src == b_rend_src)) {
|
||||
if (WUFFS_BASE__UNLIKELY(ioptr_src == iobounds1_src)) {
|
||||
goto short_read_src;
|
||||
}
|
||||
uint32_t t_3 = self->private_impl.c_decode[0].scratch & 0xFF;
|
||||
self->private_impl.c_decode[0].scratch >>= 8;
|
||||
self->private_impl.c_decode[0].scratch <<= 8;
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*b_rptr_src++))
|
||||
self->private_impl.c_decode[0].scratch |= ((uint64_t)(*ioptr_src++))
|
||||
<< (56 - t_3);
|
||||
if (t_3 == 24) {
|
||||
t_4 = self->private_impl.c_decode[0].scratch >> (64 - 32);
|
||||
@@ -2145,14 +2145,14 @@ suspend:
|
||||
goto exit;
|
||||
exit:
|
||||
if (a_dst.private_impl.buf) {
|
||||
a_dst.private_impl.buf->wi = b_wptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wstart_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_wend_dst);
|
||||
a_dst.private_impl.buf->wi = ioptr_dst - a_dst.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_dst);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_dst);
|
||||
}
|
||||
if (a_src.private_impl.buf) {
|
||||
a_src.private_impl.buf->ri = b_rptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rstart_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(b_rend_src);
|
||||
a_src.private_impl.buf->ri = ioptr_src - a_src.private_impl.buf->ptr;
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds0orig_src);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_src);
|
||||
}
|
||||
|
||||
self->private_impl.status = status;
|
||||
|
||||
Reference in new issue
Block a user