diff options
author | Stefan F <32997632+stefan301@users.noreply.github.com> | 2021-08-31 00:34:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-30 15:34:42 -0700 |
commit | b20c4d3aada74ea4bd204b03b5045585008294bc (patch) | |
tree | e2c37d1250afd88ef89c2ca00a2fbf96d173e5d8 /include | |
parent | ae145293cc589a4e991eb99656d9ab234d738c16 (diff) | |
download | flatbuffers-b20c4d3aada74ea4bd204b03b5045585008294bc.tar.gz flatbuffers-b20c4d3aada74ea4bd204b03b5045585008294bc.tar.bz2 flatbuffers-b20c4d3aada74ea4bd204b03b5045585008294bc.zip |
[C++] Add GetMutableSizePrefixedRoot and generate GetMutableSizePrefixedXxx functions (#6815)
* flattests_cpp17 doesn't compile with Visual Studio 2017: warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(127): error C2220: warning treated as error - no 'object' file generated
stringify_util.h(127): warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(85): warning C4100: 'indent': unreferenced formal parameter
stringify_util.h(85): warning C4100: 'fbs': unreferenced formal parameter
* [C++] Add GetMutableSizePrefixedRoot() and generate a GetMutableSizePrefixed function
When using the mutable API together with size prefixed buffers these functions should be present.
* clang-format
* Cleanup branch for PR
Revert "flattests_cpp17 doesn't compile with Visual Studio 2017: warning C4100: 'indent': unreferenced formal parameter"
This reverts commit a92055203e3c26b69df4896d6babd7714539307a.
Diffstat (limited to 'include')
-rw-r--r-- | include/flatbuffers/flatbuffers.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 273d5091..23229982 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -2327,6 +2327,11 @@ template<typename T> T *GetMutableRoot(void *buf) { EndianScalar(*reinterpret_cast<uoffset_t *>(buf))); } +template<typename T> T *GetMutableSizePrefixedRoot(void *buf) { + return GetMutableRoot<T>(reinterpret_cast<uint8_t *>(buf) + + sizeof(uoffset_t)); +} + template<typename T> const T *GetRoot(const void *buf) { return GetMutableRoot<T>(const_cast<void *>(buf)); } |