| 218 | } |
| 219 | |
| 220 | func (d *Decoder) parseExtLen(c byte) (int, error) { |
| 221 | switch c { |
| 222 | case msgpcode.FixExt1: |
| 223 | return 1, nil |
| 224 | case msgpcode.FixExt2: |
| 225 | return 2, nil |
| 226 | case msgpcode.FixExt4: |
| 227 | return 4, nil |
| 228 | case msgpcode.FixExt8: |
| 229 | return 8, nil |
| 230 | case msgpcode.FixExt16: |
| 231 | return 16, nil |
| 232 | case msgpcode.Ext8: |
| 233 | n, err := d.uint8() |
| 234 | return int(n), err |
| 235 | case msgpcode.Ext16: |
| 236 | n, err := d.uint16() |
| 237 | return int(n), err |
| 238 | case msgpcode.Ext32: |
| 239 | n, err := d.uint32() |
| 240 | return int(n), err |
| 241 | default: |
| 242 | return 0, fmt.Errorf("msgpack: invalid code=%x decoding ext len", c) |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | func (d *Decoder) decodeInterfaceExt(c byte) (interface{}, error) { |
| 247 | extID, extLen, err := d.extHeader(c) |