forked from TrueCloudLab/neoneo-go
io: make maxArraySize public
This commit is contained in:
parent
bc81b56708
commit
c06b3b669d
1 changed files with 4 additions and 4 deletions
|
@ -8,9 +8,9 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// maxArraySize is a maximums size of an array which can be decoded.
|
// MaxArraySize is the maximum size of an array which can be decoded.
|
||||||
// It is taken from https://github.com/neo-project/neo/blob/master/neo/IO/Helper.cs#L130
|
// It is taken from https://github.com/neo-project/neo/blob/master/neo/IO/Helper.cs#L130
|
||||||
const maxArraySize = 0x1000000
|
const MaxArraySize = 0x1000000
|
||||||
|
|
||||||
// BinReader is a convenient wrapper around a io.Reader and err object.
|
// BinReader is a convenient wrapper around a io.Reader and err object.
|
||||||
// Used to simplify error handling when reading into a struct with many fields.
|
// Used to simplify error handling when reading into a struct with many fields.
|
||||||
|
@ -110,7 +110,7 @@ func (r *BinReader) ReadArray(t interface{}, maxSize ...int) {
|
||||||
elemType := sliceType.Elem()
|
elemType := sliceType.Elem()
|
||||||
isPtr := elemType.Kind() == reflect.Ptr
|
isPtr := elemType.Kind() == reflect.Ptr
|
||||||
|
|
||||||
ms := maxArraySize
|
ms := MaxArraySize
|
||||||
if len(maxSize) != 0 {
|
if len(maxSize) != 0 {
|
||||||
ms = maxSize[0]
|
ms = maxSize[0]
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ func (r *BinReader) ReadVarUint() uint64 {
|
||||||
// ReadVarUInt() is used to determine how large that slice is
|
// ReadVarUInt() is used to determine how large that slice is
|
||||||
func (r *BinReader) ReadVarBytes(maxSize ...int) []byte {
|
func (r *BinReader) ReadVarBytes(maxSize ...int) []byte {
|
||||||
n := r.ReadVarUint()
|
n := r.ReadVarUint()
|
||||||
ms := maxArraySize
|
ms := MaxArraySize
|
||||||
if len(maxSize) != 0 {
|
if len(maxSize) != 0 {
|
||||||
ms = maxSize[0]
|
ms = maxSize[0]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue