Commit b6f9859c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent cfd55c2c
...@@ -8,8 +8,7 @@ import ( ...@@ -8,8 +8,7 @@ import (
// 0. Address // 0. Address
func (p *Address) NEOEncode(data []byte) int /*(int, error)*/ { func (p *Address) NEOEncode(data []byte) {
var nwrote uint32
{ {
l := uint32(len(p.Host)) l := uint32(len(p.Host))
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
...@@ -21,11 +20,6 @@ func (p *Address) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -21,11 +20,6 @@ func (p *Address) NEOEncode(data []byte) int /*(int, error)*/ {
nwrote += 4 + l nwrote += 4 + l
} }
binary.BigEndian.PutUint16(data[0:], p.Port) binary.BigEndian.PutUint16(data[0:], p.Port)
return int(nwrote) + 2 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *Address) NEODecode(data []byte) (int, error) { func (p *Address) NEODecode(data []byte) (int, error) {
...@@ -50,8 +44,7 @@ overflow: ...@@ -50,8 +44,7 @@ overflow:
// 1. NodeInfo // 1. NodeInfo
func (p *NodeInfo) NEOEncode(data []byte) int /*(int, error)*/ { func (p *NodeInfo) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], uint32(int32(p.NodeType))) binary.BigEndian.PutUint32(data[0:], uint32(int32(p.NodeType)))
{ {
l := uint32(len(p.Address.Host)) l := uint32(len(p.Address.Host))
...@@ -67,11 +60,6 @@ func (p *NodeInfo) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -67,11 +60,6 @@ func (p *NodeInfo) NEOEncode(data []byte) int /*(int, error)*/ {
binary.BigEndian.PutUint32(data[2:], uint32(int32(p.UUID))) binary.BigEndian.PutUint32(data[2:], uint32(int32(p.UUID)))
binary.BigEndian.PutUint32(data[6:], uint32(int32(p.NodeState))) binary.BigEndian.PutUint32(data[6:], uint32(int32(p.NodeState)))
float64_NEOEncode(data[10:], p.IdTimestamp) float64_NEOEncode(data[10:], p.IdTimestamp)
return int(nwrote) + 18 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *NodeInfo) NEODecode(data []byte) (int, error) { func (p *NodeInfo) NEODecode(data []byte) (int, error) {
...@@ -100,15 +88,9 @@ overflow: ...@@ -100,15 +88,9 @@ overflow:
// 2. CellInfo // 2. CellInfo
func (p *CellInfo) NEOEncode(data []byte) int /*(int, error)*/ { func (p *CellInfo) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], uint32(int32(p.UUID))) binary.BigEndian.PutUint32(data[0:], uint32(int32(p.UUID)))
binary.BigEndian.PutUint32(data[4:], uint32(int32(p.CellState))) binary.BigEndian.PutUint32(data[4:], uint32(int32(p.CellState)))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *CellInfo) NEODecode(data []byte) (int, error) { func (p *CellInfo) NEODecode(data []byte) (int, error) {
...@@ -124,15 +106,21 @@ overflow: ...@@ -124,15 +106,21 @@ overflow:
// 3. RowInfo // 3. RowInfo
func (p *RowInfo) NEOEncode(data []byte) int /*(int, error)*/ { func (p *RowInfo) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.Offset) binary.BigEndian.PutUint32(data[0:], p.Offset)
// TODO slice {
return int(nwrote) + 4 /*, nil*/ l := uint32(len(p.CellList))
binary.BigEndian.PutUint32(data[4:], l)
overflow: data = data[8:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 8
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.CellList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).UUID)))
binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).CellState)))
data = data[8:]
nwrote += 8
}
}
} }
func (p *RowInfo) NEODecode(data []byte) (int, error) { func (p *RowInfo) NEODecode(data []byte) (int, error) {
...@@ -160,8 +148,7 @@ overflow: ...@@ -160,8 +148,7 @@ overflow:
// 4. Notify // 4. Notify
func (p *Notify) NEOEncode(data []byte) int /*(int, error)*/ { func (p *Notify) NEOEncode(data []byte) {
var nwrote uint32
{ {
l := uint32(len(p.Message)) l := uint32(len(p.Message))
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
...@@ -172,11 +159,6 @@ func (p *Notify) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -172,11 +159,6 @@ func (p *Notify) NEOEncode(data []byte) int /*(int, error)*/ {
copy(data, p.Message) copy(data, p.Message)
nwrote += 4 + l nwrote += 4 + l
} }
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *Notify) NEODecode(data []byte) (int, error) { func (p *Notify) NEODecode(data []byte) (int, error) {
...@@ -200,8 +182,7 @@ overflow: ...@@ -200,8 +182,7 @@ overflow:
// 5. Error // 5. Error
func (p *Error) NEOEncode(data []byte) int /*(int, error)*/ { func (p *Error) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.Code) binary.BigEndian.PutUint32(data[0:], p.Code)
{ {
l := uint32(len(p.Message)) l := uint32(len(p.Message))
...@@ -213,11 +194,6 @@ func (p *Error) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -213,11 +194,6 @@ func (p *Error) NEOEncode(data []byte) int /*(int, error)*/ {
copy(data, p.Message) copy(data, p.Message)
nwrote += 8 + l nwrote += 8 + l
} }
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *Error) NEODecode(data []byte) (int, error) { func (p *Error) NEODecode(data []byte) (int, error) {
...@@ -242,13 +218,7 @@ overflow: ...@@ -242,13 +218,7 @@ overflow:
// 6. Ping // 6. Ping
func (p *Ping) NEOEncode(data []byte) int /*(int, error)*/ { func (p *Ping) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *Ping) NEODecode(data []byte) (int, error) { func (p *Ping) NEODecode(data []byte) (int, error) {
...@@ -262,13 +232,7 @@ overflow: ...@@ -262,13 +232,7 @@ overflow:
// 7. CloseClient // 7. CloseClient
func (p *CloseClient) NEOEncode(data []byte) int /*(int, error)*/ { func (p *CloseClient) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *CloseClient) NEODecode(data []byte) (int, error) { func (p *CloseClient) NEODecode(data []byte) (int, error) {
...@@ -282,8 +246,7 @@ overflow: ...@@ -282,8 +246,7 @@ overflow:
// 8. RequestIdentification // 8. RequestIdentification
func (p *RequestIdentification) NEOEncode(data []byte) int /*(int, error)*/ { func (p *RequestIdentification) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.ProtocolVersion) binary.BigEndian.PutUint32(data[0:], p.ProtocolVersion)
binary.BigEndian.PutUint32(data[4:], uint32(int32(p.NodeType))) binary.BigEndian.PutUint32(data[4:], uint32(int32(p.NodeType)))
binary.BigEndian.PutUint32(data[8:], uint32(int32(p.UUID))) binary.BigEndian.PutUint32(data[8:], uint32(int32(p.UUID)))
...@@ -309,11 +272,6 @@ func (p *RequestIdentification) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -309,11 +272,6 @@ func (p *RequestIdentification) NEOEncode(data []byte) int /*(int, error)*/ {
nwrote += 6 + l nwrote += 6 + l
} }
float64_NEOEncode(data[0:], p.IdTimestamp) float64_NEOEncode(data[0:], p.IdTimestamp)
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *RequestIdentification) NEODecode(data []byte) (int, error) { func (p *RequestIdentification) NEODecode(data []byte) (int, error) {
...@@ -352,8 +310,7 @@ overflow: ...@@ -352,8 +310,7 @@ overflow:
// 9. AcceptIdentification // 9. AcceptIdentification
func (p *AcceptIdentification) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AcceptIdentification) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], uint32(int32(p.NodeType))) binary.BigEndian.PutUint32(data[0:], uint32(int32(p.NodeType)))
binary.BigEndian.PutUint32(data[4:], uint32(int32(p.MyUUID))) binary.BigEndian.PutUint32(data[4:], uint32(int32(p.MyUUID)))
binary.BigEndian.PutUint32(data[8:], p.NumPartitions) binary.BigEndian.PutUint32(data[8:], p.NumPartitions)
...@@ -370,12 +327,29 @@ func (p *AcceptIdentification) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -370,12 +327,29 @@ func (p *AcceptIdentification) NEOEncode(data []byte) int /*(int, error)*/ {
nwrote += 24 + l nwrote += 24 + l
} }
binary.BigEndian.PutUint16(data[0:], p.Primary.Port) binary.BigEndian.PutUint16(data[0:], p.Primary.Port)
// TODO slice {
return int(nwrote) + 2 /*, nil*/ l := uint32(len(p.KnownMasterList))
binary.BigEndian.PutUint32(data[2:], l)
overflow: data = data[6:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 6
for i := 0; uint32(i) < l; i++ {
a := &p.KnownMasterList[i]
{
l := uint32(len((*a).Address.Host))
binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
if uint32(len(data)) < l {
goto overflow goto overflow
}
copy(data, (*a).Address.Host)
nwrote += 4 + l
}
binary.BigEndian.PutUint16(data[0:], (*a).Address.Port)
binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
data = data[6:]
nwrote += 6
}
}
} }
func (p *AcceptIdentification) NEODecode(data []byte) (int, error) { func (p *AcceptIdentification) NEODecode(data []byte) (int, error) {
...@@ -431,13 +405,7 @@ overflow: ...@@ -431,13 +405,7 @@ overflow:
// 10. PrimaryMaster // 10. PrimaryMaster
func (p *PrimaryMaster) NEOEncode(data []byte) int /*(int, error)*/ { func (p *PrimaryMaster) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *PrimaryMaster) NEODecode(data []byte) (int, error) { func (p *PrimaryMaster) NEODecode(data []byte) (int, error) {
...@@ -451,14 +419,8 @@ overflow: ...@@ -451,14 +419,8 @@ overflow:
// 11. AnswerPrimary // 11. AnswerPrimary
func (p *AnswerPrimary) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerPrimary) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], uint32(int32(p.PrimaryUUID))) binary.BigEndian.PutUint32(data[0:], uint32(int32(p.PrimaryUUID)))
return int(nwrote) + 4 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerPrimary) NEODecode(data []byte) (int, error) { func (p *AnswerPrimary) NEODecode(data []byte) (int, error) {
...@@ -473,13 +435,7 @@ overflow: ...@@ -473,13 +435,7 @@ overflow:
// 12. AnnouncePrimary // 12. AnnouncePrimary
func (p *AnnouncePrimary) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnnouncePrimary) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnnouncePrimary) NEODecode(data []byte) (int, error) { func (p *AnnouncePrimary) NEODecode(data []byte) (int, error) {
...@@ -493,13 +449,7 @@ overflow: ...@@ -493,13 +449,7 @@ overflow:
// 13. ReelectPrimary // 13. ReelectPrimary
func (p *ReelectPrimary) NEOEncode(data []byte) int /*(int, error)*/ { func (p *ReelectPrimary) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *ReelectPrimary) NEODecode(data []byte) (int, error) { func (p *ReelectPrimary) NEODecode(data []byte) (int, error) {
...@@ -513,13 +463,7 @@ overflow: ...@@ -513,13 +463,7 @@ overflow:
// 14. Recovery // 14. Recovery
func (p *Recovery) NEOEncode(data []byte) int /*(int, error)*/ { func (p *Recovery) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *Recovery) NEODecode(data []byte) (int, error) { func (p *Recovery) NEODecode(data []byte) (int, error) {
...@@ -533,16 +477,10 @@ overflow: ...@@ -533,16 +477,10 @@ overflow:
// 15. AnswerRecovery // 15. AnswerRecovery
func (p *AnswerRecovery) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerRecovery) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.PTid)) binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
binary.BigEndian.PutUint64(data[8:], uint64(p.BackupTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.BackupTID))
binary.BigEndian.PutUint64(data[16:], uint64(p.TruncateTID)) binary.BigEndian.PutUint64(data[16:], uint64(p.TruncateTID))
return int(nwrote) + 24 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerRecovery) NEODecode(data []byte) (int, error) { func (p *AnswerRecovery) NEODecode(data []byte) (int, error) {
...@@ -559,13 +497,7 @@ overflow: ...@@ -559,13 +497,7 @@ overflow:
// 16. LastIDs // 16. LastIDs
func (p *LastIDs) NEOEncode(data []byte) int /*(int, error)*/ { func (p *LastIDs) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *LastIDs) NEODecode(data []byte) (int, error) { func (p *LastIDs) NEODecode(data []byte) (int, error) {
...@@ -579,15 +511,9 @@ overflow: ...@@ -579,15 +511,9 @@ overflow:
// 17. AnswerLastIDs // 17. AnswerLastIDs
func (p *AnswerLastIDs) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerLastIDs) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.LastOID)) binary.BigEndian.PutUint64(data[0:], uint64(p.LastOID))
binary.BigEndian.PutUint64(data[8:], uint64(p.LastTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.LastTID))
return int(nwrote) + 16 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) { func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) {
...@@ -603,13 +529,7 @@ overflow: ...@@ -603,13 +529,7 @@ overflow:
// 18. PartitionTable // 18. PartitionTable
func (p *PartitionTable) NEOEncode(data []byte) int /*(int, error)*/ { func (p *PartitionTable) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *PartitionTable) NEODecode(data []byte) (int, error) { func (p *PartitionTable) NEODecode(data []byte) (int, error) {
...@@ -623,15 +543,33 @@ overflow: ...@@ -623,15 +543,33 @@ overflow:
// 19. AnswerPartitionTable // 19. AnswerPartitionTable
func (p *AnswerPartitionTable) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerPartitionTable) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.PTid)) binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
// TODO slice {
return int(nwrote) + 8 /*, nil*/ l := uint32(len(p.RowList))
binary.BigEndian.PutUint32(data[8:], l)
overflow: data = data[12:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 12
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.RowList[i]
binary.BigEndian.PutUint32(data[0:], (*a).Offset)
{
l := uint32(len((*a).CellList))
binary.BigEndian.PutUint32(data[4:], l)
data = data[8:]
nwrote += 8
for i := 0; uint32(i) < l; i++ {
a := &(*a).CellList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).UUID)))
binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).CellState)))
data = data[8:]
nwrote += 8
}
}
data = data[0:]
nwrote += 0
}
}
} }
func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) { func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) {
...@@ -671,15 +609,33 @@ overflow: ...@@ -671,15 +609,33 @@ overflow:
// 20. NotifyPartitionTable // 20. NotifyPartitionTable
func (p *NotifyPartitionTable) NEOEncode(data []byte) int /*(int, error)*/ { func (p *NotifyPartitionTable) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.PTid)) binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
// TODO slice {
return int(nwrote) + 8 /*, nil*/ l := uint32(len(p.RowList))
binary.BigEndian.PutUint32(data[8:], l)
overflow: data = data[12:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 12
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.RowList[i]
binary.BigEndian.PutUint32(data[0:], (*a).Offset)
{
l := uint32(len((*a).CellList))
binary.BigEndian.PutUint32(data[4:], l)
data = data[8:]
nwrote += 8
for i := 0; uint32(i) < l; i++ {
a := &(*a).CellList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).UUID)))
binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).CellState)))
data = data[8:]
nwrote += 8
}
}
data = data[0:]
nwrote += 0
}
}
} }
func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) { func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) {
...@@ -719,15 +675,22 @@ overflow: ...@@ -719,15 +675,22 @@ overflow:
// 21. PartitionChanges // 21. PartitionChanges
func (p *PartitionChanges) NEOEncode(data []byte) int /*(int, error)*/ { func (p *PartitionChanges) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.PTid)) binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
// TODO slice {
return int(nwrote) + 8 /*, nil*/ l := uint32(len(p.CellList))
binary.BigEndian.PutUint32(data[8:], l)
overflow: data = data[12:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 12
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.CellList[i]
binary.BigEndian.PutUint32(data[0:], (*a).Offset)
binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).UUID)))
binary.BigEndian.PutUint32(data[8:], uint32(int32((*a).CellState)))
data = data[12:]
nwrote += 12
}
}
} }
func (p *PartitionChanges) NEODecode(data []byte) (int, error) { func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
...@@ -760,14 +723,8 @@ overflow: ...@@ -760,14 +723,8 @@ overflow:
// 22. StartOperation // 22. StartOperation
func (p *StartOperation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *StartOperation) NEOEncode(data []byte) {
var nwrote uint32
(data[0:])[0] = bool2byte(p.Backup) (data[0:])[0] = bool2byte(p.Backup)
return int(nwrote) + 1 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *StartOperation) NEODecode(data []byte) (int, error) { func (p *StartOperation) NEODecode(data []byte) (int, error) {
...@@ -782,13 +739,7 @@ overflow: ...@@ -782,13 +739,7 @@ overflow:
// 23. StopOperation // 23. StopOperation
func (p *StopOperation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *StopOperation) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *StopOperation) NEODecode(data []byte) (int, error) { func (p *StopOperation) NEODecode(data []byte) (int, error) {
...@@ -802,13 +753,7 @@ overflow: ...@@ -802,13 +753,7 @@ overflow:
// 24. UnfinishedTransactions // 24. UnfinishedTransactions
func (p *UnfinishedTransactions) NEOEncode(data []byte) int /*(int, error)*/ { func (p *UnfinishedTransactions) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *UnfinishedTransactions) NEODecode(data []byte) (int, error) { func (p *UnfinishedTransactions) NEODecode(data []byte) (int, error) {
...@@ -822,15 +767,20 @@ overflow: ...@@ -822,15 +767,20 @@ overflow:
// 25. AnswerUnfinishedTransactions // 25. AnswerUnfinishedTransactions
func (p *AnswerUnfinishedTransactions) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerUnfinishedTransactions) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.MaxTID)) binary.BigEndian.PutUint64(data[0:], uint64(p.MaxTID))
// TODO slice {
return int(nwrote) + 8 /*, nil*/ l := uint32(len(p.TidList))
binary.BigEndian.PutUint32(data[8:], l)
overflow: data = data[12:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 12
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.TidList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a).UnfinishedTID))
data = data[8:]
nwrote += 8
}
}
} }
func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) { func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) {
...@@ -857,13 +807,7 @@ overflow: ...@@ -857,13 +807,7 @@ overflow:
// 26. LockedTransactions // 26. LockedTransactions
func (p *LockedTransactions) NEOEncode(data []byte) int /*(int, error)*/ { func (p *LockedTransactions) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *LockedTransactions) NEODecode(data []byte) (int, error) { func (p *LockedTransactions) NEODecode(data []byte) (int, error) {
...@@ -877,14 +821,8 @@ overflow: ...@@ -877,14 +821,8 @@ overflow:
// 27. AnswerLockedTransactions // 27. AnswerLockedTransactions
func (p *AnswerLockedTransactions) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerLockedTransactions) NEOEncode(data []byte) {
var nwrote uint32
// TODO map // TODO map
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) { func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) {
...@@ -911,14 +849,8 @@ overflow: ...@@ -911,14 +849,8 @@ overflow:
// 28. FinalTID // 28. FinalTID
func (p *FinalTID) NEOEncode(data []byte) int /*(int, error)*/ { func (p *FinalTID) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.TTID)) binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *FinalTID) NEODecode(data []byte) (int, error) { func (p *FinalTID) NEODecode(data []byte) (int, error) {
...@@ -933,14 +865,8 @@ overflow: ...@@ -933,14 +865,8 @@ overflow:
// 29. AnswerFinalTID // 29. AnswerFinalTID
func (p *AnswerFinalTID) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerFinalTID) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerFinalTID) NEODecode(data []byte) (int, error) { func (p *AnswerFinalTID) NEODecode(data []byte) (int, error) {
...@@ -955,15 +881,9 @@ overflow: ...@@ -955,15 +881,9 @@ overflow:
// 30. ValidateTransaction // 30. ValidateTransaction
func (p *ValidateTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *ValidateTransaction) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.TTID)) binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
binary.BigEndian.PutUint64(data[8:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[8:], uint64(p.Tid))
return int(nwrote) + 16 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *ValidateTransaction) NEODecode(data []byte) (int, error) { func (p *ValidateTransaction) NEODecode(data []byte) (int, error) {
...@@ -979,14 +899,8 @@ overflow: ...@@ -979,14 +899,8 @@ overflow:
// 31. BeginTransaction // 31. BeginTransaction
func (p *BeginTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *BeginTransaction) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *BeginTransaction) NEODecode(data []byte) (int, error) { func (p *BeginTransaction) NEODecode(data []byte) (int, error) {
...@@ -1001,14 +915,8 @@ overflow: ...@@ -1001,14 +915,8 @@ overflow:
// 32. AnswerBeginTransaction // 32. AnswerBeginTransaction
func (p *AnswerBeginTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerBeginTransaction) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerBeginTransaction) NEODecode(data []byte) (int, error) { func (p *AnswerBeginTransaction) NEODecode(data []byte) (int, error) {
...@@ -1023,16 +931,32 @@ overflow: ...@@ -1023,16 +931,32 @@ overflow:
// 33. FinishTransaction // 33. FinishTransaction
func (p *FinishTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *FinishTransaction) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
// TODO slice {
// TODO slice l := uint32(len(p.OIDList))
return int(nwrote) + 8 /*, nil*/ binary.BigEndian.PutUint32(data[8:], l)
data = data[12:]
overflow: nwrote += 12
panic(0) //return 0, ErrEncodeOverflow for i := 0; uint32(i) < l; i++ {
goto overflow a := &p.OIDList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
nwrote += 8
}
}
{
l := uint32(len(p.CheckedList))
binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
nwrote += 4
for i := 0; uint32(i) < l; i++ {
a := &p.CheckedList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
nwrote += 8
}
}
} }
func (p *FinishTransaction) NEODecode(data []byte) (int, error) { func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
...@@ -1071,15 +995,9 @@ overflow: ...@@ -1071,15 +995,9 @@ overflow:
// 34. AnswerFinishTransaction // 34. AnswerFinishTransaction
func (p *AnswerFinishTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerFinishTransaction) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.TTID)) binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
binary.BigEndian.PutUint64(data[8:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[8:], uint64(p.Tid))
return int(nwrote) + 16 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerFinishTransaction) NEODecode(data []byte) (int, error) { func (p *AnswerFinishTransaction) NEODecode(data []byte) (int, error) {
...@@ -1095,15 +1013,9 @@ overflow: ...@@ -1095,15 +1013,9 @@ overflow:
// 35. NotifyTransactionFinished // 35. NotifyTransactionFinished
func (p *NotifyTransactionFinished) NEOEncode(data []byte) int /*(int, error)*/ { func (p *NotifyTransactionFinished) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.TTID)) binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID))
return int(nwrote) + 16 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *NotifyTransactionFinished) NEODecode(data []byte) (int, error) { func (p *NotifyTransactionFinished) NEODecode(data []byte) (int, error) {
...@@ -1119,15 +1031,9 @@ overflow: ...@@ -1119,15 +1031,9 @@ overflow:
// 36. LockInformation // 36. LockInformation
func (p *LockInformation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *LockInformation) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Ttid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Ttid))
binary.BigEndian.PutUint64(data[8:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[8:], uint64(p.Tid))
return int(nwrote) + 16 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *LockInformation) NEODecode(data []byte) (int, error) { func (p *LockInformation) NEODecode(data []byte) (int, error) {
...@@ -1143,14 +1049,8 @@ overflow: ...@@ -1143,14 +1049,8 @@ overflow:
// 37. AnswerLockInformation // 37. AnswerLockInformation
func (p *AnswerLockInformation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerLockInformation) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Ttid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Ttid))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerLockInformation) NEODecode(data []byte) (int, error) { func (p *AnswerLockInformation) NEODecode(data []byte) (int, error) {
...@@ -1165,15 +1065,20 @@ overflow: ...@@ -1165,15 +1065,20 @@ overflow:
// 38. InvalidateObjects // 38. InvalidateObjects
func (p *InvalidateObjects) NEOEncode(data []byte) int /*(int, error)*/ { func (p *InvalidateObjects) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
// TODO slice {
return int(nwrote) + 8 /*, nil*/ l := uint32(len(p.OidList))
binary.BigEndian.PutUint32(data[8:], l)
overflow: data = data[12:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 12
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.OidList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
nwrote += 8
}
}
} }
func (p *InvalidateObjects) NEODecode(data []byte) (int, error) { func (p *InvalidateObjects) NEODecode(data []byte) (int, error) {
...@@ -1200,14 +1105,8 @@ overflow: ...@@ -1200,14 +1105,8 @@ overflow:
// 39. UnlockInformation // 39. UnlockInformation
func (p *UnlockInformation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *UnlockInformation) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.TTID)) binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *UnlockInformation) NEODecode(data []byte) (int, error) { func (p *UnlockInformation) NEODecode(data []byte) (int, error) {
...@@ -1222,14 +1121,8 @@ overflow: ...@@ -1222,14 +1121,8 @@ overflow:
// 40. GenerateOIDs // 40. GenerateOIDs
func (p *GenerateOIDs) NEOEncode(data []byte) int /*(int, error)*/ { func (p *GenerateOIDs) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.NumOIDs) binary.BigEndian.PutUint32(data[0:], p.NumOIDs)
return int(nwrote) + 4 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *GenerateOIDs) NEODecode(data []byte) (int, error) { func (p *GenerateOIDs) NEODecode(data []byte) (int, error) {
...@@ -1244,14 +1137,19 @@ overflow: ...@@ -1244,14 +1137,19 @@ overflow:
// 41. AnswerGenerateOIDs // 41. AnswerGenerateOIDs
func (p *AnswerGenerateOIDs) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerGenerateOIDs) NEOEncode(data []byte) {
var nwrote uint32 {
// TODO slice l := uint32(len(p.OidList))
return int(nwrote) + 0 /*, nil*/ binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
overflow: nwrote += 4
panic(0) //return 0, ErrEncodeOverflow for i := 0; uint32(i) < l; i++ {
goto overflow a := &p.OidList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
nwrote += 8
}
}
} }
func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) { func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) {
...@@ -1277,8 +1175,7 @@ overflow: ...@@ -1277,8 +1175,7 @@ overflow:
// 42. StoreObject // 42. StoreObject
func (p *StoreObject) NEOEncode(data []byte) int /*(int, error)*/ { func (p *StoreObject) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
binary.BigEndian.PutUint64(data[8:], uint64(p.Serial)) binary.BigEndian.PutUint64(data[8:], uint64(p.Serial))
(data[16:])[0] = bool2byte(p.Compression) (data[16:])[0] = bool2byte(p.Compression)
...@@ -1302,15 +1199,21 @@ func (p *StoreObject) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -1302,15 +1199,21 @@ func (p *StoreObject) NEOEncode(data []byte) int /*(int, error)*/ {
(data[34:])[0] = p.Checksum[17] (data[34:])[0] = p.Checksum[17]
(data[35:])[0] = p.Checksum[18] (data[35:])[0] = p.Checksum[18]
(data[36:])[0] = p.Checksum[19] (data[36:])[0] = p.Checksum[19]
// TODO slice {
binary.BigEndian.PutUint64(data[37:], uint64(p.DataSerial)) l := uint32(len(p.Data))
binary.BigEndian.PutUint64(data[45:], uint64(p.Tid)) binary.BigEndian.PutUint32(data[37:], l)
(data[53:])[0] = bool2byte(p.Unlock) data = data[41:]
return int(nwrote) + 54 /*, nil*/ nwrote += 41
for i := 0; uint32(i) < l; i++ {
overflow: a := &p.Data[i]
panic(0) //return 0, ErrEncodeOverflow (data[0:])[0] = (*a)
goto overflow data = data[1:]
nwrote += 1
}
}
binary.BigEndian.PutUint64(data[0:], uint64(p.DataSerial))
binary.BigEndian.PutUint64(data[8:], uint64(p.Tid))
(data[16:])[0] = bool2byte(p.Unlock)
} }
func (p *StoreObject) NEODecode(data []byte) (int, error) { func (p *StoreObject) NEODecode(data []byte) (int, error) {
...@@ -1362,16 +1265,10 @@ overflow: ...@@ -1362,16 +1265,10 @@ overflow:
// 43. AnswerStoreObject // 43. AnswerStoreObject
func (p *AnswerStoreObject) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerStoreObject) NEOEncode(data []byte) {
var nwrote uint32
(data[0:])[0] = bool2byte(p.Conflicting) (data[0:])[0] = bool2byte(p.Conflicting)
binary.BigEndian.PutUint64(data[1:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[1:], uint64(p.Oid))
binary.BigEndian.PutUint64(data[9:], uint64(p.Serial)) binary.BigEndian.PutUint64(data[9:], uint64(p.Serial))
return int(nwrote) + 17 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerStoreObject) NEODecode(data []byte) (int, error) { func (p *AnswerStoreObject) NEODecode(data []byte) (int, error) {
...@@ -1388,14 +1285,8 @@ overflow: ...@@ -1388,14 +1285,8 @@ overflow:
// 44. AbortTransaction // 44. AbortTransaction
func (p *AbortTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AbortTransaction) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AbortTransaction) NEODecode(data []byte) (int, error) { func (p *AbortTransaction) NEODecode(data []byte) (int, error) {
...@@ -1410,8 +1301,7 @@ overflow: ...@@ -1410,8 +1301,7 @@ overflow:
// 45. StoreTransaction // 45. StoreTransaction
func (p *StoreTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *StoreTransaction) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
{ {
l := uint32(len(p.User)) l := uint32(len(p.User))
...@@ -1443,12 +1333,18 @@ func (p *StoreTransaction) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -1443,12 +1333,18 @@ func (p *StoreTransaction) NEOEncode(data []byte) int /*(int, error)*/ {
copy(data, p.Extension) copy(data, p.Extension)
nwrote += 4 + l nwrote += 4 + l
} }
// TODO slice {
return int(nwrote) + 0 /*, nil*/ l := uint32(len(p.OidList))
binary.BigEndian.PutUint32(data[0:], l)
overflow: data = data[4:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 4
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.OidList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
nwrote += 8
}
}
} }
func (p *StoreTransaction) NEODecode(data []byte) (int, error) { func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
...@@ -1505,14 +1401,8 @@ overflow: ...@@ -1505,14 +1401,8 @@ overflow:
// 46. VoteTransaction // 46. VoteTransaction
func (p *VoteTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *VoteTransaction) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *VoteTransaction) NEODecode(data []byte) (int, error) { func (p *VoteTransaction) NEODecode(data []byte) (int, error) {
...@@ -1527,16 +1417,10 @@ overflow: ...@@ -1527,16 +1417,10 @@ overflow:
// 47. GetObject // 47. GetObject
func (p *GetObject) NEOEncode(data []byte) int /*(int, error)*/ { func (p *GetObject) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
binary.BigEndian.PutUint64(data[8:], uint64(p.Serial)) binary.BigEndian.PutUint64(data[8:], uint64(p.Serial))
binary.BigEndian.PutUint64(data[16:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[16:], uint64(p.Tid))
return int(nwrote) + 24 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *GetObject) NEODecode(data []byte) (int, error) { func (p *GetObject) NEODecode(data []byte) (int, error) {
...@@ -1553,8 +1437,7 @@ overflow: ...@@ -1553,8 +1437,7 @@ overflow:
// 48. AnswerGetObject // 48. AnswerGetObject
func (p *AnswerGetObject) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerGetObject) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
binary.BigEndian.PutUint64(data[8:], uint64(p.SerialStart)) binary.BigEndian.PutUint64(data[8:], uint64(p.SerialStart))
binary.BigEndian.PutUint64(data[16:], uint64(p.SerialEnd)) binary.BigEndian.PutUint64(data[16:], uint64(p.SerialEnd))
...@@ -1579,13 +1462,19 @@ func (p *AnswerGetObject) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -1579,13 +1462,19 @@ func (p *AnswerGetObject) NEOEncode(data []byte) int /*(int, error)*/ {
(data[42:])[0] = p.Checksum[17] (data[42:])[0] = p.Checksum[17]
(data[43:])[0] = p.Checksum[18] (data[43:])[0] = p.Checksum[18]
(data[44:])[0] = p.Checksum[19] (data[44:])[0] = p.Checksum[19]
// TODO slice {
binary.BigEndian.PutUint64(data[45:], uint64(p.DataSerial)) l := uint32(len(p.Data))
return int(nwrote) + 53 /*, nil*/ binary.BigEndian.PutUint32(data[45:], l)
data = data[49:]
overflow: nwrote += 49
panic(0) //return 0, ErrEncodeOverflow for i := 0; uint32(i) < l; i++ {
goto overflow a := &p.Data[i]
(data[0:])[0] = (*a)
data = data[1:]
nwrote += 1
}
}
binary.BigEndian.PutUint64(data[0:], uint64(p.DataSerial))
} }
func (p *AnswerGetObject) NEODecode(data []byte) (int, error) { func (p *AnswerGetObject) NEODecode(data []byte) (int, error) {
...@@ -1636,16 +1525,10 @@ overflow: ...@@ -1636,16 +1525,10 @@ overflow:
// 49. TIDList // 49. TIDList
func (p *TIDList) NEOEncode(data []byte) int /*(int, error)*/ { func (p *TIDList) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], p.First) binary.BigEndian.PutUint64(data[0:], p.First)
binary.BigEndian.PutUint64(data[8:], p.Last) binary.BigEndian.PutUint64(data[8:], p.Last)
binary.BigEndian.PutUint32(data[16:], p.Partition) binary.BigEndian.PutUint32(data[16:], p.Partition)
return int(nwrote) + 20 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *TIDList) NEODecode(data []byte) (int, error) { func (p *TIDList) NEODecode(data []byte) (int, error) {
...@@ -1662,14 +1545,19 @@ overflow: ...@@ -1662,14 +1545,19 @@ overflow:
// 50. AnswerTIDList // 50. AnswerTIDList
func (p *AnswerTIDList) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerTIDList) NEOEncode(data []byte) {
var nwrote uint32 {
// TODO slice l := uint32(len(p.TIDList))
return int(nwrote) + 0 /*, nil*/ binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
overflow: nwrote += 4
panic(0) //return 0, ErrEncodeOverflow for i := 0; uint32(i) < l; i++ {
goto overflow a := &p.TIDList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
nwrote += 8
}
}
} }
func (p *AnswerTIDList) NEODecode(data []byte) (int, error) { func (p *AnswerTIDList) NEODecode(data []byte) (int, error) {
...@@ -1695,17 +1583,11 @@ overflow: ...@@ -1695,17 +1583,11 @@ overflow:
// 51. TIDListFrom // 51. TIDListFrom
func (p *TIDListFrom) NEOEncode(data []byte) int /*(int, error)*/ { func (p *TIDListFrom) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.MinTID)) binary.BigEndian.PutUint64(data[0:], uint64(p.MinTID))
binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID))
binary.BigEndian.PutUint32(data[16:], p.Length) binary.BigEndian.PutUint32(data[16:], p.Length)
binary.BigEndian.PutUint32(data[20:], p.Partition) binary.BigEndian.PutUint32(data[20:], p.Partition)
return int(nwrote) + 24 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *TIDListFrom) NEODecode(data []byte) (int, error) { func (p *TIDListFrom) NEODecode(data []byte) (int, error) {
...@@ -1723,14 +1605,19 @@ overflow: ...@@ -1723,14 +1605,19 @@ overflow:
// 52. AnswerTIDListFrom // 52. AnswerTIDListFrom
func (p *AnswerTIDListFrom) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerTIDListFrom) NEOEncode(data []byte) {
var nwrote uint32 {
// TODO slice l := uint32(len(p.TidList))
return int(nwrote) + 0 /*, nil*/ binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
overflow: nwrote += 4
panic(0) //return 0, ErrEncodeOverflow for i := 0; uint32(i) < l; i++ {
goto overflow a := &p.TidList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
nwrote += 8
}
}
} }
func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) { func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) {
...@@ -1756,14 +1643,8 @@ overflow: ...@@ -1756,14 +1643,8 @@ overflow:
// 53. TransactionInformation // 53. TransactionInformation
func (p *TransactionInformation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *TransactionInformation) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *TransactionInformation) NEODecode(data []byte) (int, error) { func (p *TransactionInformation) NEODecode(data []byte) (int, error) {
...@@ -1778,8 +1659,7 @@ overflow: ...@@ -1778,8 +1659,7 @@ overflow:
// 54. AnswerTransactionInformation // 54. AnswerTransactionInformation
func (p *AnswerTransactionInformation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerTransactionInformation) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
{ {
l := uint32(len(p.User)) l := uint32(len(p.User))
...@@ -1812,12 +1692,18 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) int /*(int, error) ...@@ -1812,12 +1692,18 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) int /*(int, error)
nwrote += 4 + l nwrote += 4 + l
} }
(data[0:])[0] = bool2byte(p.Packed) (data[0:])[0] = bool2byte(p.Packed)
// TODO slice {
return int(nwrote) + 1 /*, nil*/ l := uint32(len(p.OidList))
binary.BigEndian.PutUint32(data[1:], l)
overflow: data = data[5:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 5
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.OidList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
nwrote += 8
}
}
} }
func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) { func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
...@@ -1875,16 +1761,10 @@ overflow: ...@@ -1875,16 +1761,10 @@ overflow:
// 55. ObjectHistory // 55. ObjectHistory
func (p *ObjectHistory) NEOEncode(data []byte) int /*(int, error)*/ { func (p *ObjectHistory) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
binary.BigEndian.PutUint64(data[8:], p.First) binary.BigEndian.PutUint64(data[8:], p.First)
binary.BigEndian.PutUint64(data[16:], p.Last) binary.BigEndian.PutUint64(data[16:], p.Last)
return int(nwrote) + 24 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *ObjectHistory) NEODecode(data []byte) (int, error) { func (p *ObjectHistory) NEODecode(data []byte) (int, error) {
...@@ -1901,15 +1781,21 @@ overflow: ...@@ -1901,15 +1781,21 @@ overflow:
// 56. AnswerObjectHistory // 56. AnswerObjectHistory
func (p *AnswerObjectHistory) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerObjectHistory) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
// TODO slice {
return int(nwrote) + 8 /*, nil*/ l := uint32(len(p.HistoryList))
binary.BigEndian.PutUint32(data[8:], l)
overflow: data = data[12:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 12
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.HistoryList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a).Serial))
binary.BigEndian.PutUint32(data[8:], (*a).Size)
data = data[12:]
nwrote += 12
}
}
} }
func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) { func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
...@@ -1940,16 +1826,10 @@ overflow: ...@@ -1940,16 +1826,10 @@ overflow:
// 57. PartitionList // 57. PartitionList
func (p *PartitionList) NEOEncode(data []byte) int /*(int, error)*/ { func (p *PartitionList) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.MinOffset) binary.BigEndian.PutUint32(data[0:], p.MinOffset)
binary.BigEndian.PutUint32(data[4:], p.MaxOffset) binary.BigEndian.PutUint32(data[4:], p.MaxOffset)
binary.BigEndian.PutUint32(data[8:], uint32(int32(p.UUID))) binary.BigEndian.PutUint32(data[8:], uint32(int32(p.UUID)))
return int(nwrote) + 12 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *PartitionList) NEODecode(data []byte) (int, error) { func (p *PartitionList) NEODecode(data []byte) (int, error) {
...@@ -1966,15 +1846,33 @@ overflow: ...@@ -1966,15 +1846,33 @@ overflow:
// 58. AnswerPartitionList // 58. AnswerPartitionList
func (p *AnswerPartitionList) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerPartitionList) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.PTid)) binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
// TODO slice {
return int(nwrote) + 8 /*, nil*/ l := uint32(len(p.RowList))
binary.BigEndian.PutUint32(data[8:], l)
overflow: data = data[12:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 12
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.RowList[i]
binary.BigEndian.PutUint32(data[0:], (*a).Offset)
{
l := uint32(len((*a).CellList))
binary.BigEndian.PutUint32(data[4:], l)
data = data[8:]
nwrote += 8
for i := 0; uint32(i) < l; i++ {
a := &(*a).CellList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).UUID)))
binary.BigEndian.PutUint32(data[4:], uint32(int32((*a).CellState)))
data = data[8:]
nwrote += 8
}
}
data = data[0:]
nwrote += 0
}
}
} }
func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) { func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) {
...@@ -2014,14 +1912,8 @@ overflow: ...@@ -2014,14 +1912,8 @@ overflow:
// 59. X_NodeList // 59. X_NodeList
func (p *X_NodeList) NEOEncode(data []byte) int /*(int, error)*/ { func (p *X_NodeList) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], uint32(int32(p.NodeType))) binary.BigEndian.PutUint32(data[0:], uint32(int32(p.NodeType)))
return int(nwrote) + 4 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *X_NodeList) NEODecode(data []byte) (int, error) { func (p *X_NodeList) NEODecode(data []byte) (int, error) {
...@@ -2036,14 +1928,33 @@ overflow: ...@@ -2036,14 +1928,33 @@ overflow:
// 60. AnswerNodeList // 60. AnswerNodeList
func (p *AnswerNodeList) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerNodeList) NEOEncode(data []byte) {
var nwrote uint32 {
// TODO slice l := uint32(len(p.NodeList))
return int(nwrote) + 0 /*, nil*/ binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
overflow: nwrote += 4
panic(0) //return 0, ErrEncodeOverflow for i := 0; uint32(i) < l; i++ {
a := &p.NodeList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).NodeType)))
{
l := uint32(len((*a).Address.Host))
binary.BigEndian.PutUint32(data[4:], l)
data = data[8:]
if uint32(len(data)) < l {
goto overflow goto overflow
}
copy(data, (*a).Address.Host)
nwrote += 8 + l
}
binary.BigEndian.PutUint16(data[0:], (*a).Address.Port)
binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
binary.BigEndian.PutUint32(data[6:], uint32(int32((*a).NodeState)))
float64_NEOEncode(data[10:], (*a).IdTimestamp)
data = data[18:]
nwrote += 18
}
}
} }
func (p *AnswerNodeList) NEODecode(data []byte) (int, error) { func (p *AnswerNodeList) NEODecode(data []byte) (int, error) {
...@@ -2083,15 +1994,9 @@ overflow: ...@@ -2083,15 +1994,9 @@ overflow:
// 61. SetNodeState // 61. SetNodeState
func (p *SetNodeState) NEOEncode(data []byte) int /*(int, error)*/ { func (p *SetNodeState) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], uint32(int32(p.UUID))) binary.BigEndian.PutUint32(data[0:], uint32(int32(p.UUID)))
binary.BigEndian.PutUint32(data[4:], uint32(int32(p.NodeState))) binary.BigEndian.PutUint32(data[4:], uint32(int32(p.NodeState)))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *SetNodeState) NEODecode(data []byte) (int, error) { func (p *SetNodeState) NEODecode(data []byte) (int, error) {
...@@ -2107,14 +2012,19 @@ overflow: ...@@ -2107,14 +2012,19 @@ overflow:
// 62. AddPendingNodes // 62. AddPendingNodes
func (p *AddPendingNodes) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AddPendingNodes) NEOEncode(data []byte) {
var nwrote uint32 {
// TODO slice l := uint32(len(p.UUIDList))
return int(nwrote) + 0 /*, nil*/ binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
overflow: nwrote += 4
panic(0) //return 0, ErrEncodeOverflow for i := 0; uint32(i) < l; i++ {
goto overflow a := &p.UUIDList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a))))
data = data[4:]
nwrote += 4
}
}
} }
func (p *AddPendingNodes) NEODecode(data []byte) (int, error) { func (p *AddPendingNodes) NEODecode(data []byte) (int, error) {
...@@ -2140,14 +2050,19 @@ overflow: ...@@ -2140,14 +2050,19 @@ overflow:
// 63. TweakPartitionTable // 63. TweakPartitionTable
func (p *TweakPartitionTable) NEOEncode(data []byte) int /*(int, error)*/ { func (p *TweakPartitionTable) NEOEncode(data []byte) {
var nwrote uint32 {
// TODO slice l := uint32(len(p.UUIDList))
return int(nwrote) + 0 /*, nil*/ binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
overflow: nwrote += 4
panic(0) //return 0, ErrEncodeOverflow for i := 0; uint32(i) < l; i++ {
goto overflow a := &p.UUIDList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a))))
data = data[4:]
nwrote += 4
}
}
} }
func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) { func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) {
...@@ -2173,14 +2088,33 @@ overflow: ...@@ -2173,14 +2088,33 @@ overflow:
// 64. NotifyNodeInformation // 64. NotifyNodeInformation
func (p *NotifyNodeInformation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *NotifyNodeInformation) NEOEncode(data []byte) {
var nwrote uint32 {
// TODO slice l := uint32(len(p.NodeList))
return int(nwrote) + 0 /*, nil*/ binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
overflow: nwrote += 4
panic(0) //return 0, ErrEncodeOverflow for i := 0; uint32(i) < l; i++ {
a := &p.NodeList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).NodeType)))
{
l := uint32(len((*a).Address.Host))
binary.BigEndian.PutUint32(data[4:], l)
data = data[8:]
if uint32(len(data)) < l {
goto overflow goto overflow
}
copy(data, (*a).Address.Host)
nwrote += 8 + l
}
binary.BigEndian.PutUint16(data[0:], (*a).Address.Port)
binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
binary.BigEndian.PutUint32(data[6:], uint32(int32((*a).NodeState)))
float64_NEOEncode(data[10:], (*a).IdTimestamp)
data = data[18:]
nwrote += 18
}
}
} }
func (p *NotifyNodeInformation) NEODecode(data []byte) (int, error) { func (p *NotifyNodeInformation) NEODecode(data []byte) (int, error) {
...@@ -2220,13 +2154,7 @@ overflow: ...@@ -2220,13 +2154,7 @@ overflow:
// 65. NodeInformation // 65. NodeInformation
func (p *NodeInformation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *NodeInformation) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *NodeInformation) NEODecode(data []byte) (int, error) { func (p *NodeInformation) NEODecode(data []byte) (int, error) {
...@@ -2240,14 +2168,8 @@ overflow: ...@@ -2240,14 +2168,8 @@ overflow:
// 66. SetClusterState // 66. SetClusterState
func (p *SetClusterState) NEOEncode(data []byte) int /*(int, error)*/ { func (p *SetClusterState) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], uint32(int32(p.State))) binary.BigEndian.PutUint32(data[0:], uint32(int32(p.State)))
return int(nwrote) + 4 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *SetClusterState) NEODecode(data []byte) (int, error) { func (p *SetClusterState) NEODecode(data []byte) (int, error) {
...@@ -2262,14 +2184,8 @@ overflow: ...@@ -2262,14 +2184,8 @@ overflow:
// 67. ClusterInformation // 67. ClusterInformation
func (p *ClusterInformation) NEOEncode(data []byte) int /*(int, error)*/ { func (p *ClusterInformation) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], uint32(int32(p.State))) binary.BigEndian.PutUint32(data[0:], uint32(int32(p.State)))
return int(nwrote) + 4 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *ClusterInformation) NEODecode(data []byte) (int, error) { func (p *ClusterInformation) NEODecode(data []byte) (int, error) {
...@@ -2284,14 +2200,8 @@ overflow: ...@@ -2284,14 +2200,8 @@ overflow:
// 68. X_ClusterState // 68. X_ClusterState
func (p *X_ClusterState) NEOEncode(data []byte) int /*(int, error)*/ { func (p *X_ClusterState) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], uint32(int32(p.State))) binary.BigEndian.PutUint32(data[0:], uint32(int32(p.State)))
return int(nwrote) + 4 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *X_ClusterState) NEODecode(data []byte) (int, error) { func (p *X_ClusterState) NEODecode(data []byte) (int, error) {
...@@ -2306,17 +2216,22 @@ overflow: ...@@ -2306,17 +2216,22 @@ overflow:
// 69. ObjectUndoSerial // 69. ObjectUndoSerial
func (p *ObjectUndoSerial) NEOEncode(data []byte) int /*(int, error)*/ { func (p *ObjectUndoSerial) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
binary.BigEndian.PutUint64(data[8:], uint64(p.LTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.LTID))
binary.BigEndian.PutUint64(data[16:], uint64(p.UndoneTID)) binary.BigEndian.PutUint64(data[16:], uint64(p.UndoneTID))
// TODO slice {
return int(nwrote) + 24 /*, nil*/ l := uint32(len(p.OidList))
binary.BigEndian.PutUint32(data[24:], l)
overflow: data = data[28:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 28
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.OidList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
nwrote += 8
}
}
} }
func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) { func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) {
...@@ -2345,14 +2260,8 @@ overflow: ...@@ -2345,14 +2260,8 @@ overflow:
// 70. AnswerObjectUndoSerial // 70. AnswerObjectUndoSerial
func (p *AnswerObjectUndoSerial) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerObjectUndoSerial) NEOEncode(data []byte) {
var nwrote uint32
// TODO map // TODO map
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) { func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
...@@ -2391,15 +2300,9 @@ overflow: ...@@ -2391,15 +2300,9 @@ overflow:
// 71. HasLock // 71. HasLock
func (p *HasLock) NEOEncode(data []byte) int /*(int, error)*/ { func (p *HasLock) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
binary.BigEndian.PutUint64(data[8:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[8:], uint64(p.Oid))
return int(nwrote) + 16 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *HasLock) NEODecode(data []byte) (int, error) { func (p *HasLock) NEODecode(data []byte) (int, error) {
...@@ -2415,15 +2318,9 @@ overflow: ...@@ -2415,15 +2318,9 @@ overflow:
// 72. AnswerHasLock // 72. AnswerHasLock
func (p *AnswerHasLock) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerHasLock) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
binary.BigEndian.PutUint32(data[8:], uint32(int32(p.LockState))) binary.BigEndian.PutUint32(data[8:], uint32(int32(p.LockState)))
return int(nwrote) + 12 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerHasLock) NEODecode(data []byte) (int, error) { func (p *AnswerHasLock) NEODecode(data []byte) (int, error) {
...@@ -2439,16 +2336,10 @@ overflow: ...@@ -2439,16 +2336,10 @@ overflow:
// 73. CheckCurrentSerial // 73. CheckCurrentSerial
func (p *CheckCurrentSerial) NEOEncode(data []byte) int /*(int, error)*/ { func (p *CheckCurrentSerial) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
binary.BigEndian.PutUint64(data[8:], uint64(p.Serial)) binary.BigEndian.PutUint64(data[8:], uint64(p.Serial))
binary.BigEndian.PutUint64(data[16:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[16:], uint64(p.Oid))
return int(nwrote) + 24 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *CheckCurrentSerial) NEODecode(data []byte) (int, error) { func (p *CheckCurrentSerial) NEODecode(data []byte) (int, error) {
...@@ -2465,16 +2356,10 @@ overflow: ...@@ -2465,16 +2356,10 @@ overflow:
// 74. AnswerCheckCurrentSerial // 74. AnswerCheckCurrentSerial
func (p *AnswerCheckCurrentSerial) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerCheckCurrentSerial) NEOEncode(data []byte) {
var nwrote uint32
(data[0:])[0] = bool2byte(p.Conflicting) (data[0:])[0] = bool2byte(p.Conflicting)
binary.BigEndian.PutUint64(data[1:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[1:], uint64(p.Oid))
binary.BigEndian.PutUint64(data[9:], uint64(p.Serial)) binary.BigEndian.PutUint64(data[9:], uint64(p.Serial))
return int(nwrote) + 17 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerCheckCurrentSerial) NEODecode(data []byte) (int, error) { func (p *AnswerCheckCurrentSerial) NEODecode(data []byte) (int, error) {
...@@ -2491,14 +2376,8 @@ overflow: ...@@ -2491,14 +2376,8 @@ overflow:
// 75. Pack // 75. Pack
func (p *Pack) NEOEncode(data []byte) int /*(int, error)*/ { func (p *Pack) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *Pack) NEODecode(data []byte) (int, error) { func (p *Pack) NEODecode(data []byte) (int, error) {
...@@ -2513,14 +2392,8 @@ overflow: ...@@ -2513,14 +2392,8 @@ overflow:
// 76. AnswerPack // 76. AnswerPack
func (p *AnswerPack) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerPack) NEOEncode(data []byte) {
var nwrote uint32
(data[0:])[0] = bool2byte(p.Status) (data[0:])[0] = bool2byte(p.Status)
return int(nwrote) + 1 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerPack) NEODecode(data []byte) (int, error) { func (p *AnswerPack) NEODecode(data []byte) (int, error) {
...@@ -2535,16 +2408,10 @@ overflow: ...@@ -2535,16 +2408,10 @@ overflow:
// 77. CheckReplicas // 77. CheckReplicas
func (p *CheckReplicas) NEOEncode(data []byte) int /*(int, error)*/ { func (p *CheckReplicas) NEOEncode(data []byte) {
var nwrote uint32
// TODO map // TODO map
binary.BigEndian.PutUint64(data[0:], uint64(p.MinTID)) binary.BigEndian.PutUint64(data[0:], uint64(p.MinTID))
binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID))
return int(nwrote) + 16 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *CheckReplicas) NEODecode(data []byte) (int, error) { func (p *CheckReplicas) NEODecode(data []byte) (int, error) {
...@@ -2573,8 +2440,7 @@ overflow: ...@@ -2573,8 +2440,7 @@ overflow:
// 78. CheckPartition // 78. CheckPartition
func (p *CheckPartition) NEOEncode(data []byte) int /*(int, error)*/ { func (p *CheckPartition) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.Partition) binary.BigEndian.PutUint32(data[0:], p.Partition)
{ {
l := uint32(len(p.Source.UpstreamName)) l := uint32(len(p.Source.UpstreamName))
...@@ -2599,11 +2465,6 @@ func (p *CheckPartition) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -2599,11 +2465,6 @@ func (p *CheckPartition) NEOEncode(data []byte) int /*(int, error)*/ {
binary.BigEndian.PutUint16(data[0:], p.Source.Address.Port) binary.BigEndian.PutUint16(data[0:], p.Source.Address.Port)
binary.BigEndian.PutUint64(data[2:], uint64(p.MinTID)) binary.BigEndian.PutUint64(data[2:], uint64(p.MinTID))
binary.BigEndian.PutUint64(data[10:], uint64(p.MaxTID)) binary.BigEndian.PutUint64(data[10:], uint64(p.MaxTID))
return int(nwrote) + 18 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *CheckPartition) NEODecode(data []byte) (int, error) { func (p *CheckPartition) NEODecode(data []byte) (int, error) {
...@@ -2641,17 +2502,11 @@ overflow: ...@@ -2641,17 +2502,11 @@ overflow:
// 79. CheckTIDRange // 79. CheckTIDRange
func (p *CheckTIDRange) NEOEncode(data []byte) int /*(int, error)*/ { func (p *CheckTIDRange) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.Partition) binary.BigEndian.PutUint32(data[0:], p.Partition)
binary.BigEndian.PutUint32(data[4:], p.Length) binary.BigEndian.PutUint32(data[4:], p.Length)
binary.BigEndian.PutUint64(data[8:], uint64(p.MinTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.MinTID))
binary.BigEndian.PutUint64(data[16:], uint64(p.MaxTID)) binary.BigEndian.PutUint64(data[16:], uint64(p.MaxTID))
return int(nwrote) + 24 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *CheckTIDRange) NEODecode(data []byte) (int, error) { func (p *CheckTIDRange) NEODecode(data []byte) (int, error) {
...@@ -2669,8 +2524,7 @@ overflow: ...@@ -2669,8 +2524,7 @@ overflow:
// 80. AnswerCheckTIDRange // 80. AnswerCheckTIDRange
func (p *AnswerCheckTIDRange) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerCheckTIDRange) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.Count) binary.BigEndian.PutUint32(data[0:], p.Count)
(data[4:])[0] = p.Checksum[0] (data[4:])[0] = p.Checksum[0]
(data[5:])[0] = p.Checksum[1] (data[5:])[0] = p.Checksum[1]
...@@ -2693,11 +2547,6 @@ func (p *AnswerCheckTIDRange) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -2693,11 +2547,6 @@ func (p *AnswerCheckTIDRange) NEOEncode(data []byte) int /*(int, error)*/ {
(data[22:])[0] = p.Checksum[18] (data[22:])[0] = p.Checksum[18]
(data[23:])[0] = p.Checksum[19] (data[23:])[0] = p.Checksum[19]
binary.BigEndian.PutUint64(data[24:], uint64(p.MaxTID)) binary.BigEndian.PutUint64(data[24:], uint64(p.MaxTID))
return int(nwrote) + 32 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerCheckTIDRange) NEODecode(data []byte) (int, error) { func (p *AnswerCheckTIDRange) NEODecode(data []byte) (int, error) {
...@@ -2733,18 +2582,12 @@ overflow: ...@@ -2733,18 +2582,12 @@ overflow:
// 81. CheckSerialRange // 81. CheckSerialRange
func (p *CheckSerialRange) NEOEncode(data []byte) int /*(int, error)*/ { func (p *CheckSerialRange) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.Partition) binary.BigEndian.PutUint32(data[0:], p.Partition)
binary.BigEndian.PutUint32(data[4:], p.Length) binary.BigEndian.PutUint32(data[4:], p.Length)
binary.BigEndian.PutUint64(data[8:], uint64(p.MinTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.MinTID))
binary.BigEndian.PutUint64(data[16:], uint64(p.MaxTID)) binary.BigEndian.PutUint64(data[16:], uint64(p.MaxTID))
binary.BigEndian.PutUint64(data[24:], uint64(p.MinOID)) binary.BigEndian.PutUint64(data[24:], uint64(p.MinOID))
return int(nwrote) + 32 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *CheckSerialRange) NEODecode(data []byte) (int, error) { func (p *CheckSerialRange) NEODecode(data []byte) (int, error) {
...@@ -2763,8 +2606,7 @@ overflow: ...@@ -2763,8 +2606,7 @@ overflow:
// 82. AnswerCheckSerialRange // 82. AnswerCheckSerialRange
func (p *AnswerCheckSerialRange) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerCheckSerialRange) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.Count) binary.BigEndian.PutUint32(data[0:], p.Count)
(data[4:])[0] = p.TidChecksum[0] (data[4:])[0] = p.TidChecksum[0]
(data[5:])[0] = p.TidChecksum[1] (data[5:])[0] = p.TidChecksum[1]
...@@ -2808,11 +2650,6 @@ func (p *AnswerCheckSerialRange) NEOEncode(data []byte) int /*(int, error)*/ { ...@@ -2808,11 +2650,6 @@ func (p *AnswerCheckSerialRange) NEOEncode(data []byte) int /*(int, error)*/ {
(data[50:])[0] = p.OidChecksum[18] (data[50:])[0] = p.OidChecksum[18]
(data[51:])[0] = p.OidChecksum[19] (data[51:])[0] = p.OidChecksum[19]
binary.BigEndian.PutUint64(data[52:], uint64(p.MaxOID)) binary.BigEndian.PutUint64(data[52:], uint64(p.MaxOID))
return int(nwrote) + 60 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) { func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) {
...@@ -2869,15 +2706,20 @@ overflow: ...@@ -2869,15 +2706,20 @@ overflow:
// 83. PartitionCorrupted // 83. PartitionCorrupted
func (p *PartitionCorrupted) NEOEncode(data []byte) int /*(int, error)*/ { func (p *PartitionCorrupted) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint32(data[0:], p.Partition) binary.BigEndian.PutUint32(data[0:], p.Partition)
// TODO slice {
return int(nwrote) + 4 /*, nil*/ l := uint32(len(p.CellList))
binary.BigEndian.PutUint32(data[4:], l)
overflow: data = data[8:]
panic(0) //return 0, ErrEncodeOverflow nwrote += 8
goto overflow for i := 0; uint32(i) < l; i++ {
a := &p.CellList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a))))
data = data[4:]
nwrote += 4
}
}
} }
func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) { func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) {
...@@ -2904,13 +2746,7 @@ overflow: ...@@ -2904,13 +2746,7 @@ overflow:
// 84. LastTransaction // 84. LastTransaction
func (p *LastTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *LastTransaction) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *LastTransaction) NEODecode(data []byte) (int, error) { func (p *LastTransaction) NEODecode(data []byte) (int, error) {
...@@ -2924,14 +2760,8 @@ overflow: ...@@ -2924,14 +2760,8 @@ overflow:
// 85. AnswerLastTransaction // 85. AnswerLastTransaction
func (p *AnswerLastTransaction) NEOEncode(data []byte) int /*(int, error)*/ { func (p *AnswerLastTransaction) NEOEncode(data []byte) {
var nwrote uint32
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
return int(nwrote) + 8 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *AnswerLastTransaction) NEODecode(data []byte) (int, error) { func (p *AnswerLastTransaction) NEODecode(data []byte) (int, error) {
...@@ -2946,13 +2776,7 @@ overflow: ...@@ -2946,13 +2776,7 @@ overflow:
// 86. NotifyReady // 86. NotifyReady
func (p *NotifyReady) NEOEncode(data []byte) int /*(int, error)*/ { func (p *NotifyReady) NEOEncode(data []byte) {
var nwrote uint32
return int(nwrote) + 0 /*, nil*/
overflow:
panic(0) //return 0, ErrEncodeOverflow
goto overflow
} }
func (p *NotifyReady) NEODecode(data []byte) (int, error) { func (p *NotifyReady) NEODecode(data []byte) (int, error) {
......
...@@ -94,9 +94,12 @@ var ErrDecodeOverflow = errors.New("decode: bufer overflow") ...@@ -94,9 +94,12 @@ var ErrDecodeOverflow = errors.New("decode: bufer overflow")
// NEOEncoder is interface for marshaling objects to wire format in NEO // NEOEncoder is interface for marshaling objects to wire format in NEO
type NEOEncoder interface { type NEOEncoder interface {
// NEOEncodedLen() int ? // compute how much space is needed to encode
// XXX len(buf) must be >= NEOEncodedLen() NEOEncodedLen() int
NEOEncode(buf []byte) (nwrote int)
// perform the encoding.
// len(buf) must be >= NEOEncodedLen() // XXX check in tests it will panic
NEOEncode(buf []byte)
} }
// NEODecoder is interface for unmarshalling objects from wire format in NEO // NEODecoder is interface for unmarshalling objects from wire format in NEO
......
...@@ -212,8 +212,8 @@ func (d *decoder) generatedCode() string { ...@@ -212,8 +212,8 @@ func (d *decoder) generatedCode() string {
} }
func (e *encoder) genPrologue(recvName, typeName string) { func (e *encoder) genPrologue(recvName, typeName string) {
e.emit("func (%s *%s) NEOEncode(data []byte) int /*(int, error)*/ {", recvName, typeName) e.emit("func (%s *%s) NEOEncode(data []byte) {", recvName, typeName)
e.emit("var nwrote uint32") //e.emit("var nwrote uint32")
} }
func (d *decoder) genPrologue(recvName, typeName string) { func (d *decoder) genPrologue(recvName, typeName string) {
...@@ -222,10 +222,10 @@ func (d *decoder) genPrologue(recvName, typeName string) { ...@@ -222,10 +222,10 @@ func (d *decoder) genPrologue(recvName, typeName string) {
} }
func (e *encoder) genEpilogue() { func (e *encoder) genEpilogue() {
e.emit("return int(nwrote) + %v /*, nil*/", e.n) //e.emit("return int(nwrote) + %v /*, nil*/", e.n)
e.emit("\noverflow:") //e.emit("\noverflow:")
e.emit("panic(0) //return 0, ErrEncodeOverflow") //e.emit("panic(0) //return 0, ErrEncodeOverflow")
e.emit("goto overflow") // TODO remove //e.emit("goto overflow") // TODO remove
e.emit("}\n") e.emit("}\n")
} }
...@@ -268,7 +268,7 @@ func (d *decoder) genBasic(assignto string, typ *types.Basic, userType types.Typ ...@@ -268,7 +268,7 @@ func (d *decoder) genBasic(assignto string, typ *types.Basic, userType types.Typ
d.emit("%s= %s", assignto, decoded) d.emit("%s= %s", assignto, decoded)
} }
// emit code to encode/decode next string or []byte // emit code to encode/decode string or []byte
// len u32 // len u32
// [len]byte // [len]byte
// TODO []byte support // TODO []byte support
...@@ -296,14 +296,31 @@ func (d *decoder) genStrBytes(assignto string) { ...@@ -296,14 +296,31 @@ func (d *decoder) genStrBytes(assignto string) {
d.n = 0 d.n = 0
} }
// emit code to encode/decode slice
// len u32
// [len]item
// TODO optimize for []byte
func (e *encoder) genSlice(path string, typ *types.Slice, obj types.Object) { func (e *encoder) genSlice(path string, typ *types.Slice, obj types.Object) {
e.emit("// TODO slice") e.emit("{")
e.emit("l := uint32(len(%s))", path)
e.genBasic("l", types.Typ[types.Uint32], nil, nil)
e.emit("data = data[%v:]", e.n)
e.emit("nwrote += %v", e.n)
e.n = 0
// TODO size check
// TODO if size(item)==const - check l in one go
e.emit("for i := 0; uint32(i) <l; i++ {")
e.emit("a := &%s[i]", path)
codegenType("(*a)", typ.Elem(), obj, e)
e.emit("data = data[%v:]", e.n) // FIXME wrt slice of slice ?
e.emit("nwrote += %v", e.n)
e.emit("}")
// see vvv
e.emit("}")
e.n = 0
} }
// TODO optimize for []byte
func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object) { func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object) {
// len u32
// [len]item
d.emit("{") d.emit("{")
d.genBasic("l:", types.Typ[types.Uint32], nil, nil) d.genBasic("l:", types.Typ[types.Uint32], nil, nil)
d.emit("data = data[%v:]", d.n) d.emit("data = data[%v:]", d.n)
......
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