Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
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
rapidjson
Commits
3cf4f7c5
Unverified
Commit
3cf4f7c5
authored
Mar 06, 2019
by
Milo Yip
Committed by
GitHub
Mar 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #727 from mapbox/silence-dereference-null-pointer
Silence false positive clang-tidy warning
parents
7484e06c
16872af8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
stack.h
include/rapidjson/internal/stack.h
+3
-2
No files found.
include/rapidjson/internal/stack.h
View file @
3cf4f7c5
...
...
@@ -17,6 +17,7 @@
#include "../allocators.h"
#include "swap.h"
#include <cstddef>
#if defined(__clang__)
RAPIDJSON_DIAG_PUSH
...
...
@@ -114,7 +115,7 @@ public:
template
<
typename
T
>
RAPIDJSON_FORCEINLINE
void
Reserve
(
size_t
count
=
1
)
{
// Expand the stack if needed
if
(
RAPIDJSON_UNLIKELY
(
sta
ckTop_
+
sizeof
(
T
)
*
count
>
stackEnd_
))
if
(
RAPIDJSON_UNLIKELY
(
sta
tic_cast
<
std
::
ptrdiff_t
>
(
sizeof
(
T
)
*
count
)
>
(
stackEnd_
-
stackTop_
)
))
Expand
<
T
>
(
count
);
}
...
...
@@ -127,7 +128,7 @@ public:
template
<
typename
T
>
RAPIDJSON_FORCEINLINE
T
*
PushUnsafe
(
size_t
count
=
1
)
{
RAPIDJSON_ASSERT
(
stackTop_
);
RAPIDJSON_ASSERT
(
sta
ckTop_
+
sizeof
(
T
)
*
count
<=
stackEnd_
);
RAPIDJSON_ASSERT
(
sta
tic_cast
<
std
::
ptrdiff_t
>
(
sizeof
(
T
)
*
count
)
<=
(
stackEnd_
-
stackTop_
)
);
T
*
ret
=
reinterpret_cast
<
T
*>
(
stackTop_
);
stackTop_
+=
sizeof
(
T
)
*
count
;
return
ret
;
...
...
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