|
@ -189,13 +189,8 @@ func writeReflect(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Dereference pointer or interface
|
|
|
|
|
|
if rt.Kind() == reflect.Ptr { |
|
|
|
|
|
rt = rt.Elem() |
|
|
|
|
|
rv = rv.Elem() |
|
|
|
|
|
// RegisterType registers the ptr type,
|
|
|
|
|
|
// so typeInfo is already for the ptr.
|
|
|
|
|
|
} else if rt.Kind() == reflect.Interface { |
|
|
|
|
|
|
|
|
// Dereference interface
|
|
|
|
|
|
if rt.Kind() == reflect.Interface { |
|
|
rv = rv.Elem() |
|
|
rv = rv.Elem() |
|
|
rt = rv.Type() |
|
|
rt = rv.Type() |
|
|
typeInfo = typeInfos[rt] |
|
|
typeInfo = typeInfos[rt] |
|
@ -205,6 +200,14 @@ func writeReflect(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Dereference pointer
|
|
|
|
|
|
if rt.Kind() == reflect.Ptr { |
|
|
|
|
|
rt = rt.Elem() |
|
|
|
|
|
rv = rv.Elem() |
|
|
|
|
|
// RegisterType registers the ptr type,
|
|
|
|
|
|
// so typeInfo is already for the ptr.
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Write TypeByte prefix
|
|
|
// Write TypeByte prefix
|
|
|
if typeInfo.HasTypeByte { |
|
|
if typeInfo.HasTypeByte { |
|
|
WriteByte(typeInfo.TypeByte, w, n, err) |
|
|
WriteByte(typeInfo.TypeByte, w, n, err) |
|
@ -215,7 +218,7 @@ func writeReflect(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err |
|
|
elemRt := rt.Elem() |
|
|
elemRt := rt.Elem() |
|
|
if elemRt.Kind() == reflect.Uint8 { |
|
|
if elemRt.Kind() == reflect.Uint8 { |
|
|
// Special case: Byteslices
|
|
|
// Special case: Byteslices
|
|
|
byteslice := rv.Interface().([]byte) |
|
|
|
|
|
|
|
|
byteslice := rv.Bytes() |
|
|
WriteByteSlice(byteslice, w, n, err) |
|
|
WriteByteSlice(byteslice, w, n, err) |
|
|
} else { |
|
|
} else { |
|
|
// Write length
|
|
|
// Write length
|
|
|