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
b0564acc
Commit
b0564acc
authored
Jan 24, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6e96f88e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
23 deletions
+31
-23
t/neo/marshal.go
t/neo/marshal.go
+21
-21
t/neo/protogen.go
t/neo/protogen.go
+10
-2
No files found.
t/neo/marshal.go
View file @
b0564acc
...
...
@@ -150,13 +150,13 @@ func (p *RowInfo) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
CellList
=
make
([]
CellInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -743,13 +743,13 @@ func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
nread
+=
8
}
}
}
...
...
@@ -820,13 +820,13 @@ func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
nread
+=
8
}
}
}
...
...
@@ -872,6 +872,7 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
12
{
goto
overflow
}
nread
+=
l
*
12
p
.
CellList
=
make
([]
struct
{
Offset
uint32
UUID
UUID
...
...
@@ -883,7 +884,6 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
data
=
data
[
12
:
]
nread
+=
12
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -972,12 +972,12 @@ func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
TidList
=
make
([]
struct
{
UnfinishedTID
Tid
},
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
(
*
a
)
.
UnfinishedTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -1200,12 +1200,12 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
4
+
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
OIDList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OIDList
[
i
]
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
{
...
...
@@ -1215,12 +1215,12 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
CheckedList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CheckedList
[
i
]
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -1352,12 +1352,12 @@ func (p *InvalidateObjects) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -1439,12 +1439,12 @@ func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -1533,12 +1533,12 @@ func (p *StoreObject) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
17
+
l
*
1
{
goto
overflow
}
nread
+=
l
*
1
p
.
Data
=
make
([]
byte
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
Data
[
i
]
(
*
a
)
=
(
data
[
0
:
])[
0
]
data
=
data
[
1
:
]
nread
+=
1
}
}
p
.
DataSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -1680,12 +1680,12 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -1820,12 +1820,12 @@ func (p *AnswerGetObject) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
8
+
l
*
1
{
goto
overflow
}
nread
+=
l
*
1
p
.
Data
=
make
([]
byte
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
Data
[
i
]
(
*
a
)
=
(
data
[
0
:
])[
0
]
data
=
data
[
1
:
]
nread
+=
1
}
}
p
.
DataSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -1891,12 +1891,12 @@ func (p *AnswerTIDList) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
TIDList
=
make
([]
Tid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TIDList
[
i
]
(
*
a
)
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -1963,12 +1963,12 @@ func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
TidList
=
make
([]
Tid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
(
*
a
)
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -2084,12 +2084,12 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -2157,6 +2157,7 @@ func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
12
{
goto
overflow
}
nread
+=
l
*
12
p
.
HistoryList
=
make
([]
struct
{
Serial
Tid
Size
uint32
...
...
@@ -2166,7 +2167,6 @@ func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
(
*
a
)
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
.
Size
=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
nread
+=
12
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -2260,13 +2260,13 @@ func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
nread
+=
8
}
}
}
...
...
@@ -2427,12 +2427,12 @@ func (p *AddPendingNodes) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
4
{
goto
overflow
}
nread
+=
l
*
4
p
.
UUIDList
=
make
([]
UUID
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
data
=
data
[
4
:
]
nread
+=
4
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -2472,12 +2472,12 @@ func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
4
{
goto
overflow
}
nread
+=
l
*
4
p
.
UUIDList
=
make
([]
UUID
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
data
=
data
[
4
:
]
nread
+=
4
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -2674,12 +2674,12 @@ func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
nread
+=
8
}
}
return
0
+
int
(
nread
),
nil
...
...
@@ -3268,12 +3268,12 @@ func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) {
if
uint32
(
len
(
data
))
<
l
*
4
{
goto
overflow
}
nread
+=
l
*
4
p
.
CellList
=
make
([]
UUID
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
data
=
data
[
4
:
]
nread
+=
4
}
}
return
0
+
int
(
nread
),
nil
...
...
t/neo/protogen.go
View file @
b0564acc
...
...
@@ -606,7 +606,6 @@ func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object)
d
.
emit
(
"{"
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
d
.
resetPos
()
elemSize
,
elemFixed
:=
typeSizeFixed
(
typ
.
Elem
())
...
...
@@ -616,6 +615,8 @@ func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object)
d
.
overflowCheckpoint
()
d
.
overflowCheckSize
.
AddExpr
(
"l * %v"
,
elemSize
)
d
.
overflowChecked
=
true
d
.
emit
(
"%v += l * %v"
,
d
.
var_
(
"nread"
),
elemSize
)
}
...
...
@@ -628,8 +629,15 @@ func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object)
}
codegenType
(
"(*a)"
,
typ
.
Elem
(),
obj
,
d
)
// d.resetPos() with nread update optionally skipped
if
d
.
n
!=
0
{
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
if
!
elemFixed
{
d
.
emit
(
"%v += %v"
,
d
.
var_
(
"nread"
),
d
.
n
)
}
d
.
n
=
0
}
d
.
resetPos
()
d
.
emit
(
"}"
)
d
.
overflowChecked
=
overflowChecked
...
...
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