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
7b6b7ae2
Commit
7b6b7ae2
authored
Apr 16, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build under CAPNP_DEBUG_TYPES.
parent
1f609e20
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
message.c++
c++/src/capnp/message.c++
+6
-3
No files found.
c++/src/capnp/message.c++
View file @
7b6b7ae2
...
...
@@ -242,8 +242,10 @@ MallocMessageBuilder::~MallocMessageBuilder() noexcept(false) {
}
kj
::
ArrayPtr
<
word
>
MallocMessageBuilder
::
allocateSegment
(
uint
minimumSize
)
{
KJ_REQUIRE
(
minimumSize
<=
MAX_SEGMENT_WORDS
,
"MallocMessageBuilder asked to allocate segment above maximum serializable size."
);
KJ_ASSERT
(
nextSize
<=
MAX_SEGMENT_WORDS
,
"MallocMessageBuilder nextSize out of bounds."
);
KJ_REQUIRE
(
bounded
(
minimumSize
)
*
WORDS
<=
MAX_SEGMENT_WORDS
,
"MallocMessageBuilder asked to allocate segment above maximum serializable size."
);
KJ_ASSERT
(
bounded
(
nextSize
)
*
WORDS
<=
MAX_SEGMENT_WORDS
,
"MallocMessageBuilder nextSize out of bounds."
);
if
(
!
returnedFirstSegment
&&
!
ownFirstSegment
)
{
kj
::
ArrayPtr
<
word
>
result
=
kj
::
arrayPtr
(
reinterpret_cast
<
word
*>
(
firstSegment
),
nextSize
);
...
...
@@ -283,7 +285,8 @@ kj::ArrayPtr<word> MallocMessageBuilder::allocateSegment(uint minimumSize) {
if
(
allocationStrategy
==
AllocationStrategy
::
GROW_HEURISTICALLY
)
{
// set nextSize = min(nextSize+size, MAX_SEGMENT_WORDS)
// while protecting against possible overflow of (nextSize+size)
nextSize
=
(
size
<=
MAX_SEGMENT_WORDS
-
nextSize
)
?
nextSize
+
size
:
MAX_SEGMENT_WORDS
;
nextSize
=
(
size
<=
unbound
(
MAX_SEGMENT_WORDS
/
WORDS
)
-
nextSize
)
?
nextSize
+
size
:
unbound
(
MAX_SEGMENT_WORDS
/
WORDS
);
}
}
...
...
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