Merge pull request #1066 from yang-g/clangformat

clang-format c++ code
pull/1099/head
Vijay Pai 10 years ago
commit f0b6e26f16
  1. 3
      include/grpc++/async_generic_service.h
  2. 3
      include/grpc++/async_unary_call.h
  3. 4
      include/grpc++/byte_buffer.h
  4. 8
      include/grpc++/client_context.h
  5. 5
      include/grpc++/completion_queue.h
  6. 7
      include/grpc++/config.h
  7. 5
      src/cpp/client/create_channel.cc
  8. 4
      src/cpp/proto/proto_utils.cc
  9. 1
      src/cpp/server/async_generic_service.cc
  10. 3
      src/cpp/server/insecure_server_credentials.cc
  11. 6
      src/cpp/server/secure_server_credentials.cc
  12. 5
      src/cpp/server/server.cc
  13. 3
      src/cpp/server/server_builder.cc
  14. 4
      src/cpp/util/slice.cc
  15. 16
      test/cpp/end2end/async_end2end_test.cc
  16. 5
      test/cpp/end2end/generic_end2end_test.cc
  17. 7
      test/cpp/interop/client.cc
  18. 3
      test/cpp/util/create_test_channel.cc

@ -41,7 +41,8 @@ struct grpc_server;
namespace grpc {
typedef ServerAsyncReaderWriter<ByteBuffer, ByteBuffer> GenericServerAsyncReaderWriter;
typedef ServerAsyncReaderWriter<ByteBuffer, ByteBuffer>
GenericServerAsyncReaderWriter;
class GenericServerContext GRPC_FINAL : public ServerContext {
public:

@ -50,8 +50,7 @@ class ClientAsyncResponseReader GRPC_FINAL {
ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
const grpc::protobuf::Message& request, void* tag)
: context_(context),
call_(channel->CreateCall(method, context, cq)) {
: context_(context), call_(channel->CreateCall(method, context, cq)) {
init_buf_.Reset(tag);
init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_);
init_buf_.AddSendMessage(request);

@ -72,9 +72,7 @@ class ByteBuffer GRPC_FINAL {
buffer_ = buf;
}
grpc_byte_buffer* buffer() const {
return buffer_;
}
grpc_byte_buffer* buffer() const { return buffer_; }
grpc_byte_buffer* buffer_;
};

@ -90,9 +90,7 @@ class ClientContext {
void set_absolute_deadline(const system_clock::time_point& deadline);
system_clock::time_point absolute_deadline();
void set_authority(const grpc::string& authority) {
authority_ = authority;
}
void set_authority(const grpc::string& authority) { authority_ = authority; }
void TryCancel();
@ -129,9 +127,7 @@ class ClientContext {
gpr_timespec RawDeadline() { return absolute_deadline_; }
grpc::string authority() {
return authority_;
}
grpc::string authority() { return authority_; }
bool initial_metadata_received_;
grpc_call* call_;

@ -86,9 +86,10 @@ class CompletionQueue {
// Blocking (until deadline) read from queue.
// Returns false if the queue is ready for destruction, true if event
bool Next(void** tag, bool* ok) {
return (AsyncNext(tag,ok,
(std::chrono::system_clock::time_point::max)()) !=
return (
AsyncNext(tag, ok, (std::chrono::system_clock::time_point::max)()) !=
SHUTDOWN);
}

@ -59,11 +59,12 @@
#ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM
#include <google/protobuf/io/zero_copy_stream.h>
#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ::google::protobuf::io::ZeroCopyOutputStream
#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ::google::protobuf::io::ZeroCopyInputStream
#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM \
::google::protobuf::io::ZeroCopyOutputStream
#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \
::google::protobuf::io::ZeroCopyInputStream
#endif
namespace grpc {
typedef GRPC_CUSTOM_STRING string;

@ -43,7 +43,8 @@ class ChannelArguments;
std::shared_ptr<ChannelInterface> CreateChannel(
const grpc::string& target, const std::unique_ptr<Credentials>& creds,
const ChannelArguments& args) {
return creds ? creds->CreateChannel(target, args) :
std::shared_ptr<ChannelInterface>(new Channel(target, grpc_lame_client_channel_create()));
return creds ? creds->CreateChannel(target, args)
: std::shared_ptr<ChannelInterface>(
new Channel(target, grpc_lame_client_channel_create()));
}
} // namespace grpc

@ -123,9 +123,7 @@ class GrpcBufferReader GRPC_FINAL
return true;
}
void BackUp(int count) GRPC_OVERRIDE {
backup_count_ = count;
}
void BackUp(int count) GRPC_OVERRIDE { backup_count_ = count; }
bool Skip(int count) GRPC_OVERRIDE {
const void* data;

@ -48,4 +48,3 @@ CompletionQueue* AsyncGenericService::completion_queue() {
}
} // namespace grpc

@ -46,7 +46,8 @@ class InsecureServerCredentialsImpl GRPC_FINAL : public ServerCredentials {
} // namespace
std::shared_ptr<ServerCredentials> InsecureServerCredentials() {
return std::shared_ptr<ServerCredentials>(new InsecureServerCredentialsImpl());
return std::shared_ptr<ServerCredentials>(
new InsecureServerCredentialsImpl());
}
} // namespace grpc

@ -40,7 +40,8 @@ namespace grpc {
namespace {
class SecureServerCredentials GRPC_FINAL : public ServerCredentials {
public:
explicit SecureServerCredentials(grpc_server_credentials* creds) : creds_(creds) {}
explicit SecureServerCredentials(grpc_server_credentials* creds)
: creds_(creds) {}
~SecureServerCredentials() GRPC_OVERRIDE {
grpc_server_credentials_release(creds_);
}
@ -65,7 +66,8 @@ std::shared_ptr<ServerCredentials> SslServerCredentials(
grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create(
options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(),
&pem_key_cert_pairs[0], pem_key_cert_pairs.size());
return std::shared_ptr<ServerCredentials>(new SecureServerCredentials(c_creds));
return std::shared_ptr<ServerCredentials>(
new SecureServerCredentials(c_creds));
}
} // namespace grpc

@ -322,11 +322,10 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag {
payload_(nullptr) {
memset(&array_, 0, sizeof(array_));
grpc_call_details_init(&call_details_);
grpc_server_request_call(
server->server_, &call_, &call_details_, &array_, cq->cq(), this);
grpc_server_request_call(server->server_, &call_, &call_details_, &array_,
cq->cq(), this);
}
~AsyncRequest() {
if (payload_) {
grpc_byte_buffer_destroy(payload_);

@ -56,7 +56,8 @@ void ServerBuilder::RegisterAsyncGenericService(AsyncGenericService* service) {
if (generic_service_) {
gpr_log(GPR_ERROR,
"Adding multiple AsyncGenericService is unsupported for now. "
"Dropping the service %p", service);
"Dropping the service %p",
service);
return;
}
generic_service_ = service;

@ -37,9 +37,7 @@ namespace grpc {
Slice::Slice() : slice_(gpr_empty_slice()) {}
Slice::~Slice() {
gpr_slice_unref(slice_);
}
Slice::~Slice() { gpr_slice_unref(slice_); }
Slice::Slice(gpr_slice slice, AddRef) : slice_(gpr_slice_ref(slice)) {}

@ -76,11 +76,11 @@ void verify_ok(CompletionQueue* cq, int i, bool expect_ok) {
EXPECT_EQ(tag(i), got_tag);
}
void verify_timed_ok(CompletionQueue* cq, int i, bool expect_ok,
void verify_timed_ok(
CompletionQueue* cq, int i, bool expect_ok,
std::chrono::system_clock::time_point deadline =
std::chrono::system_clock::time_point::max(),
CompletionQueue::NextStatus expected_outcome =
CompletionQueue::GOT_EVENT) {
CompletionQueue::NextStatus expected_outcome = CompletionQueue::GOT_EVENT) {
bool ok;
void* got_tag;
EXPECT_EQ(cq->AsyncNext(&got_tag, &ok, deadline), expected_outcome);
@ -195,12 +195,11 @@ TEST_F(AsyncEnd2endTest, AsyncNextRpc) {
grpc::ServerAsyncResponseWriter<EchoResponse> response_writer(&srv_ctx);
send_request.set_message("Hello");
std::unique_ptr<ClientAsyncResponseReader<EchoResponse> >
response_reader(stub_->AsyncEcho(&cli_ctx, send_request,
&cli_cq_, tag(1)));
std::unique_ptr<ClientAsyncResponseReader<EchoResponse> > response_reader(
stub_->AsyncEcho(&cli_ctx, send_request, &cli_cq_, tag(1)));
std::chrono::system_clock::time_point
time_now(std::chrono::system_clock::now()),
std::chrono::system_clock::time_point time_now(
std::chrono::system_clock::now()),
time_limit(std::chrono::system_clock::now() + std::chrono::seconds(5));
verify_timed_ok(&srv_cq_, -1, true, time_now, CompletionQueue::TIMEOUT);
verify_timed_ok(&cli_cq_, -1, true, time_now, CompletionQueue::TIMEOUT);
@ -221,7 +220,6 @@ TEST_F(AsyncEnd2endTest, AsyncNextRpc) {
EXPECT_EQ(send_response.message(), recv_response.message());
EXPECT_TRUE(recv_status.IsOk());
}
// Two pings and a final pong.

@ -116,8 +116,8 @@ class GenericEnd2endTest : public ::testing::Test {
}
void ResetStub() {
std::shared_ptr<ChannelInterface> channel =
CreateChannel(server_address_.str(), InsecureCredentials(), ChannelArguments());
std::shared_ptr<ChannelInterface> channel = CreateChannel(
server_address_.str(), InsecureCredentials(), ChannelArguments());
stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel));
}
@ -238,7 +238,6 @@ TEST_F(GenericEnd2endTest, SimpleBidiStreaming) {
client_ok(6);
EXPECT_EQ(send_response.message(), recv_response.message());
cli_stream->WritesDone(tag(7));
client_ok(7);

@ -165,8 +165,8 @@ void AssertOkOrPrintErrorStatus(const grpc::Status& s) {
if (s.IsOk()) {
return;
}
gpr_log(GPR_INFO, "Error status code: %d, message: %s",
s.code(), s.details().c_str());
gpr_log(GPR_INFO, "Error status code: %d, message: %s", s.code(),
s.details().c_str());
GPR_ASSERT(0);
}
@ -246,8 +246,7 @@ void DoServiceAccountCreds() {
}
void DoJwtTokenCreds() {
gpr_log(GPR_INFO,
"Sending a large unary rpc with JWT token credentials ...");
gpr_log(GPR_INFO, "Sending a large unary rpc with JWT token credentials ...");
std::shared_ptr<ChannelInterface> channel =
CreateChannelForTestCase("jwt_token_creds");
SimpleRequest request;

@ -72,8 +72,7 @@ std::shared_ptr<ChannelInterface> CreateTestChannel(
const grpc::string& connect_to =
server.empty() ? override_hostname : server;
if (creds.get()) {
channel_creds =
CompositeCredentials(creds, channel_creds);
channel_creds = CompositeCredentials(creds, channel_creds);
}
return CreateChannel(connect_to, channel_creds, channel_args);
} else {

Loading…
Cancel
Save