mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-19 13:02:13 +01:00
Byte arrays in Go should not be serialized as arrays.
This commit is contained in:
parent
0e82278cd5
commit
003fb3392f
@ -452,6 +452,13 @@ func PackFloatArray(writer io.Writer, value []float) (n int, err os.Error) {
|
||||
}
|
||||
|
||||
func PackArray(writer io.Writer, value reflect.ArrayOrSliceValue) (n int, err os.Error) {
|
||||
{
|
||||
elemType, ok := value.Type().(reflect.ArrayOrSliceType).Elem().(*reflect.UintType)
|
||||
if ok && elemType.Kind() == reflect.Uint8 {
|
||||
return PackBytes(writer, value.Interface().([]byte))
|
||||
}
|
||||
}
|
||||
|
||||
l := value.Len()
|
||||
if l < 16 {
|
||||
n, err := writer.Write([]byte { 0x90 | byte(l) })
|
||||
|
Loading…
x
Reference in New Issue
Block a user