Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
ffd66066
Commit
ffd66066
authored
May 20, 2016
by
Matthew Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move canonicalize out of generated code
parent
c1d973e7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
canonicalize-test.c++
c++/src/capnp/canonicalize-test.c++
+2
-2
capnpc-c++.c++
c++/src/capnp/compiler/capnpc-c++.c++
+0
-4
message.h
c++/src/capnp/message.h
+5
-0
No files found.
c++/src/capnp/canonicalize-test.c++
View file @
ffd66066
...
...
@@ -37,7 +37,7 @@ KJ_TEST("canonicalize yields cannonical message") {
initTestMessage
(
root
);
root
.
asReader
().
canonicalize
(
);
canonicalize
(
root
.
asReader
()
);
//Will assert if canonicalize failed to do so
}
...
...
@@ -141,7 +141,7 @@ KJ_TEST("upgraded lists can be canonicalized") {
SegmentArrayMessageReader
upgraded
(
kj
::
arrayPtr
(
segments
,
1
));
auto
root
=
upgraded
.
getRoot
<
TestLists
>
();
root
.
canonicalize
(
);
canonicalize
(
root
);
}
KJ_TEST
(
"isCanonical requires truncation of 0-valued struct fields in all list members"
)
{
...
...
c++/src/capnp/compiler/capnpc-c++.c++
View file @
ffd66066
...
...
@@ -1747,10 +1747,6 @@ private:
" return _reader.totalSize().asPublic();
\n
"
" }
\n
"
"
\n
"
" ::kj::Array<::capnp::word> canonicalize() {
\n
"
" return _reader.canonicalize();
\n
"
" }
\n
"
"
\n
"
"#if !CAPNP_LITE
\n
"
" inline ::kj::StringTree toString() const {
\n
"
" return ::capnp::_::structString(_reader, *_capnpPrivate::brand);
\n
"
...
...
c++/src/capnp/message.h
View file @
ffd66066
...
...
@@ -498,6 +498,11 @@ static typename Type::Reader defaultValue() {
return
typename
Type
::
Reader
(
_
::
StructReader
());
}
template
<
typename
T
>
kj
::
Array
<
word
>
canonicalize
(
T
&&
reader
)
{
return
_
::
PointerHelpers
<
FromReader
<
T
>>::
getInternalReader
(
reader
).
canonicalize
();
}
}
// namespace capnp
#endif // CAPNP_MESSAGE_H_
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