Use literal values for data type consts per the AMF spec, rather than iota.

This commit is contained in:
scruzin 2019-01-12 17:48:17 +10:30
parent b31c65001e
commit cb2ea08fff
1 changed files with 21 additions and 21 deletions

View File

@ -44,28 +44,28 @@ import (
"math"
)
// AMF data types.
// AMF data types, as defined by the AMF specification.
// NB: we export these sparingly.
const (
typeNumber = iota
typeBoolean
typeString
TypeObject
typeMovieClip
TypeNull
typeUndefined
typeReference
typeEcmaArray
TypeObjectEnd
typeStrictArray
typeDate
typeLongString
typeUnsupported
typeRecordset
typeXmlDoc
typeTypedObject
typeAvmplus
typeInvalid = 0xff
typeNumber = 0x00
typeBoolean = 0x01
typeString = 0x02
TypeObject = 0x03
typeMovieClip = 0x04
TypeNull = 0x05
typeUndefined = 0x06
typeReference = 0x07
typeEcmaArray = 0x08
TypeObjectEnd = 0x09
typeStrictArray = 0x0A
typeDate = 0x0B
typeLongString = 0x0C
typeUnsupported = 0x0D
typeRecordset = 0x0E
typeXmlDoc = 0x0F
typeTypedObject = 0x10
typeAvmplus = 0x11
typeInvalid = 0xff
)
// AMF represents an AMF message (object), which is simply a collection of properties.
@ -479,7 +479,7 @@ func Decode(obj *Object, buf []byte, decodeName bool) (int, error) {
// GetProp returns an object's property, either by its index when idx is non-negative, or by its name otherwise.
// If the requested property is not found an ErrPropertyNotFound error is returned.
func (obj *Object)GetProp(name string, idx int) (*Property, error) {
func (obj *Object) GetProp(name string, idx int) (*Property, error) {
if idx >= 0 {
if idx < len(obj.Props) {
return &obj.Props[idx], nil