Commit 350c0669 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 545b588f
...@@ -875,9 +875,15 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) { ...@@ -875,9 +875,15 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
m := p.ObjectTIDDict m := p.ObjectTIDDict
for i := 0; uint32(i) < l; i++ { for i := 0; uint32(i) < l; i++ {
key := Oid(binary.BigEndian.Uint64(data[0:])) key := Oid(binary.BigEndian.Uint64(data[0:]))
m[key].CurrentSerial = Tid(binary.BigEndian.Uint64(data[8:])) var v struct {
m[key].UndoSerial = Tid(binary.BigEndian.Uint64(data[16:])) CurrentSerial Tid
m[key].IsCurrent = byte2bool((data[24:])[0]) UndoSerial Tid
IsCurrent bool
}
v.CurrentSerial = Tid(binary.BigEndian.Uint64(data[8:]))
v.UndoSerial = Tid(binary.BigEndian.Uint64(data[16:]))
v.IsCurrent = byte2bool((data[24:])[0])
m[key] = v
data = data[25:] data = data[25:]
} }
} }
......
...@@ -252,7 +252,20 @@ func (d *decoder) emitmap(assignto string, obj types.Object, typ *types.Map) { ...@@ -252,7 +252,20 @@ func (d *decoder) emitmap(assignto string, obj types.Object, typ *types.Map) {
d.emit("m := %v", assignto) d.emit("m := %v", assignto)
d.emit("for i := 0; uint32(i) < l; i++ {") d.emit("for i := 0; uint32(i) < l; i++ {")
d.emitobjtype("key:", obj, typ.Key()) d.emitobjtype("key:", obj, typ.Key())
switch typ.Elem().Underlying().(type) {
// basic types can be directly assigned to map entry
case *types.Basic:
// XXX handle string
d.emitobjtype("m[key]", obj, typ.Elem()) d.emitobjtype("m[key]", obj, typ.Elem())
// otherwise assign via temporary
default:
d.emit("var v %v", typeName(typ.Elem()))
d.emitobjtype("v", obj, typ.Elem())
d.emit("m[key] = v")
}
d.emit("data = data[%v:]", d.n) // FIXME wrt map of map ? d.emit("data = data[%v:]", d.n) // FIXME wrt map of map ?
d.emit("}") d.emit("}")
//d.emit("%v = string(data[:l])", assignto) //d.emit("%v = string(data[:l])", assignto)
......
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