From 77d57fd07560e1bfeccd34d1e4088cd36d3bf4be Mon Sep 17 00:00:00 2001 From: astange Date: Mon, 12 Oct 2020 12:14:45 -0400 Subject: [PATCH] Cast to right type for reserved_ subtraction (#6167) 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 69c8d71..b31191c 100644 --- 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(reserved_ - (cur_ - buf_)); + return static_cast(reserved_ - static_cast(cur_ - buf_)); } uoffset_t scratch_size() const { -- 2.7.4