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

Function decodeValue

core/os/android/binaryxml/value.go:183–214  ·  view source on GitHub ↗
(r binary.Reader, xml *xmlTree)

Source from the content-addressed store, hash-verified

181}
182
183func decodeValue(r binary.Reader, xml *xmlTree) (typedValue, error) {
184 size := r.Uint16()
185 if size != valueSize {
186 return nil, fmt.Errorf("Value size was not as expected. Got %d, expected %d",
187 size, valueSize)
188 }
189 res0 := r.Uint8()
190 if res0 != 0 {
191 return nil, fmt.Errorf("res0 was %d, expected 0", res0)
192 }
193 ty := valueType(r.Uint8())
194 switch ty {
195 case typeIntDec:
196 return valIntDec(r.Int32()), nil
197 case typeIntHex:
198 return valIntHex(r.Uint32()), nil
199 case typeReference:
200 return valReference(r.Uint32()), nil
201 case typeString:
202 return valStringID(xml.decodeString(r)), nil
203 case typeFloat:
204 return valFloat(r.Float32()), nil
205 case typeIntBoolean:
206 return valIntBoolean(r.Uint32() != 0), nil
207 case typeNull:
208 return valNull(r.Uint32()), nil
209 case typeDimension:
210 return decodeDimension(r)
211 default:
212 return nil, fmt.Errorf("Value type %v not implemented", ty)
213 }
214}
215
216type valueType uint8
217

Callers 2

decodeMethod · 0.85
decodeMethod · 0.85

Calls 15

valueTypeTypeAlias · 0.85
valIntDecTypeAlias · 0.85
valIntHexTypeAlias · 0.85
valReferenceTypeAlias · 0.85
valStringIDTypeAlias · 0.85
valFloatTypeAlias · 0.85
valIntBooleanTypeAlias · 0.85
valNullTypeAlias · 0.85
decodeDimensionFunction · 0.85
decodeStringMethod · 0.80
Uint16Method · 0.65
Uint8Method · 0.65

Tested by

no test coverage detected