Replace deprecated Vector::Length() with Vector::size() (#5131)

- enable FLATBUFFERS_ATTRIBUTE if C++17 or higher
This commit is contained in:
Vladimir Glavnyy
2019-01-25 04:33:19 +07:00
committed by Wouter van Oortmerssen
parent 3f388ec747
commit fcacb46d01
6 changed files with 16 additions and 16 deletions

View File

@@ -299,13 +299,13 @@ class ResizeContext {
void SetString(const reflection::Schema &schema, const std::string &val,
const String *str, std::vector<uint8_t> *flatbuf,
const reflection::Object *root_table) {
auto delta = static_cast<int>(val.size()) - static_cast<int>(str->Length());
auto delta = static_cast<int>(val.size()) - static_cast<int>(str->size());
auto str_start = static_cast<uoffset_t>(
reinterpret_cast<const uint8_t *>(str) - vector_data(*flatbuf));
auto start = str_start + static_cast<uoffset_t>(sizeof(uoffset_t));
if (delta) {
// Clear the old string, since we don't want parts of it remaining.
memset(vector_data(*flatbuf) + start, 0, str->Length());
memset(vector_data(*flatbuf) + start, 0, str->size());
// Different size, we must expand (or contract).
ResizeContext(schema, start, delta, flatbuf, root_table);
// Set the new length.