projects
/
platform
/
upstream
/
flatbuffers.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
543c1bb
)
Cast to right type for reserved_ subtraction (#6167)
author
astange
<stange@google.com>
Mon, 12 Oct 2020 16:14:45 +0000
(12:14 -0400)
committer
GitHub
<noreply@github.com>
Mon, 12 Oct 2020 16:14:45 +0000
(09:14 -0700)
reserved_ is a size_t so ensure that the output of cur_ - buf_ is cast to that to avoid compiler warnings.
include/flatbuffers/flatbuffers.h
patch
|
blob
|
history
diff --git
a/include/flatbuffers/flatbuffers.h
b/include/flatbuffers/flatbuffers.h
index
69c8d71
..
b31191c
100644
(file)
--- a/
include/flatbuffers/flatbuffers.h
+++ b/
include/flatbuffers/flatbuffers.h
@@
-933,7
+933,7
@@
class vector_downward {
Allocator *get_custom_allocator() { return allocator_; }
uoffset_t size() const {
- return static_cast<uoffset_t>(reserved_ - (cur_ - buf_));
+ return static_cast<uoffset_t>(reserved_ -
static_cast<size_t>
(cur_ - buf_));
}
uoffset_t scratch_size() const {