Commit d236e664 authored by Levin Zimmermann's avatar Levin Zimmermann

go/neo/proto/M: Fix decoding of RowList

Structures are encoded as arrays, but this isn't true for the structure
'RowList'. RowList in python is simply a list of lists. It's not a
nested array, as using a structure would expect. Therefore we need a
special case for RowList. Alternatively we could adjust proto.go to no
longer use 'RowList', but simply '[][]CellInfo', but this would perhaps
break N encoding.
parent 55b0c760
...@@ -1765,6 +1765,7 @@ func (d *decoderM) genStructHead(path string, typ *types.Struct, userType types. ...@@ -1765,6 +1765,7 @@ func (d *decoderM) genStructHead(path string, typ *types.Struct, userType types.
d.resetPos() // we need to reset, otherwise we may read the same data again, and wrong data types will result d.resetPos() // we need to reset, otherwise we may read the same data again, and wrong data types will result
if typeName(userType) != "RowInfo" {
d.emit("{") d.emit("{")
d.emit("_, tail, err := msgp.ReadArrayHeaderBytes(data)") d.emit("_, tail, err := msgp.ReadArrayHeaderBytes(data)")
d.emit("if err != nil {") d.emit("if err != nil {")
...@@ -1772,6 +1773,7 @@ func (d *decoderM) genStructHead(path string, typ *types.Struct, userType types. ...@@ -1772,6 +1773,7 @@ func (d *decoderM) genStructHead(path string, typ *types.Struct, userType types.
d.emit("}") d.emit("}")
d.emit("data = tail") d.emit("data = tail")
d.emit("}") d.emit("}")
}
d.overflow.Add(1) d.overflow.Add(1)
} }
......
...@@ -1796,13 +1796,6 @@ func (p *AnswerPartitionTable) neoMsgDecodeM(data []byte) (int, error) { ...@@ -1796,13 +1796,6 @@ func (p *AnswerPartitionTable) neoMsgDecodeM(data []byte) (int, error) {
if op, opOk := msgpack.Op(data[0]), msgpack.FixArray_4|1; op != opOk { if op, opOk := msgpack.Op(data[0]), msgpack.FixArray_4|1; op != opOk {
return 0, &mstructDecodeError{"AnswerPartitionTable", op, opOk} return 0, &mstructDecodeError{"AnswerPartitionTable", op, opOk}
} }
{
_, tail, err := msgp.ReadArrayHeaderBytes(data)
if err != nil {
return 0, mdecodeErr("AnswerPartitionTable", err)
}
data = tail
}
{ {
l, tail, err := msgp.ReadArrayHeaderBytes(data) l, tail, err := msgp.ReadArrayHeaderBytes(data)
if err != nil { if err != nil {
...@@ -2046,13 +2039,6 @@ func (p *SendPartitionTable) neoMsgDecodeM(data []byte) (int, error) { ...@@ -2046,13 +2039,6 @@ func (p *SendPartitionTable) neoMsgDecodeM(data []byte) (int, error) {
if op, opOk := msgpack.Op(data[0]), msgpack.FixArray_4|1; op != opOk { if op, opOk := msgpack.Op(data[0]), msgpack.FixArray_4|1; op != opOk {
return 0, &mstructDecodeError{"SendPartitionTable", op, opOk} return 0, &mstructDecodeError{"SendPartitionTable", op, opOk}
} }
{
_, tail, err := msgp.ReadArrayHeaderBytes(data)
if err != nil {
return 0, mdecodeErr("SendPartitionTable", err)
}
data = tail
}
{ {
l, tail, err := msgp.ReadArrayHeaderBytes(data) l, tail, err := msgp.ReadArrayHeaderBytes(data)
if err != nil { if err != nil {
...@@ -6617,13 +6603,6 @@ func (p *AnswerPartitionList) neoMsgDecodeM(data []byte) (int, error) { ...@@ -6617,13 +6603,6 @@ func (p *AnswerPartitionList) neoMsgDecodeM(data []byte) (int, error) {
if op, opOk := msgpack.Op(data[0]), msgpack.FixArray_4|1; op != opOk { if op, opOk := msgpack.Op(data[0]), msgpack.FixArray_4|1; op != opOk {
return 0, &mstructDecodeError{"AnswerPartitionList", op, opOk} return 0, &mstructDecodeError{"AnswerPartitionList", op, opOk}
} }
{
_, tail, err := msgp.ReadArrayHeaderBytes(data)
if err != nil {
return 0, mdecodeErr("AnswerPartitionList", err)
}
data = tail
}
{ {
l, tail, err := msgp.ReadArrayHeaderBytes(data) l, tail, err := msgp.ReadArrayHeaderBytes(data)
if err != nil { if err != nil {
...@@ -7519,13 +7498,6 @@ func (p *AnswerTweakPartitionTable) neoMsgDecodeM(data []byte) (int, error) { ...@@ -7519,13 +7498,6 @@ func (p *AnswerTweakPartitionTable) neoMsgDecodeM(data []byte) (int, error) {
if op, opOk := msgpack.Op(data[0]), msgpack.FixArray_4|1; op != opOk { if op, opOk := msgpack.Op(data[0]), msgpack.FixArray_4|1; op != opOk {
return 0, &mstructDecodeError{"AnswerTweakPartitionTable", op, opOk} return 0, &mstructDecodeError{"AnswerTweakPartitionTable", op, opOk}
} }
{
_, tail, err := msgp.ReadArrayHeaderBytes(data)
if err != nil {
return 0, mdecodeErr("AnswerTweakPartitionTable", err)
}
data = tail
}
{ {
l, tail, err := msgp.ReadArrayHeaderBytes(data) l, tail, err := msgp.ReadArrayHeaderBytes(data)
if err != nil { if err != nil {
......
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