|
|
@ -29,6 +29,23 @@ import ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
var ( |
|
|
|
|
|
|
|
// EOL is returned when the end of the current list
|
|
|
|
|
|
|
|
// has been reached during streaming.
|
|
|
|
|
|
|
|
EOL = errors.New("rlp: end of list") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Actual Errors
|
|
|
|
|
|
|
|
ErrExpectedString = errors.New("rlp: expected String or Byte") |
|
|
|
|
|
|
|
ErrExpectedList = errors.New("rlp: expected List") |
|
|
|
|
|
|
|
ErrCanonInt = errors.New("rlp: non-canonical integer format") |
|
|
|
|
|
|
|
ErrCanonSize = errors.New("rlp: non-canonical size information") |
|
|
|
|
|
|
|
ErrElemTooLarge = errors.New("rlp: element is larger than containing list") |
|
|
|
|
|
|
|
ErrValueTooLarge = errors.New("rlp: value size exceeds available input length") |
|
|
|
|
|
|
|
ErrMoreThanOneValue = errors.New("rlp: input contains more than one value") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// internal errors
|
|
|
|
|
|
|
|
errNotInList = errors.New("rlp: call of ListEnd outside of any list") |
|
|
|
|
|
|
|
errNotAtEOL = errors.New("rlp: call of ListEnd not positioned at EOL") |
|
|
|
|
|
|
|
errUintOverflow = errors.New("rlp: uint overflow") |
|
|
|
errNoPointer = errors.New("rlp: interface given to Decode must be a pointer") |
|
|
|
errNoPointer = errors.New("rlp: interface given to Decode must be a pointer") |
|
|
|
errDecodeIntoNil = errors.New("rlp: pointer given to Decode must not be nil") |
|
|
|
errDecodeIntoNil = errors.New("rlp: pointer given to Decode must not be nil") |
|
|
|
) |
|
|
|
) |
|
|
@ -274,9 +291,8 @@ func makeListDecoder(typ reflect.Type, tag tags) (decoder, error) { |
|
|
|
if etype.Kind() == reflect.Uint8 && !reflect.PtrTo(etype).Implements(decoderInterface) { |
|
|
|
if etype.Kind() == reflect.Uint8 && !reflect.PtrTo(etype).Implements(decoderInterface) { |
|
|
|
if typ.Kind() == reflect.Array { |
|
|
|
if typ.Kind() == reflect.Array { |
|
|
|
return decodeByteArray, nil |
|
|
|
return decodeByteArray, nil |
|
|
|
} else { |
|
|
|
|
|
|
|
return decodeByteSlice, nil |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return decodeByteSlice, nil |
|
|
|
} |
|
|
|
} |
|
|
|
etypeinfo, err := cachedTypeInfo1(etype, tags{}) |
|
|
|
etypeinfo, err := cachedTypeInfo1(etype, tags{}) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -555,29 +571,6 @@ func (k Kind) String() string { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
|
|
|
// EOL is returned when the end of the current list
|
|
|
|
|
|
|
|
// has been reached during streaming.
|
|
|
|
|
|
|
|
EOL = errors.New("rlp: end of list") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Actual Errors
|
|
|
|
|
|
|
|
ErrExpectedString = errors.New("rlp: expected String or Byte") |
|
|
|
|
|
|
|
ErrExpectedList = errors.New("rlp: expected List") |
|
|
|
|
|
|
|
ErrCanonInt = errors.New("rlp: non-canonical integer format") |
|
|
|
|
|
|
|
ErrCanonSize = errors.New("rlp: non-canonical size information") |
|
|
|
|
|
|
|
ErrElemTooLarge = errors.New("rlp: element is larger than containing list") |
|
|
|
|
|
|
|
ErrValueTooLarge = errors.New("rlp: value size exceeds available input length") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This error is reported by DecodeBytes if the slice contains
|
|
|
|
|
|
|
|
// additional data after the first RLP value.
|
|
|
|
|
|
|
|
ErrMoreThanOneValue = errors.New("rlp: input contains more than one value") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// internal errors
|
|
|
|
|
|
|
|
errNotInList = errors.New("rlp: call of ListEnd outside of any list") |
|
|
|
|
|
|
|
errNotAtEOL = errors.New("rlp: call of ListEnd not positioned at EOL") |
|
|
|
|
|
|
|
errUintOverflow = errors.New("rlp: uint overflow") |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ByteReader must be implemented by any input reader for a Stream. It
|
|
|
|
// ByteReader must be implemented by any input reader for a Stream. It
|
|
|
|
// is implemented by e.g. bufio.Reader and bytes.Reader.
|
|
|
|
// is implemented by e.g. bufio.Reader and bytes.Reader.
|
|
|
|
type ByteReader interface { |
|
|
|
type ByteReader interface { |
|
|
|