aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-01-18 14:36:47 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-01-18 14:36:47 -0800
commitecd49345b5c500b9ea1da70b15c90b87da3ff55a (patch)
tree29afa5d2986d5c85a93e126c1d1f1cd1213d82ab /src
parentcf1d6eb4ae1b48958454259f7e26bee9140cbf65 (diff)
Use clang-format-3.5
Diffstat (limited to 'src')
-rw-r--r--src/compiler/cpp_generator.cc58
-rw-r--r--src/compiler/cpp_generator.h6
-rw-r--r--src/compiler/cpp_generator_helpers.h16
-rw-r--r--src/compiler/cpp_plugin.cc16
-rw-r--r--src/compiler/ruby_generator.cc10
-rw-r--r--src/compiler/ruby_generator.h2
-rw-r--r--src/compiler/ruby_generator_helpers-inl.h6
-rw-r--r--src/compiler/ruby_generator_map-inl.h2
-rw-r--r--src/compiler/ruby_generator_string-inl.h22
-rw-r--r--src/compiler/ruby_plugin.cc10
-rw-r--r--src/core/channel/census_filter.c12
-rw-r--r--src/core/channel/channel_stack.c11
-rw-r--r--src/core/channel/child_channel.c4
-rw-r--r--src/core/channel/client_channel.c4
-rw-r--r--src/core/channel/connected_channel.c6
-rw-r--r--src/core/channel/http_client_filter.c4
-rw-r--r--src/core/channel/http_filter.c4
-rw-r--r--src/core/channel/http_server_filter.c4
-rw-r--r--src/core/channel/metadata_buffer.c2
-rw-r--r--src/core/channel/noop_filter.c4
-rw-r--r--src/core/security/auth.c5
-rw-r--r--src/core/security/security_context.c8
-rw-r--r--src/core/statistics/census_rpc_stats.c5
-rw-r--r--src/core/statistics/census_tracing.c3
-rw-r--r--src/core/support/murmur_hash.c8
-rw-r--r--src/core/surface/call.c4
-rw-r--r--src/core/surface/channel.c2
-rw-r--r--src/core/surface/client.c4
-rw-r--r--src/core/surface/lame_client.c4
-rw-r--r--src/core/surface/server.c4
-rw-r--r--src/core/transport/chttp2/hpack_table.c124
-rw-r--r--src/core/transport/chttp2/varint.h20
-rw-r--r--src/core/transport/chttp2_transport.c14
-rw-r--r--src/core/tsi/fake_transport_security.c17
-rw-r--r--src/core/tsi/ssl_transport_security.c23
-rw-r--r--src/core/tsi/ssl_transport_security.h3
-rw-r--r--src/cpp/client/channel.cc56
-rw-r--r--src/cpp/client/channel.h22
-rw-r--r--src/cpp/client/channel_arguments.cc18
-rw-r--r--src/cpp/client/client_context.cc8
-rw-r--r--src/cpp/client/create_channel.cc8
-rw-r--r--src/cpp/client/credentials.cc40
-rw-r--r--src/cpp/proto/proto_utils.cc12
-rw-r--r--src/cpp/proto/proto_utils.h6
-rw-r--r--src/cpp/server/async_server.cc4
-rw-r--r--src/cpp/server/async_server_context.cc16
-rw-r--r--src/cpp/server/completion_queue.cc8
-rw-r--r--src/cpp/server/server.cc16
-rw-r--r--src/cpp/server/server_builder.cc12
-rw-r--r--src/cpp/server/server_credentials.cc20
-rw-r--r--src/cpp/server/server_rpc_handler.cc14
-rw-r--r--src/cpp/server/server_rpc_handler.h8
-rw-r--r--src/cpp/server/thread_pool.cc4
-rw-r--r--src/cpp/server/thread_pool.h2
-rw-r--r--src/cpp/stream/stream_context.cc34
-rw-r--r--src/cpp/stream/stream_context.h50
-rw-r--r--src/cpp/util/status.cc4
-rw-r--r--src/cpp/util/time.cc4
-rw-r--r--src/cpp/util/time.h4
-rw-r--r--src/php/ext/grpc/call.c19
-rw-r--r--src/php/ext/grpc/channel.c2
-rw-r--r--src/php/ext/grpc/completion_queue.c16
-rw-r--r--src/php/ext/grpc/credentials.c13
-rw-r--r--src/php/ext/grpc/php_grpc.c3
-rw-r--r--src/php/ext/grpc/server.c8
-rw-r--r--src/php/ext/grpc/server_credentials.c4
-rw-r--r--src/php/ext/grpc/timeval.c24
67 files changed, 458 insertions, 452 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index 29bd3560f3..8724f97e8b 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -45,23 +45,23 @@
namespace grpc_cpp_generator {
namespace {
-bool NoStreaming(const google::protobuf::MethodDescriptor* method) {
+bool NoStreaming(const google::protobuf::MethodDescriptor *method) {
return !method->client_streaming() && !method->server_streaming();
}
-bool ClientOnlyStreaming(const google::protobuf::MethodDescriptor* method) {
+bool ClientOnlyStreaming(const google::protobuf::MethodDescriptor *method) {
return method->client_streaming() && !method->server_streaming();
}
-bool ServerOnlyStreaming(const google::protobuf::MethodDescriptor* method) {
+bool ServerOnlyStreaming(const google::protobuf::MethodDescriptor *method) {
return !method->client_streaming() && method->server_streaming();
}
-bool BidiStreaming(const google::protobuf::MethodDescriptor* method) {
+bool BidiStreaming(const google::protobuf::MethodDescriptor *method) {
return method->client_streaming() && method->server_streaming();
}
-bool HasClientOnlyStreaming(const google::protobuf::FileDescriptor* file) {
+bool HasClientOnlyStreaming(const google::protobuf::FileDescriptor *file) {
for (int i = 0; i < file->service_count(); i++) {
for (int j = 0; j < file->service(i)->method_count(); j++) {
if (ClientOnlyStreaming(file->service(i)->method(j))) {
@@ -72,7 +72,7 @@ bool HasClientOnlyStreaming(const google::protobuf::FileDescriptor* file) {
return false;
}
-bool HasServerOnlyStreaming(const google::protobuf::FileDescriptor* file) {
+bool HasServerOnlyStreaming(const google::protobuf::FileDescriptor *file) {
for (int i = 0; i < file->service_count(); i++) {
for (int j = 0; j < file->service(i)->method_count(); j++) {
if (ServerOnlyStreaming(file->service(i)->method(j))) {
@@ -83,7 +83,7 @@ bool HasServerOnlyStreaming(const google::protobuf::FileDescriptor* file) {
return false;
}
-bool HasBidiStreaming(const google::protobuf::FileDescriptor* file) {
+bool HasBidiStreaming(const google::protobuf::FileDescriptor *file) {
for (int i = 0; i < file->service_count(); i++) {
for (int j = 0; j < file->service(i)->method_count(); j++) {
if (BidiStreaming(file->service(i)->method(j))) {
@@ -95,7 +95,7 @@ bool HasBidiStreaming(const google::protobuf::FileDescriptor* file) {
}
} // namespace
-std::string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) {
+std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) {
std::string temp =
"#include \"grpc++/impl/internal_stub.h\"\n"
"#include \"grpc++/status.h\"\n"
@@ -131,9 +131,9 @@ std::string GetSourceIncludes() {
"#include \"grpc++/stream.h\"\n";
}
-void PrintHeaderClientMethod(google::protobuf::io::Printer* printer,
- const google::protobuf::MethodDescriptor* method,
- std::map<std::string, std::string>* vars) {
+void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -160,9 +160,9 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer* printer,
}
}
-void PrintHeaderServerMethod(google::protobuf::io::Printer* printer,
- const google::protobuf::MethodDescriptor* method,
- std::map<std::string, std::string>* vars) {
+void PrintHeaderServerMethod(google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -194,9 +194,9 @@ void PrintHeaderServerMethod(google::protobuf::io::Printer* printer,
}
}
-void PrintHeaderService(google::protobuf::io::Printer* printer,
- const google::protobuf::ServiceDescriptor* service,
- std::map<std::string, std::string>* vars) {
+void PrintHeaderService(google::protobuf::io::Printer *printer,
+ const google::protobuf::ServiceDescriptor *service,
+ std::map<std::string, std::string> *vars) {
(*vars)["Service"] = service->name();
printer->Print(*vars,
@@ -241,7 +241,7 @@ void PrintHeaderService(google::protobuf::io::Printer* printer,
printer->Print("};\n");
}
-std::string GetHeaderServices(const google::protobuf::FileDescriptor* file) {
+std::string GetHeaderServices(const google::protobuf::FileDescriptor *file) {
std::string output;
google::protobuf::io::StringOutputStream output_stream(&output);
google::protobuf::io::Printer printer(&output_stream, '$');
@@ -254,9 +254,9 @@ std::string GetHeaderServices(const google::protobuf::FileDescriptor* file) {
return output;
}
-void PrintSourceClientMethod(google::protobuf::io::Printer* printer,
- const google::protobuf::MethodDescriptor* method,
- std::map<std::string, std::string>* vars) {
+void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -312,9 +312,9 @@ void PrintSourceClientMethod(google::protobuf::io::Printer* printer,
}
}
-void PrintSourceServerMethod(google::protobuf::io::Printer* printer,
- const google::protobuf::MethodDescriptor* method,
- std::map<std::string, std::string>* vars) {
+void PrintSourceServerMethod(google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -362,9 +362,9 @@ void PrintSourceServerMethod(google::protobuf::io::Printer* printer,
}
}
-void PrintSourceService(google::protobuf::io::Printer* printer,
- const google::protobuf::ServiceDescriptor* service,
- std::map<std::string, std::string>* vars) {
+void PrintSourceService(google::protobuf::io::Printer *printer,
+ const google::protobuf::ServiceDescriptor *service,
+ std::map<std::string, std::string> *vars) {
(*vars)["Service"] = service->name();
printer->Print(
*vars,
@@ -394,7 +394,7 @@ void PrintSourceService(google::protobuf::io::Printer* printer,
"}\n");
printer->Print("service_ = new ::grpc::RpcService();\n");
for (int i = 0; i < service->method_count(); ++i) {
- const google::protobuf::MethodDescriptor* method = service->method(i);
+ const google::protobuf::MethodDescriptor *method = service->method(i);
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -458,7 +458,7 @@ void PrintSourceService(google::protobuf::io::Printer* printer,
printer->Print("}\n\n");
}
-std::string GetSourceServices(const google::protobuf::FileDescriptor* file) {
+std::string GetSourceServices(const google::protobuf::FileDescriptor *file) {
std::string output;
google::protobuf::io::StringOutputStream output_stream(&output);
google::protobuf::io::Printer printer(&output_stream, '$');
diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h
index 1a74211b71..fe84d08b4c 100644
--- a/src/compiler/cpp_generator.h
+++ b/src/compiler/cpp_generator.h
@@ -45,16 +45,16 @@ class FileDescriptor;
namespace grpc_cpp_generator {
// Return the includes needed for generated header file.
-std::string GetHeaderIncludes(const google::protobuf::FileDescriptor* file);
+std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file);
// Return the includes needed for generated source file.
std::string GetSourceIncludes();
// Return the services for generated header file.
-std::string GetHeaderServices(const google::protobuf::FileDescriptor* file);
+std::string GetHeaderServices(const google::protobuf::FileDescriptor *file);
// Return the services for generated source file.
-std::string GetSourceServices(const google::protobuf::FileDescriptor* file);
+std::string GetSourceServices(const google::protobuf::FileDescriptor *file);
} // namespace grpc_cpp_generator
diff --git a/src/compiler/cpp_generator_helpers.h b/src/compiler/cpp_generator_helpers.h
index 1ad3cb2db3..54c343866f 100644
--- a/src/compiler/cpp_generator_helpers.h
+++ b/src/compiler/cpp_generator_helpers.h
@@ -41,7 +41,7 @@
namespace grpc_cpp_generator {
-inline bool StripSuffix(std::string* filename, const std::string& suffix) {
+inline bool StripSuffix(std::string *filename, const std::string &suffix) {
if (filename->length() >= suffix.length()) {
size_t suffix_pos = filename->length() - suffix.length();
if (filename->compare(suffix_pos, std::string::npos, suffix) == 0) {
@@ -60,8 +60,8 @@ inline std::string StripProto(std::string filename) {
return filename;
}
-inline std::string StringReplace(std::string str, const std::string& from,
- const std::string& to) {
+inline std::string StringReplace(std::string str, const std::string &from,
+ const std::string &to) {
size_t pos = 0;
for (;;) {
@@ -76,22 +76,22 @@ inline std::string StringReplace(std::string str, const std::string& from,
return str;
}
-inline std::string DotsToColons(const std::string& name) {
+inline std::string DotsToColons(const std::string &name) {
return StringReplace(name, ".", "::");
}
-inline std::string DotsToUnderscores(const std::string& name) {
+inline std::string DotsToUnderscores(const std::string &name) {
return StringReplace(name, ".", "_");
}
-inline std::string ClassName(const google::protobuf::Descriptor* descriptor,
+inline std::string ClassName(const google::protobuf::Descriptor *descriptor,
bool qualified) {
// Find "outer", the descriptor of the top-level message in which
// "descriptor" is embedded.
- const google::protobuf::Descriptor* outer = descriptor;
+ const google::protobuf::Descriptor *outer = descriptor;
while (outer->containing_type() != NULL) outer = outer->containing_type();
- const std::string& outer_name = outer->full_name();
+ const std::string &outer_name = outer->full_name();
std::string inner_name = descriptor->full_name().substr(outer_name.size());
if (qualified) {
diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc
index e43278529d..a7fdb1f093 100644
--- a/src/compiler/cpp_plugin.cc
+++ b/src/compiler/cpp_plugin.cc
@@ -51,10 +51,10 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
CppGrpcGenerator() {}
virtual ~CppGrpcGenerator() {}
- virtual bool Generate(const google::protobuf::FileDescriptor* file,
- const std::string& parameter,
- google::protobuf::compiler::GeneratorContext* context,
- std::string* error) const {
+ virtual bool Generate(const google::protobuf::FileDescriptor *file,
+ const std::string &parameter,
+ google::protobuf::compiler::GeneratorContext *context,
+ std::string *error) const {
if (file->options().cc_generic_services()) {
*error =
"cpp grpc proto compiler plugin does not work with generic "
@@ -81,9 +81,9 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
private:
// Insert the given code into the given file at the given insertion point.
- void Insert(google::protobuf::compiler::GeneratorContext* context,
- const std::string& filename, const std::string& insertion_point,
- const std::string& code) const {
+ void Insert(google::protobuf::compiler::GeneratorContext *context,
+ const std::string &filename, const std::string &insertion_point,
+ const std::string &code) const {
std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
context->OpenForInsert(filename, insertion_point));
google::protobuf::io::CodedOutputStream coded_out(output.get());
@@ -91,7 +91,7 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
}
};
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
CppGrpcGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc
index 393f8f3b59..16632325dc 100644
--- a/src/compiler/ruby_generator.cc
+++ b/src/compiler/ruby_generator.cc
@@ -57,8 +57,8 @@ namespace grpc_ruby_generator {
namespace {
// Prints out the method using the ruby gRPC DSL.
-void PrintMethod(const MethodDescriptor* method, const std::string& package,
- Printer* out) {
+void PrintMethod(const MethodDescriptor *method, const std::string &package,
+ Printer *out) {
std::string input_type = RubyTypeOf(method->input_type()->name(), package);
if (method->client_streaming()) {
input_type = "stream(" + input_type + ")";
@@ -75,8 +75,8 @@ void PrintMethod(const MethodDescriptor* method, const std::string& package,
}
// Prints out the service using the ruby gRPC DSL.
-void PrintService(const ServiceDescriptor* service, const std::string& package,
- Printer* out) {
+void PrintService(const ServiceDescriptor *service, const std::string &package,
+ Printer *out) {
if (service->method_count() == 0) {
return;
}
@@ -125,7 +125,7 @@ void PrintService(const ServiceDescriptor* service, const std::string& package,
} // namespace
-std::string GetServices(const FileDescriptor* file) {
+std::string GetServices(const FileDescriptor *file) {
std::string output;
StringOutputStream output_stream(&output);
Printer out(&output_stream, '$');
diff --git a/src/compiler/ruby_generator.h b/src/compiler/ruby_generator.h
index 0306536d08..89d7a0b92a 100644
--- a/src/compiler/ruby_generator.h
+++ b/src/compiler/ruby_generator.h
@@ -44,7 +44,7 @@ class FileDescriptor;
namespace grpc_ruby_generator {
-std::string GetServices(const google::protobuf::FileDescriptor* file);
+std::string GetServices(const google::protobuf::FileDescriptor *file);
} // namespace grpc_ruby_generator
diff --git a/src/compiler/ruby_generator_helpers-inl.h b/src/compiler/ruby_generator_helpers-inl.h
index 7b973ed9eb..0034f5ef56 100644
--- a/src/compiler/ruby_generator_helpers-inl.h
+++ b/src/compiler/ruby_generator_helpers-inl.h
@@ -41,8 +41,8 @@
namespace grpc_ruby_generator {
-inline bool ServicesFilename(const google::protobuf::FileDescriptor* file,
- std::string* file_name_or_error) {
+inline bool ServicesFilename(const google::protobuf::FileDescriptor *file,
+ std::string *file_name_or_error) {
// Get output file name.
static const unsigned proto_suffix_length = 6; // length of ".proto"
if (file->name().size() > proto_suffix_length &&
@@ -58,7 +58,7 @@ inline bool ServicesFilename(const google::protobuf::FileDescriptor* file,
}
inline std::string MessagesRequireName(
- const google::protobuf::FileDescriptor* file) {
+ const google::protobuf::FileDescriptor *file) {
return Replace(file->name(), ".proto", "");
}
diff --git a/src/compiler/ruby_generator_map-inl.h b/src/compiler/ruby_generator_map-inl.h
index a49650a2f7..fea9c2e2fa 100644
--- a/src/compiler/ruby_generator_map-inl.h
+++ b/src/compiler/ruby_generator_map-inl.h
@@ -49,7 +49,7 @@ namespace grpc_ruby_generator {
// Converts an initializer list of the form { key0, value0, key1, value1, ... }
// into a map of key* to value*. Is merely a readability helper for later code.
inline std::map<std::string, std::string> ListToDict(
- const initializer_list<std::string>& values) {
+ const initializer_list<std::string> &values) {
if (values.size() % 2 != 0) {
// MOE: insert std::cerr << "Not every 'key' has a value in `values`."
// << std::endl;
diff --git a/src/compiler/ruby_generator_string-inl.h b/src/compiler/ruby_generator_string-inl.h
index a253f78d49..d24a61b9f5 100644
--- a/src/compiler/ruby_generator_string-inl.h
+++ b/src/compiler/ruby_generator_string-inl.h
@@ -45,8 +45,8 @@ using std::transform;
namespace grpc_ruby_generator {
// Split splits a string using char into elems.
-inline std::vector<std::string>& Split(const std::string& s, char delim,
- std::vector<std::string>* elems) {
+inline std::vector<std::string> &Split(const std::string &s, char delim,
+ std::vector<std::string> *elems) {
std::stringstream ss(s);
std::string item;
while (getline(ss, item, delim)) {
@@ -56,15 +56,15 @@ inline std::vector<std::string>& Split(const std::string& s, char delim,
}
// Split splits a string using char, returning the result in a vector.
-inline std::vector<std::string> Split(const std::string& s, char delim) {
+inline std::vector<std::string> Split(const std::string &s, char delim) {
std::vector<std::string> elems;
Split(s, delim, &elems);
return elems;
}
// Replace replaces from with to in s.
-inline std::string Replace(std::string s, const std::string& from,
- const std::string& to) {
+inline std::string Replace(std::string s, const std::string &from,
+ const std::string &to) {
size_t start_pos = s.find(from);
if (start_pos == std::string::npos) {
return s;
@@ -74,8 +74,8 @@ inline std::string Replace(std::string s, const std::string& from,
}
// ReplaceAll replaces all instances of search with replace in s.
-inline std::string ReplaceAll(std::string s, const std::string& search,
- const std::string& replace) {
+inline std::string ReplaceAll(std::string s, const std::string &search,
+ const std::string &replace) {
size_t pos = 0;
while ((pos = s.find(search, pos)) != std::string::npos) {
s.replace(pos, search.length(), replace);
@@ -85,8 +85,8 @@ inline std::string ReplaceAll(std::string s, const std::string& search,
}
// ReplacePrefix replaces from with to in s if search is a prefix of s.
-inline bool ReplacePrefix(std::string* s, const std::string& from,
- const std::string& to) {
+inline bool ReplacePrefix(std::string *s, const std::string &from,
+ const std::string &to) {
size_t start_pos = s->find(from);
if (start_pos == std::string::npos || start_pos != 0) {
return false;
@@ -105,8 +105,8 @@ inline std::string CapitalizeFirst(std::string s) {
}
// RubyTypeOf updates a proto type to the required ruby equivalent.
-inline std::string RubyTypeOf(const std::string& a_type,
- const std::string& package) {
+inline std::string RubyTypeOf(const std::string &a_type,
+ const std::string &package) {
std::string res(a_type);
ReplacePrefix(&res, package, ""); // remove the leading package if present
ReplacePrefix(&res, ".", ""); // remove the leading . (no package)
diff --git a/src/compiler/ruby_plugin.cc b/src/compiler/ruby_plugin.cc
index 86c0e11e1c..9397452f55 100644
--- a/src/compiler/ruby_plugin.cc
+++ b/src/compiler/ruby_plugin.cc
@@ -52,10 +52,10 @@ class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
RubyGrpcGenerator() {}
~RubyGrpcGenerator() override {}
- bool Generate(const google::protobuf::FileDescriptor* file,
- const std::string& parameter,
- google::protobuf::compiler::GeneratorContext* context,
- std::string* error) const override {
+ bool Generate(const google::protobuf::FileDescriptor *file,
+ const std::string &parameter,
+ google::protobuf::compiler::GeneratorContext *context,
+ std::string *error) const override {
std::string code = grpc_ruby_generator::GetServices(file);
if (code.size() == 0) {
return true; // don't generate a file if there are no services
@@ -74,7 +74,7 @@ class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
}
};
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
RubyGrpcGenerator generator;
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}
diff --git a/src/core/channel/census_filter.c b/src/core/channel/census_filter.c
index 2799bded8a..ed60f0a5f6 100644
--- a/src/core/channel/census_filter.c
+++ b/src/core/channel/census_filter.c
@@ -178,19 +178,19 @@ static void destroy_channel_elem(grpc_channel_element* elem) {
}
const grpc_channel_filter grpc_client_census_filter = {
- client_call_op, channel_op,
+ client_call_op, channel_op,
- sizeof(call_data), client_init_call_elem, client_destroy_call_elem,
+ sizeof(call_data), client_init_call_elem, client_destroy_call_elem,
- sizeof(channel_data), init_channel_elem, destroy_channel_elem,
+ sizeof(channel_data), init_channel_elem, destroy_channel_elem,
"census-client"};
const grpc_channel_filter grpc_server_census_filter = {
- server_call_op, channel_op,
+ server_call_op, channel_op,
- sizeof(call_data), server_init_call_elem, server_destroy_call_elem,
+ sizeof(call_data), server_init_call_elem, server_destroy_call_elem,
- sizeof(channel_data), init_channel_elem, destroy_channel_elem,
+ sizeof(channel_data), init_channel_elem, destroy_channel_elem,
"census-server"};
diff --git a/src/core/channel/channel_stack.c b/src/core/channel/channel_stack.c
index 14fc800778..5ee412bf7d 100644
--- a/src/core/channel/channel_stack.c
+++ b/src/core/channel/channel_stack.c
@@ -54,7 +54,7 @@
/* Given a size, round up to the next multiple of sizeof(void*) */
#define ROUND_UP_TO_ALIGNMENT_SIZE(x) \
- (((x) + GPR_MAX_ALIGNMENT - 1) & ~(GPR_MAX_ALIGNMENT - 1))
+ (((x)+GPR_MAX_ALIGNMENT - 1) & ~(GPR_MAX_ALIGNMENT - 1))
size_t grpc_channel_stack_size(const grpc_channel_filter **filters,
size_t filter_count) {
@@ -190,13 +190,14 @@ void grpc_channel_next_op(grpc_channel_element *elem, grpc_channel_op *op) {
grpc_channel_stack *grpc_channel_stack_from_top_element(
grpc_channel_element *elem) {
- return (grpc_channel_stack *)((char *)(elem)-ROUND_UP_TO_ALIGNMENT_SIZE(
- sizeof(grpc_channel_stack)));
+ return (grpc_channel_stack *)((char *)(elem) -
+ ROUND_UP_TO_ALIGNMENT_SIZE(
+ sizeof(grpc_channel_stack)));
}
grpc_call_stack *grpc_call_stack_from_top_element(grpc_call_element *elem) {
- return (grpc_call_stack *)((char *)(elem)-ROUND_UP_TO_ALIGNMENT_SIZE(
- sizeof(grpc_call_stack)));
+ return (grpc_call_stack *)((char *)(elem) - ROUND_UP_TO_ALIGNMENT_SIZE(
+ sizeof(grpc_call_stack)));
}
static void do_nothing(void *user_data, grpc_op_error error) {}
diff --git a/src/core/channel/child_channel.c b/src/core/channel/child_channel.c
index 3778f4fb88..f400e9b670 100644
--- a/src/core/channel/child_channel.c
+++ b/src/core/channel/child_channel.c
@@ -165,9 +165,9 @@ static void lb_destroy_channel_elem(grpc_channel_element *elem) {
}
const grpc_channel_filter grpc_child_channel_top_filter = {
- lb_call_op, lb_channel_op,
+ lb_call_op, lb_channel_op,
- sizeof(lb_call_data), lb_init_call_elem, lb_destroy_call_elem,
+ sizeof(lb_call_data), lb_init_call_elem, lb_destroy_call_elem,
sizeof(lb_channel_data), lb_init_channel_elem, lb_destroy_channel_elem,
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c
index 46283835a0..fa75561c78 100644
--- a/src/core/channel/client_channel.c
+++ b/src/core/channel/client_channel.c
@@ -450,9 +450,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
const grpc_channel_filter grpc_client_channel_filter = {
- call_op, channel_op,
+ call_op, channel_op,
- sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(call_data), init_call_elem, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
diff --git a/src/core/channel/connected_channel.c b/src/core/channel/connected_channel.c
index 30de10905c..e01cb81a89 100644
--- a/src/core/channel/connected_channel.c
+++ b/src/core/channel/connected_channel.c
@@ -69,7 +69,7 @@ typedef struct {
/* We perform a small hack to locate transport data alongside the connected
channel data in call allocations, to allow everything to be pulled in minimal
cache line requests */
-#define TRANSPORT_STREAM_FROM_CALL_DATA(calld) ((grpc_stream *)((calld) + 1))
+#define TRANSPORT_STREAM_FROM_CALL_DATA(calld) ((grpc_stream *)((calld)+1))
#define CALL_DATA_FROM_TRANSPORT_STREAM(transport_stream) \
(((call_data *)(transport_stream)) - 1)
@@ -257,9 +257,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
const grpc_channel_filter grpc_connected_channel_filter = {
- call_op, channel_op,
+ call_op, channel_op,
- sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(call_data), init_call_elem, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c
index ab9d3aff16..b139b72795 100644
--- a/src/core/channel/http_client_filter.c
+++ b/src/core/channel/http_client_filter.c
@@ -178,9 +178,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
const grpc_channel_filter grpc_http_client_filter = {
- call_op, channel_op,
+ call_op, channel_op,
- sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(call_data), init_call_elem, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
diff --git a/src/core/channel/http_filter.c b/src/core/channel/http_filter.c
index 6cfe34695c..846f7b9713 100644
--- a/src/core/channel/http_filter.c
+++ b/src/core/channel/http_filter.c
@@ -132,9 +132,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
const grpc_channel_filter grpc_http_filter = {
- call_op, channel_op,
+ call_op, channel_op,
- sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(call_data), init_call_elem, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c
index 44eab43f09..19b9606b43 100644
--- a/src/core/channel/http_server_filter.c
+++ b/src/core/channel/http_server_filter.c
@@ -244,9 +244,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
const grpc_channel_filter grpc_http_server_filter = {
- call_op, channel_op,
+ call_op, channel_op,
- sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(call_data), init_call_elem, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
diff --git a/src/core/channel/metadata_buffer.c b/src/core/channel/metadata_buffer.c
index d4de4ba576..75fd90b707 100644
--- a/src/core/channel/metadata_buffer.c
+++ b/src/core/channel/metadata_buffer.c
@@ -61,7 +61,7 @@ struct grpc_metadata_buffer_impl {
size_t elem_cap;
};
-#define ELEMS(buffer) ((qelem *)((buffer) + 1))
+#define ELEMS(buffer) ((qelem *)((buffer)+1))
void grpc_metadata_buffer_init(grpc_metadata_buffer *buffer) {
/* start buffer as NULL, indicating no elements */
diff --git a/src/core/channel/noop_filter.c b/src/core/channel/noop_filter.c
index 6f854a2b87..b6b3f661f7 100644
--- a/src/core/channel/noop_filter.c
+++ b/src/core/channel/noop_filter.c
@@ -131,9 +131,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
const grpc_channel_filter grpc_no_op_filter = {
- call_op, channel_op,
+ call_op, channel_op,
- sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(call_data), init_call_elem, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
diff --git a/src/core/security/auth.c b/src/core/security/auth.c
index e36bf2382f..f743b25838 100644
--- a/src/core/security/auth.c
+++ b/src/core/security/auth.c
@@ -157,5 +157,6 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
const grpc_channel_filter grpc_client_auth_filter = {
- call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem,
- sizeof(channel_data), init_channel_elem, destroy_channel_elem, "auth"};
+ call_op, channel_op, sizeof(call_data),
+ init_call_elem, destroy_call_elem, sizeof(channel_data),
+ init_channel_elem, destroy_channel_elem, "auth"};
diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c
index 421b81fd36..3a70f44a0a 100644
--- a/src/core/security/security_context.c
+++ b/src/core/security/security_context.c
@@ -413,10 +413,10 @@ grpc_security_status grpc_ssl_server_security_context_create(
(const unsigned char **)&config->pem_private_key,
&config->pem_private_key_size,
(const unsigned char **)&config->pem_cert_chain,
- &config->pem_cert_chain_size, 1,
- config->pem_root_certs, config->pem_root_certs_size,
- GRPC_SSL_CIPHER_SUITES, alpn_protocol_strings,
- alpn_protocol_string_lengths, num_alpn_protocols, &c->handshaker_factory);
+ &config->pem_cert_chain_size, 1, config->pem_root_certs,
+ config->pem_root_certs_size, GRPC_SSL_CIPHER_SUITES,
+ alpn_protocol_strings, alpn_protocol_string_lengths, num_alpn_protocols,
+ &c->handshaker_factory);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result));
diff --git a/src/core/statistics/census_rpc_stats.c b/src/core/statistics/census_rpc_stats.c
index 2db3054a0d..39094b5f65 100644
--- a/src/core/statistics/census_rpc_stats.c
+++ b/src/core/statistics/census_rpc_stats.c
@@ -85,8 +85,9 @@ static void delete_key(void* key) { gpr_free(key); }
static const census_ht_option ht_opt = {
CENSUS_HT_POINTER /* key type */, 1999 /* n_of_buckets */,
- simple_hash /* hash function */, cmp_str_keys /* key comparator */,
- delete_stats /* data deleter */, delete_key /* key deleter */};
+ simple_hash /* hash function */, cmp_str_keys /* key comparator */,
+ delete_stats /* data deleter */, delete_key /* key deleter */
+};
static void init_rpc_stats(void* stats) {
memset(stats, 0, sizeof(census_rpc_stats));
diff --git a/src/core/statistics/census_tracing.c b/src/core/statistics/census_tracing.c
index 8c7cf11642..1e61602071 100644
--- a/src/core/statistics/census_tracing.c
+++ b/src/core/statistics/census_tracing.c
@@ -76,7 +76,8 @@ static void delete_trace_obj(void* obj) { trace_obj_destroy((trace_obj*)obj); }
static const census_ht_option ht_opt = {
CENSUS_HT_UINT64 /* key type*/, 571 /* n_of_buckets */, NULL /* hash */,
NULL /* compare_keys */, delete_trace_obj /* delete data */,
- NULL /* delete key */};
+ NULL /* delete key */
+};
static gpr_once g_init_mutex_once = GPR_ONCE_INIT;
static gpr_mu g_mu; /* Guards following two static variables. */
diff --git a/src/core/support/murmur_hash.c b/src/core/support/murmur_hash.c
index 5d30263e52..08b1eb80d8 100644
--- a/src/core/support/murmur_hash.c
+++ b/src/core/support/murmur_hash.c
@@ -46,8 +46,8 @@
handle aligned reads, do the conversion here */
#define GETBLOCK32(p, i) (p)[(i)]
-gpr_uint32 gpr_murmur_hash3(const void* key, size_t len, gpr_uint32 seed) {
- const gpr_uint8* data = (const gpr_uint8*)key;
+gpr_uint32 gpr_murmur_hash3(const void *key, size_t len, gpr_uint32 seed) {
+ const gpr_uint8 *data = (const gpr_uint8 *)key;
const int nblocks = len / 4;
int i;
@@ -57,8 +57,8 @@ gpr_uint32 gpr_murmur_hash3(const void* key, size_t len, gpr_uint32 seed) {
const gpr_uint32 c1 = 0xcc9e2d51;
const gpr_uint32 c2 = 0x1b873593;
- const gpr_uint32* blocks = (const uint32_t*)(data + nblocks * 4);
- const uint8_t* tail = (const uint8_t*)(data + nblocks * 4);
+ const gpr_uint32 *blocks = (const uint32_t *)(data + nblocks * 4);
+ const uint8_t *tail = (const uint8_t *)(data + nblocks * 4);
/* body */
for (i = -nblocks; i; i++) {
diff --git a/src/core/surface/call.c b/src/core/surface/call.c
index 26bfa02ad1..46502fb6b1 100644
--- a/src/core/surface/call.c
+++ b/src/core/surface/call.c
@@ -198,7 +198,7 @@ struct grpc_call {
gpr_refcount internal_refcount;
};
-#define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1))
+#define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call)+1))
#define CALL_FROM_CALL_STACK(call_stack) (((grpc_call *)(call_stack)) - 1)
#define CALL_ELEM_FROM_CALL(call, idx) \
grpc_call_stack_element(CALL_STACK_FROM_CALL(call), idx)
@@ -801,7 +801,7 @@ static gpr_uint32 decode_status(grpc_mdelem *md) {
gpr_uint32 status;
void *user_data = grpc_mdelem_get_user_data(md, destroy_status);
if (user_data) {
- status = ((gpr_uint32)(gpr_intptr)user_data) - STATUS_OFFSET;
+ status = ((gpr_uint32)(gpr_intptr) user_data) - STATUS_OFFSET;
} else {
if (!gpr_parse_bytes_to_uint32(grpc_mdstr_as_c_string(md->value),
GPR_SLICE_LENGTH(md->value->slice),
diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c
index a1bcea58dd..8ef13675fe 100644
--- a/src/core/surface/channel.c
+++ b/src/core/surface/channel.c
@@ -51,7 +51,7 @@ struct grpc_channel {
grpc_mdstr *authority_string;
};
-#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c) + 1))
+#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c)+1))
grpc_channel *grpc_channel_create_from_filters(
const grpc_channel_filter **filters, size_t num_filters,
diff --git a/src/core/surface/client.c b/src/core/surface/client.c
index 524b0718a9..74c79bdf9b 100644
--- a/src/core/surface/client.c
+++ b/src/core/surface/client.c
@@ -109,9 +109,9 @@ static void init_channel_elem(grpc_channel_element *elem,
static void destroy_channel_elem(grpc_channel_element *elem) {}
const grpc_channel_filter grpc_client_surface_filter = {
- call_op, channel_op,
+ call_op, channel_op,
- sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(call_data), init_call_elem, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c
index 5fa3e42362..a5244dbe61 100644
--- a/src/core/surface/lame_client.c
+++ b/src/core/surface/lame_client.c
@@ -111,9 +111,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
static const grpc_channel_filter lame_filter = {
- call_op, channel_op,
+ call_op, channel_op,
- sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(call_data), init_call_elem, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
diff --git a/src/core/surface/server.c b/src/core/surface/server.c
index 846a00c94f..cbdd3bfa30 100644
--- a/src/core/surface/server.c
+++ b/src/core/surface/server.c
@@ -411,9 +411,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
}
static const grpc_channel_filter server_surface_filter = {
- call_op, channel_op,
+ call_op, channel_op,
- sizeof(call_data), init_call_elem, destroy_call_elem,
+ sizeof(call_data), init_call_elem, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
diff --git a/src/core/transport/chttp2/hpack_table.c b/src/core/transport/chttp2/hpack_table.c
index ae8bfa8009..8f2ebecfeb 100644
--- a/src/core/transport/chttp2/hpack_table.c
+++ b/src/core/transport/chttp2/hpack_table.c
@@ -43,68 +43,68 @@ static struct {
const char *key;
const char *value;
} static_table[] = {
- /* 0: */ {NULL, NULL},
- /* 1: */ {":authority", ""},
- /* 2: */ {":method", "GET"},
- /* 3: */ {":method", "POST"},
- /* 4: */ {":path", "/"},
- /* 5: */ {":path", "/index.html"},
- /* 6: */ {":scheme", "http"},
- /* 7: */ {":scheme", "https"},
- /* 8: */ {":status", "200"},
- /* 9: */ {":status", "204"},
- /* 10: */ {":status", "206"},
- /* 11: */ {":status", "304"},
- /* 12: */ {":status", "400"},
- /* 13: */ {":status", "404"},
- /* 14: */ {":status", "500"},
- /* 15: */ {"accept-charset", ""},
- /* 16: */ {"accept-encoding", "gzip, deflate"},
- /* 17: */ {"accept-language", ""},
- /* 18: */ {"accept-ranges", ""},
- /* 19: */ {"accept", ""},
- /* 20: */ {"access-control-allow-origin", ""},
- /* 21: */ {"age", ""},
- /* 22: */ {"allow", ""},
- /* 23: */ {"authorization", ""},
- /* 24: */ {"cache-control", ""},
- /* 25: */ {"content-disposition", ""},
- /* 26: */ {"content-encoding", ""},
- /* 27: */ {"content-language", ""},
- /* 28: */ {"content-length", ""},
- /* 29: */ {"content-location", ""},
- /* 30: */ {"content-range", ""},
- /* 31: */ {"content-type", ""},
- /* 32: */ {"cookie", ""},
- /* 33: */ {"date", ""},
- /* 34: */ {"etag", ""},
- /* 35: */ {"expect", ""},
- /* 36: */ {"expires", ""},
- /* 37: */ {"from", ""},
- /* 38: */ {"host", ""},
- /* 39: */ {"if-match", ""},
- /* 40: */ {"if-modified-since", ""},
- /* 41: */ {"if-none-match", ""},
- /* 42: */ {"if-range", ""},
- /* 43: */ {"if-unmodified-since", ""},
- /* 44: */ {"last-modified", ""},
- /* 45: */ {"link", ""},
- /* 46: */ {"location", ""},
- /* 47: */ {"max-forwards", ""},
- /* 48: */ {"proxy-authenticate", ""},
- /* 49: */ {"proxy-authorization", ""},
- /* 50: */ {"range", ""},
- /* 51: */ {"referer", ""},
- /* 52: */ {"refresh", ""},
- /* 53: */ {"retry-after", ""},
- /* 54: */ {"server", ""},
- /* 55: */ {"set-cookie", ""},
- /* 56: */ {"strict-transport-security", ""},
- /* 57: */ {"transfer-encoding", ""},
- /* 58: */ {"user-agent", ""},
- /* 59: */ {"vary", ""},
- /* 60: */ {"via", ""},
- /* 61: */ {"www-authenticate", ""},
+ /* 0: */ {NULL, NULL},
+ /* 1: */ {":authority", ""},
+ /* 2: */ {":method", "GET"},
+ /* 3: */ {":method", "POST"},
+ /* 4: */ {":path", "/"},
+ /* 5: */ {":path", "/index.html"},
+ /* 6: */ {":scheme", "http"},
+ /* 7: */ {":scheme", "https"},
+ /* 8: */ {":status", "200"},
+ /* 9: */ {":status", "204"},
+ /* 10: */ {":status", "206"},
+ /* 11: */ {":status", "304"},
+ /* 12: */ {":status", "400"},
+ /* 13: */ {":status", "404"},
+ /* 14: */ {":status", "500"},
+ /* 15: */ {"accept-charset", ""},
+ /* 16: */ {"accept-encoding", "gzip, deflate"},
+ /* 17: */ {"accept-language", ""},
+ /* 18: */ {"accept-ranges", ""},
+ /* 19: */ {"accept", ""},
+ /* 20: */ {"access-control-allow-origin", ""},
+ /* 21: */ {"age", ""},
+ /* 22: */ {"allow", ""},
+ /* 23: */ {"authorization", ""},
+ /* 24: */ {"cache-control", ""},
+ /* 25: */ {"content-disposition", ""},
+ /* 26: */ {"content-encoding", ""},
+ /* 27: */ {"content-language", ""},
+ /* 28: */ {"content-length", ""},
+ /* 29: */ {"content-location", ""},
+ /* 30: */ {"content-range", ""},
+ /* 31: */ {"content-type", ""},
+ /* 32: */ {"cookie", ""},
+ /* 33: */ {"date", ""},
+ /* 34: */ {"etag", ""},
+ /* 35: */ {"expect", ""},
+ /* 36: */ {"expires", ""},
+ /* 37: */ {"from", ""},
+ /* 38: */ {"host", ""},
+ /* 39: */ {"if-match", ""},
+ /* 40: */ {"if-modified-since", ""},
+ /* 41: */ {"if-none-match", ""},
+ /* 42: */ {"if-range", ""},
+ /* 43: */ {"if-unmodified-since", ""},
+ /* 44: */ {"last-modified", ""},
+ /* 45: */ {"link", ""},
+ /* 46: */ {"location", ""},
+ /* 47: */ {"max-forwards", ""},
+ /* 48: */ {"proxy-authenticate", ""},
+ /* 49: */ {"proxy-authorization", ""},
+ /* 50: */ {"range", ""},
+ /* 51: */ {"referer", ""},
+ /* 52: */ {"refresh", ""},
+ /* 53: */ {"retry-after", ""},
+ /* 54: */ {"server", ""},
+ /* 55: */ {"set-cookie", ""},
+ /* 56: */ {"strict-transport-security", ""},
+ /* 57: */ {"transfer-encoding", ""},
+ /* 58: */ {"user-agent", ""},
+ /* 59: */ {"vary", ""},
+ /* 60: */ {"via", ""},
+ /* 61: */ {"www-authenticate", ""},
};
void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl *tbl, grpc_mdctx *mdctx) {
diff --git a/src/core/transport/chttp2/varint.h b/src/core/transport/chttp2/varint.h
index 940df00a99..55f92af3d6 100644
--- a/src/core/transport/chttp2/varint.h
+++ b/src/core/transport/chttp2/varint.h
@@ -58,16 +58,16 @@ void grpc_chttp2_hpack_write_varint_tail(gpr_uint32 tail_value,
: grpc_chttp2_hpack_varint_length( \
(n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits)))
-#define GRPC_CHTTP2_WRITE_VARINT(n, prefix_bits, prefix_or, target, length) \
- do { \
- gpr_uint8* tgt = target; \
- if ((length) == 1) { \
- (tgt)[0] = (prefix_or) | (n); \
- } else { \
- (tgt)[0] = (prefix_or) | GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits); \
- grpc_chttp2_hpack_write_varint_tail( \
- (n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits), (tgt) + 1, (length)-1); \
- } \
+#define GRPC_CHTTP2_WRITE_VARINT(n, prefix_bits, prefix_or, target, length) \
+ do { \
+ gpr_uint8* tgt = target; \
+ if ((length) == 1) { \
+ (tgt)[0] = (prefix_or) | (n); \
+ } else { \
+ (tgt)[0] = (prefix_or) | GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits); \
+ grpc_chttp2_hpack_write_varint_tail( \
+ (n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits), (tgt)+1, (length)-1); \
+ } \
} while (0)
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_VARINT_H__ */
diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index 1b90d4715b..6078e1b65b 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/transport/chttp2_transport.c
@@ -525,7 +525,7 @@ static int init_stream(grpc_transport *gt, grpc_stream *gs,
lock(t);
s->id = 0;
} else {
- s->id = (gpr_uint32)(gpr_uintptr)server_data;
+ s->id = (gpr_uint32)(gpr_uintptr) server_data;
t->incoming_stream = s;
grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
}
@@ -1238,7 +1238,7 @@ static int init_header_frame_parser(transport *t, int is_continuation) {
t->incoming_stream = NULL;
/* if stream is accepted, we set incoming_stream in init_stream */
t->cb->accept_stream(t->cb_user_data, &t->base,
- (void *)(gpr_uintptr)t->incoming_stream_id);
+ (void *)(gpr_uintptr) t->incoming_stream_id);
s = t->incoming_stream;
if (!s) {
gpr_log(GPR_ERROR, "stream not accepted");
@@ -1503,8 +1503,8 @@ static int process_read(transport *t, gpr_slice slice) {
"Connect string mismatch: expected '%c' (%d) got '%c' (%d) "
"at byte %d",
CLIENT_CONNECT_STRING[t->deframe_state],
- (int)(gpr_uint8)CLIENT_CONNECT_STRING[t->deframe_state], *cur,
- (int)*cur, t->deframe_state);
+ (int)(gpr_uint8) CLIENT_CONNECT_STRING[t->deframe_state],
+ *cur, (int)*cur, t->deframe_state);
return 0;
}
++cur;
@@ -1737,9 +1737,9 @@ static void add_to_pollset(grpc_transport *gt, grpc_pollset *pollset) {
*/
static const grpc_transport_vtable vtable = {
- sizeof(stream), init_stream, send_batch, set_allow_window_updates,
- add_to_pollset, destroy_stream, abort_stream, goaway, close_transport,
- send_ping, destroy_transport};
+ sizeof(stream), init_stream, send_batch, set_allow_window_updates,
+ add_to_pollset, destroy_stream, abort_stream, goaway,
+ close_transport, send_ping, destroy_transport};
void grpc_create_chttp2_transport(grpc_transport_setup_callback setup,
void *arg,
diff --git a/src/core/tsi/fake_transport_security.c b/src/core/tsi/fake_transport_security.c
index 446329215f..756b2173ec 100644
--- a/src/core/tsi/fake_transport_security.c
+++ b/src/core/tsi/fake_transport_security.c
@@ -120,7 +120,7 @@ static void store32_little_endian(gpr_uint32 value, unsigned char* buf) {
buf[3] = (unsigned char)(value >> 24) & 0xFF;
buf[2] = (unsigned char)(value >> 16) & 0xFF;
buf[1] = (unsigned char)(value >> 8) & 0xFF;
- buf[0] = (unsigned char)(value)&0xFF;
+ buf[0] = (unsigned char)(value) & 0xFF;
}
static void tsi_fake_frame_reset(tsi_fake_frame* frame, int needs_draining) {
@@ -230,10 +230,11 @@ static void tsi_fake_frame_destruct(tsi_fake_frame* frame) {
/* --- tsi_frame_protector methods implementation. ---*/
-static tsi_result fake_protector_protect(
- tsi_frame_protector* self, const unsigned char* unprotected_bytes,
- size_t* unprotected_bytes_size, unsigned char* protected_output_frames,
- size_t* protected_output_frames_size) {
+static tsi_result fake_protector_protect(tsi_frame_protector* self,
+ const unsigned char* unprotected_bytes,
+ size_t* unprotected_bytes_size,
+ unsigned char* protected_output_frames,
+ size_t* protected_output_frames_size) {
tsi_result result = TSI_OK;
tsi_fake_frame_protector* impl = (tsi_fake_frame_protector*)self;
unsigned char frame_header[TSI_FAKE_FRAME_HEADER_SIZE];
@@ -480,8 +481,10 @@ static void fake_handshaker_destroy(tsi_handshaker* self) {
static const tsi_handshaker_vtable handshaker_vtable = {
fake_handshaker_get_bytes_to_send_to_peer,
- fake_handshaker_process_bytes_from_peer, fake_handshaker_get_result,
- fake_handshaker_extract_peer, fake_handshaker_create_frame_protector,
+ fake_handshaker_process_bytes_from_peer,
+ fake_handshaker_get_result,
+ fake_handshaker_extract_peer,
+ fake_handshaker_create_frame_protector,
fake_handshaker_destroy,
};
diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c
index 02af080a31..1159254a8c 100644
--- a/src/core/tsi/ssl_transport_security.c
+++ b/src/core/tsi/ssl_transport_security.c
@@ -573,10 +573,11 @@ static tsi_result build_alpn_protocol_name_list(
/* --- tsi_frame_protector methods implementation. ---*/
-static tsi_result ssl_protector_protect(
- tsi_frame_protector* self, const unsigned char* unprotected_bytes,
- size_t* unprotected_bytes_size, unsigned char* protected_output_frames,
- size_t* protected_output_frames_size) {
+static tsi_result ssl_protector_protect(tsi_frame_protector* self,
+ const unsigned char* unprotected_bytes,
+ size_t* unprotected_bytes_size,
+ unsigned char* protected_output_frames,
+ size_t* protected_output_frames_size) {
tsi_ssl_frame_protector* impl = (tsi_ssl_frame_protector*)self;
int read_from_ssl;
size_t available;
@@ -707,8 +708,9 @@ static const tsi_frame_protector_vtable frame_protector_vtable = {
/* --- tsi_handshaker methods implementation. ---*/
-static tsi_result ssl_handshaker_get_bytes_to_send_to_peer(
- tsi_handshaker* self, unsigned char* bytes, size_t* bytes_size) {
+static tsi_result ssl_handshaker_get_bytes_to_send_to_peer(tsi_handshaker* self,
+ unsigned char* bytes,
+ size_t* bytes_size) {
tsi_ssl_handshaker* impl = (tsi_ssl_handshaker*)self;
int bytes_read_from_ssl = 0;
if (bytes == NULL || bytes_size == NULL || *bytes_size == 0 ||
@@ -871,8 +873,10 @@ static void ssl_handshaker_destroy(tsi_handshaker* self) {
static const tsi_handshaker_vtable handshaker_vtable = {
ssl_handshaker_get_bytes_to_send_to_peer,
- ssl_handshaker_process_bytes_from_peer, ssl_handshaker_get_result,
- ssl_handshaker_extract_peer, ssl_handshaker_create_frame_protector,
+ ssl_handshaker_process_bytes_from_peer,
+ ssl_handshaker_get_result,
+ ssl_handshaker_extract_peer,
+ ssl_handshaker_create_frame_protector,
ssl_handshaker_destroy,
};
@@ -1157,8 +1161,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
tsi_result tsi_create_ssl_server_handshaker_factory(
const unsigned char** pem_private_keys,
- const size_t* pem_private_keys_sizes,
- const unsigned char** pem_cert_chains,
+ const size_t* pem_private_keys_sizes, const unsigned char** pem_cert_chains,
const size_t* pem_cert_chains_sizes, size_t key_cert_pair_count,
const unsigned char* pem_client_root_certs,
size_t pem_client_root_certs_size, const char* cipher_list,
diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h
index 9c839b9d3a..3a33deacac 100644
--- a/src/core/tsi/ssl_transport_security.h
+++ b/src/core/tsi/ssl_transport_security.h
@@ -132,8 +132,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
where a parameter is invalid. */
tsi_result tsi_create_ssl_server_handshaker_factory(
const unsigned char** pem_private_keys,
- const size_t* pem_private_keys_sizes,
- const unsigned char** pem_cert_chains,
+ const size_t* pem_private_keys_sizes, const unsigned char** pem_cert_chains,
const size_t* pem_cert_chains_sizes, size_t key_cert_pair_count,
const unsigned char* pem_client_root_certs,
size_t pem_client_root_certs_size, const char* cipher_suites,
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index ddda8c22d6..a8919a10d9 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -53,7 +53,7 @@
namespace grpc {
-Channel::Channel(const grpc::string& target, const ChannelArguments& args)
+Channel::Channel(const grpc::string &target, const ChannelArguments &args)
: target_(target) {
grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args);
@@ -61,15 +61,15 @@ Channel::Channel(const grpc::string& target, const ChannelArguments& args)
target_.c_str(), channel_args.num_args > 0 ? &channel_args : nullptr);
}
-Channel::Channel(const grpc::string& target,
- const std::unique_ptr<Credentials>& creds,
- const ChannelArguments& args)
+Channel::Channel(const grpc::string &target,
+ const std::unique_ptr<Credentials> &creds,
+ const ChannelArguments &args)
: target_(args.GetSslTargetNameOverride().empty()
? target
: args.GetSslTargetNameOverride()) {
grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args);
- grpc_credentials* c_creds = creds ? creds->GetRawCreds() : nullptr;
+ grpc_credentials *c_creds = creds ? creds->GetRawCreds() : nullptr;
c_channel_ = grpc_secure_channel_create(
c_creds, target.c_str(),
channel_args.num_args > 0 ? &channel_args : nullptr);
@@ -79,9 +79,9 @@ Channel::~Channel() { grpc_channel_destroy(c_channel_); }
namespace {
// Pluck the finished event and set to status when it is not nullptr.
-void GetFinalStatus(grpc_completion_queue* cq, void* finished_tag,
- Status* status) {
- grpc_event* ev =
+void GetFinalStatus(grpc_completion_queue *cq, void *finished_tag,
+ Status *status) {
+ grpc_event *ev =
grpc_completion_queue_pluck(cq, finished_tag, gpr_inf_future);
if (status) {
StatusCode error_code = static_cast<StatusCode>(ev->data.finished.status);
@@ -94,23 +94,23 @@ void GetFinalStatus(grpc_completion_queue* cq, void* finished_tag,
} // namespace
// TODO(yangg) more error handling
-Status Channel::StartBlockingRpc(const RpcMethod& method,
- ClientContext* context,
- const google::protobuf::Message& request,
- google::protobuf::Message* result) {
+Status Channel::StartBlockingRpc(const RpcMethod &method,
+ ClientContext *context,
+ const google::protobuf::Message &request,
+ google::protobuf::Message *result) {
Status status;
- grpc_call* call = grpc_channel_create_call(
+ grpc_call *call = grpc_channel_create_call(
c_channel_, method.name(), target_.c_str(), context->RawDeadline());
context->set_call(call);
- grpc_event* ev;
- void* finished_tag = reinterpret_cast<char*>(call);
- void* invoke_tag = reinterpret_cast<char*>(call) + 1;
- void* metadata_read_tag = reinterpret_cast<char*>(call) + 2;
- void* write_tag = reinterpret_cast<char*>(call) + 3;
- void* halfclose_tag = reinterpret_cast<char*>(call) + 4;
- void* read_tag = reinterpret_cast<char*>(call) + 5;
+ grpc_event *ev;
+ void *finished_tag = reinterpret_cast<char *>(call);
+ void *invoke_tag = reinterpret_cast<char *>(call) + 1;
+ void *metadata_read_tag = reinterpret_cast<char *>(call) + 2;
+ void *write_tag = reinterpret_cast<char *>(call) + 3;
+ void *halfclose_tag = reinterpret_cast<char *>(call) + 4;
+ void *read_tag = reinterpret_cast<char *>(call) + 5;
- grpc_completion_queue* cq = grpc_completion_queue_create();
+ grpc_completion_queue *cq = grpc_completion_queue_create();
context->set_cq(cq);
// add_metadata from context
//
@@ -126,7 +126,7 @@ Status Channel::StartBlockingRpc(const RpcMethod& method,
return status;
}
// write request
- grpc_byte_buffer* write_buffer = nullptr;
+ grpc_byte_buffer *write_buffer = nullptr;
success = SerializeProto(request, &write_buffer);
if (!success) {
grpc_call_cancel(call);
@@ -172,14 +172,14 @@ Status Channel::StartBlockingRpc(const RpcMethod& method,
return status;
}
-StreamContextInterface* Channel::CreateStream(
- const RpcMethod& method, ClientContext* context,
- const google::protobuf::Message* request,
- google::protobuf::Message* result) {
- grpc_call* call = grpc_channel_create_call(
+StreamContextInterface *Channel::CreateStream(
+ const RpcMethod &method, ClientContext *context,
+ const google::protobuf::Message *request,
+ google::protobuf::Message *result) {
+ grpc_call *call = grpc_channel_create_call(
c_channel_, method.name(), target_.c_str(), context->RawDeadline());
context->set_call(call);
- grpc_completion_queue* cq = grpc_completion_queue_create();
+ grpc_completion_queue *cq = grpc_completion_queue_create();
context->set_cq(cq);
return new StreamContext(method, context, request, result);
}
diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h
index 8de1180ac2..67d18bf4c8 100644
--- a/src/cpp/client/channel.h
+++ b/src/cpp/client/channel.h
@@ -48,24 +48,24 @@ class StreamContextInterface;
class Channel : public ChannelInterface {
public:
- Channel(const grpc::string& target, const ChannelArguments& args);
- Channel(const grpc::string& target, const std::unique_ptr<Credentials>& creds,
- const ChannelArguments& args);
+ Channel(const grpc::string &target, const ChannelArguments &args);
+ Channel(const grpc::string &target, const std::unique_ptr<Credentials> &creds,
+ const ChannelArguments &args);
~Channel() override;
- Status StartBlockingRpc(const RpcMethod& method, ClientContext* context,
- const google::protobuf::Message& request,
- google::protobuf::Message* result) override;
+ Status StartBlockingRpc(const RpcMethod &method, ClientContext *context,
+ const google::protobuf::Message &request,
+ google::protobuf::Message *result) override;
- StreamContextInterface* CreateStream(
- const RpcMethod& method, ClientContext* context,
- const google::protobuf::Message* request,
- google::protobuf::Message* result) override;
+ StreamContextInterface *CreateStream(
+ const RpcMethod &method, ClientContext *context,
+ const google::protobuf::Message *request,
+ google::protobuf::Message *result) override;
private:
const grpc::string target_;
- grpc_channel* c_channel_; // owned
+ grpc_channel *c_channel_; // owned
};
} // namespace grpc
diff --git a/src/cpp/client/channel_arguments.cc b/src/cpp/client/channel_arguments.cc
index eba9c1e76a..70713f015f 100644
--- a/src/cpp/client/channel_arguments.cc
+++ b/src/cpp/client/channel_arguments.cc
@@ -37,7 +37,7 @@
namespace grpc {
-void ChannelArguments::SetSslTargetNameOverride(const grpc::string& name) {
+void ChannelArguments::SetSslTargetNameOverride(const grpc::string &name) {
SetString(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, name);
}
@@ -50,32 +50,32 @@ grpc::string ChannelArguments::GetSslTargetNameOverride() const {
return "";
}
-void ChannelArguments::SetInt(const grpc::string& key, int value) {
+void ChannelArguments::SetInt(const grpc::string &key, int value) {
grpc_arg arg;
arg.type = GRPC_ARG_INTEGER;
strings_.push_back(key);
- arg.key = const_cast<char*>(strings_.back().c_str());
+ arg.key = const_cast<char *>(strings_.back().c_str());
arg.value.integer = value;
args_.push_back(arg);
}
-void ChannelArguments::SetString(const grpc::string& key,
- const grpc::string& value) {
+void ChannelArguments::SetString(const grpc::string &key,
+ const grpc::string &value) {
grpc_arg arg;
arg.type = GRPC_ARG_STRING;
strings_.push_back(key);
- arg.key = const_cast<char*>(strings_.back().c_str());
+ arg.key = const_cast<char *>(strings_.back().c_str());
strings_.push_back(value);
- arg.value.string = const_cast<char*>(strings_.back().c_str());
+ arg.value.string = const_cast<char *>(strings_.back().c_str());
args_.push_back(arg);
}
-void ChannelArguments::SetChannelArgs(grpc_channel_args* channel_args) const {
+void ChannelArguments::SetChannelArgs(grpc_channel_args *channel_args) const {
channel_args->num_args = args_.size();
if (channel_args->num_args > 0) {
- channel_args->args = const_cast<grpc_arg*>(&args_[0]);
+ channel_args->args = const_cast<grpc_arg *>(&args_[0]);
}
}
diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc
index 505b7d89b4..7bda2d07c3 100644
--- a/src/cpp/client/client_context.cc
+++ b/src/cpp/client/client_context.cc
@@ -50,7 +50,7 @@ ClientContext::~ClientContext() {
if (cq_) {
grpc_completion_queue_shutdown(cq_);
// Drain cq_.
- grpc_event* ev;
+ grpc_event *ev;
grpc_completion_type t;
do {
ev = grpc_completion_queue_next(cq_, gpr_inf_future);
@@ -62,7 +62,7 @@ ClientContext::~ClientContext() {
}
void ClientContext::set_absolute_deadline(
- const system_clock::time_point& deadline) {
+ const system_clock::time_point &deadline) {
Timepoint2Timespec(deadline, &absolute_deadline_);
}
@@ -70,8 +70,8 @@ system_clock::time_point ClientContext::absolute_deadline() {
return Timespec2Timepoint(absolute_deadline_);
}
-void ClientContext::AddMetadata(const grpc::string& meta_key,
- const grpc::string& meta_value) {
+void ClientContext::AddMetadata(const grpc::string &meta_key,
+ const grpc::string &meta_value) {
return;
}
diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc
index 1a88d7f2f1..9cc5cff214 100644
--- a/src/cpp/client/create_channel.cc
+++ b/src/cpp/client/create_channel.cc
@@ -40,14 +40,14 @@
namespace grpc {
class ChannelArguments;
-std::shared_ptr<ChannelInterface> CreateChannel(const grpc::string& target,
- const ChannelArguments& args) {
+std::shared_ptr<ChannelInterface> CreateChannel(const grpc::string &target,
+ const ChannelArguments &args) {
return std::shared_ptr<ChannelInterface>(new Channel(target, args));
}
std::shared_ptr<ChannelInterface> CreateChannel(
- const grpc::string& target, const std::unique_ptr<Credentials>& creds,
- const ChannelArguments& args) {
+ const grpc::string &target, const std::unique_ptr<Credentials> &creds,
+ const ChannelArguments &args) {
return std::shared_ptr<ChannelInterface>(new Channel(target, creds, args));
}
} // namespace grpc
diff --git a/src/cpp/client/credentials.cc b/src/cpp/client/credentials.cc
index d81cf9f4d0..0955fa28ae 100644
--- a/src/cpp/client/credentials.cc
+++ b/src/cpp/client/credentials.cc
@@ -40,37 +40,37 @@
namespace grpc {
-Credentials::Credentials(grpc_credentials* c_creds) : creds_(c_creds) {}
+Credentials::Credentials(grpc_credentials *c_creds) : creds_(c_creds) {}
Credentials::~Credentials() { grpc_credentials_release(creds_); }
-grpc_credentials* Credentials::GetRawCreds() { return creds_; }
+grpc_credentials *Credentials::GetRawCreds() { return creds_; }
std::unique_ptr<Credentials> CredentialsFactory::DefaultCredentials() {
- grpc_credentials* c_creds = grpc_default_credentials_create();
+ grpc_credentials *c_creds = grpc_default_credentials_create();
std::unique_ptr<Credentials> cpp_creds(new Credentials(c_creds));
return cpp_creds;
}
// Builds SSL Credentials given SSL specific options
std::unique_ptr<Credentials> CredentialsFactory::SslCredentials(
- const SslCredentialsOptions& options) {
- const unsigned char* pem_root_certs =
+ const SslCredentialsOptions &options) {
+ const unsigned char *pem_root_certs =
options.pem_root_certs.empty() ? nullptr
- : reinterpret_cast<const unsigned char*>(
+ : reinterpret_cast<const unsigned char *>(
options.pem_root_certs.c_str());
if (pem_root_certs == nullptr) {
return std::unique_ptr<Credentials>();
}
- const unsigned char* pem_private_key =
+ const unsigned char *pem_private_key =
options.pem_private_key.empty() ? nullptr
- : reinterpret_cast<const unsigned char*>(
+ : reinterpret_cast<const unsigned char *>(
options.pem_private_key.c_str());
- const unsigned char* pem_cert_chain =
+ const unsigned char *pem_cert_chain =
options.pem_cert_chain.empty() ? nullptr
- : reinterpret_cast<const unsigned char*>(
+ : reinterpret_cast<const unsigned char *>(
options.pem_cert_chain.c_str());
- grpc_credentials* c_creds = grpc_ssl_credentials_create(
+ grpc_credentials *c_creds = grpc_ssl_credentials_create(
pem_root_certs, options.pem_root_certs.size(), pem_private_key,
options.pem_private_key.size(), pem_cert_chain,
options.pem_cert_chain.size());
@@ -81,7 +81,7 @@ std::unique_ptr<Credentials> CredentialsFactory::SslCredentials(
// Builds credentials for use when running in GCE
std::unique_ptr<Credentials> CredentialsFactory::ComputeEngineCredentials() {
- grpc_credentials* c_creds = grpc_compute_engine_credentials_create();
+ grpc_credentials *c_creds = grpc_compute_engine_credentials_create();
std::unique_ptr<Credentials> cpp_creds(
c_creds == nullptr ? nullptr : new Credentials(c_creds));
return cpp_creds;
@@ -89,11 +89,11 @@ std::unique_ptr<Credentials> CredentialsFactory::ComputeEngineCredentials() {
// Builds service account credentials.
std::unique_ptr<Credentials> CredentialsFactory::ServiceAccountCredentials(
- const grpc::string& json_key, const grpc::string& scope,
+ const grpc::string &json_key, const grpc::string &scope,
std::chrono::seconds token_lifetime) {
gpr_timespec lifetime = gpr_time_from_seconds(
token_lifetime.count() > 0 ? token_lifetime.count() : 0);
- grpc_credentials* c_creds = grpc_service_account_credentials_create(
+ grpc_credentials *c_creds = grpc_service_account_credentials_create(
json_key.c_str(), scope.c_str(), lifetime);
std::unique_ptr<Credentials> cpp_creds(
c_creds == nullptr ? nullptr : new Credentials(c_creds));
@@ -102,9 +102,9 @@ std::unique_ptr<Credentials> CredentialsFactory::ServiceAccountCredentials(
// Builds IAM credentials.
std::unique_ptr<Credentials> CredentialsFactory::IAMCredentials(
- const grpc::string& authorization_token,
- const grpc::string& authority_selector) {
- grpc_credentials* c_creds = grpc_iam_credentials_create(
+ const grpc::string &authorization_token,
+ const grpc::string &authority_selector) {
+ grpc_credentials *c_creds = grpc_iam_credentials_create(
authorization_token.c_str(), authority_selector.c_str());
std::unique_ptr<Credentials> cpp_creds(
c_creds == nullptr ? nullptr : new Credentials(c_creds));
@@ -113,13 +113,13 @@ std::unique_ptr<Credentials> CredentialsFactory::IAMCredentials(
// Combines two credentials objects into a composite credentials.
std::unique_ptr<Credentials> CredentialsFactory::ComposeCredentials(
- const std::unique_ptr<Credentials>& creds1,
- const std::unique_ptr<Credentials>& creds2) {
+ const std::unique_ptr<Credentials> &creds1,
+ const std::unique_ptr<Credentials> &creds2) {
// Note that we are not saving unique_ptrs to the two credentials
// passed in here. This is OK because the underlying C objects (i.e.,
// creds1 and creds2) into grpc_composite_credentials_create will see their
// refcounts incremented.
- grpc_credentials* c_creds = grpc_composite_credentials_create(
+ grpc_credentials *c_creds = grpc_composite_credentials_create(
creds1->GetRawCreds(), creds2->GetRawCreds());
std::unique_ptr<Credentials> cpp_creds(
c_creds == nullptr ? nullptr : new Credentials(c_creds));
diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc
index 3b94dc3c07..85f859b9eb 100644
--- a/src/cpp/proto/proto_utils.cc
+++ b/src/cpp/proto/proto_utils.cc
@@ -40,8 +40,8 @@
namespace grpc {
-bool SerializeProto(const google::protobuf::Message& msg,
- grpc_byte_buffer** bp) {
+bool SerializeProto(const google::protobuf::Message &msg,
+ grpc_byte_buffer **bp) {
grpc::string msg_str;
bool success = msg.SerializeToString(&msg_str);
if (success) {
@@ -53,13 +53,13 @@ bool SerializeProto(const google::protobuf::Message& msg,
return success;
}
-bool DeserializeProto(grpc_byte_buffer* buffer,
- google::protobuf::Message* msg) {
+bool DeserializeProto(grpc_byte_buffer *buffer,
+ google::protobuf::Message *msg) {
grpc::string msg_string;
- grpc_byte_buffer_reader* reader = grpc_byte_buffer_reader_create(buffer);
+ grpc_byte_buffer_reader *reader = grpc_byte_buffer_reader_create(buffer);
gpr_slice slice;
while (grpc_byte_buffer_reader_next(reader, &slice)) {
- const char* data = reinterpret_cast<const char*>(
+ const char *data = reinterpret_cast<const char *>(
slice.refcount ? slice.data.refcounted.bytes
: slice.data.inlined.bytes);
msg_string.append(data, slice.refcount ? slice.data.refcounted.length
diff --git a/src/cpp/proto/proto_utils.h b/src/cpp/proto/proto_utils.h
index ea472f9c51..a611a227fa 100644
--- a/src/cpp/proto/proto_utils.h
+++ b/src/cpp/proto/proto_utils.h
@@ -46,11 +46,11 @@ namespace grpc {
// Serialize the msg into a buffer created inside the function. The caller
// should destroy the returned buffer when done with it. If serialization fails,
// false is returned and buffer is left unchanged.
-bool SerializeProto(const google::protobuf::Message& msg,
- grpc_byte_buffer** buffer);
+bool SerializeProto(const google::protobuf::Message &msg,
+ grpc_byte_buffer **buffer);
// The caller keeps ownership of buffer and msg.
-bool DeserializeProto(grpc_byte_buffer* buffer, google::protobuf::Message* msg);
+bool DeserializeProto(grpc_byte_buffer *buffer, google::protobuf::Message *msg);
} // namespace grpc
diff --git a/src/cpp/server/async_server.cc b/src/cpp/server/async_server.cc
index aae2c82050..d576201b11 100644
--- a/src/cpp/server/async_server.cc
+++ b/src/cpp/server/async_server.cc
@@ -39,7 +39,7 @@
namespace grpc {
-AsyncServer::AsyncServer(CompletionQueue* cc)
+AsyncServer::AsyncServer(CompletionQueue *cc)
: started_(false), shutdown_(false) {
server_ = grpc_server_create(cc->cq(), nullptr);
}
@@ -53,7 +53,7 @@ AsyncServer::~AsyncServer() {
grpc_server_destroy(server_);
}
-void AsyncServer::AddPort(const grpc::string& addr) {
+void AsyncServer::AddPort(const grpc::string &addr) {
GPR_ASSERT(!started_);
int success = grpc_server_add_http2_port(server_, addr.c_str());
GPR_ASSERT(success);
diff --git a/src/cpp/server/async_server_context.cc b/src/cpp/server/async_server_context.cc
index 298936dec9..92958111c0 100644
--- a/src/cpp/server/async_server_context.cc
+++ b/src/cpp/server/async_server_context.cc
@@ -42,7 +42,7 @@
namespace grpc {
AsyncServerContext::AsyncServerContext(
- grpc_call* call, const grpc::string& method, const grpc::string& host,
+ grpc_call *call, const grpc::string &method, const grpc::string &host,
system_clock::time_point absolute_deadline)
: method_(method),
host_(host),
@@ -52,21 +52,21 @@ AsyncServerContext::AsyncServerContext(
AsyncServerContext::~AsyncServerContext() { grpc_call_destroy(call_); }
-void AsyncServerContext::Accept(grpc_completion_queue* cq) {
+void AsyncServerContext::Accept(grpc_completion_queue *cq) {
GPR_ASSERT(grpc_call_server_accept(call_, cq, this) == GRPC_CALL_OK);
GPR_ASSERT(grpc_call_server_end_initial_metadata(call_, 0) == GRPC_CALL_OK);
}
-bool AsyncServerContext::StartRead(google::protobuf::Message* request) {
+bool AsyncServerContext::StartRead(google::protobuf::Message *request) {
GPR_ASSERT(request);
request_ = request;
grpc_call_error err = grpc_call_start_read(call_, this);
return err == GRPC_CALL_OK;
}
-bool AsyncServerContext::StartWrite(const google::protobuf::Message& response,
+bool AsyncServerContext::StartWrite(const google::protobuf::Message &response,
int flags) {
- grpc_byte_buffer* buffer = nullptr;
+ grpc_byte_buffer *buffer = nullptr;
if (!SerializeProto(response, &buffer)) {
return false;
}
@@ -75,16 +75,16 @@ bool AsyncServerContext::StartWrite(const google::protobuf::Message& response,
return err == GRPC_CALL_OK;
}
-bool AsyncServerContext::StartWriteStatus(const Status& status) {
+bool AsyncServerContext::StartWriteStatus(const Status &status) {
grpc_call_error err = grpc_call_start_write_status(
call_, static_cast<grpc_status_code>(status.code()),
status.details().empty() ? nullptr
- : const_cast<char*>(status.details().c_str()),
+ : const_cast<char *>(status.details().c_str()),
this);
return err == GRPC_CALL_OK;
}
-bool AsyncServerContext::ParseRead(grpc_byte_buffer* read_buffer) {
+bool AsyncServerContext::ParseRead(grpc_byte_buffer *read_buffer) {
GPR_ASSERT(request_);
bool success = DeserializeProto(read_buffer, request_);
request_ = nullptr;
diff --git a/src/cpp/server/completion_queue.cc b/src/cpp/server/completion_queue.cc
index 56d165c9a6..102a81bf0e 100644
--- a/src/cpp/server/completion_queue.cc
+++ b/src/cpp/server/completion_queue.cc
@@ -48,8 +48,8 @@ CompletionQueue::~CompletionQueue() { grpc_completion_queue_destroy(cq_); }
void CompletionQueue::Shutdown() { grpc_completion_queue_shutdown(cq_); }
-CompletionQueue::CompletionType CompletionQueue::Next(void** tag) {
- grpc_event* ev;
+CompletionQueue::CompletionType CompletionQueue::Next(void **tag) {
+ grpc_event *ev;
CompletionType return_type;
bool success;
@@ -65,8 +65,8 @@ CompletionQueue::CompletionType CompletionQueue::Next(void** tag) {
case GRPC_READ:
*tag = ev->tag;
if (ev->data.read) {
- success =
- static_cast<AsyncServerContext*>(ev->tag)->ParseRead(ev->data.read);
+ success = static_cast<AsyncServerContext *>(ev->tag)
+ ->ParseRead(ev->data.read);
return_type = success ? SERVER_READ_OK : SERVER_READ_ERROR;
} else {
return_type = SERVER_READ_ERROR;
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index d85748eea4..193688e743 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -49,7 +49,7 @@ namespace grpc {
// TODO(rocking): consider a better default value like num of cores.
static const int kNumThreads = 4;
-Server::Server(ThreadPoolInterface* thread_pool, ServerCredentials* creds)
+Server::Server(ThreadPoolInterface *thread_pool, ServerCredentials *creds)
: started_(false),
shutdown_(false),
num_running_cb_(0),
@@ -82,14 +82,14 @@ Server::~Server() {
}
}
-void Server::RegisterService(RpcService* service) {
+void Server::RegisterService(RpcService *service) {
for (int i = 0; i < service->GetMethodCount(); ++i) {
- RpcServiceMethod* method = service->GetMethod(i);
+ RpcServiceMethod *method = service->GetMethod(i);
method_map_.insert(std::make_pair(method->name(), method));
}
}
-void Server::AddPort(const grpc::string& addr) {
+void Server::AddPort(const grpc::string &addr) {
GPR_ASSERT(!started_);
int success;
if (secure_) {
@@ -131,7 +131,7 @@ void Server::Shutdown() {
// Shutdown the completion queue.
cq_.Shutdown();
- void* tag = nullptr;
+ void *tag = nullptr;
CompletionQueue::CompletionType t = cq_.Next(&tag);
GPR_ASSERT(t == CompletionQueue::QUEUE_CLOSED);
}
@@ -147,18 +147,18 @@ void Server::ScheduleCallback() {
void Server::RunRpc() {
// Wait for one more incoming rpc.
- void* tag = nullptr;
+ void *tag = nullptr;
AllowOneRpc();
CompletionQueue::CompletionType t = cq_.Next(&tag);
GPR_ASSERT(t == CompletionQueue::SERVER_RPC_NEW);
- AsyncServerContext* server_context = static_cast<AsyncServerContext*>(tag);
+ AsyncServerContext *server_context = static_cast<AsyncServerContext *>(tag);
// server_context could be nullptr during server shutdown.
if (server_context != nullptr) {
// Schedule a new callback to handle more rpcs.
ScheduleCallback();
- RpcServiceMethod* method = nullptr;
+ RpcServiceMethod *method = nullptr;
auto iter = method_map_.find(server_context->method());
if (iter != method_map_.end()) {
method = iter->second;
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index d74d8cb65f..add22cc3d8 100644
--- a/src/cpp/server/server_builder.cc
+++ b/src/cpp/server/server_builder.cc
@@ -40,30 +40,30 @@ namespace grpc {
ServerBuilder::ServerBuilder() : thread_pool_(nullptr) {}
-void ServerBuilder::RegisterService(RpcService* service) {
+void ServerBuilder::RegisterService(RpcService *service) {
services_.push_back(service);
}
-void ServerBuilder::AddPort(const grpc::string& addr) {
+void ServerBuilder::AddPort(const grpc::string &addr) {
ports_.push_back(addr);
}
void ServerBuilder::SetCredentials(
- const std::shared_ptr<ServerCredentials>& creds) {
+ const std::shared_ptr<ServerCredentials> &creds) {
GPR_ASSERT(!creds_);
creds_ = creds;
}
-void ServerBuilder::SetThreadPool(ThreadPoolInterface* thread_pool) {
+void ServerBuilder::SetThreadPool(ThreadPoolInterface *thread_pool) {
thread_pool_ = thread_pool;
}
std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
std::unique_ptr<Server> server(new Server(thread_pool_, creds_.get()));
- for (auto* service : services_) {
+ for (auto *service : services_) {
server->RegisterService(service);
}
- for (auto& port : ports_) {
+ for (auto &port : ports_) {
server->AddPort(port);
}
server->Start();
diff --git a/src/cpp/server/server_credentials.cc b/src/cpp/server/server_credentials.cc
index 5d899b1cd9..b82a2d821a 100644
--- a/src/cpp/server/server_credentials.cc
+++ b/src/cpp/server/server_credentials.cc
@@ -37,31 +37,31 @@
namespace grpc {
-ServerCredentials::ServerCredentials(grpc_server_credentials* c_creds)
+ServerCredentials::ServerCredentials(grpc_server_credentials *c_creds)
: creds_(c_creds) {}
ServerCredentials::~ServerCredentials() {
grpc_server_credentials_release(creds_);
}
-grpc_server_credentials* ServerCredentials::GetRawCreds() { return creds_; }
+grpc_server_credentials *ServerCredentials::GetRawCreds() { return creds_; }
std::shared_ptr<ServerCredentials> ServerCredentialsFactory::SslCredentials(
- const SslServerCredentialsOptions& options) {
- const unsigned char* pem_root_certs =
+ const SslServerCredentialsOptions &options) {
+ const unsigned char *pem_root_certs =
options.pem_root_certs.empty() ? nullptr
- : reinterpret_cast<const unsigned char*>(
+ : reinterpret_cast<const unsigned char *>(
options.pem_root_certs.c_str());
- const unsigned char* pem_private_key =
+ const unsigned char *pem_private_key =
options.pem_private_key.empty() ? nullptr
- : reinterpret_cast<const unsigned char*>(
+ : reinterpret_cast<const unsigned char *>(
options.pem_private_key.c_str());
- const unsigned char* pem_cert_chain =
+ const unsigned char *pem_cert_chain =
options.pem_cert_chain.empty() ? nullptr
- : reinterpret_cast<const unsigned char*>(
+ : reinterpret_cast<const unsigned char *>(
options.pem_cert_chain.c_str());
- grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create(
+ grpc_server_credentials *c_creds = grpc_ssl_server_credentials_create(
pem_root_certs, options.pem_root_certs.size(), pem_private_key,
options.pem_private_key.size(), pem_cert_chain,
options.pem_cert_chain.size());
diff --git a/src/cpp/server/server_rpc_handler.cc b/src/cpp/server/server_rpc_handler.cc
index 42f8b755b6..061ac1c2f3 100644
--- a/src/cpp/server/server_rpc_handler.cc
+++ b/src/cpp/server/server_rpc_handler.cc
@@ -41,8 +41,8 @@
namespace grpc {
-ServerRpcHandler::ServerRpcHandler(AsyncServerContext* async_server_context,
- RpcServiceMethod* method)
+ServerRpcHandler::ServerRpcHandler(AsyncServerContext *async_server_context,
+ RpcServiceMethod *method)
: async_server_context_(async_server_context), method_(method) {}
void ServerRpcHandler::StartRpc() {
@@ -71,7 +71,7 @@ void ServerRpcHandler::StartRpc() {
GPR_ASSERT(type == CompletionQueue::SERVER_READ_OK);
// Run the application's rpc handler
- MethodHandler* handler = method_->handler();
+ MethodHandler *handler = method_->handler();
Status status = handler->RunHandler(MethodHandler::HandlerParameter(
&user_context, request.get(), response.get()));
@@ -97,7 +97,7 @@ void ServerRpcHandler::StartRpc() {
cq_.cq(), request.get(), response.get());
// Run the application's rpc handler
- MethodHandler* handler = method_->handler();
+ MethodHandler *handler = method_->handler();
Status status = handler->RunHandler(MethodHandler::HandlerParameter(
&user_context, request.get(), response.get(), &stream_context));
if (status.IsOk() &&
@@ -110,17 +110,17 @@ void ServerRpcHandler::StartRpc() {
}
CompletionQueue::CompletionType ServerRpcHandler::WaitForNextEvent() {
- void* tag = nullptr;
+ void *tag = nullptr;
CompletionQueue::CompletionType type = cq_.Next(&tag);
if (type != CompletionQueue::QUEUE_CLOSED &&
type != CompletionQueue::RPC_END) {
- GPR_ASSERT(static_cast<AsyncServerContext*>(tag) ==
+ GPR_ASSERT(static_cast<AsyncServerContext *>(tag) ==
async_server_context_.get());
}
return type;
}
-void ServerRpcHandler::FinishRpc(const Status& status) {
+void ServerRpcHandler::FinishRpc(const Status &status) {
async_server_context_->StartWriteStatus(status);
CompletionQueue::CompletionType type;
diff --git a/src/cpp/server/server_rpc_handler.h b/src/cpp/server/server_rpc_handler.h
index 249576d504..a43e07dc5f 100644
--- a/src/cpp/server/server_rpc_handler.h
+++ b/src/cpp/server/server_rpc_handler.h
@@ -47,17 +47,17 @@ class RpcServiceMethod;
class ServerRpcHandler {
public:
// Takes ownership of async_server_context.
- ServerRpcHandler(AsyncServerContext* async_server_context,
- RpcServiceMethod* method);
+ ServerRpcHandler(AsyncServerContext *async_server_context,
+ RpcServiceMethod *method);
void StartRpc();
private:
CompletionQueue::CompletionType WaitForNextEvent();
- void FinishRpc(const Status& status);
+ void FinishRpc(const Status &status);
std::unique_ptr<AsyncServerContext> async_server_context_;
- RpcServiceMethod* method_;
+ RpcServiceMethod *method_;
CompletionQueue cq_;
};
diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc
index ce364c4795..a46d4c64d2 100644
--- a/src/cpp/server/thread_pool.cc
+++ b/src/cpp/server/thread_pool.cc
@@ -63,12 +63,12 @@ ThreadPool::~ThreadPool() {
shutdown_ = true;
cv_.notify_all();
}
- for (auto& t : threads_) {
+ for (auto &t : threads_) {
t.join();
}
}
-void ThreadPool::ScheduleCallback(const std::function<void()>& callback) {
+void ThreadPool::ScheduleCallback(const std::function<void()> &callback) {
std::lock_guard<std::mutex> lock(mu_);
callbacks_.push(callback);
cv_.notify_all();
diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h
index 6fc71d6695..c53f7a7517 100644
--- a/src/cpp/server/thread_pool.h
+++ b/src/cpp/server/thread_pool.h
@@ -49,7 +49,7 @@ class ThreadPool : public ThreadPoolInterface {
explicit ThreadPool(int num_threads);
~ThreadPool();
- void ScheduleCallback(const std::function<void()>& callback) final;
+ void ScheduleCallback(const std::function<void()> &callback) final;
private:
std::mutex mu_;
diff --git a/src/cpp/stream/stream_context.cc b/src/cpp/stream/stream_context.cc
index 5ccf8c9682..e64010be64 100644
--- a/src/cpp/stream/stream_context.cc
+++ b/src/cpp/stream/stream_context.cc
@@ -44,14 +44,14 @@
namespace grpc {
// Client only ctor
-StreamContext::StreamContext(const RpcMethod& method, ClientContext* context,
- const google::protobuf::Message* request,
- google::protobuf::Message* result)
+StreamContext::StreamContext(const RpcMethod &method, ClientContext *context,
+ const google::protobuf::Message *request,
+ google::protobuf::Message *result)
: is_client_(true),
method_(&method),
call_(context->call()),
cq_(context->cq()),
- request_(const_cast<google::protobuf::Message*>(request)),
+ request_(const_cast<google::protobuf::Message *>(request)),
result_(result),
peer_halfclosed_(false),
self_halfclosed_(false) {
@@ -59,10 +59,10 @@ StreamContext::StreamContext(const RpcMethod& method, ClientContext* context,
}
// Server only ctor
-StreamContext::StreamContext(const RpcMethod& method, grpc_call* call,
- grpc_completion_queue* cq,
- google::protobuf::Message* request,
- google::protobuf::Message* result)
+StreamContext::StreamContext(const RpcMethod &method, grpc_call *call,
+ grpc_completion_queue *cq,
+ google::protobuf::Message *request,
+ google::protobuf::Message *result)
: is_client_(false),
method_(&method),
call_(call),
@@ -84,7 +84,7 @@ void StreamContext::Start(bool buffered) {
client_metadata_read_tag(),
finished_tag(), flag);
GPR_ASSERT(GRPC_CALL_OK == error);
- grpc_event* invoke_ev =
+ grpc_event *invoke_ev =
grpc_completion_queue_pluck(cq(), invoke_tag(), gpr_inf_future);
if (invoke_ev->data.invoke_accepted != GRPC_OP_OK) {
peer_halfclosed_ = true;
@@ -101,11 +101,11 @@ void StreamContext::Start(bool buffered) {
}
}
-bool StreamContext::Read(google::protobuf::Message* msg) {
+bool StreamContext::Read(google::protobuf::Message *msg) {
// TODO(yangg) check peer_halfclosed_ here for possible early return.
grpc_call_error err = grpc_call_start_read(call(), read_tag());
GPR_ASSERT(err == GRPC_CALL_OK);
- grpc_event* read_ev =
+ grpc_event *read_ev =
grpc_completion_queue_pluck(cq(), read_tag(), gpr_inf_future);
GPR_ASSERT(read_ev->type == GRPC_READ);
bool ret = true;
@@ -123,13 +123,13 @@ bool StreamContext::Read(google::protobuf::Message* msg) {
return ret;
}
-bool StreamContext::Write(const google::protobuf::Message* msg, bool is_last) {
+bool StreamContext::Write(const google::protobuf::Message *msg, bool is_last) {
// TODO(yangg) check self_halfclosed_ for possible early return.
bool ret = true;
- grpc_event* ev = nullptr;
+ grpc_event *ev = nullptr;
if (msg) {
- grpc_byte_buffer* out_buf = nullptr;
+ grpc_byte_buffer *out_buf = nullptr;
if (!SerializeProto(*msg, &out_buf)) {
grpc_call_cancel_with_status(call(), GRPC_STATUS_INVALID_ARGUMENT,
"Failed to serialize outgoing proto");
@@ -163,16 +163,16 @@ bool StreamContext::Write(const google::protobuf::Message* msg, bool is_last) {
return ret;
}
-const Status& StreamContext::Wait() {
+const Status &StreamContext::Wait() {
// TODO(yangg) properly support metadata
- grpc_event* metadata_ev = grpc_completion_queue_pluck(
+ grpc_event *metadata_ev = grpc_completion_queue_pluck(
cq(), client_metadata_read_tag(), gpr_inf_future);
grpc_event_finish(metadata_ev);
// TODO(yangg) protect states by a mutex, including other places.
if (!self_halfclosed_ || !peer_halfclosed_) {
Cancel();
}
- grpc_event* finish_ev =
+ grpc_event *finish_ev =
grpc_completion_queue_pluck(cq(), finished_tag(), gpr_inf_future);
GPR_ASSERT(finish_ev->type == GRPC_FINISHED);
final_status_ = Status(
diff --git a/src/cpp/stream/stream_context.h b/src/cpp/stream/stream_context.h
index 4781f27a77..8697d86e83 100644
--- a/src/cpp/stream/stream_context.h
+++ b/src/cpp/stream/stream_context.h
@@ -50,43 +50,45 @@ class RpcMethod;
class StreamContext final : public StreamContextInterface {
public:
- StreamContext(const RpcMethod& method, ClientContext* context,
- const google::protobuf::Message* request,
- google::protobuf::Message* result);
- StreamContext(const RpcMethod& method, grpc_call* call,
- grpc_completion_queue* cq, google::protobuf::Message* request,
- google::protobuf::Message* result);
+ StreamContext(const RpcMethod &method, ClientContext *context,
+ const google::protobuf::Message *request,
+ google::protobuf::Message *result);
+ StreamContext(const RpcMethod &method, grpc_call *call,
+ grpc_completion_queue *cq, google::protobuf::Message *request,
+ google::protobuf::Message *result);
~StreamContext();
// Start the stream, if there is a final write following immediately, set
// buffered so that the messages can be sent in batch.
void Start(bool buffered) override;
- bool Read(google::protobuf::Message* msg) override;
- bool Write(const google::protobuf::Message* msg, bool is_last) override;
- const Status& Wait() override;
+ bool Read(google::protobuf::Message *msg) override;
+ bool Write(const google::protobuf::Message *msg, bool is_last) override;
+ const Status &Wait() override;
void Cancel() override;
- google::protobuf::Message* request() override { return request_; }
- google::protobuf::Message* response() override { return result_; }
+ google::protobuf::Message *request() override { return request_; }
+ google::protobuf::Message *response() override { return result_; }
private:
// Unique tags for plucking events from the c layer. this pointer is casted
// to char* to create single byte step between tags. It implicitly relies on
// that StreamContext is large enough to contain all the pointers.
- void* finished_tag() { return reinterpret_cast<char*>(this); }
- void* read_tag() { return reinterpret_cast<char*>(this) + 1; }
- void* write_tag() { return reinterpret_cast<char*>(this) + 2; }
- void* halfclose_tag() { return reinterpret_cast<char*>(this) + 3; }
- void* invoke_tag() { return reinterpret_cast<char*>(this) + 4; }
- void* client_metadata_read_tag() { return reinterpret_cast<char*>(this) + 5; }
- grpc_call* call() { return call_; }
- grpc_completion_queue* cq() { return cq_; }
+ void *finished_tag() { return reinterpret_cast<char *>(this); }
+ void *read_tag() { return reinterpret_cast<char *>(this) + 1; }
+ void *write_tag() { return reinterpret_cast<char *>(this) + 2; }
+ void *halfclose_tag() { return reinterpret_cast<char *>(this) + 3; }
+ void *invoke_tag() { return reinterpret_cast<char *>(this) + 4; }
+ void *client_metadata_read_tag() {
+ return reinterpret_cast<char *>(this) + 5;
+ }
+ grpc_call *call() { return call_; }
+ grpc_completion_queue *cq() { return cq_; }
bool is_client_;
- const RpcMethod* method_; // not owned
- grpc_call* call_; // not owned
- grpc_completion_queue* cq_; // not owned
- google::protobuf::Message* request_; // first request, not owned
- google::protobuf::Message* result_; // last response, not owned
+ const RpcMethod *method_; // not owned
+ grpc_call *call_; // not owned
+ grpc_completion_queue *cq_; // not owned
+ google::protobuf::Message *request_; // first request, not owned
+ google::protobuf::Message *result_; // last response, not owned
bool peer_halfclosed_;
bool self_halfclosed_;
diff --git a/src/cpp/util/status.cc b/src/cpp/util/status.cc
index e7ca41b752..1ca12d0ae9 100644
--- a/src/cpp/util/status.cc
+++ b/src/cpp/util/status.cc
@@ -35,7 +35,7 @@
namespace grpc {
-const Status& Status::OK = Status();
-const Status& Status::Cancelled = Status(StatusCode::CANCELLED);
+const Status &Status::OK = Status();
+const Status &Status::Cancelled = Status(StatusCode::CANCELLED);
} // namespace grpc
diff --git a/src/cpp/util/time.cc b/src/cpp/util/time.cc
index e58dde82a3..7ce7a371f5 100644
--- a/src/cpp/util/time.cc
+++ b/src/cpp/util/time.cc
@@ -43,8 +43,8 @@ using std::chrono::system_clock;
namespace grpc {
// TODO(yangg) prevent potential overflow.
-void Timepoint2Timespec(const system_clock::time_point& from,
- gpr_timespec* to) {
+void Timepoint2Timespec(const system_clock::time_point &from,
+ gpr_timespec *to) {
system_clock::duration deadline = from.time_since_epoch();
seconds secs = duration_cast<seconds>(deadline);
nanoseconds nsecs = duration_cast<nanoseconds>(deadline - secs);
diff --git a/src/cpp/util/time.h b/src/cpp/util/time.h
index 338c4f5119..908395c92b 100644
--- a/src/cpp/util/time.h
+++ b/src/cpp/util/time.h
@@ -41,8 +41,8 @@
namespace grpc {
// from and to should be absolute time.
-void Timepoint2Timespec(const std::chrono::system_clock::time_point& from,
- gpr_timespec* to);
+void Timepoint2Timespec(const std::chrono::system_clock::time_point &from,
+ gpr_timespec *to);
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t);
diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c
index c01af34e95..410efbce68 100644
--- a/src/php/ext/grpc/call.c
+++ b/src/php/ext/grpc/call.c
@@ -423,16 +423,15 @@ PHP_METHOD(Call, start_read) {
static zend_function_entry call_methods[] = {
PHP_ME(Call, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME(Call, server_accept, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Call, server_end_initial_metadata, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Call, add_metadata, NULL, ZEND_ACC_PUBLIC) PHP_ME(
- Call, cancel, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Call, start_invoke, NULL, ZEND_ACC_PUBLIC) PHP_ME(
- Call, start_read, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Call, start_write, NULL, ZEND_ACC_PUBLIC) PHP_ME(
- Call, start_write_status, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Call, writes_done, NULL, ZEND_ACC_PUBLIC)
- PHP_FE_END};
+ PHP_ME(Call, server_accept, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Call, server_end_initial_metadata, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Call, add_metadata, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Call, cancel, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Call, start_invoke, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Call, start_read, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Call, start_write, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Call, start_write_status, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Call, writes_done, NULL, ZEND_ACC_PUBLIC) PHP_FE_END};
void grpc_init_call(TSRMLS_D) {
zend_class_entry ce;
diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c
index f0e4153b22..2ab229f5e6 100644
--- a/src/php/ext/grpc/channel.c
+++ b/src/php/ext/grpc/channel.c
@@ -155,7 +155,7 @@ PHP_METHOD(Channel, close) {
static zend_function_entry channel_methods[] = {
PHP_ME(Channel, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME(Channel, close, NULL, ZEND_ACC_PUBLIC) PHP_FE_END};
+ PHP_ME(Channel, close, NULL, ZEND_ACC_PUBLIC) PHP_FE_END};
void grpc_init_channel(TSRMLS_D) {
zend_class_entry ce;
diff --git a/src/php/ext/grpc/completion_queue.c b/src/php/ext/grpc/completion_queue.c
index 9785eab8cc..3a93bfcff7 100644
--- a/src/php/ext/grpc/completion_queue.c
+++ b/src/php/ext/grpc/completion_queue.c
@@ -63,8 +63,8 @@ zend_object_value create_wrapped_grpc_completion_queue(
*/
PHP_METHOD(CompletionQueue, __construct) {
wrapped_grpc_completion_queue *queue =
- (wrapped_grpc_completion_queue *)zend_object_store_get_object(
- getThis() TSRMLS_CC);
+ (wrapped_grpc_completion_queue *)zend_object_store_get_object(getThis()
+ TSRMLS_CC);
queue->wrapped = grpc_completion_queue_create();
}
@@ -86,8 +86,8 @@ PHP_METHOD(CompletionQueue, next) {
return;
}
wrapped_grpc_completion_queue *completion_queue =
- (wrapped_grpc_completion_queue *)zend_object_store_get_object(
- getThis() TSRMLS_CC);
+ (wrapped_grpc_completion_queue *)zend_object_store_get_object(getThis()
+ TSRMLS_CC);
wrapped_grpc_timeval *wrapped_timeout =
(wrapped_grpc_timeval *)zend_object_store_get_object(timeout TSRMLS_CC);
grpc_event *event = grpc_completion_queue_next(completion_queue->wrapped,
@@ -109,8 +109,8 @@ PHP_METHOD(CompletionQueue, pluck) {
"pluck needs a long and a Timeval", 1 TSRMLS_CC);
}
wrapped_grpc_completion_queue *completion_queue =
- (wrapped_grpc_completion_queue *)zend_object_store_get_object(
- getThis() TSRMLS_CC);
+ (wrapped_grpc_completion_queue *)zend_object_store_get_object(getThis()
+ TSRMLS_CC);
wrapped_grpc_timeval *wrapped_timeout =
(wrapped_grpc_timeval *)zend_object_store_get_object(timeout TSRMLS_CC);
grpc_event *event = grpc_completion_queue_pluck(
@@ -124,8 +124,8 @@ PHP_METHOD(CompletionQueue, pluck) {
static zend_function_entry completion_queue_methods[] = {
PHP_ME(CompletionQueue, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME(CompletionQueue, next, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CompletionQueue, pluck, NULL, ZEND_ACC_PUBLIC) PHP_FE_END};
+ PHP_ME(CompletionQueue, next, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(CompletionQueue, pluck, NULL, ZEND_ACC_PUBLIC) PHP_FE_END};
void grpc_init_completion_queue(TSRMLS_D) {
zend_class_entry ce;
diff --git a/src/php/ext/grpc/credentials.c b/src/php/ext/grpc/credentials.c
index f486272531..2a83d1cbc1 100644
--- a/src/php/ext/grpc/credentials.c
+++ b/src/php/ext/grpc/credentials.c
@@ -151,13 +151,12 @@ PHP_METHOD(Credentials, createFake) {
static zend_function_entry credentials_methods[] = {
PHP_ME(Credentials, createDefault, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(Credentials, createSsl, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(Credentials, createComposite, NULL,
- ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(Credentials, createGce, NULL,
- ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(Credentials, createFake, NULL,
- ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END};
+ PHP_ME(Credentials, createSsl, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(Credentials, createComposite, NULL,
+ ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(Credentials, createGce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(Credentials, createFake, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_FE_END};
void grpc_init_credentials(TSRMLS_D) {
zend_class_entry ce;
diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c
index c1042293aa..e8b4643a58 100644
--- a/src/php/ext/grpc/php_grpc.c
+++ b/src/php/ext/grpc/php_grpc.c
@@ -33,7 +33,8 @@ zend_module_entry grpc_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
- "grpc", grpc_functions, PHP_MINIT(grpc), PHP_MSHUTDOWN(grpc), NULL, NULL,
+ "grpc", grpc_functions, PHP_MINIT(grpc),
+ PHP_MSHUTDOWN(grpc), NULL, NULL,
PHP_MINFO(grpc),
#if ZEND_MODULE_API_NO >= 20010901
PHP_GRPC_VERSION,
diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c
index f484375712..38777f3d54 100644
--- a/src/php/ext/grpc/server.c
+++ b/src/php/ext/grpc/server.c
@@ -176,10 +176,10 @@ PHP_METHOD(Server, start) {
static zend_function_entry server_methods[] = {
PHP_ME(Server, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
- PHP_ME(Server, request_call, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Server, add_http2_port, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Server, add_secure_http2_port, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Server, start, NULL, ZEND_ACC_PUBLIC) PHP_FE_END};
+ PHP_ME(Server, request_call, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Server, add_http2_port, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Server, add_secure_http2_port, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Server, start, NULL, ZEND_ACC_PUBLIC) PHP_FE_END};
void grpc_init_server(TSRMLS_D) {
zend_class_entry ce;
diff --git a/src/php/ext/grpc/server_credentials.c b/src/php/ext/grpc/server_credentials.c
index 5b9ab3390d..1f8e58aa4d 100644
--- a/src/php/ext/grpc/server_credentials.c
+++ b/src/php/ext/grpc/server_credentials.c
@@ -102,8 +102,8 @@ PHP_METHOD(ServerCredentials, createFake) {
static zend_function_entry server_credentials_methods[] = {
PHP_ME(ServerCredentials, createSsl, NULL,
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(ServerCredentials, createFake, NULL,
- ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END};
+ PHP_ME(ServerCredentials, createFake, NULL,
+ ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END};
void grpc_init_server_credentials(TSRMLS_D) {
zend_class_entry ce;
diff --git a/src/php/ext/grpc/timeval.c b/src/php/ext/grpc/timeval.c
index a5508115e4..cbbbf37915 100644
--- a/src/php/ext/grpc/timeval.c
+++ b/src/php/ext/grpc/timeval.c
@@ -217,20 +217,16 @@ PHP_METHOD(Timeval, sleep_until) {
}
static zend_function_entry timeval_methods[] = {
- PHP_ME(Timeval, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) PHP_ME(
- Timeval, add, NULL,
- ZEND_ACC_PUBLIC) PHP_ME(Timeval, compare, NULL,
- ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(Timeval, inf_future, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(Timeval, inf_past, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(Timeval, now, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(Timeval, similar, NULL,
- ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(Timeval, sleep_until, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Timeval, subtract, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Timeval, zero, NULL,
- ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_FE_END};
+ PHP_ME(Timeval, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
+ PHP_ME(Timeval, add, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Timeval, compare, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(Timeval, inf_future, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(Timeval, inf_past, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(Timeval, now, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(Timeval, similar, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(Timeval, sleep_until, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Timeval, subtract, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Timeval, zero, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END};
void grpc_init_timeval(TSRMLS_D) {
zend_class_entry ce;