package layerwire import ( "fmt" "github.com/gotd/td/bin" ) // skipObject advances b past one boxed object (CRC + body), resolving the // constructor from the canonical schema. func (m *schemaModel) skipObject(b *bin.Buffer) error { id, err := b.PeekID() if err != nil { return err } cl, ok := m.byCRC[id] if !ok { return fmt.Errorf("layerwire: unknown constructor %#08x", id) } if err := b.ConsumeID(id); err != nil { return err } return m.skipCtorBody(b, cl) } // skipCtorBody advances b past a constructor body (no leading CRC), evaluating // flag integers so conditional fields are read iff present. func (m *schemaModel) skipCtorBody(b *bin.Buffer, cl *ctorLayout) error { var flags map[string]uint32 for i := range cl.fields { f := &cl.fields[i] if f.isFlags { v, err := b.Uint32() if err != nil { return fmt.Errorf("%s.%s: %w", cl.name, f.name, err) } if flags == nil { flags = make(map[string]uint32, 2) } flags[f.name] = v continue } if f.conditional() && flags[f.flagName]&(1<