Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
350c0669
Commit
350c0669
authored
Dec 28, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
545b588f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
t/neo/marshal.go
t/neo/marshal.go
+9
-3
t/neo/protogen.go
t/neo/protogen.go
+14
-1
No files found.
t/neo/marshal.go
View file @
350c0669
...
...
@@ -875,9 +875,15 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
m
:=
p
.
ObjectTIDDict
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
key
:=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
m
[
key
]
.
CurrentSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
m
[
key
]
.
UndoSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
m
[
key
]
.
IsCurrent
=
byte2bool
((
data
[
24
:
])[
0
])
var
v
struct
{
CurrentSerial
Tid
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
:
]
}
}
...
...
t/neo/protogen.go
View file @
350c0669
...
...
@@ -252,7 +252,20 @@ func (d *decoder) emitmap(assignto string, obj types.Object, typ *types.Map) {
d
.
emit
(
"m := %v"
,
assignto
)
d
.
emit
(
"for i := 0; uint32(i) < l; i++ {"
)
d
.
emitobjtype
(
"key:"
,
obj
,
typ
.
Key
())
d
.
emitobjtype
(
"m[key]"
,
obj
,
typ
.
Elem
())
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
())
// 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
(
"}"
)
//d.emit("%v = string(data[:l])", assignto)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment