Commit e1f92e97 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent cd42a2aa
...@@ -403,9 +403,9 @@ func (p *AcceptIdentification) NEOEncodedLen() int { ...@@ -403,9 +403,9 @@ func (p *AcceptIdentification) NEOEncodedLen() int {
size += 30 size += 30
for i := 0; i < len(p.KnownMasterList); i++ { for i := 0; i < len(p.KnownMasterList); i++ {
a := &p.KnownMasterList[i] a := &p.KnownMasterList[i]
size += 10 size += 10 + len((*a).Address.Host)
} }
return 0 + len(p.Primary.Host) + len((*a).Address.Host) + size return 0 + len(p.Primary.Host) + size
} }
func (p *AcceptIdentification) NEOEncode(data []byte) { func (p *AcceptIdentification) NEOEncode(data []byte) {
...@@ -724,9 +724,9 @@ func (p *AnswerPartitionTable) NEOEncodedLen() int { ...@@ -724,9 +724,9 @@ func (p *AnswerPartitionTable) NEOEncodedLen() int {
size += 12 size += 12
for i := 0; i < len(p.RowList); i++ { for i := 0; i < len(p.RowList); i++ {
a := &p.RowList[i] a := &p.RowList[i]
size += 8 size += 8 + len((*a).CellList)*8
} }
return 0 + len((*a).CellList)*8 + size return 0 + size
} }
func (p *AnswerPartitionTable) NEOEncode(data []byte) { func (p *AnswerPartitionTable) NEOEncode(data []byte) {
...@@ -813,9 +813,9 @@ func (p *NotifyPartitionTable) NEOEncodedLen() int { ...@@ -813,9 +813,9 @@ func (p *NotifyPartitionTable) NEOEncodedLen() int {
size += 12 size += 12
for i := 0; i < len(p.RowList); i++ { for i := 0; i < len(p.RowList); i++ {
a := &p.RowList[i] a := &p.RowList[i]
size += 8 size += 8 + len((*a).CellList)*8
} }
return 0 + len((*a).CellList)*8 + size return 0 + size
} }
func (p *NotifyPartitionTable) NEOEncode(data []byte) { func (p *NotifyPartitionTable) NEOEncode(data []byte) {
...@@ -2597,9 +2597,9 @@ func (p *AnswerPartitionList) NEOEncodedLen() int { ...@@ -2597,9 +2597,9 @@ func (p *AnswerPartitionList) NEOEncodedLen() int {
size += 12 size += 12
for i := 0; i < len(p.RowList); i++ { for i := 0; i < len(p.RowList); i++ {
a := &p.RowList[i] a := &p.RowList[i]
size += 8 size += 8 + len((*a).CellList)*8
} }
return 0 + len((*a).CellList)*8 + size return 0 + size
} }
func (p *AnswerPartitionList) NEOEncode(data []byte) { func (p *AnswerPartitionList) NEOEncode(data []byte) {
...@@ -2709,9 +2709,9 @@ func (p *AnswerNodeList) NEOEncodedLen() int { ...@@ -2709,9 +2709,9 @@ func (p *AnswerNodeList) NEOEncodedLen() int {
size += 4 size += 4
for i := 0; i < len(p.NodeList); i++ { for i := 0; i < len(p.NodeList); i++ {
a := &p.NodeList[i] a := &p.NodeList[i]
size += 26 size += 26 + len((*a).Address.Host)
} }
return 0 + len((*a).Address.Host) + size return 0 + size
} }
func (p *AnswerNodeList) NEOEncode(data []byte) { func (p *AnswerNodeList) NEOEncode(data []byte) {
...@@ -2920,9 +2920,9 @@ func (p *NotifyNodeInformation) NEOEncodedLen() int { ...@@ -2920,9 +2920,9 @@ func (p *NotifyNodeInformation) NEOEncodedLen() int {
size += 4 size += 4
for i := 0; i < len(p.NodeList); i++ { for i := 0; i < len(p.NodeList); i++ {
a := &p.NodeList[i] a := &p.NodeList[i]
size += 26 size += 26 + len((*a).Address.Host)
} }
return 0 + len((*a).Address.Host) + size return 0 + size
} }
func (p *NotifyNodeInformation) NEOEncode(data []byte) { func (p *NotifyNodeInformation) NEOEncode(data []byte) {
......
...@@ -388,8 +388,10 @@ func (s *sizer) genSlice(path string, typ *types.Slice, obj types.Object) { ...@@ -388,8 +388,10 @@ func (s *sizer) genSlice(path string, typ *types.Slice, obj types.Object) {
s.emit("for i := 0; i < len(%v); i++ {", path) s.emit("for i := 0; i < len(%v); i++ {", path)
s.emit("a := &%s[i]", path) s.emit("a := &%s[i]", path)
//codegenType("(*a)", typ.Elem(), obj, s) //codegenType("(*a)", typ.Elem(), obj, s)
codegenType("(*a)", typ.Elem(), obj, &sizer{}) sloop := &sizer{}
s.emit("size += %v", s.n) codegenType("(*a)", typ.Elem(), obj, sloop)
// FIXME vvv if symLenv is ø; -> turn into "result" function
s.emit("size += %v + %v", sloop.n, strings.Join(sloop.symLenv, " + "))
s.emit("}") s.emit("}")
s.n = 0 s.n = 0
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment