Commit 42c08cbc authored by Derek Bailey's avatar Derek Bailey Committed by Wouter van Oortmerssen

Ran src/clang-format-all.sh (#5617)

parent 33d5dd9b
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
#ifndef GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H #ifndef GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
#define GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H #define GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
#include "src/compiler/config.h"
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "src/compiler/config.h"
#ifndef GRPC_CUSTOM_STRING #ifndef GRPC_CUSTOM_STRING
# include <string> # include <string>
# define GRPC_CUSTOM_STRING std::string # define GRPC_CUSTOM_STRING std::string
......
...@@ -14,17 +14,17 @@ ...@@ -14,17 +14,17 @@
* limitations under the License. * limitations under the License.
*/ */
#include <thread>
#include <grpc++/grpc++.h> #include <grpc++/grpc++.h>
#include <thread>
#include "monster_test.grpc.fb.h" #include "monster_test.grpc.fb.h"
#include "monster_test_generated.h" #include "monster_test_generated.h"
#include "test_assert.h" #include "test_assert.h"
using namespace MyGame::Example; using namespace MyGame::Example;
using flatbuffers::grpc::MessageBuilder;
using flatbuffers::FlatBufferBuilder; using flatbuffers::FlatBufferBuilder;
using flatbuffers::grpc::MessageBuilder;
void message_builder_tests(); void message_builder_tests();
...@@ -97,8 +97,7 @@ void RunServer() { ...@@ -97,8 +97,7 @@ void RunServer() {
server_instance->Wait(); server_instance->Wait();
} }
template <class Builder> template<class Builder> void StoreRPC(MonsterStorage::Stub *stub) {
void StoreRPC(MonsterStorage::Stub *stub) {
Builder fbb; Builder fbb;
grpc::ClientContext context; grpc::ClientContext context;
// Build a request with the name set. // Build a request with the name set.
...@@ -119,8 +118,7 @@ void StoreRPC(MonsterStorage::Stub *stub) { ...@@ -119,8 +118,7 @@ void StoreRPC(MonsterStorage::Stub *stub) {
} }
} }
template <class Builder> template<class Builder> void RetrieveRPC(MonsterStorage::Stub *stub) {
void RetrieveRPC(MonsterStorage::Stub *stub) {
Builder fbb; Builder fbb;
grpc::ClientContext context; grpc::ClientContext context;
fbb.Clear(); fbb.Clear();
...@@ -155,7 +153,6 @@ int grpc_server_test() { ...@@ -155,7 +153,6 @@ int grpc_server_test() {
RetrieveRPC<MessageBuilder>(stub.get()); RetrieveRPC<MessageBuilder>(stub.get());
RetrieveRPC<FlatBufferBuilder>(stub.get()); RetrieveRPC<FlatBufferBuilder>(stub.get());
#if !FLATBUFFERS_GRPC_DISABLE_AUTO_VERIFICATION #if !FLATBUFFERS_GRPC_DISABLE_AUTO_VERIFICATION
{ {
// Test that an invalid request errors out correctly // Test that an invalid request errors out correctly
...@@ -181,7 +178,7 @@ int grpc_server_test() { ...@@ -181,7 +178,7 @@ int grpc_server_test() {
return 0; return 0;
} }
int main(int /*argc*/, const char * /*argv*/ []) { int main(int /*argc*/, const char * /*argv*/[]) {
message_builder_tests(); message_builder_tests();
grpc_server_test(); grpc_server_test();
...@@ -193,4 +190,3 @@ int main(int /*argc*/, const char * /*argv*/ []) { ...@@ -193,4 +190,3 @@ int main(int /*argc*/, const char * /*argv*/ []) {
return 1; return 1;
} }
} }
This diff is collapsed.
...@@ -228,7 +228,7 @@ inline std::string GetAnyVectorElemS(const VectorOfAny *vec, ...@@ -228,7 +228,7 @@ inline std::string GetAnyVectorElemS(const VectorOfAny *vec,
template<typename T> template<typename T>
T *GetAnyVectorElemPointer(const VectorOfAny *vec, size_t i) { T *GetAnyVectorElemPointer(const VectorOfAny *vec, size_t i) {
auto elem_ptr = vec->Data() + sizeof(uoffset_t) * i; auto elem_ptr = vec->Data() + sizeof(uoffset_t) * i;
return reinterpret_cast<T*>(elem_ptr + ReadScalar<uoffset_t>(elem_ptr)); return reinterpret_cast<T *>(elem_ptr + ReadScalar<uoffset_t>(elem_ptr));
} }
// Get the inline-address of a vector element. Useful for Structs (pass Struct // Get the inline-address of a vector element. Useful for Structs (pass Struct
......
...@@ -16,8 +16,7 @@ ...@@ -16,8 +16,7 @@
#include "flatbuffers/idl.h" #include "flatbuffers/idl.h"
#include "flatbuffers/util.h" #include "flatbuffers/util.h"
#include "monster_generated.h" // Already includes "flatbuffers/flatbuffers.h".
#include "monster_generated.h" // Already includes "flatbuffers/flatbuffers.h".
using namespace MyGame::Sample; using namespace MyGame::Sample;
...@@ -30,7 +29,8 @@ int main(int /*argc*/, const char * /*argv*/[]) { ...@@ -30,7 +29,8 @@ int main(int /*argc*/, const char * /*argv*/[]) {
std::string bfbs_file; std::string bfbs_file;
bool ok = bool ok =
flatbuffers::LoadFile("tests/monster_test.fbs", false, &schema_file) && flatbuffers::LoadFile("tests/monster_test.fbs", false, &schema_file) &&
flatbuffers::LoadFile("tests/monsterdata_test.golden", false, &json_file) && flatbuffers::LoadFile("tests/monsterdata_test.golden", false,
&json_file) &&
flatbuffers::LoadFile("tests/monster_test.bfbs", true, &bfbs_file); flatbuffers::LoadFile("tests/monster_test.bfbs", true, &bfbs_file);
if (!ok) { if (!ok) {
printf("couldn't load files!\n"); printf("couldn't load files!\n");
......
...@@ -20,7 +20,7 @@ using namespace MyGame::Sample; ...@@ -20,7 +20,7 @@ using namespace MyGame::Sample;
// Example how to use FlatBuffers to create and read binary buffers. // Example how to use FlatBuffers to create and read binary buffers.
int main(int /*argc*/, const char * /*argv*/ []) { int main(int /*argc*/, const char * /*argv*/[]) {
// Build up a serialized buffer algorithmically: // Build up a serialized buffer algorithmically:
flatbuffers::FlatBufferBuilder builder; flatbuffers::FlatBufferBuilder builder;
......
...@@ -16,14 +16,13 @@ ...@@ -16,14 +16,13 @@
#include "flatbuffers/idl.h" #include "flatbuffers/idl.h"
#include "flatbuffers/util.h" #include "flatbuffers/util.h"
#include "monster_generated.h" // Already includes "flatbuffers/flatbuffers.h". #include "monster_generated.h" // Already includes "flatbuffers/flatbuffers.h".
using namespace MyGame::Sample; using namespace MyGame::Sample;
// This is an example of parsing text straight into a buffer and then // This is an example of parsing text straight into a buffer and then
// generating flatbuffer (JSON) text from the buffer. // generating flatbuffer (JSON) text from the buffer.
int main(int /*argc*/, const char * /*argv*/ []) { int main(int /*argc*/, const char * /*argv*/[]) {
// load FlatBuffer schema (.fbs) and JSON from disk // load FlatBuffer schema (.fbs) and JSON from disk
std::string schemafile; std::string schemafile;
std::string jsonfile; std::string jsonfile;
......
...@@ -1014,7 +1014,8 @@ class JsTsGenerator : public BaseGenerator { ...@@ -1014,7 +1014,8 @@ class JsTsGenerator : public BaseGenerator {
} }
// Adds the mutable scalar value to the output // Adds the mutable scalar value to the output
if (IsScalar(field.value.type.base_type) && parser.opts.mutable_buffer && !IsUnion(field.value.type)) { if (IsScalar(field.value.type.base_type) && parser.opts.mutable_buffer &&
!IsUnion(field.value.type)) {
std::string annotations = GenTypeAnnotation( std::string annotations = GenTypeAnnotation(
kParam, GenTypeName(field.value.type, true), "value"); kParam, GenTypeName(field.value.type, true), "value");
GenDocComment( GenDocComment(
......
...@@ -2308,7 +2308,6 @@ void InvalidNestedFlatbufferTest() { ...@@ -2308,7 +2308,6 @@ void InvalidNestedFlatbufferTest() {
TEST_EQ(parser1.Parse("{ name: \"Bender\", testnestedflatbuffer: { name: " TEST_EQ(parser1.Parse("{ name: \"Bender\", testnestedflatbuffer: { name: "
"\"Leela\", color: \"nonexistent\"}}"), "\"Leela\", color: \"nonexistent\"}}"),
false); false);
// Check that Parser is destroyed correctly after parsing invalid json
} }
void UnionVectorTest() { void UnionVectorTest() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment