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.
This commit is contained in:
astange
2020-10-12 12:14:45 -04:00
committed by GitHub
parent 543c1bbeba
commit 77d57fd075

View File

@@ -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 {