diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 4f797cbdb..bc828a313 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -85,14 +85,13 @@ inline SizeT GetPrefixedSize(const uint8_t *buf) { // // This includes the size of the prefix as well as the buffer: // -// [size prefix][flatbuffer] +// [size prefix][flatbuffer] // |---------length--------| template -inline SizeT GetSizePrefixedBufferLength(const uint8_t * const buf) { +inline SizeT GetSizePrefixedBufferLength(const uint8_t *const buf) { return ReadScalar(buf) + sizeof(SizeT); } - // Base class for native objects (FlatBuffer data de-serialized into native // C++ data structures). // Contains no functionality, purely documentative. diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h index 18ee76e98..2d7c8581f 100644 --- a/include/flatbuffers/idl.h +++ b/include/flatbuffers/idl.h @@ -1212,7 +1212,8 @@ class Parser : public ParserState { // strict_json adds "quotes" around field names if true. // If the flatbuffer cannot be encoded in JSON (e.g., it contains non-UTF-8 // byte arrays in String values), returns false. -extern const char *GenerateTextFromTable(const Parser &parser, const void *table, +extern const char *GenerateTextFromTable(const Parser &parser, + const void *table, const std::string &tablename, std::string *text); extern const char *GenerateText(const Parser &parser, const void *flatbuffer, diff --git a/include/flatbuffers/registry.h b/include/flatbuffers/registry.h index 80c385c36..ed3d922f2 100644 --- a/include/flatbuffers/registry.h +++ b/include/flatbuffers/registry.h @@ -54,8 +54,8 @@ class Registry { // Now we're ready to generate text. auto err = GenerateText(parser, flatbuf, dest); if (err) { - lasterror_ = "unable to generate text for FlatBuffer binary: " + - std::string(err); + lasterror_ = + "unable to generate text for FlatBuffer binary: " + std::string(err); return false; } return true; diff --git a/include/flatbuffers/table.h b/include/flatbuffers/table.h index b370ccb35..e92d8ae8e 100644 --- a/include/flatbuffers/table.h +++ b/include/flatbuffers/table.h @@ -153,7 +153,7 @@ class Table { return verifier.Check(field_offset != 0) && verifier.VerifyOffset(data_, field_offset); } - + bool VerifyOffset64(const Verifier &verifier, voffset_t field) const { return VerifyOffset(verifier, field); } diff --git a/include/flatbuffers/vector.h b/include/flatbuffers/vector.h index 7d836362e..ae52b9382 100644 --- a/include/flatbuffers/vector.h +++ b/include/flatbuffers/vector.h @@ -147,12 +147,10 @@ struct VectorReverseIterator : public std::reverse_iterator { // Vector::data() assumes the vector elements start after the length field. template class Vector { public: - typedef VectorIterator::mutable_return_type, + typedef VectorIterator::mutable_return_type, uint8_t *, SizeT> iterator; - typedef VectorConstIterator::return_type, - SizeT> + typedef VectorConstIterator::return_type, SizeT> const_iterator; typedef VectorReverseIterator reverse_iterator; typedef VectorReverseIterator const_reverse_iterator; @@ -171,8 +169,7 @@ template class Vector { typedef SizeT size_type; typedef typename IndirectHelper::return_type return_type; - typedef typename IndirectHelper::mutable_return_type - mutable_return_type; + typedef typename IndirectHelper::mutable_return_type mutable_return_type; typedef return_type value_type; return_type Get(SizeT i) const { diff --git a/include/flatbuffers/vector_downward.h b/include/flatbuffers/vector_downward.h index fd491e763..2b5a92cf1 100644 --- a/include/flatbuffers/vector_downward.h +++ b/include/flatbuffers/vector_downward.h @@ -17,9 +17,8 @@ #ifndef FLATBUFFERS_VECTOR_DOWNWARD_H_ #define FLATBUFFERS_VECTOR_DOWNWARD_H_ -#include - #include +#include #include "flatbuffers/base.h" #include "flatbuffers/default_allocator.h" @@ -167,7 +166,9 @@ template class vector_downward { inline SizeT size() const { return size_; } // The size of the buffer part of the vector that is currently unused. - SizeT unused_buffer_size() const { return static_cast(cur_ - scratch_); } + SizeT unused_buffer_size() const { + return static_cast(cur_ - scratch_); + } // The size of the scratch part of the vector. SizeT scratch_size() const { return static_cast(scratch_ - buf_); } diff --git a/src/bfbs_gen_lua.cpp b/src/bfbs_gen_lua.cpp index b9883424a..185e85962 100644 --- a/src/bfbs_gen_lua.cpp +++ b/src/bfbs_gen_lua.cpp @@ -656,7 +656,8 @@ class LuaBfbsGenerator : public BaseBfbsGenerator { // TODO(derekbailey): figure out a save file without depending on util.h EnsureDirExists(path); - const std::string file_name = options_.output_path + path + "/" + namer_.File(name); + const std::string file_name = + options_.output_path + path + "/" + namer_.File(name); SaveFile(file_name.c_str(), code, false); } diff --git a/src/file_name_saving_file_manager.cpp b/src/file_name_saving_file_manager.cpp index fc4a4aa1e..b43c7b6eb 100644 --- a/src/file_name_saving_file_manager.cpp +++ b/src/file_name_saving_file_manager.cpp @@ -37,8 +37,8 @@ class FileNameSavingFileManager : public FileManager { } bool Loadfile(const std::string &absolute_file_name, std::string *content) { - (void) absolute_file_name; - (void) content; + (void)absolute_file_name; + (void)content; return false; } diff --git a/src/idl_gen_text.cpp b/src/idl_gen_text.cpp index c1d69f233..17d518032 100644 --- a/src/idl_gen_text.cpp +++ b/src/idl_gen_text.cpp @@ -30,8 +30,12 @@ namespace flatbuffers { struct PrintScalarTag {}; struct PrintPointerTag {}; -template struct PrintTag { typedef PrintScalarTag type; }; -template<> struct PrintTag { typedef PrintPointerTag type; }; +template struct PrintTag { + typedef PrintScalarTag type; +}; +template<> struct PrintTag { + typedef PrintPointerTag type; +}; struct JsonPrinter { // If indentation is less than 0, that indicates we don't want any newlines diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index 055277b2e..fe1d63986 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -2368,8 +2368,12 @@ template void EnumDef::ChangeEnumValue(EnumVal *ev, T new_value) { } namespace EnumHelper { -template struct EnumValType { typedef int64_t type; }; -template<> struct EnumValType { typedef uint64_t type; }; +template struct EnumValType { + typedef int64_t type; +}; +template<> struct EnumValType { + typedef uint64_t type; +}; } // namespace EnumHelper struct EnumValBuilder { diff --git a/src/reflection.cpp b/src/reflection.cpp index 0d0814ef6..f064c1c6b 100644 --- a/src/reflection.cpp +++ b/src/reflection.cpp @@ -24,17 +24,18 @@ namespace flatbuffers { namespace { -static void CopyInline(FlatBufferBuilder &fbb, const reflection::Field &fielddef, - const Table &table, size_t align, size_t size) { +static void CopyInline(FlatBufferBuilder &fbb, + const reflection::Field &fielddef, const Table &table, + size_t align, size_t size) { fbb.Align(align); fbb.PushBytes(table.GetStruct(fielddef.offset()), size); fbb.TrackField(fielddef.offset(), fbb.GetSize()); } static bool VerifyStruct(flatbuffers::Verifier &v, - const flatbuffers::Table &parent_table, - voffset_t field_offset, const reflection::Object &obj, - bool required) { + const flatbuffers::Table &parent_table, + voffset_t field_offset, const reflection::Object &obj, + bool required) { auto offset = parent_table.GetOptionalFieldOffset(field_offset); if (required && !offset) { return false; } @@ -44,9 +45,10 @@ static bool VerifyStruct(flatbuffers::Verifier &v, } static bool VerifyVectorOfStructs(flatbuffers::Verifier &v, - const flatbuffers::Table &parent_table, - voffset_t field_offset, - const reflection::Object &obj, bool required) { + const flatbuffers::Table &parent_table, + voffset_t field_offset, + const reflection::Object &obj, + bool required) { auto p = parent_table.GetPointer(field_offset); if (required && !p) { return false; } @@ -54,13 +56,15 @@ static bool VerifyVectorOfStructs(flatbuffers::Verifier &v, } // forward declare to resolve cyclic deps between VerifyObject and VerifyVector -static bool VerifyObject(flatbuffers::Verifier &v, const reflection::Schema &schema, - const reflection::Object &obj, - const flatbuffers::Table *table, bool required); +static bool VerifyObject(flatbuffers::Verifier &v, + const reflection::Schema &schema, + const reflection::Object &obj, + const flatbuffers::Table *table, bool required); -static bool VerifyUnion(flatbuffers::Verifier &v, const reflection::Schema &schema, - uint8_t utype, const uint8_t *elem, - const reflection::Field &union_field) { +static bool VerifyUnion(flatbuffers::Verifier &v, + const reflection::Schema &schema, uint8_t utype, + const uint8_t *elem, + const reflection::Field &union_field) { if (!utype) return true; // Not present. auto fb_enum = schema.enums()->Get(union_field.type()->index()); if (utype >= fb_enum->values()->size()) return false; @@ -83,9 +87,10 @@ static bool VerifyUnion(flatbuffers::Verifier &v, const reflection::Schema &sche } } -static bool VerifyVector(flatbuffers::Verifier &v, const reflection::Schema &schema, - const flatbuffers::Table &table, - const reflection::Field &vec_field) { +static bool VerifyVector(flatbuffers::Verifier &v, + const reflection::Schema &schema, + const flatbuffers::Table &table, + const reflection::Field &vec_field) { FLATBUFFERS_ASSERT(vec_field.type()->base_type() == reflection::Vector); if (!table.VerifyField(v, vec_field.offset(), sizeof(uoffset_t))) return false; @@ -161,9 +166,10 @@ static bool VerifyVector(flatbuffers::Verifier &v, const reflection::Schema &sch } } -static bool VerifyObject(flatbuffers::Verifier &v, const reflection::Schema &schema, - const reflection::Object &obj, - const flatbuffers::Table *table, bool required) { +static bool VerifyObject(flatbuffers::Verifier &v, + const reflection::Schema &schema, + const reflection::Object &obj, + const flatbuffers::Table *table, bool required) { if (!table) return !required; if (!table->VerifyTableStart(v)) return false; for (uoffset_t i = 0; i < obj.fields()->size(); i++) { @@ -251,8 +257,7 @@ static bool VerifyObject(flatbuffers::Verifier &v, const reflection::Schema &sch return true; } - -} // namespace +} // namespace int64_t GetAnyValueI(reflection::BaseType type, const uint8_t *data) { // clang-format off @@ -618,9 +623,6 @@ const uint8_t *AddFlatBuffer(std::vector &flatbuf, return flatbuf.data() + insertion_point + root_offset; } - - - Offset CopyTable(FlatBufferBuilder &fbb, const reflection::Schema &schema, const reflection::Object &objectdef, @@ -691,7 +693,7 @@ Offset CopyTable(FlatBufferBuilder &fbb, FLATBUFFERS_FALLTHROUGH(); // fall thru default: { // Scalars and structs. auto element_size = GetTypeSize(element_base_type); - auto element_alignment = element_size; // For primitive elements + auto element_alignment = element_size; // For primitive elements if (elemobjectdef && elemobjectdef->is_struct()) element_size = elemobjectdef->bytesize(); fbb.StartVector(vec->size(), element_size, element_alignment); @@ -746,7 +748,6 @@ Offset CopyTable(FlatBufferBuilder &fbb, } } - bool Verify(const reflection::Schema &schema, const reflection::Object &root, const uint8_t *const buf, const size_t length, const uoffset_t max_depth, const uoffset_t max_tables) { diff --git a/src/util.cpp b/src/util.cpp index 38d8536c0..b201246fd 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -90,13 +90,12 @@ static std::string ToCamelCase(const std::string &input, bool is_upper) { std::string s; for (size_t i = 0; i < input.length(); i++) { if (!i && input[i] == '_') { - s += input[i]; - // we ignore leading underscore but make following - // alphabet char upper. - if (i + 1 < input.length() && is_alpha(input[i + 1])) - s += CharToUpper(input[++i]); - } - else if (!i) + s += input[i]; + // we ignore leading underscore but make following + // alphabet char upper. + if (i + 1 < input.length() && is_alpha(input[i + 1])) + s += CharToUpper(input[++i]); + } else if (!i) s += is_upper ? CharToUpper(input[i]) : CharToLower(input[i]); else if (input[i] == '_' && i + 1 < input.length()) s += CharToUpper(input[++i]); @@ -116,7 +115,10 @@ static std::string ToSnakeCase(const std::string &input, bool screaming) { } else if (!islower(input[i])) { // Prevent duplicate underscores for Upper_Snake_Case strings // and UPPERCASE strings. - if (islower(input[i - 1]) || (isdigit(input[i-1]) && !isdigit(input[i]))) { s += '_'; } + if (islower(input[i - 1]) || + (isdigit(input[i - 1]) && !isdigit(input[i]))) { + s += '_'; + } s += screaming ? CharToUpper(input[i]) : CharToLower(input[i]); } else { s += screaming ? CharToUpper(input[i]) : input[i]; @@ -126,7 +128,7 @@ static std::string ToSnakeCase(const std::string &input, bool screaming) { } std::string ToAll(const std::string &input, - std::function transform) { + std::function transform) { std::string s; for (size_t i = 0; i < input.length(); i++) { s += transform(input[i]); } return s; @@ -142,7 +144,10 @@ std::string CamelToSnake(const std::string &input) { } else if (!islower(input[i])) { // Prevent duplicate underscores for Upper_Snake_Case strings // and UPPERCASE strings. - if (islower(input[i - 1]) || (isdigit(input[i-1]) && !isdigit(input[i]))) { s += '_'; } + if (islower(input[i - 1]) || + (isdigit(input[i - 1]) && !isdigit(input[i]))) { + s += '_'; + } s += CharToLower(input[i]); } else { s += input[i]; @@ -184,7 +189,6 @@ std::string ToDasher(const std::string &input) { return s; } - // Converts foo_bar_123baz_456 to foo_bar123_baz456 std::string SnakeToSnake2(const std::string &s) { if (s.length() <= 1) return s; @@ -206,8 +210,7 @@ std::string SnakeToSnake2(const std::string &s) { return result; } -} // namespace - +} // namespace bool LoadFile(const char *name, bool binary, std::string *buf) { FLATBUFFERS_ASSERT(g_load_file_function); diff --git a/tests/alignment_test.cpp b/tests/alignment_test.cpp index 1026fc339..9fbf6d8eb 100644 --- a/tests/alignment_test.cpp +++ b/tests/alignment_test.cpp @@ -1,7 +1,7 @@ #include "alignment_test.h" -#include "flatbuffers/flatbuffer_builder.h" #include "alignment_test_generated.h" +#include "flatbuffers/flatbuffer_builder.h" #include "test_assert.h" namespace flatbuffers { @@ -16,7 +16,7 @@ void AlignmentTest() { BadAlignmentSmall *small; Offset> small_offset = builder.CreateUninitializedVectorOfStructs(9, &small); - (void)small; // We do not have to write data to trigger the test failure + (void)small; // We do not have to write data to trigger the test failure Offset root = CreateBadAlignmentRoot(builder, outer_large, small_offset); diff --git a/tests/flexbuffers_test.cpp b/tests/flexbuffers_test.cpp index b8da8ed70..c504f4e3b 100644 --- a/tests/flexbuffers_test.cpp +++ b/tests/flexbuffers_test.cpp @@ -1,7 +1,7 @@ -#include - #include "flexbuffers_test.h" +#include + #include "flatbuffers/flexbuffers.h" #include "flatbuffers/idl.h" #include "is_quiet_nan.h" diff --git a/tests/fuzz_test.cpp b/tests/fuzz_test.cpp index f6ee238d7..4e42549a1 100644 --- a/tests/fuzz_test.cpp +++ b/tests/fuzz_test.cpp @@ -1,7 +1,7 @@ -#include - #include "fuzz_test.h" +#include + #include "flatbuffers/flatbuffers.h" #include "flatbuffers/idl.h" #include "test_assert.h" @@ -22,7 +22,7 @@ void lcg_reset() { lcg_seed = 48271; } template static void CompareTableFieldValue(flatbuffers::Table *table, - flatbuffers::voffset_t voffset, T val) { + flatbuffers::voffset_t voffset, T val) { T read = table->GetField(voffset, static_cast(0)); TEST_EQ(read, val); } diff --git a/tests/json_test.cpp b/tests/json_test.cpp index 8acbb10ee..86367eec3 100644 --- a/tests/json_test.cpp +++ b/tests/json_test.cpp @@ -2,8 +2,8 @@ #include "flatbuffers/flatbuffers.h" #include "flatbuffers/idl.h" +#include "monster_test_bfbs_generated.h" #include "monster_test_generated.h" -#include "monster_test_bfbs_generated.h" #include "optional_scalars_generated.h" #include "test_assert.h" @@ -13,7 +13,7 @@ namespace tests { using namespace MyGame::Example; // Check stringify of an default enum value to json -void JsonDefaultTest(const std::string& tests_data_path) { +void JsonDefaultTest(const std::string &tests_data_path) { // load FlatBuffer schema (.fbs) from disk std::string schemafile; TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.fbs").c_str(), @@ -44,7 +44,7 @@ void JsonDefaultTest(const std::string& tests_data_path) { TEST_EQ(std::string::npos != jsongen.find("testf: 3.14159"), true); } -void JsonEnumsTest(const std::string& tests_data_path) { +void JsonEnumsTest(const std::string &tests_data_path) { // load FlatBuffer schema (.fbs) from disk std::string schemafile; TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.fbs").c_str(), @@ -83,7 +83,8 @@ void JsonEnumsTest(const std::string& tests_data_path) { TEST_EQ(std::string::npos != future_json.find("color: 13"), true); } -void JsonOptionalTest(const std::string& tests_data_path, bool default_scalars) { +void JsonOptionalTest(const std::string &tests_data_path, + bool default_scalars) { // load FlatBuffer schema (.fbs) and JSON from disk std::string schemafile; std::string jsonfile; @@ -124,7 +125,7 @@ void JsonOptionalTest(const std::string& tests_data_path, bool default_scalars) TEST_EQ_STR(jsongen.c_str(), jsonfile.c_str()); } -void ParseIncorrectMonsterJsonTest(const std::string& tests_data_path) { +void ParseIncorrectMonsterJsonTest(const std::string &tests_data_path) { std::string schemafile; TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.bfbs").c_str(), true, &schemafile), @@ -179,7 +180,7 @@ table JsonUnionStructTest { union_with_struct: UnionWithStruct; } root_type JsonUnionStructTest; )"; // source text to parse and expected result of generation text back - auto json_source =R"({ + auto json_source = R"({ union_with_struct_type: "MyStruct", union_with_struct: { field: 12345 diff --git a/tests/key_field_test.cpp b/tests/key_field_test.cpp index 7194e6d69..20eb2094c 100644 --- a/tests/key_field_test.cpp +++ b/tests/key_field_test.cpp @@ -38,7 +38,6 @@ void FixedSizedScalarKeyInStructTest() { bars.push_back(Bar(flatbuffers::make_span(test_float_array4), 1)); auto bar_vec = fbb.CreateVectorOfSortedStructs(&bars); - auto t = CreateFooTable(fbb, 1, 2, test_string, baz_vec, bar_vec); fbb.Finish(t); @@ -51,15 +50,11 @@ void FixedSizedScalarKeyInStructTest() { TEST_EQ(sorted_baz_vec->Get(3)->b(), 4); uint8_t test_array[4]; - auto* key_array = &flatbuffers::CastToArray(test_array); + auto *key_array = &flatbuffers::CastToArray(test_array); key_array->CopyFromSpan(flatbuffers::make_span(test_array1)); - - TEST_NOTNULL( - sorted_baz_vec->LookupByKey(key_array)); - TEST_EQ( - sorted_baz_vec->LookupByKey(key_array)->b(), - 4); + TEST_NOTNULL(sorted_baz_vec->LookupByKey(key_array)); + TEST_EQ(sorted_baz_vec->LookupByKey(key_array)->b(), 4); uint8_t array_int[4] = { 7, 2, 3, 0 }; key_array->CopyFromSpan(flatbuffers::make_span(array_int)); TEST_EQ(sorted_baz_vec->LookupByKey(key_array), @@ -70,7 +65,7 @@ void FixedSizedScalarKeyInStructTest() { TEST_EQ(sorted_bar_vec->Get(3)->b(), 4); float test_float_array[3]; - auto* key_float_array = &flatbuffers::CastToArray(test_float_array); + auto *key_float_array = &flatbuffers::CastToArray(test_float_array); key_float_array->CopyFromSpan(flatbuffers::make_span(test_float_array1)); TEST_NOTNULL(sorted_bar_vec->LookupByKey(key_float_array)); TEST_EQ(sorted_bar_vec->LookupByKey(key_float_array)->b(), 3); @@ -105,7 +100,6 @@ void StructKeyInStructTest() { auto orc = foo_builder.Finish(); fbb.Finish(orc); - uint8_t *buf = fbb.GetBufferPointer(); auto foo_table = GetFooTable(buf); @@ -153,9 +147,14 @@ void NestedStructKeyInStructTest() { TEST_EQ(sorted_fruit_vec->Get(0)->b(), 3); TEST_EQ(sorted_fruit_vec->Get(1)->b(), 1); TEST_EQ(sorted_fruit_vec->Get(2)->b(), 2); - TEST_EQ(sorted_fruit_vec->LookupByKey(Apple(2, Color(flatbuffers::make_span(test_float_array2), 1)))->b(), 1); - TEST_EQ(sorted_fruit_vec->LookupByKey(Apple(1, Color(flatbuffers::make_span(test_float_array2), 1))), static_cast(nullptr)); - + TEST_EQ(sorted_fruit_vec + ->LookupByKey( + Apple(2, Color(flatbuffers::make_span(test_float_array2), 1))) + ->b(), + 1); + TEST_EQ(sorted_fruit_vec->LookupByKey( + Apple(1, Color(flatbuffers::make_span(test_float_array2), 1))), + static_cast(nullptr)); } void FixedSizedStructArrayKeyInStructTest() { diff --git a/tests/optional_scalars_test.cpp b/tests/optional_scalars_test.cpp index 5dada0291..7713eb558 100644 --- a/tests/optional_scalars_test.cpp +++ b/tests/optional_scalars_test.cpp @@ -1,13 +1,14 @@ #include "optional_scalars_test.h" + #include #include + #include "flatbuffers/idl.h" #include "optional_scalars_generated.h" #include "test_assert.h" -namespace flatbuffers{ - namespace tests{ - +namespace flatbuffers { +namespace tests { void OptionalScalarsTest() { // Simple schemas and a "has optional scalar" sentinal. @@ -97,5 +98,5 @@ void OptionalScalarsTest() { TEST_ASSERT(opts->maybe_i32() == flatbuffers::Optional(-1)); } - } -} +} // namespace tests +} // namespace flatbuffers diff --git a/tests/proto_test.cpp b/tests/proto_test.cpp index 755ddd084..6fb3ef356 100644 --- a/tests/proto_test.cpp +++ b/tests/proto_test.cpp @@ -31,8 +31,9 @@ void RunTest(const flatbuffers::IDLOptions &opts, const std::string &proto_path, TEST_EQ(import_parser.Parse(import_proto_file.c_str(), include_directories), true); std::string import_fbs; - TEST_EQ(fbs_generator->GenerateCodeString(import_parser, "test", import_fbs), - CodeGenerator::Status::OK); + TEST_EQ( + fbs_generator->GenerateCodeString(import_parser, "test", import_fbs), + CodeGenerator::Status::OK); // auto import_fbs = flatbuffers::GenerateFBS(import_parser, "test", true); // Since `imported.fbs` isn't in the filesystem AbsolutePath can't figure it // out by itself. We manually construct it so Parser works. diff --git a/tests/reflection_test.cpp b/tests/reflection_test.cpp index 9f9268951..869c98db4 100644 --- a/tests/reflection_test.cpp +++ b/tests/reflection_test.cpp @@ -1,19 +1,21 @@ #include "reflection_test.h" + #include "arrays_test_generated.h" #include "flatbuffers/minireflect.h" #include "flatbuffers/reflection.h" #include "flatbuffers/reflection_generated.h" #include "flatbuffers/verifier.h" -#include "test_assert.h" #include "monster_test.h" #include "monster_test_generated.h" +#include "test_assert.h" namespace flatbuffers { namespace tests { using namespace MyGame::Example; -void ReflectionTest(const std::string& tests_data_path, uint8_t *flatbuf, size_t length) { +void ReflectionTest(const std::string &tests_data_path, uint8_t *flatbuf, + size_t length) { // Load a binary schema. std::string bfbsfile; TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.bfbs").c_str(), diff --git a/tests/test_builder.cpp b/tests/test_builder.cpp index 3b0eaa04c..8b14a92ae 100644 --- a/tests/test_builder.cpp +++ b/tests/test_builder.cpp @@ -15,8 +15,7 @@ class TestHeapBuilder : public FlatBufferBuilder { TestHeapBuilder &operator=(const TestHeapBuilder &); public: - TestHeapBuilder() - : FlatBufferBuilder(2048, new OwnedAllocator(), true) {} + TestHeapBuilder() : FlatBufferBuilder(2048, new OwnedAllocator(), true) {} TestHeapBuilder(TestHeapBuilder &&other) : FlatBufferBuilder(std::move(other)) {} @@ -144,7 +143,7 @@ void FlatBufferBuilderTest() { } // forward-declared in test_builder.h -void CheckTestGeneratedIsValid(const MyGame::Example::Color&); +void CheckTestGeneratedIsValid(const MyGame::Example::Color &); // Link-time check using pointer type. void CheckTestGeneratedIsValid(const MyGame::Example::Color &) {}