mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 08:52:18 +01:00
Reset the GIF's LZW decoder if necessary
This commit is contained in:
1 parent
614ac408ae
commit
8586cf8e3d
7 files changed
+25
-6
No files matched your search
@@ -128,6 +128,7 @@ var phases = [...]struct {
|
||||
{a.KStatus, (*Checker).checkStatus},
|
||||
{a.KConst, (*Checker).checkConst},
|
||||
{a.KStruct, (*Checker).checkStructDecl},
|
||||
{a.KStruct, (*Checker).checkImplicitResetMethod},
|
||||
{a.KInvalid, (*Checker).checkStructCycles},
|
||||
{a.KStruct, (*Checker).checkStructFields},
|
||||
{a.KFunc, (*Checker).checkFuncSignature},
|
||||
@@ -392,6 +393,14 @@ func (c *Checker) checkStructDecl(node *a.Node) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Checker) checkImplicitResetMethod(node *a.Node) error {
|
||||
n := node.Struct()
|
||||
in := a.NewStruct(0, n.Filename(), n.Line(), t.IDIn, nil)
|
||||
out := a.NewStruct(0, n.Filename(), n.Line(), t.IDOut, nil)
|
||||
f := a.NewFunc(0, n.Filename(), n.Line(), n.QID()[1], t.IDReset, in, out, nil, nil)
|
||||
return c.checkFuncSignature(f.Node())
|
||||
}
|
||||
|
||||
func (c *Checker) checkStructCycles(_ *a.Node) error {
|
||||
if _, ok := a.TopologicalSortStructs(c.unsortedStructs); !ok {
|
||||
return fmt.Errorf("check: cyclical struct definitions")
|
||||
|
||||
@@ -440,6 +440,7 @@ const (
|
||||
IDIn = ID(0x142)
|
||||
IDOut = ID(0x143)
|
||||
IDBase = ID(0x144)
|
||||
IDReset = ID(0x145)
|
||||
|
||||
// -------- 0x200 block.
|
||||
|
||||
@@ -629,6 +630,7 @@ var builtInsByID = [nBuiltInIDs]string{
|
||||
IDIn: "in",
|
||||
IDOut: "out",
|
||||
IDBase: "base",
|
||||
IDReset: "reset",
|
||||
|
||||
// -------- 0x200 block.
|
||||
|
||||
|
||||
Reference in new issue
Block a user