From 2eeed733485d9ce7bfbb8840f80ed63901926fc2 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 5 Dec 2017 12:15:17 +0100 Subject: [PATCH] contrib/format.sh src/grpc.cc --- src/grpc.cc | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/grpc.cc b/src/grpc.cc index 87ef754a..314e9b07 100644 --- a/src/grpc.cc +++ b/src/grpc.cc @@ -56,7 +56,8 @@ using collectd::QueryValuesResponse; using google::protobuf::util::TimeUtil; -typedef google::protobuf::Map grpcMetadata; +typedef google::protobuf::Map + grpcMetadata; /* * private types @@ -175,10 +176,11 @@ static grpc::Status marshal_meta_data(meta_data_t *meta, switch (md_type) { case MD_TYPE_STRING: char *md_string; - if (meta_data_get_string(meta, key, &md_string) != 0 || md_string == nullptr) { + if (meta_data_get_string(meta, key, &md_string) != 0 || + md_string == nullptr) { strarray_free(meta_data_keys, meta_data_keys_len); return grpc::Status(grpc::StatusCode::INTERNAL, - grpc::string("missing metadata")); + grpc::string("missing metadata")); } md_value.set_string_value(md_string); free(md_string); @@ -188,7 +190,7 @@ static grpc::Status marshal_meta_data(meta_data_t *meta, if (meta_data_get_signed_int(meta, key, &int64_value) != 0) { strarray_free(meta_data_keys, meta_data_keys_len); return grpc::Status(grpc::StatusCode::INTERNAL, - grpc::string("missing metadata")); + grpc::string("missing metadata")); } md_value.set_int64_value(int64_value); break; @@ -197,7 +199,7 @@ static grpc::Status marshal_meta_data(meta_data_t *meta, if (meta_data_get_unsigned_int(meta, key, &uint64_value) != 0) { strarray_free(meta_data_keys, meta_data_keys_len); return grpc::Status(grpc::StatusCode::INTERNAL, - grpc::string("missing metadata")); + grpc::string("missing metadata")); } md_value.set_uint64_value(uint64_value); break; @@ -206,7 +208,7 @@ static grpc::Status marshal_meta_data(meta_data_t *meta, if (meta_data_get_double(meta, key, &double_value) != 0) { strarray_free(meta_data_keys, meta_data_keys_len); return grpc::Status(grpc::StatusCode::INTERNAL, - grpc::string("missing metadata")); + grpc::string("missing metadata")); } md_value.set_double_value(double_value); break; @@ -215,7 +217,7 @@ static grpc::Status marshal_meta_data(meta_data_t *meta, if (meta_data_get_boolean(meta, key, &bool_value) != 0) { strarray_free(meta_data_keys, meta_data_keys_len); return grpc::Status(grpc::StatusCode::INTERNAL, - grpc::string("missing metadata")); + grpc::string("missing metadata")); } md_value.set_bool_value(bool_value); break; @@ -241,7 +243,7 @@ static grpc::Status unmarshal_meta_data(const grpcMetadata &rpc_metadata, return grpc::Status(grpc::StatusCode::RESOURCE_EXHAUSTED, grpc::string("failed to metadata list")); } - for (auto kv: rpc_metadata) { + for (auto kv : rpc_metadata) { auto k = kv.first.c_str(); auto v = kv.second; @@ -267,8 +269,8 @@ static grpc::Status unmarshal_meta_data(const grpcMetadata &rpc_metadata, break; default: meta_data_destroy(*md_out); - return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, - grpc::string("Metadata of unknown type")); + return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, + grpc::string("Metadata of unknown type")); } } return grpc::Status::OK; @@ -482,8 +484,9 @@ private: break; } if (uc_iterator_get_meta(iter, &vl.meta) < 0) { - status = grpc::Status(grpc::StatusCode::INTERNAL, - grpc::string("failed to retrieve value metadata")); + status = + grpc::Status(grpc::StatusCode::INTERNAL, + grpc::string("failed to retrieve value metadata")); } value_lists->push(vl); -- 2.11.0