Commit e1e7dfa6 authored by Chris Pickett's avatar Chris Pickett

Fixed warning building in VS2012

src\reflection.cpp(297): warning C4267: 'argument' : conversion from 'size_t' to 'flatbuffers::uoffset_t', possible loss of data

sizeof() was promoting the type from uoffset_t to size_t.
parent 56f9b2d1
...@@ -289,7 +289,7 @@ void SetString(const reflection::Schema &schema, const std::string &val, ...@@ -289,7 +289,7 @@ void SetString(const reflection::Schema &schema, const std::string &val,
auto delta = static_cast<int>(val.size()) - static_cast<int>(str->Length()); auto delta = static_cast<int>(val.size()) - static_cast<int>(str->Length());
auto str_start = static_cast<uoffset_t>( auto str_start = static_cast<uoffset_t>(
reinterpret_cast<const uint8_t *>(str) - flatbuf->data()); reinterpret_cast<const uint8_t *>(str) - flatbuf->data());
auto start = str_start + sizeof(uoffset_t); auto start = str_start + static_cast<uoffset_t>(sizeof(uoffset_t));
if (delta) { if (delta) {
// Clear the old string, since we don't want parts of it remaining. // Clear the old string, since we don't want parts of it remaining.
memset(flatbuf->data() + start, 0, str->Length()); memset(flatbuf->data() + start, 0, str->Length());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment