mirror of https://bitbucket.org/ausocean/av.git
Use literal values for data type consts per the AMF spec, rather than iota.
This commit is contained in:
parent
b31c65001e
commit
cb2ea08fff
|
@ -44,28 +44,28 @@ import (
|
||||||
"math"
|
"math"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AMF data types.
|
// AMF data types, as defined by the AMF specification.
|
||||||
// NB: we export these sparingly.
|
// NB: we export these sparingly.
|
||||||
const (
|
const (
|
||||||
typeNumber = iota
|
typeNumber = 0x00
|
||||||
typeBoolean
|
typeBoolean = 0x01
|
||||||
typeString
|
typeString = 0x02
|
||||||
TypeObject
|
TypeObject = 0x03
|
||||||
typeMovieClip
|
typeMovieClip = 0x04
|
||||||
TypeNull
|
TypeNull = 0x05
|
||||||
typeUndefined
|
typeUndefined = 0x06
|
||||||
typeReference
|
typeReference = 0x07
|
||||||
typeEcmaArray
|
typeEcmaArray = 0x08
|
||||||
TypeObjectEnd
|
TypeObjectEnd = 0x09
|
||||||
typeStrictArray
|
typeStrictArray = 0x0A
|
||||||
typeDate
|
typeDate = 0x0B
|
||||||
typeLongString
|
typeLongString = 0x0C
|
||||||
typeUnsupported
|
typeUnsupported = 0x0D
|
||||||
typeRecordset
|
typeRecordset = 0x0E
|
||||||
typeXmlDoc
|
typeXmlDoc = 0x0F
|
||||||
typeTypedObject
|
typeTypedObject = 0x10
|
||||||
typeAvmplus
|
typeAvmplus = 0x11
|
||||||
typeInvalid = 0xff
|
typeInvalid = 0xff
|
||||||
)
|
)
|
||||||
|
|
||||||
// AMF represents an AMF message (object), which is simply a collection of properties.
|
// 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.
|
// 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.
|
// 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 >= 0 {
|
||||||
if idx < len(obj.Props) {
|
if idx < len(obj.Props) {
|
||||||
return &obj.Props[idx], nil
|
return &obj.Props[idx], nil
|
||||||
|
|
Loading…
Reference in New Issue