forked from BigfootDev/flatbuffers
flatbuffer_builder: Fix GetTemporaryPointer constantness
This commit is contained in:
@@ -47,7 +47,8 @@ inline voffset_t FieldIndexToOffset(voffset_t field_id) {
|
||||
2 * sizeof(voffset_t); // Vtable size and Object Size.
|
||||
size_t offset = fixed_fields + field_id * sizeof(voffset_t);
|
||||
FLATBUFFERS_ASSERT(offset < std::numeric_limits<voffset_t>::max());
|
||||
return static_cast<voffset_t>(offset);}
|
||||
return static_cast<voffset_t>(offset);
|
||||
}
|
||||
|
||||
template<typename T, typename Alloc = std::allocator<T>>
|
||||
const T *data(const std::vector<T, Alloc> &v) {
|
||||
@@ -1470,7 +1471,8 @@ T *GetMutableTemporaryPointer(FlatBufferBuilder &fbb, Offset<T> offset) {
|
||||
|
||||
template<typename T>
|
||||
const T *GetTemporaryPointer(const FlatBufferBuilder &fbb, Offset<T> offset) {
|
||||
return GetMutableTemporaryPointer<T>(fbb, offset);
|
||||
return reinterpret_cast<const T *>(fbb.GetCurrentBufferPointer() +
|
||||
fbb.GetSize() - offset.o);
|
||||
}
|
||||
|
||||
} // namespace flatbuffers
|
||||
|
||||
Reference in New Issue
Block a user