Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
2c80ac82
Commit
2c80ac82
authored
7 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e7174feb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
t/neo/marshal.go
t/neo/marshal.go
+2
-1
t/neo/proto_test.go
t/neo/proto_test.go
+4
-0
t/neo/protogen.go
t/neo/protogen.go
+14
-2
No files found.
t/neo/marshal.go
View file @
2c80ac82
...
...
@@ -231,8 +231,9 @@ func (p *XXXTest) NEODecode(data []byte) (int, error) {
data
=
data
[
l
:
]
}
}
nread
+=
l
*
8
}
return
20
+
int
(
nread
),
nil
return
12
+
int
(
nread
),
nil
overflow
:
return
0
,
ErrDecodeOverflow
...
...
This diff is collapsed.
Click to expand it.
t/neo/proto_test.go
View file @
2c80ac82
...
...
@@ -244,6 +244,10 @@ func TestPktMarshal(t *testing.T) {
hex
(
"3fbf9add1091c895"
),
},
// TODO we need tests for:
// []varsize + trailing
// map[]varsize + trailing
// TODO special cases for:
// - float64 (+ nan !nan ...)
...
...
This diff is collapsed.
Click to expand it.
t/neo/protogen.go
View file @
2c80ac82
...
...
@@ -869,7 +869,12 @@ func (d *decoder) genMap(assignto string, typ *types.Map, obj types.Object) {
d
.
emit
(
"m := %v"
,
assignto
)
d
.
emit
(
"for i := 0; uint32(i) < l; i++ {"
)
d
.
overflowCheckPoint
()
d
.
overflowCheckPoint
()
// -> overflowCheckPointLoopEntry ?
var
nreadCur
int
if
!
d
.
overflowCheck
.
checked
{
// TODO merge-in into overflow checker
nreadCur
=
d
.
nread
d
.
nread
=
0
}
codegenType
(
"key:"
,
typ
.
Key
(),
obj
,
d
)
...
...
@@ -888,8 +893,15 @@ func (d *decoder) genMap(assignto string, typ *types.Map, obj types.Object) {
d
.
resetPos
()
d
.
emit
(
"}"
)
d
.
overflowCheckPoint
()
// -> overflowCheckPointLoopExit("l") ?
// TODO overflowCheckPointLoopExit("l")
// merge-in numeric nread updates from loop
if
!
d
.
overflowCheck
.
checked
{
if
d
.
nread
!=
0
{
d
.
emit
(
"%v += l * %v"
,
d
.
var_
(
"nread"
),
d
.
nread
)
}
d
.
nread
=
nreadCur
}
d
.
emit
(
"}"
)
}
...
...
This diff is collapsed.
Click to expand it.
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