140140
141141#define FLATBUFFERS_VERSION_MAJOR 2
142142#define FLATBUFFERS_VERSION_MINOR 0
143- #define FLATBUFFERS_VERSION_REVISION 6
143+ #define FLATBUFFERS_VERSION_REVISION 8
144144#define FLATBUFFERS_STRING_EXPAND (X ) #X
145145#define FLATBUFFERS_STRING (X ) FLATBUFFERS_STRING_EXPAND(X)
146146namespace flatbuffers {
@@ -260,24 +260,27 @@ namespace flatbuffers {
260260#endif // !FLATBUFFERS_HAS_NEW_STRTOD
261261
262262#ifndef FLATBUFFERS_LOCALE_INDEPENDENT
263- // Enable locale independent functions {strtof_l, strtod_l,strtoll_l, strtoull_l}.
264- #if ((defined(_MSC_VER) && _MSC_VER >= 1800) || \
265- (defined (_XOPEN_VERSION) && (_XOPEN_VERSION>=700 )) && (!defined (__ANDROID_API__) || (defined (__ANDROID_API__) && (__ANDROID_API__>=21 ))))
263+ // Enable locale independent functions {strtof_l, strtod_l,strtoll_l,
264+ // strtoull_l}.
265+ #if (defined(_MSC_VER) && _MSC_VER >= 1800) || \
266+ (defined (__ANDROID_API__) && __ANDROID_API__>= 21 ) || \
267+ (defined (_XOPEN_VERSION) && (_XOPEN_VERSION >= 700 )) && \
268+ (!defined (__Fuchsia__) && !defined (__ANDROID_API__))
266269 #define FLATBUFFERS_LOCALE_INDEPENDENT 1
267270 #else
268271 #define FLATBUFFERS_LOCALE_INDEPENDENT 0
269272 #endif
270273#endif // !FLATBUFFERS_LOCALE_INDEPENDENT
271274
272275// Suppress Undefined Behavior Sanitizer (recoverable only). Usage:
273- // - __supress_ubsan__ ("undefined")
274- // - __supress_ubsan__ ("signed-integer-overflow")
276+ // - __suppress_ubsan__ ("undefined")
277+ // - __suppress_ubsan__ ("signed-integer-overflow")
275278#if defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))
276- #define __supress_ubsan__ (type ) __attribute__((no_sanitize(type)))
279+ #define __suppress_ubsan__ (type ) __attribute__((no_sanitize(type)))
277280#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)
278- #define __supress_ubsan__ (type ) __attribute__((no_sanitize_undefined))
281+ #define __suppress_ubsan__ (type ) __attribute__((no_sanitize_undefined))
279282#else
280- #define __supress_ubsan__ (type )
283+ #define __suppress_ubsan__ (type )
281284#endif
282285
283286// This is constexpr function used for checking compile-time constants.
@@ -328,6 +331,13 @@ typedef uintmax_t largest_scalar_t;
328331// In 32bits, this evaluates to 2GB - 1
329332#define FLATBUFFERS_MAX_BUFFER_SIZE ((1ULL << (sizeof (::flatbuffers::soffset_t ) * 8 - 1 )) - 1 )
330333
334+ // The minimum size buffer that can be a valid flatbuffer.
335+ // Includes the offset to the root table (uoffset_t), the offset to the vtable
336+ // of the root table (soffset_t), the size of the vtable (uint16_t), and the
337+ // size of the referring table (uint16_t).
338+ #define FLATBUFFERS_MIN_BUFFER_SIZE sizeof (uoffset_t ) + sizeof (soffset_t ) + \
339+ sizeof (uint16_t ) + sizeof (uint16_t )
340+
331341// We support aligning the contents of buffers up to this size.
332342#ifndef FLATBUFFERS_MAX_ALIGNMENT
333343 #define FLATBUFFERS_MAX_ALIGNMENT 32
@@ -403,7 +413,7 @@ template<typename T> T EndianScalar(T t) {
403413
404414template <typename T>
405415// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
406- __supress_ubsan__ (" alignment" )
416+ __suppress_ubsan__ (" alignment" )
407417T ReadScalar (const void *p) {
408418 return EndianScalar (*reinterpret_cast <const T *>(p));
409419}
@@ -417,13 +427,13 @@ T ReadScalar(const void *p) {
417427
418428template <typename T>
419429// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
420- __supress_ubsan__ (" alignment" )
430+ __suppress_ubsan__ (" alignment" )
421431void WriteScalar (void *p, T t) {
422432 *reinterpret_cast <T *>(p) = EndianScalar (t);
423433}
424434
425435template <typename T> struct Offset ;
426- template <typename T> __supress_ubsan__ (" alignment" ) void WriteScalar(void *p, Offset<T> t) {
436+ template <typename T> __suppress_ubsan__ (" alignment" ) void WriteScalar(void *p, Offset<T> t) {
427437 *reinterpret_cast <uoffset_t *>(p) = EndianScalar (t.o );
428438}
429439
@@ -434,7 +444,7 @@ template<typename T> __supress_ubsan__("alignment") void WriteScalar(void *p, Of
434444// Computes how many bytes you'd have to pad to be able to write an
435445// "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in
436446// memory).
437- __supress_ubsan__ (" unsigned-integer-overflow" )
447+ __suppress_ubsan__ (" unsigned-integer-overflow" )
438448inline size_t PaddingBytes (size_t buf_size, size_t scalar_size) {
439449 return ((~buf_size) + 1 ) & (scalar_size - 1 );
440450}
0 commit comments