refactor: use decodeIntMap

This commit is contained in:
Derrick Hammer 2024-03-01 02:55:45 -05:00
parent 9485c023e7
commit 889d327c3a
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 15 deletions

View File

@ -23,25 +23,12 @@ func (mmd *MediaMetadataDetails) EncodeMsgpack(enc *msgpack.Encoder) error {
}
func (mmd *MediaMetadataDetails) DecodeMsgpack(dec *msgpack.Decoder) error {
mapLen, err := dec.DecodeMapLen()
intMap, err := decodeIntMap(dec)
if err != nil {
return err
}
mmd.Data = make(map[int]interface{}, mapLen)
for i := 0; i < mapLen; i++ {
key, err := dec.DecodeInt8()
if err != nil {
return err
}
value, err := dec.DecodeInterface()
if err != nil {
return err
}
mmd.Data[int(key)] = value
}
mmd.Data = intMap
return nil
}