MCPcopy Create free account
hub / github.com/google/gapid / decode

Method decode

core/os/android/binaryxml/xml_start_element.go:38–75  ·  view source on GitHub ↗
(header, data []byte)

Source from the content-addressed store, hash-verified

36}
37
38func (c *xmlStartElement) decode(header, data []byte) error {
39 r := endian.Reader(bytes.NewReader(header), device.LittleEndian)
40 c.lineNumber = r.Uint32()
41 c.comment = c.root().decodeString(r)
42 if err := r.Error(); err != nil {
43 return err
44 }
45
46 r = endian.Reader(bytes.NewReader(data), device.LittleEndian)
47 c.namespace = c.root().decodeString(r)
48 c.name = c.root().decodeString(r)
49 attributeStart := r.Uint16()
50 attributeSize := r.Uint16()
51 attributeCount := r.Uint16()
52 if err := r.Error(); err != nil {
53 return err
54 }
55 if attributeSize != xmlAttributeSize {
56 return fmt.Errorf("Attribute size was not as expected. Got %d, expected %d",
57 attributeSize, xmlAttributeSize)
58 }
59 if r.Uint16() != 0 {
60 return fmt.Errorf("idIndex != 0 not supported.")
61 }
62 if r.Uint16() != 0 {
63 return fmt.Errorf("classIndex != 0 not supported.")
64 }
65 if r.Uint16() != 0 {
66 return fmt.Errorf("styleIndex != 0 not supported.")
67 }
68
69 r = endian.Reader(bytes.NewReader(data[attributeStart:]), device.LittleEndian)
70 c.attributes = make([]xmlAttribute, attributeCount)
71 for i := range c.attributes {
72 c.attributes[i].decode(r, c.root())
73 }
74 return r.Error()
75}
76
77func (c *xmlStartElement) updateContext(ctx *xmlContext) {
78 ctx.indent++

Callers

nothing calls this directly

Calls 8

decodeStringMethod · 0.80
ReaderMethod · 0.65
NewReaderMethod · 0.65
Uint32Method · 0.65
rootMethod · 0.65
ErrorMethod · 0.65
Uint16Method · 0.65
decodeMethod · 0.65

Tested by

no test coverage detected