Fixed AddFlatBuffer using wrong buffer length.

Also made the Xcode project link.

Tested: on OS X.
This commit is contained in:
Wouter van Oortmerssen
2015-08-03 17:39:47 -07:00
parent 7101224d86
commit ad84b5b8fa
3 changed files with 20 additions and 99 deletions

View File

@@ -334,8 +334,7 @@ const uint8_t *AddFlatBuffer(std::vector<uint8_t> &flatbuf,
}
auto insertion_point = static_cast<uoffset_t>(flatbuf.size());
// Insert the entire FlatBuffer minus the root pointer.
flatbuf.insert(flatbuf.end(), newbuf + sizeof(uoffset_t),
newbuf + newlen - sizeof(uoffset_t));
flatbuf.insert(flatbuf.end(), newbuf + sizeof(uoffset_t), newbuf + newlen);
auto root_offset = ReadScalar<uoffset_t>(newbuf) - sizeof(uoffset_t);
return flatbuf.data() + insertion_point + root_offset;
}