aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpp/client/channel.h10
-rw-r--r--src/cpp/client/channel_arguments.cc18
-rw-r--r--src/cpp/client/client_context.cc8
-rw-r--r--src/cpp/client/client_unary_call.cc8
-rw-r--r--src/cpp/client/create_channel.cc9
-rw-r--r--src/cpp/client/secure_credentials.cc5
-rw-r--r--src/cpp/proto/proto_utils.cc22
-rw-r--r--src/cpp/proto/proto_utils.h6
-rw-r--r--src/cpp/server/async_generic_service.cc3
-rw-r--r--src/cpp/server/async_server_context.cc16
-rw-r--r--src/cpp/server/insecure_server_credentials.cc3
-rw-r--r--src/cpp/server/secure_server_credentials.cc12
-rw-r--r--src/cpp/server/server.cc5
-rw-r--r--src/cpp/server/server_builder.cc3
-rw-r--r--src/cpp/server/thread_pool.cc4
-rw-r--r--src/cpp/server/thread_pool.h2
-rw-r--r--src/cpp/util/slice.cc4
-rw-r--r--src/cpp/util/status.cc4
-rw-r--r--src/cpp/util/time.cc4
-rw-r--r--src/cpp/util/time.h4
20 files changed, 75 insertions, 75 deletions
diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h
index a1de3817e6..3980eba237 100644
--- a/src/cpp/client/channel.h
+++ b/src/cpp/client/channel.h
@@ -51,16 +51,16 @@ class StreamContextInterface;
class Channel GRPC_FINAL : public ChannelInterface {
public:
- Channel(const grpc::string &target, grpc_channel *c_channel);
+ Channel(const grpc::string& target, grpc_channel* c_channel);
~Channel() GRPC_OVERRIDE;
- virtual Call CreateCall(const RpcMethod &method, ClientContext *context,
- CompletionQueue *cq) GRPC_OVERRIDE;
- virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) GRPC_OVERRIDE;
+ virtual Call CreateCall(const RpcMethod& method, ClientContext* context,
+ CompletionQueue* cq) GRPC_OVERRIDE;
+ virtual void PerformOpsOnCall(CallOpBuffer* ops, Call* call) GRPC_OVERRIDE;
private:
const grpc::string target_;
- grpc_channel *const c_channel_; // owned
+ grpc_channel* const c_channel_; // owned
};
} // namespace grpc
diff --git a/src/cpp/client/channel_arguments.cc b/src/cpp/client/channel_arguments.cc
index abf0fc1c0a..87f8349eef 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 9f99f7bcd5..de9f8c7201 100644
--- a/src/cpp/client/client_context.cc
+++ b/src/cpp/client/client_context.cc
@@ -53,7 +53,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);
@@ -65,7 +65,7 @@ ClientContext::~ClientContext() {
}
void ClientContext::set_absolute_deadline(
- const system_clock::time_point &deadline) {
+ const system_clock::time_point& deadline) {
Timepoint2Timespec(deadline, &absolute_deadline_);
}
@@ -73,8 +73,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) {
send_initial_metadata_.insert(std::make_pair(meta_key, meta_value));
}
diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc
index 5c179de9d8..7e7ea78bcd 100644
--- a/src/cpp/client/client_unary_call.cc
+++ b/src/cpp/client/client_unary_call.cc
@@ -42,10 +42,10 @@
namespace grpc {
// Wrapper that performs a blocking unary call
-Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method,
- ClientContext *context,
- const grpc::protobuf::Message &request,
- grpc::protobuf::Message *result) {
+Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method,
+ ClientContext* context,
+ const grpc::protobuf::Message& request,
+ grpc::protobuf::Message* result) {
CompletionQueue cq;
Call call(channel->CreateCall(method, context, &cq));
CallOpBuffer buf;
diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc
index 57d215d0f3..301430572a 100644
--- a/src/cpp/client/create_channel.cc
+++ b/src/cpp/client/create_channel.cc
@@ -41,9 +41,10 @@ namespace grpc {
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()));
+ 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()));
}
} // namespace grpc
diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc
index a2f6a69858..412dc0764f 100644
--- a/src/cpp/client/secure_credentials.cc
+++ b/src/cpp/client/secure_credentials.cc
@@ -55,7 +55,8 @@ class SecureCredentials GRPC_FINAL : public Credentials {
args.SetChannelArgs(&channel_args);
return std::shared_ptr<ChannelInterface>(new Channel(
args.GetSslTargetNameOverride().empty()
- ? target : args.GetSslTargetNameOverride(),
+ ? target
+ : args.GetSslTargetNameOverride(),
grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args)));
}
@@ -111,7 +112,7 @@ std::unique_ptr<Credentials> ServiceAccountCredentials(
// Builds JWT credentials.
std::unique_ptr<Credentials> JWTCredentials(
- const grpc::string &json_key, std::chrono::seconds token_lifetime) {
+ const grpc::string& json_key, std::chrono::seconds token_lifetime) {
if (token_lifetime.count() <= 0) {
gpr_log(GPR_ERROR,
"Trying to create JWTCredentials with non-positive lifetime");
diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc
index 9254e5879f..b8de2ea173 100644
--- a/src/cpp/proto/proto_utils.cc
+++ b/src/cpp/proto/proto_utils.cc
@@ -45,7 +45,7 @@ const int kMaxBufferLength = 8192;
class GrpcBufferWriter GRPC_FINAL
: public ::grpc::protobuf::io::ZeroCopyOutputStream {
public:
- explicit GrpcBufferWriter(grpc_byte_buffer **bp,
+ explicit GrpcBufferWriter(grpc_byte_buffer** bp,
int block_size = kMaxBufferLength)
: block_size_(block_size), byte_count_(0), have_backup_(false) {
*bp = grpc_byte_buffer_create(NULL, 0);
@@ -58,7 +58,7 @@ class GrpcBufferWriter GRPC_FINAL
}
}
- bool Next(void **data, int *size) GRPC_OVERRIDE {
+ bool Next(void** data, int* size) GRPC_OVERRIDE {
if (have_backup_) {
slice_ = backup_slice_;
have_backup_ = false;
@@ -89,7 +89,7 @@ class GrpcBufferWriter GRPC_FINAL
private:
const int block_size_;
gpr_int64 byte_count_;
- gpr_slice_buffer *slice_buffer_;
+ gpr_slice_buffer* slice_buffer_;
bool have_backup_;
gpr_slice backup_slice_;
gpr_slice slice_;
@@ -98,7 +98,7 @@ class GrpcBufferWriter GRPC_FINAL
class GrpcBufferReader GRPC_FINAL
: public ::grpc::protobuf::io::ZeroCopyInputStream {
public:
- explicit GrpcBufferReader(grpc_byte_buffer *buffer)
+ explicit GrpcBufferReader(grpc_byte_buffer* buffer)
: byte_count_(0), backup_count_(0) {
reader_ = grpc_byte_buffer_reader_create(buffer);
}
@@ -106,7 +106,7 @@ class GrpcBufferReader GRPC_FINAL
grpc_byte_buffer_reader_destroy(reader_);
}
- bool Next(const void **data, int *size) GRPC_OVERRIDE {
+ bool Next(const void** data, int* size) GRPC_OVERRIDE {
if (backup_count_ > 0) {
*data = GPR_SLICE_START_PTR(slice_) + GPR_SLICE_LENGTH(slice_) -
backup_count_;
@@ -123,12 +123,10 @@ 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;
+ const void* data;
int size;
while (Next(&data, &size)) {
if (size >= count) {
@@ -149,18 +147,18 @@ class GrpcBufferReader GRPC_FINAL
private:
gpr_int64 byte_count_;
gpr_int64 backup_count_;
- grpc_byte_buffer_reader *reader_;
+ grpc_byte_buffer_reader* reader_;
gpr_slice slice_;
};
namespace grpc {
-bool SerializeProto(const grpc::protobuf::Message &msg, grpc_byte_buffer **bp) {
+bool SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) {
GrpcBufferWriter writer(bp);
return msg.SerializeToZeroCopyStream(&writer);
}
-bool DeserializeProto(grpc_byte_buffer *buffer, grpc::protobuf::Message *msg) {
+bool DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg) {
GrpcBufferReader reader(buffer);
return msg->ParseFromZeroCopyStream(&reader);
}
diff --git a/src/cpp/proto/proto_utils.h b/src/cpp/proto/proto_utils.h
index 7a1b1f8b7c..bc60dc9929 100644
--- a/src/cpp/proto/proto_utils.h
+++ b/src/cpp/proto/proto_utils.h
@@ -43,11 +43,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 grpc::protobuf::Message &msg,
- grpc_byte_buffer **buffer);
+bool SerializeProto(const grpc::protobuf::Message& msg,
+ grpc_byte_buffer** buffer);
// The caller keeps ownership of buffer and msg.
-bool DeserializeProto(grpc_byte_buffer *buffer, grpc::protobuf::Message *msg);
+bool DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg);
} // namespace grpc
diff --git a/src/cpp/server/async_generic_service.cc b/src/cpp/server/async_generic_service.cc
index 2009af7cbd..07cb933715 100644
--- a/src/cpp/server/async_generic_service.cc
+++ b/src/cpp/server/async_generic_service.cc
@@ -47,5 +47,4 @@ CompletionQueue* AsyncGenericService::completion_queue() {
return &server_->cq_;
}
-} // namespace grpc
-
+} // namespace grpc
diff --git a/src/cpp/server/async_server_context.cc b/src/cpp/server/async_server_context.cc
index f21efcfb19..628822a338 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,22 +52,22 @@ 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_old(call_, cq, this) == GRPC_CALL_OK);
GPR_ASSERT(grpc_call_server_end_initial_metadata_old(
call_, GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK);
}
-bool AsyncServerContext::StartRead(grpc::protobuf::Message *request) {
+bool AsyncServerContext::StartRead(grpc::protobuf::Message* request) {
GPR_ASSERT(request);
request_ = request;
grpc_call_error err = grpc_call_start_read_old(call_, this);
return err == GRPC_CALL_OK;
}
-bool AsyncServerContext::StartWrite(const grpc::protobuf::Message &response,
+bool AsyncServerContext::StartWrite(const grpc::protobuf::Message& response,
int flags) {
- grpc_byte_buffer *buffer = nullptr;
+ grpc_byte_buffer* buffer = nullptr;
if (!SerializeProto(response, &buffer)) {
return false;
}
@@ -76,16 +76,16 @@ bool AsyncServerContext::StartWrite(const grpc::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_old(
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/insecure_server_credentials.cc b/src/cpp/server/insecure_server_credentials.cc
index f5e4732f73..55dd90d7a7 100644
--- a/src/cpp/server/insecure_server_credentials.cc
+++ b/src/cpp/server/insecure_server_credentials.cc
@@ -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
diff --git a/src/cpp/server/secure_server_credentials.cc b/src/cpp/server/secure_server_credentials.cc
index ff35638503..88f7a9b1a9 100644
--- a/src/cpp/server/secure_server_credentials.cc
+++ b/src/cpp/server/secure_server_credentials.cc
@@ -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_);
}
@@ -56,16 +57,17 @@ class SecureServerCredentials GRPC_FINAL : public ServerCredentials {
} // namespace
std::shared_ptr<ServerCredentials> SslServerCredentials(
- const SslServerCredentialsOptions &options) {
+ const SslServerCredentialsOptions& options) {
std::vector<grpc_ssl_pem_key_cert_pair> pem_key_cert_pairs;
- for (const auto &key_cert_pair : options.pem_key_cert_pairs) {
+ for (const auto& key_cert_pair : options.pem_key_cert_pairs) {
pem_key_cert_pairs.push_back(
{key_cert_pair.private_key.c_str(), key_cert_pair.cert_chain.c_str()});
}
- grpc_server_credentials *c_creds = grpc_ssl_server_credentials_create(
+ 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
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 4d5e77e633..4ed4c45507 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -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_);
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index 835596d393..2f5a0dc6c8 100644
--- a/src/cpp/server/server_builder.cc
+++ b/src/cpp/server/server_builder.cc
@@ -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;
diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc
index 5dc9bcf916..d3013b806c 100644
--- a/src/cpp/server/thread_pool.cc
+++ b/src/cpp/server/thread_pool.cc
@@ -66,12 +66,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_one();
diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h
index 6157e403e9..6225d82a0b 100644
--- a/src/cpp/server/thread_pool.h
+++ b/src/cpp/server/thread_pool.h
@@ -50,7 +50,7 @@ class ThreadPool GRPC_FINAL : public ThreadPoolInterface {
explicit ThreadPool(int num_threads);
~ThreadPool();
- void ScheduleCallback(const std::function<void()> &callback) GRPC_OVERRIDE;
+ void ScheduleCallback(const std::function<void()>& callback) GRPC_OVERRIDE;
private:
std::mutex mu_;
diff --git a/src/cpp/util/slice.cc b/src/cpp/util/slice.cc
index a549c5008d..57370dabc6 100644
--- a/src/cpp/util/slice.cc
+++ b/src/cpp/util/slice.cc
@@ -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)) {}
diff --git a/src/cpp/util/status.cc b/src/cpp/util/status.cc
index bbf8030668..b694a513e7 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 919e5623fa..44d2283e76 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 1994848eb2..8b7fcf55f7 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);