tape: Decode KTV into any
This commit is contained in:
parent
3f51beddb6
commit
ef3f5cf4bb
@ -240,8 +240,16 @@ func decodeAnyOrError(decoder *Decoder, destination reflect.Value, tag Tag) (n i
|
||||
if length > uint64(MaxStructureLength) {
|
||||
return 0, ErrTooLong
|
||||
}
|
||||
lengthCast, err := Uint64ToIntSafe(length)
|
||||
if err != nil { return n, err }
|
||||
if isTypeAny(destination.Type()) {
|
||||
// need a skeleton value if we are assigning to any.
|
||||
value := reflect.MakeMapWithSize(reflect.TypeOf(dummyMap), lengthCast)
|
||||
destination.Set(value)
|
||||
destination = value
|
||||
}
|
||||
destination.Clear()
|
||||
for _ = range length {
|
||||
for _ = range lengthCast {
|
||||
key, nn, err := decoder.ReadUint16()
|
||||
n += nn; if err != nil { return n, err }
|
||||
itemTag, nn, err := decoder.ReadTag()
|
||||
|
Loading…
x
Reference in New Issue
Block a user