io: drop getVarStringSize() completely
After unexport this doesn't make much sense at all as it has just one user.
This commit is contained in:
parent
d01b7740e2
commit
f69adc59ad
1 changed files with 2 additions and 8 deletions
|
@ -46,13 +46,6 @@ func getVarIntSize(value int) int {
|
||||||
return int(size)
|
return int(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
// getVarStringSize returns the size of a variable string
|
|
||||||
// (reference: GetVarSize(this string value), https://github.com/neo-project/neo/blob/master/neo/IO/Helper.cs)
|
|
||||||
func getVarStringSize(value string) int {
|
|
||||||
valueSize := len([]byte(value))
|
|
||||||
return getVarIntSize(valueSize) + valueSize
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVarSize returns the number of bytes in a serialized variable. It supports ints/uints (estimating
|
// GetVarSize returns the number of bytes in a serialized variable. It supports ints/uints (estimating
|
||||||
// them using variable-length encoding that is used in NEO), strings, pointers to Serializable structures,
|
// them using variable-length encoding that is used in NEO), strings, pointers to Serializable structures,
|
||||||
// slices and arrays of ints/uints or Serializable structures. It's similar to GetVarSize<T>(this T[] value)
|
// slices and arrays of ints/uints or Serializable structures. It's similar to GetVarSize<T>(this T[] value)
|
||||||
|
@ -61,7 +54,8 @@ func GetVarSize(value interface{}) int {
|
||||||
v := reflect.ValueOf(value)
|
v := reflect.ValueOf(value)
|
||||||
switch v.Kind() {
|
switch v.Kind() {
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
return getVarStringSize(v.String())
|
valueSize := len([]byte(v.String()))
|
||||||
|
return getVarIntSize(valueSize) + valueSize
|
||||||
case reflect.Int,
|
case reflect.Int,
|
||||||
reflect.Int8,
|
reflect.Int8,
|
||||||
reflect.Int16,
|
reflect.Int16,
|
||||||
|
|
Loading…
Reference in a new issue