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
03974a96
Commit
03974a96
authored
Jun 06, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct 'segment' to 'section' in places that clearly meant 'section'.
parent
eba66ff5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
16 deletions
+16
-16
layout-test.c++
c++/src/capnproto/layout-test.c++
+3
-3
layout.c++
c++/src/capnproto/layout.c++
+3
-3
layout.h
c++/src/capnproto/layout.h
+10
-10
No files found.
c++/src/capnproto/layout-test.c++
View file @
03974a96
...
...
@@ -42,7 +42,7 @@ TEST(WireFormat, SimpleRawDataStruct) {
AlignedData
<
2
>
data
=
{{
// Struct ref, offset = 1, dataSize = 1, pointerCount = 0
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x00
,
0x00
,
// Content for the data se
gment
.
// Content for the data se
ction
.
0x01
,
0x23
,
0x45
,
0x67
,
0x89
,
0xab
,
0xcd
,
0xef
}};
...
...
@@ -286,8 +286,8 @@ TEST(WireFormat, StructRoundTrip_OneSegment) {
// 13 struct list
// 1 tag
// 12 4x struct
// 1 data se
gment
// 1 pointer se
gment
// 1 data se
ction
// 1 pointer se
ction
// 1 sub-struct
// 11 list list
// 5 pointers to sub-lists
...
...
c++/src/capnproto/layout.c++
View file @
03974a96
...
...
@@ -1562,7 +1562,7 @@ struct WireHelpers {
case
FieldSize
:
:
POINTER
:
// We expected a list of pointers but got a list of structs. Assuming the first field
// in the struct is the pointer we were looking for, we want to munge the pointer to
// point at the first element's pointer se
gment
.
// point at the first element's pointer se
ction
.
ptr
+=
tag
->
structRef
.
dataSize
.
get
();
KJ_REQUIRE
(
tag
->
structRef
.
ptrCount
.
get
()
>
0
*
POINTERS
,
"Expected a pointer list, but got a list of data-only structs."
)
{
...
...
@@ -2162,7 +2162,7 @@ StructReader ListReader::getStructElement(ElementCount index) const {
// This check should pass if there are no bugs in the list pointer validation code.
KJ_DASSERT
(
structPointerCount
==
0
*
POINTERS
||
(
uintptr_t
)
structPointers
%
sizeof
(
WirePointer
)
==
0
,
"Pointer se
gment
of struct list element not aligned."
);
"Pointer se
ction
of struct list element not aligned."
);
return
StructReader
(
segment
,
structData
,
structPointers
,
...
...
@@ -2172,7 +2172,7 @@ StructReader ListReader::getStructElement(ElementCount index) const {
static
const
WirePointer
*
checkAlignment
(
const
void
*
ptr
)
{
KJ_DASSERT
((
uintptr_t
)
ptr
%
sizeof
(
WirePointer
)
==
0
,
"Pointer se
gment
of struct list element not aligned."
);
"Pointer se
ction
of struct list element not aligned."
);
return
reinterpret_cast
<
const
WirePointer
*>
(
ptr
);
}
...
...
c++/src/capnproto/layout.h
View file @
03974a96
...
...
@@ -66,7 +66,7 @@ enum class FieldSize: uint8_t {
FOUR_BYTES
=
4
,
EIGHT_BYTES
=
5
,
POINTER
=
6
,
// Indicates that the field lives in the pointer se
gment, not the data segment
.
POINTER
=
6
,
// Indicates that the field lives in the pointer se
ction, not the data section
.
INLINE_COMPOSITE
=
7
// A composite type of fixed width. This serves two purposes:
...
...
@@ -324,14 +324,14 @@ public:
// with non-zero default values.
StructBuilder
initStructField
(
WirePointerCount
ptrIndex
,
StructSize
size
);
// Initializes the struct field at the given index in the pointer se
gment
. If it is already
// Initializes the struct field at the given index in the pointer se
ction
. If it is already
// initialized, the previous value is discarded or overwritten. The struct is initialized to
// the type's default state (all-zero). Use getStructField() if you want the struct to be
// initialized as a copy of the field's default value (which may have non-null pointers).
StructBuilder
getStructField
(
WirePointerCount
ptrIndex
,
StructSize
size
,
const
word
*
defaultValue
);
// Gets the struct field at the given index in the pointer se
gment
. If the field is not already
// Gets the struct field at the given index in the pointer se
ction
. If the field is not already
// initialized, it is initialized as a deep copy of the given default value (a flat message),
// or to the empty state if defaultValue is nullptr.
...
...
@@ -392,10 +392,10 @@ private:
WirePointer
*
pointers
;
// Pointer to the encoded pointers.
BitCount32
dataSize
;
// Size of data se
gment
. We use a bit count rather than a word count to more easily handle the
// Size of data se
ction
. We use a bit count rather than a word count to more easily handle the
// case of struct lists encoded with less than a word per element.
WirePointerCount16
pointerCount
;
// Size of the pointer se
gment
.
WirePointerCount16
pointerCount
;
// Size of the pointer se
ction
.
BitCount8
bit0Offset
;
// A special hack: If dataSize == 1 bit, then bit0Offset is the offset of that bit within the
...
...
@@ -428,7 +428,7 @@ public:
KJ_ALWAYS_INLINE
(
T
getDataField
(
ElementCount
offset
)
const
);
// Get the data field value of the given type at the given offset. The offset is measured in
// multiples of the field size, determined by the type. Returns zero if the offset is past the
// end of the struct's data se
gment
.
// end of the struct's data se
ction
.
template
<
typename
T
>
KJ_ALWAYS_INLINE
(
...
...
@@ -437,14 +437,14 @@ public:
// fields with non-zero default values.
StructReader
getStructField
(
WirePointerCount
ptrIndex
,
const
word
*
defaultValue
)
const
;
// Get the struct field at the given index in the pointer se
gment
, or the default value if not
// Get the struct field at the given index in the pointer se
ction
, or the default value if not
// initialized. defaultValue will be interpreted as a flat message -- it must point at a
// struct pointer, which in turn points at the struct value. The default value is allowed to
// be null, in which case an empty struct is used.
ListReader
getListField
(
WirePointerCount
ptrIndex
,
FieldSize
expectedElementSize
,
const
word
*
defaultValue
)
const
;
// Get the list field at the given index in the pointer se
gment
, or the default value if not
// Get the list field at the given index in the pointer se
ction
, or the default value if not
// initialized. The default value is allowed to be null, in which case an empty list is used.
template
<
typename
T
>
...
...
@@ -476,10 +476,10 @@ private:
const
WirePointer
*
pointers
;
BitCount32
dataSize
;
// Size of data se
gment
. We use a bit count rather than a word count to more easily handle the
// Size of data se
ction
. We use a bit count rather than a word count to more easily handle the
// case of struct lists encoded with less than a word per element.
WirePointerCount16
pointerCount
;
// Size of the pointer se
gment
.
WirePointerCount16
pointerCount
;
// Size of the pointer se
ction
.
BitCount8
bit0Offset
;
// A special hack: If dataSize == 1 bit, then bit0Offset is the offset of that bit within the
...
...
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