bulk code format fix (#8707)

This commit is contained in:
Derek Bailey
2025-09-23 21:50:27 -07:00
committed by GitHub
parent 0e047869da
commit caf3b494db
559 changed files with 38871 additions and 31276 deletions

View File

@@ -23,7 +23,7 @@ static const uint64_t kOffsetBasis = 0xcbf29ce484222645ULL;
namespace flatbuffers {
template<typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
template <typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
uint64_t Hash(T value, uint64_t hash) {
return (hash * kFnvPrime) ^ value;
}
@@ -33,33 +33,51 @@ uint64_t Hash(double value, uint64_t hash) {
return (hash * kFnvPrime) ^ static_cast<uint64_t>(value);
}
uint64_t Hash(const flatbuffers::String *value, uint64_t hash) {
if (value == nullptr) { return hash * kFnvPrime; }
for (auto &c : value->str()) { hash = Hash(static_cast<uint8_t>(c), hash); }
uint64_t Hash(const flatbuffers::String* value, uint64_t hash) {
if (value == nullptr) {
return hash * kFnvPrime;
}
for (auto& c : value->str()) {
hash = Hash(static_cast<uint8_t>(c), hash);
}
return hash;
}
uint64_t Hash(const LeafStruct *value, uint64_t hash) {
if (value == nullptr) { return hash * kFnvPrime; }
uint64_t Hash(const LeafStruct* value, uint64_t hash) {
if (value == nullptr) {
return hash * kFnvPrime;
}
hash = Hash(value->a(), hash);
hash = Hash(value->b(), hash);
return hash;
}
template<typename T> uint64_t Hash(const Vector<T> *value, uint64_t hash) {
if (value == nullptr) { return hash * kFnvPrime; }
for (const T c : *value) { hash = Hash(c, hash); }
template <typename T>
uint64_t Hash(const Vector<T>* value, uint64_t hash) {
if (value == nullptr) {
return hash * kFnvPrime;
}
for (const T c : *value) {
hash = Hash(c, hash);
}
return hash;
}
template<typename T> uint64_t Hash(const Vector64<T> *value, uint64_t hash) {
if (value == nullptr) { return hash * kFnvPrime; }
for (const T c : *value) { hash = Hash(c, hash); }
template <typename T>
uint64_t Hash(const Vector64<T>* value, uint64_t hash) {
if (value == nullptr) {
return hash * kFnvPrime;
}
for (const T c : *value) {
hash = Hash(c, hash);
}
return hash;
}
uint64_t Hash(const RootTable *value, uint64_t hash) {
if (value == nullptr) { return hash * kFnvPrime; }
uint64_t Hash(const RootTable* value, uint64_t hash) {
if (value == nullptr) {
return hash * kFnvPrime;
}
// Hash all the fields so we can exercise all parts of the code.
hash = Hash(value->far_vector(), hash);
hash = Hash(value->a(), hash);
@@ -72,9 +90,9 @@ uint64_t Hash(const RootTable *value, uint64_t hash) {
return hash;
}
static int AccessBuffer(const uint8_t *data, size_t size,
static int AccessBuffer(const uint8_t* data, size_t size,
bool is_size_prefixed) {
const RootTable *root_table =
const RootTable* root_table =
is_size_prefixed ? GetSizePrefixedRootTable(data) : GetRootTable(data);
TEST_NOTNULL(root_table);
@@ -85,15 +103,17 @@ static int AccessBuffer(const uint8_t *data, size_t size,
return 0;
}
extern "C" int LLVMFuzzerInitialize(int *, char ***argv) {
extern "C" int LLVMFuzzerInitialize(int*, char*** argv) {
Verifier verifier(schema.begin(), schema.size());
TEST_EQ(true, reflection::VerifySchemaBuffer(verifier));
return 0;
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size < FLATBUFFERS_MIN_BUFFER_SIZE) { return 0; }
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < FLATBUFFERS_MIN_BUFFER_SIZE) {
return 0;
}
// Take the first bit of data as a flag to control things.
const uint8_t flags = data[0];