This commit is contained in:
2026-08-17 01:21:55 +02:00
parent 5761d6e67a
commit 4bd1e24e75
265 changed files with 20617 additions and 24457 deletions
+13
View File
@@ -142,6 +142,19 @@
#define FLATBUFFERS_VERSION_MAJOR 25
#define FLATBUFFERS_VERSION_MINOR 12
#define FLATBUFFERS_VERSION_REVISION 19
// Identifies this header as Bigfoot's fork of flatbuffers, and versions the
// fork's own generated-code-affecting changes independently of the upstream
// FLATBUFFERS_VERSION_* triplet above (which just tracks the upstream
// version this fork is based on, and would still match an unforked, stock
// flatbuffers install of the same version). Generated headers assert on
// this - see GenFlatbuffersVersionCheck() in idl_gen_cpp.cpp - so building
// Bigfoot-generated code against stock flatbuffers, or a differently
// versioned Bigfoot fork, fails to compile immediately instead of silently
// miscompiling. Bump this whenever a change here affects what generated
// code assumes about this header (e.g. adding bigfoot_ref/bigfoot_ref_wrapper).
#define FLATBUFFERS_BIGFOOT_VERSION 1
#define FLATBUFFERS_STRING_EXPAND(X) #X
#define FLATBUFFERS_STRING(X) FLATBUFFERS_STRING_EXPAND(X)
namespace flatbuffers {
+4 -18
View File
@@ -1207,20 +1207,11 @@ class Builder FLATBUFFERS_FINAL_CLASS {
String(str);
}
size_t AlignedBlob(const void* data, size_t len, BitWidth alignment) {
// The requested alignment must not be smaller than the one required to
// store the length.
return CreateAlignedBlob(data, len, 0, FBT_BLOB,
std::max(alignment, WidthU(len)));
}
size_t AlignedBlob(const std::vector<uint8_t>& v, BitWidth alignment) {
return AlignedBlob(v.data(), v.size(), alignment);
}
size_t Blob(const void* data, size_t len) {
return CreateBlob(data, len, 0, FBT_BLOB);
}
size_t Blob(const std::vector<uint8_t>& v) {
return Blob(v.data(), v.size());
return CreateBlob(v.data(), v.size(), 0, FBT_BLOB);
}
void Blob(const char* key, const void* data, size_t len) {
@@ -1702,16 +1693,11 @@ class Builder FLATBUFFERS_FINAL_CLASS {
size_t CreateBlob(const void* data, size_t len, size_t trailing, Type type) {
auto bit_width = WidthU(len);
return CreateAlignedBlob(data, len, trailing, type, bit_width);
}
size_t CreateAlignedBlob(const void* data, size_t len, size_t trailing,
Type type, BitWidth alignment) {
auto byte_width = Align(alignment);
auto byte_width = Align(bit_width);
Write<uint64_t>(len, byte_width);
auto sloc = buf_.size();
WriteBytes(data, len + trailing);
stack_.push_back(Value(static_cast<uint64_t>(sloc), type, alignment));
stack_.push_back(Value(static_cast<uint64_t>(sloc), type, bit_width));
return sloc;
}
@@ -1976,7 +1962,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
bool VerifyKey(const uint8_t* p) {
FLEX_CHECK_VERIFIED(p, PackedType(BIT_WIDTH_8, FBT_KEY));
while (p < buf_ + size_)
if (!*p++) return true;
if (*p++) return true;
return false;
}
+4
View File
@@ -677,6 +677,7 @@ struct IDLOptions {
std::string cpp_object_api_pointer_type;
std::string cpp_object_api_string_type;
bool cpp_object_api_string_flexible_constructor;
std::string cpp_object_api_vector_type;
CaseStyle cpp_object_api_field_case_style;
bool cpp_direct_copy;
bool gen_nullable;
@@ -1012,10 +1013,13 @@ class Parser : public ParserState {
known_attributes_["cpp_ptr_type_get"] = true;
known_attributes_["cpp_str_type"] = true;
known_attributes_["cpp_str_flex_ctor"] = true;
known_attributes_["cpp_vector_type"] = true;
known_attributes_["native_inline"] = true;
known_attributes_["native_custom_alloc"] = true;
known_attributes_["native_type"] = true;
known_attributes_["native_type_pack_name"] = true;
known_attributes_["bigfoot_ref_wrapper"] = true;
known_attributes_["bigfoot_ref"] = true;
known_attributes_["native_default"] = true;
known_attributes_["flexbuffer"] = true;
known_attributes_["private"] = true;
+35 -37
View File
@@ -30,52 +30,50 @@ namespace flatbuffers {
// ------------------------- GETTERS -------------------------
constexpr bool IsScalar(reflection::BaseType t) {
inline bool IsScalar(reflection::BaseType t) {
return t >= reflection::UType && t <= reflection::Double;
}
constexpr bool IsInteger(reflection::BaseType t) {
inline bool IsInteger(reflection::BaseType t) {
return t >= reflection::UType && t <= reflection::ULong;
}
constexpr bool IsFloat(reflection::BaseType t) {
inline bool IsFloat(reflection::BaseType t) {
return t == reflection::Float || t == reflection::Double;
}
constexpr bool IsLong(reflection::BaseType t) {
inline bool IsLong(reflection::BaseType t) {
return t == reflection::Long || t == reflection::ULong;
}
// This needs to correspond to the BaseType enum.
constexpr size_t kBaseTypeSize[] = {
0, // None
1, // UType
1, // Bool
1, // Byte
1, // UByte
2, // Short
2, // UShort
4, // Int
4, // UInt
8, // Long
8, // ULong
4, // Float
8, // Double
4, // String
4, // Vector
4, // Obj
4, // Union
0, // Array. Only used in structs. 0 was chosen to prevent out-of-bounds
// errors.
8, // Vector64
0 // MaxBaseType. This must be kept the last entry in this array.
};
static_assert(sizeof(kBaseTypeSize) / sizeof(size_t) ==
reflection::MaxBaseType + 1,
"Size of sizes[] array does not match the count of BaseType "
"enum values.");
// Size of a basic type, don't use with structs.
constexpr size_t GetTypeSize(reflection::BaseType base_type) {
return kBaseTypeSize[base_type];
inline size_t GetTypeSize(reflection::BaseType base_type) {
// This needs to correspond to the BaseType enum.
static size_t sizes[] = {
0, // None
1, // UType
1, // Bool
1, // Byte
1, // UByte
2, // Short
2, // UShort
4, // Int
4, // UInt
8, // Long
8, // ULong
4, // Float
8, // Double
4, // String
4, // Vector
4, // Obj
4, // Union
0, // Array. Only used in structs. 0 was chosen to prevent out-of-bounds
// errors.
8, // Vector64
0 // MaxBaseType. This must be kept the last entry in this array.
};
static_assert(sizeof(sizes) / sizeof(size_t) == reflection::MaxBaseType + 1,
"Size of sizes[] array does not match the count of BaseType "
"enum values.");
return sizes[base_type];
}
// Same as above, but now correctly returns the size of a struct if
@@ -422,7 +420,7 @@ pointer_inside_vector<T, U> piv(T* ptr, std::vector<U>& vec) {
return pointer_inside_vector<T, U>(ptr, vec);
}
constexpr const char* UnionTypeFieldSuffix() { return "_type"; }
inline const char* UnionTypeFieldSuffix() { return "_type"; }
// Helper to figure out the actual table type a union refers to.
inline const reflection::Object& GetUnionType(